Commit d9795808 authored by Sam Nooij's avatar Sam Nooij
Browse files

Add mapped read depuplication

parent 4e50c7a4
......@@ -108,10 +108,18 @@ rule all:
sample = SAMPLES, ref = REFERENCE_NAMES),
#Paired reads mapped to reference
expand("data/tmp/Deduplicated-metrics_{sample}_to_{ref}-paired.txt",
sample = SAMPLES, ref = REFERENCE_NAMES),
#Paired deduplicated mapped reads
expand("data/tmp/Mapped-only_{sample}_to_{ref}-unpaired.bam",
sample = SAMPLES, ref = REFERENCE_NAMES),
#Unpaired reads mapped to reference
expand("data/tmp/Deduplicated-metrics_{sample}_to_{ref}-unpaired.txt",
sample = SAMPLES, ref = REFERENCE_NAMES),
#Unpaired deduplicated mapped reads
expand("data/tmp/counts/Mapped_read_counts-{sample}_to_{ref}-paired.tsv",
sample = SAMPLES, ref = REFERENCE_NAMES),
#Counts of mapped paired reads
......@@ -442,6 +450,25 @@ rule filter_unaligned_paired_reads:
samtools view -b -F 4 -F 256 -F 2048 {input} > {output} 2> {log}
"""
rule deduplicate_paired_reads:
input:
"data/tmp/Mapped-only_{sample}_to_{ref}-paired.bam"
output:
bam="data/tmp/Deduplicated-mapped_{sample}_to_{ref}-paired.bam",
metrics="data/tmp/Deduplicated-metrics_{sample}_to_{ref}-paired.txt",
conda:
"envs/picard.yaml"
threads: 1
log:
"log/deduplicate_paired_reads-{sample}_to_{ref}.txt"
benchmark:
"log/benchmark/deduplicate_paired_reads-{sample}_to_{ref}.txt"
shell:
"""
picard MarkDuplicates --REMOVE_DUPLICATES -I {input} -O {output.bam} -M {output.metrics}
"""
rule map_unpaired_trimmed_reads:
input:
unpaired="data/raw/trimmed_reads/{sample}_unpaired.fq",
......@@ -486,6 +513,24 @@ rule filter_unaligned_unpaired_reads:
samtools view -b -F 4 -F 256 -F 2048 {input} > {output} 2> {log}
"""
rule deduplicate_unpaired_reads:
input:
"data/tmp/Mapped-only_{sample}_to_{ref}-unpaired.bam"
output:
bam="data/tmp/Deduplicated-mapped_{sample}_to_{ref}-unpaired.bam",
metrics="data/tmp/Deduplicated-metrics_{sample}_to_{ref}-unpaired.txt",
conda:
"envs/picard.yaml"
threads: 1
log:
"log/deduplicate_unpaired_reads-{sample}_to_{ref}.txt"
benchmark:
"log/benchmark/deduplicate_unpaired_reads-{sample}_to_{ref}.txt"
shell:
"""
picard MarkDuplicates --REMOVE_DUPLICATES -I {input} -O {output.bam} -M {output.metrics}
"""
rule count_mapped_paired_reads:
input:
"data/tmp/Mapped-only_{sample}_to_{ref}-paired.bam",
......
name: picard
channels:
- default
- bioconda
- conda-forge
dependencies:
- picard=2.23.3
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment