Created
September 3, 2018 13:10
-
-
Save finswimmer/55c2b6f3e74001b9a6321fe53958a9ad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
configfile: | |
"config.json" | |
SAMPLES, = glob_wildcards(config['data']+"/{id}_L001_R1_001.fastq.gz") | |
rule move: | |
input: | |
bam = expand("{sample}.final.bam", sample=SAMPLES), | |
bai = expand("{sample}.final.bai", sample=SAMPLES) | |
params: | |
output = config['data']+"/Alignment" | |
shell: | |
""" | |
mkdir -p {params.output} | |
mv {input} {params.output} | |
""" | |
rule align_sort: | |
input: | |
config['data']+"/{sample}_L001_R1_001.fastq.gz", | |
config['data']+"/{sample}_L001_R2_001.fastq.gz" | |
output: | |
temp("{sample}.mapped.bam") | |
params: | |
rg = "@RG\\tID:{sample}\\tPL:ILLUMINA\\tSM:{sample}", | |
ref = config['genome'] | |
conda: | |
"envs.yaml" | |
shell: | |
"bwa mem -R '{params.rg}' -M {params.ref} {input} | samtools sort -o {output} -" | |
rule mark_duplicates: | |
input: | |
"{sample}.mapped.bam" | |
output: | |
bam = "{sample}.final.bam", | |
bai = "{sample}.final.bai", | |
metrics = temp("{sample}_dedup_metricx.txt") | |
conda: | |
"envs.yaml" | |
shell: | |
"picard MarkDuplicates I={input} O={output.bam} M={output.metrics} CREATE_INDEX=true" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment