Commit b83bb9c0 authored by van den Berg's avatar van den Berg
Browse files

Rename final bamfile to {sample}.bam

When using multiqc, the sample name for the picard statistics are
determined by simply removing the '.bam' part of the filename. This
would lead all sample names to be set to {sample}.markdup, which makes
later parsing of the statistics difficult.
parent 33faba14
......@@ -105,7 +105,7 @@ rule all:
multiqc = "multiqc_report/multiqc_report.html",
stats = "stats.json",
stats_tsv = "stats.tsv",
bais = expand("{sample}/bams/{sample}.markdup.bam.bai", sample=config["samples"]),
bam = expand("{sample}/bams/{sample}.bam", sample=config["samples"]),
vcfs = expand("{sample}/vcf/{sample}.vcf.gz", sample=config["samples"]),
vcf_tbi = expand("{sample}/vcf/{sample}.vcf.gz.tbi", sample=config["samples"]),
gvcfs = expand("{sample}/vcf/{sample}.g.vcf.gz", sample=config["samples"]),
......@@ -175,9 +175,9 @@ rule markdup:
read_group=rg) for rg in get_readgroup(wildcards)),
tmp = ancient("tmp")
output:
bam = "{sample}/bams/{sample}.markdup.bam",
bai = "{sample}/bams/{sample}.markdup.bai",
metrics = "{sample}/bams/{sample}.markdup.metrics"
bam = "{sample}/bams/{sample}.bam",
bai = "{sample}/bams/{sample}.bai",
metrics = "{sample}/bams/{sample}.metrics"
params:
bams=markdup_bam_input
singularity: containers["picard"]
......@@ -190,9 +190,9 @@ rule markdup:
rule bai:
"""Copy bai files as some genome browsers can only .bam.bai files"""
input:
bai = "{sample}/bams/{sample}.markdup.bai"
bai = rules.markdup.output.bai
output:
bai = "{sample}/bams/{sample}.markdup.bam.bai"
bai = "{sample}/bams/{sample}.bam.bai"
singularity: containers["debian"]
shell: "cp {input.bai} {output.bai}"
......@@ -239,7 +239,7 @@ checkpoint scatterregions:
rule gvcf_scatter:
"""Run HaplotypeCaller in GVCF mode by chunk"""
input:
bam = "{sample}/bams/{sample}.markdup.bam",
bam = rules.markdup.output.bam,
bqsr = "{sample}/bams/{sample}.baserecal.grp",
dbsnp = config["dbsnp"],
ref = config["reference"],
......@@ -329,8 +329,8 @@ rule genotype_gather:
rule mapped_reads_bases:
"""Calculate number of mapped reads"""
input:
bam="{sample}/bams/{sample}.markdup.bam",
pywc=config["py_wordcount"]
bam = rules.markdup.output.bam,
pywc = config["py_wordcount"]
output:
reads="{sample}/bams/{sample}.mapped.num",
bases="{sample}/bams/{sample}.mapped.basenum"
......@@ -342,7 +342,7 @@ rule mapped_reads_bases:
rule unique_reads_bases:
"""Calculate number of unique reads"""
input:
bam="{sample}/bams/{sample}.markdup.bam",
bam = rules.markdup.output.bam,
pywc=config["py_wordcount"]
output:
reads="{sample}/bams/{sample}.unique.num",
......@@ -383,7 +383,7 @@ rule fastqc_postqc:
rule covstats:
"""Calculate coverage statistics on bam file"""
input:
bam="{sample}/bams/{sample}.markdup.bam",
bam = rules.markdup.output.bam,
genome="current.genome",
covpy=config["covstats"],
bed=config.get("bedfile","")
......@@ -497,7 +497,7 @@ rule stats_tsv:
rule multiple_metrics:
"""Run picard CollectMultipleMetrics"""
input:
bam = "{sample}/bams/{sample}.markdup.bam",
bam = rules.markdup.output.bam,
ref = config["reference"],
params:
prefix="{sample}/bams/{sample}",
......@@ -518,8 +518,8 @@ rule multiqc:
"""
input:
stats="stats.tsv",
bam=expand("{sample}/bams/{sample}.markdup.bam", sample=config["samples"]),
metric=expand("{sample}/bams/{sample}.markdup.metrics", sample=config["samples"]),
bam=expand("{sample}/bams/{sample}.bam", sample=config["samples"]),
metric=expand("{sample}/bams/{sample}.metrics", sample=config["samples"]),
alignment_metrics=expand("{sample}/bams/{sample}.alignment_summary_metrics", sample=config["samples"]),
insert_metrics=expand("{sample}/bams/{sample}.insert_size_metrics", sample=config["samples"]),
params:
......
......@@ -10,6 +10,10 @@
- "localrule all:"
- "output: micro/vcf/micro.vcf.gz"
- "output: micro/vcf/micro.g.vcf.gz"
- "multiple_metrics"
- "output: stats.tsv"
- "micro/bams/micro.alignment_summary_metrics"
- "micro/bams/micro.insert_size_metrics"
must_not_contain:
- "rror"
stderr:
......
......@@ -49,6 +49,14 @@
- "chrM\t16560\t.\tC\t<NON_REF>\t.\t.\tEND=16569\tGT:DP:GQ:MIN_DP:PL\t0/0:195:0:187:0,0,0"
- path: "multiqc_report/multiqc_data/multiqc_picard_dups.json"
- path: "multiqc_report/multiqc_data/multiqc_fastqc.json"
- path: "multiqc_report/multiqc_data/multiqc_picard_AlignmentSummaryMetrics.json"
- path: "multiqc_report/multiqc_data/multiqc_picard_insertSize.json"
contains:
- '"SAMPLE_NAME": "micro",'
must_not_contain:
- '"SAMPLE_NAME": "micro.markdup",'
- name: test-integration-small-scatter
......@@ -277,8 +285,8 @@
- path: "micro2/vcf/micro2.vcf.gz"
- path: "micro1/vcf/micro1.g.vcf.gz"
- path: "micro2/vcf/micro2.g.vcf.gz"
- path: "micro1/bams/micro1.markdup.bam"
- path: "micro2/bams/micro2.markdup.bam"
- path: "micro1/bams/micro1.bam"
- path: "micro2/bams/micro2.bam"
- path: "stats.tsv"
contains:
- "sample_name\tpreqc_reads\tpreqc_bases\tpostqc_reads\tpostqc_bases"
......
Supports Markdown
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