Skip to content

Commit

Permalink
Adding new rule NanoStat for alignment statistics
Browse files Browse the repository at this point in the history
  • Loading branch information
skchronicles committed Jan 25, 2023
1 parent 26fa2a5 commit 7099bce
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
4 changes: 4 additions & 0 deletions config/cluster.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,9 @@
"nanoplot": {
"threads": "4",
"mem": "16g"
},
"nanostat": {
"threads": "4",
"mem": "16g"
}
}
6 changes: 6 additions & 0 deletions workflow/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ rule all:
join(workpath, "{name}", "nanoplot", "NanoPlot-report.html"),
name=samples
),
# NanoStat to gather BAM statistics
# @imported from `rule nanostat` in rules/qc.smk
expand(
join(workpath, "{name}", "bams", "{name}.sorted.genome.metrics"),
name=samples
),
# MultiQC to aggregate results into a report
# @imported from `rule multiqc` in rules/qc.smk
join(workpath, "reports", "multiqc_report.html"),
Expand Down
28 changes: 28 additions & 0 deletions workflow/rules/qc.smk
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,33 @@ rule nanoplot:
"""


rule nanostat:
"""
Quality-control step to gather various statistics from a BAM file.
This tool is supported by MultiQC.
Github: https://github.com/wdecoster/nanostat
@Input:
Sorted Genomic BAM file (scatter)
@Output:
NanoStat metrics file
"""
input:
bam = join(workpath, "{name}", "bams", "{name}.sorted.genome.bam"),
output:
metrics = join(workpath, "{name}", "bams", "{name}.sorted.genome.metrics"),
params:
rname = "nanostat",
conda: depending(join(workpath, config['conda']['modr']), use_conda)
container: depending(config['images']['modr'], use_singularity)
threads: int(allocated("threads", "nanostat", cluster))
shell: """
NanoStat \\
-t {threads} \\
--bam {input.bam} \\
> {output.metrics}
"""


rule multiqc:
"""
Reporting step to aggregate QC information across
Expand All @@ -97,6 +124,7 @@ rule multiqc:
expand(join(workpath, "{name}", "fastqc", "{name}_fastqc.zip"), name=samples),
expand(join(workpath, "{name}", "fastqc", "{name}.filtered_fastqc.zip"), name=samples),
expand(join(workpath, "{name}", "bams", "{name}.sorted.genome.stats"), name=samples),
expand(join(workpath, "{name}", "bams", "{name}.sorted.genome.metrics"), name=samples),
output:
html = join(workpath, "reports", "multiqc_report.html"),
params:
Expand Down

0 comments on commit 7099bce

Please sign in to comment.