Skip to content

Commit

Permalink
Merge pull request #14 from WEHI-ResearchComputing/flagstat
Browse files Browse the repository at this point in the history
Flagstat
  • Loading branch information
edoyango authored Oct 30, 2024
2 parents aa57e46 + 78e7e1b commit cd6598e
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 5 deletions.
5 changes: 5 additions & 0 deletions config/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ process {
memory = { 4.GB * task.attempt }
time = '2h'
}
withLabel: Flagstats {
cpus = 1
memory = { 4.GB * task.attempt }
time = '1h'
}
withLabel: Multiqc {
cpus = 2
memory = { 1.GB * task.attempt }
Expand Down
3 changes: 3 additions & 0 deletions config/multiqc_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ remove_sections:
- fastqc_per_sequence_gc_content
- fastqc_adapter_content
- fastqc_per_base_sequence_content
- fastqc_sequence_length_distribution
- mosdepth-coverage-dist-cov
mosdepth_config:
general_stats_coverage:
Expand All @@ -13,3 +14,5 @@ mosdepth_config:
exclude_contigs:
- "*_API_*"
- "*_M*"
table_columns_visible:
mapped_passed_pct: true
4 changes: 3 additions & 1 deletion main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ include { RPlotROI } from './modules/stvariant.nf'

include{ FastQC } from './modules/qc.nf'
include{ MosDepth } from './modules/qc.nf'
include{ FlagStats } from './modules/qc.nf'
include{ MultiQC } from './modules/qc.nf'

process foo {
Expand Down Expand Up @@ -134,8 +135,9 @@ workflow {
fastqc_ch=FastQC(bam_ch.bamnodup.map{row->row[1]}.unique({it.baseName}).collect())

mosdepth_ch=MosDepth(bam_ch.bamnodup.join(bam_ch.bai)) // join bams with their index based on groupId
flagstat_ch=FlagStats(bam_ch[0], bam_ch.bamnodup.map{row->row[1]})

MultiQC( fastqc_ch.zip.mix(mosdepth_ch).collect().ifEmpty([]) )
MultiQC( fastqc_ch.zip.mix(mosdepth_ch, flagstat_ch).collect().ifEmpty([]) )
//----------------BCF tools----------------------------------------
//BCF Input Channel Emits parentId,groupId,ref,bamlist,bams,parentbams
input_ch.map{row -> tuple(row[0],row[4],row[5])}
Expand Down
23 changes: 21 additions & 2 deletions modules/qc.nf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
process FastQC {
label 'Fastqc' // assumes resources are defined in a label
tag "${groupId}"
tag "${sampleId}"
publishDir "${params.outdir}/QC", mode: 'copy'
cache true
input:
Expand All @@ -19,7 +19,7 @@ process FastQC {

process MosDepth {
label 'Mosdepth'
tag "${groupId}"
tag "${sampleId}"
publishDir "${params.outdir}/QC", mode: 'copy'
cache true
input:
Expand All @@ -35,6 +35,25 @@ process MosDepth {
"""
}

process FlagStats {
label 'Flagstats'
tag "${sampleId}"
publishDir "${params.outdir}/QC", mode: 'copy'
cache true
input:
val(sampleId)
path(bam)

output:
path("*.flagstats"), emit: txt


script:
"""
samtools flagstats ${bam} > ${bam.baseName}.flagstats
"""
}

process MultiQC {
label 'Multiqc'
cache true
Expand Down
4 changes: 2 additions & 2 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ profiles {
docker.enabled = false
singularity.pullTimeout = "3h"
process {
withLabel: 'BWAAlign|Samtools|Bcftools|Fastqc|Mosdepth|Multiqc|RGridss|Rfilter|IndexDedup' {
withLabel: 'BWAAlign|Samtools|Bcftools|Fastqc|Mosdepth|Flagstats|Multiqc|RGridss|Rfilter|IndexDedup' {
container = "ghcr.io/wehi-researchcomputing/nf-malaria-variant-analysis:latest"
}
}
Expand All @@ -45,7 +45,7 @@ profiles {
apptainer.enabled = false
singularity.enabled = false
process {
withLabel: 'BWAAlign|Samtools|Bcftools|Fastqc|Mosdepth|Multiqc|RGridss|Rfilter|IndexDedup' {
withLabel: 'BWAAlign|Samtools|Bcftools|Fastqc|Mosdepth|Flagstats|Multiqc|RGridss|Rfilter|IndexDedup' {
container = "ghcr.io/wehi-researchcomputing/nf-malaria-variant-analysis:latest"
}
}
Expand Down

0 comments on commit cd6598e

Please sign in to comment.