Skip to content

Commit

Permalink
Fix handling of ONT samples re fastqc & postalignqc
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanjameskennedy committed Jan 30, 2025
1 parent b7476b0 commit b0499ab
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 17 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed channel problem by changing `Channel.of([])` to `Channel.value([])`
- Fixed `nextflow.hopper.config` re singularity image path
- Fixed sccmec version file
- Fixed handling of ONT samples re fastqc & postalignqc

### Changed

Expand Down
5 changes: 4 additions & 1 deletion nextflow-modules/modules/fastqc/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ process fastqc {
scratch params.scratch

input:
tuple val(sample_id), path(reads)
tuple val(sample_id), path(reads), val(platform)

output:
tuple val(sample_id), path(summary_output), emit: summary
tuple val(sample_id), path(output) , emit: output
tuple val(sample_id), path(html_output) , emit: html
path "*versions.yml" , emit: versions

when:
platform == "illumina"

script:
def args = task.ext.args ?: ''
def old_new_pairs = reads instanceof Path || reads.size() == 1 ? [[ reads, "${sample_id}.${reads.extension}" ]] : reads.withIndex().collect { entry, index -> [ entry, "${sample_id}_${index + 1}.${entry.extension}" ] }
Expand Down
4 changes: 2 additions & 2 deletions nextflow-modules/modules/prp/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,15 @@ process post_align_qc {
scratch params.scratch

input:
tuple val(sample_id), path(bam)
tuple val(sample_id), path(bam), val(platform)
path reference
path bed

output:
tuple val(sample_id), path(output), emit: qc

when:
task.ext.when
task.ext.when && platform == "illumina"

script:
output = "${sample_id}_qc.json"
Expand Down
5 changes: 3 additions & 2 deletions workflows/bacterial_base.nf
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ workflow CALL_BACTERIAL_BASE {
quast(ch_assembly, referenceGenome)

// qc processing
fastqc(ch_reads)
fastqc(ch_reads_w_meta)
bwa_mem_ref(ch_reads, referenceGenomeDir)
samtools_index_ref(bwa_mem_ref.out.bam)

post_align_qc(bwa_mem_ref.out.bam, referenceGenome, coreLociBed)
post_align_qc(bwa_mem_ref.out.bam.join(ch_meta), referenceGenome, coreLociBed)

nanoplot(ch_reads_w_meta)

Expand All @@ -127,6 +127,7 @@ workflow CALL_BACTERIAL_BASE {
bam = bwa_mem_ref.out.bam // channel: [ val(meta), path(bam)]
bai = samtools_index_ref.out.bai // channel: [ val(meta), path(bai)]
fastqc = fastqc.out.output // channel: [ val(meta), path(txt)]
seqplat_meta = ch_meta // channel: [ val(meta), val(str)]
metadata = save_analysis_metadata.out.meta // channel: [ val(meta), path(json)]
qc = post_align_qc.out.qc // channel: [ val(meta), path(fasta)]
qc_nano = nanoplot.out.html // channel: [ val(meta), path(html)]
Expand Down
7 changes: 5 additions & 2 deletions workflows/escherichia_coli.nf
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ workflow CALL_ESCHERICHIA_COLI {
CALL_BACTERIAL_BASE.out.quast.set{ch_quast}
CALL_BACTERIAL_BASE.out.qc.set{ch_qc}
CALL_BACTERIAL_BASE.out.metadata.set{ch_metadata}
CALL_BACTERIAL_BASE.out.seqplat_meta.set{ch_seqplat_meta}
CALL_BACTERIAL_BASE.out.seqrun_meta.set{ch_seqrun_meta}
CALL_BACTERIAL_BASE.out.reads_w_meta.set{ch_input_meta}
CALL_BACTERIAL_BASE.out.sourmash.set{ch_sourmash}
Expand Down Expand Up @@ -118,8 +119,10 @@ workflow CALL_ESCHERICHIA_COLI {

ch_reads.map { sampleID, reads -> [ sampleID, [] ] }.set{ ch_empty }

ch_qc_illumina = ch_seqplat_meta.filter { it[1] == 'illumina' } ? ch_qc : ch_empty

ch_quast
.join(ch_qc)
.join(ch_qc_illumina)
.join(mlst.out.json)
.join(chewbbaca_split_results.out.output)
.join(amrfinderplus.out.output)
Expand Down Expand Up @@ -155,7 +158,7 @@ workflow CALL_ESCHERICHIA_COLI {
create_yaml(create_analysis_result.out.json.join(ch_sourmash).join(ch_ska), params.speciesDir)

ch_quast
.join(ch_qc)
.join(ch_qc_illumina)
.join(chewbbaca_split_results.out.output)
.set{ cdmInput }

Expand Down
7 changes: 5 additions & 2 deletions workflows/klebsiella_pneumoniae.nf
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ workflow CALL_KLEBSIELLA_PNEUMONIAE {
CALL_BACTERIAL_BASE.out.quast.set{ch_quast}
CALL_BACTERIAL_BASE.out.qc.set{ch_qc}
CALL_BACTERIAL_BASE.out.metadata.set{ch_metadata}
CALL_BACTERIAL_BASE.out.seqplat_meta.set{ch_seqplat_meta}
CALL_BACTERIAL_BASE.out.seqrun_meta.set{ch_seqrun_meta}
CALL_BACTERIAL_BASE.out.reads_w_meta.set{ch_input_meta}
CALL_BACTERIAL_BASE.out.sourmash.set{ch_sourmash}
Expand Down Expand Up @@ -115,8 +116,10 @@ workflow CALL_KLEBSIELLA_PNEUMONIAE {

ch_reads.map { sampleID, reads -> [ sampleID, [] ] }.set{ ch_empty }

ch_qc_illumina = ch_seqplat_meta.filter { it[1] == 'illumina' } ? ch_qc : ch_empty

ch_quast
.join(ch_qc)
.join(ch_qc_illumina)
.join(mlst.out.json)
.join(chewbbaca_split_results.out.output)
.join(amrfinderplus.out.output)
Expand Down Expand Up @@ -152,7 +155,7 @@ workflow CALL_KLEBSIELLA_PNEUMONIAE {
create_yaml(create_analysis_result.out.json.join(ch_sourmash).join(ch_ska), params.speciesDir)

ch_quast
.join(ch_qc)
.join(ch_qc_illumina)
.join(chewbbaca_split_results.out.output)
.set{ cdmInput }

Expand Down
7 changes: 5 additions & 2 deletions workflows/mycobacterium_tuberculosis.nf
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ workflow CALL_MYCOBACTERIUM_TUBERCULOSIS {
CALL_BACTERIAL_BASE.out.reads.set{ch_reads}
CALL_BACTERIAL_BASE.out.quast.set{ch_quast}
CALL_BACTERIAL_BASE.out.metadata.set{ch_metadata}
CALL_BACTERIAL_BASE.out.seqplat_meta.set{ch_seqplat_meta}
CALL_BACTERIAL_BASE.out.seqrun_meta.set{ch_seqrun_meta}
CALL_BACTERIAL_BASE.out.reads_w_meta.set{ch_input_meta}
CALL_BACTERIAL_BASE.out.sourmash.set{ch_sourmash}
Expand All @@ -63,8 +64,10 @@ workflow CALL_MYCOBACTERIUM_TUBERCULOSIS {

ch_reads.map { sampleID, reads -> [ sampleID, [] ] }.set{ ch_empty }

ch_qc_illumina = ch_seqplat_meta.filter { it[1] == 'illumina' } ? ch_qc : ch_empty

ch_quast
.join(ch_qc)
.join(ch_qc_illumina)
.join(ch_empty)
.join(ch_empty)
.join(ch_empty)
Expand Down Expand Up @@ -105,7 +108,7 @@ workflow CALL_MYCOBACTERIUM_TUBERCULOSIS {
create_yaml(add_grading_bed_track.out.json.join(ch_sourmash).join(ch_ska), params.speciesDir)

ch_quast
.join(ch_qc)
.join(ch_qc_illumina)
.join(ch_empty)
.set{ cdmInput }

Expand Down
7 changes: 5 additions & 2 deletions workflows/staphylococcus_aureus.nf
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ workflow CALL_STAPHYLOCOCCUS_AUREUS {
CALL_BACTERIAL_BASE.out.quast.set{ch_quast}
CALL_BACTERIAL_BASE.out.qc.set{ch_qc}
CALL_BACTERIAL_BASE.out.metadata.set{ch_metadata}
CALL_BACTERIAL_BASE.out.seqplat_meta.set{ch_seqplat_meta}
CALL_BACTERIAL_BASE.out.seqrun_meta.set{ch_seqrun_meta}
CALL_BACTERIAL_BASE.out.reads_w_meta.set{ch_input_meta}
CALL_BACTERIAL_BASE.out.sourmash.set{ch_sourmash}
Expand Down Expand Up @@ -114,8 +115,10 @@ workflow CALL_STAPHYLOCOCCUS_AUREUS {

ch_reads.map { sampleID, reads -> [ sampleID, [] ] }.set{ ch_empty }

ch_qc_illumina = ch_seqplat_meta.filter { it[1] == 'illumina' } ? ch_qc : ch_empty

ch_quast
.join(ch_qc)
.join(ch_qc_illumina)
.join(mlst.out.json)
.join(chewbbaca_split_results.out.output)
.join(amrfinderplus.out.output)
Expand Down Expand Up @@ -151,7 +154,7 @@ workflow CALL_STAPHYLOCOCCUS_AUREUS {
create_yaml(create_analysis_result.out.json.join(ch_sourmash).join(ch_ska), params.speciesDir)

ch_quast
.join(ch_qc)
.join(ch_qc_illumina)
.join(chewbbaca_split_results.out.output)
.set{ cdmInput }

Expand Down
11 changes: 9 additions & 2 deletions workflows/streptococcus.nf
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ workflow CALL_STREPTOCOCCUS {
CALL_BACTERIAL_BASE.out.quast.set{ch_quast}
CALL_BACTERIAL_BASE.out.qc.set{ch_qc}
CALL_BACTERIAL_BASE.out.metadata.set{ch_metadata}
CALL_BACTERIAL_BASE.out.seqplat_meta.set{ch_seqplat_meta}
CALL_BACTERIAL_BASE.out.seqrun_meta.set{ch_seqrun_meta}
CALL_BACTERIAL_BASE.out.reads_w_meta.set{ch_input_meta}
CALL_BACTERIAL_BASE.out.sourmash.set{ch_sourmash}
Expand Down Expand Up @@ -125,9 +126,15 @@ workflow CALL_STREPTOCOCCUS {
virulencefinder(ch_reads, params.useVirulenceDbs, virulencefinderDb)

ch_reads.map{ sampleID, reads -> [ sampleID, [] ] }.set{ ch_empty }

if (species == "streptococcus") {
ch_empty.set{ ch_qc_illumina }
} else {
ch_qc_illumina = ch_seqplat_meta.filter { it[1] == 'illumina' } ? ch_qc : ch_empty
}

ch_quast
.join(ch_empty)
.join(ch_qc_illumina)
.join(mlst.out.json)
.join(chewbbaca_split_results.out.output)
.join(amrfinderplus.out.output)
Expand Down Expand Up @@ -163,7 +170,7 @@ workflow CALL_STREPTOCOCCUS {
create_yaml(create_analysis_result.out.json.join(ch_sourmash).join(ch_ska), speciesDir)

ch_quast
.join(ch_empty)
.join(ch_qc_illumina)
.join(chewbbaca_split_results.out.output)
.set{ cdmInput }

Expand Down
7 changes: 5 additions & 2 deletions workflows/streptococcus_pyogenes.nf
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ workflow CALL_STREPTOCOCCUS_PYOGENES {
CALL_BACTERIAL_BASE.out.quast.set{ch_quast}
CALL_BACTERIAL_BASE.out.qc.set{ch_qc}
CALL_BACTERIAL_BASE.out.metadata.set{ch_metadata}
CALL_BACTERIAL_BASE.out.seqplat_meta.set{ch_seqplat_meta}
CALL_BACTERIAL_BASE.out.seqrun_meta.set{ch_seqrun_meta}
CALL_BACTERIAL_BASE.out.reads_w_meta.set{ch_input_meta}
CALL_BACTERIAL_BASE.out.sourmash.set{ch_sourmash}
Expand Down Expand Up @@ -118,8 +119,10 @@ workflow CALL_STREPTOCOCCUS_PYOGENES {

ch_reads.map { sampleID, reads -> [ sampleID, [] ] }.set{ ch_empty }

ch_qc_illumina = ch_seqplat_meta.filter { it[1] == 'illumina' } ? ch_qc : ch_empty

ch_quast
.join(ch_qc)
.join(ch_qc_illumina)
.join(mlst.out.json)
.join(chewbbaca_split_results.out.output)
.join(amrfinderplus.out.output)
Expand Down Expand Up @@ -155,7 +158,7 @@ workflow CALL_STREPTOCOCCUS_PYOGENES {
create_yaml(create_analysis_result.out.json.join(ch_sourmash).join(ch_ska), speciesDir)

ch_quast
.join(ch_qc)
.join(ch_qc_illumina)
.join(chewbbaca_split_results.out.output)
.set{ cdmInput }

Expand Down

0 comments on commit b0499ab

Please sign in to comment.