Created
September 3, 2018 13:12
-
-
Save finswimmer/716212e966254c0d3b33668688d0f0b8 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'] | |
shell: | |
"bwa mem -R '{params.rg}' -M {params.ref} {input} | samtools sort -o {output} -" | |
rule removeClipping: | |
input: | |
"{sample}.mapped.bam" | |
output: | |
temp("{sample}.clipped.bam") | |
conda: | |
"bio2.yml" | |
shell: | |
"bamutils removeclipping {input} {output}" | |
rule mark_duplicates: | |
input: | |
"{sample}.clipped.bam" | |
output: | |
bam = "{sample}.final.bam", | |
bai = "{sample}.final.bai", | |
metrics = temp("{sample}_dedup_metricx.txt") | |
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