Skip to content

Commit

Permalink
Assembly QC -> return the unmodified contigs if no contigs decontamin…
Browse files Browse the repository at this point in the history
…ation is used.
  • Loading branch information
mberacochea committed Jun 26, 2024
1 parent a537693 commit 0bfa81c
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions subworkflows/local/assembly_qc.nf
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ workflow ASSEMBLY_QC {
contaminated_contigs = BLAST_BLASTN_HUMAN_PHIX.out.txt
}

if ( host_reference_genome != null) {
if ( host_reference_genome != null ) {

ch_blast_host_refs = Channel.fromPath( "${params.blast_reference_genomes_folder}/${host_reference_genome}*", checkIfExists: true)
.collect().map {
Expand All @@ -53,20 +53,25 @@ workflow ASSEMBLY_QC {

ch_versions = ch_versions.mix(BLAST_BLASTN_HOST.out.versions.first())

contaminated_contigs = BLAST_BLASTN_HUMAN_PHIX.out.txt.mix( BLAST_BLASTN_HOST.out.txt )
} else {
contaminated_contigs = BLAST_BLASTN_HUMAN_PHIX.out.txt
contaminated_contigs = contaminated_contigs.mix( BLAST_BLASTN_HOST.out.txt )
}

// TODO: this is not fit for samplesheets kind of inputs
// TODO: this is not fit for samplesheets kind of inputs, it should .join with the contaminated contigs channel
SEQKIT_GREP(
SEQKIT_SEQ.out.fastx,
contaminated_contigs.map { meta, hits_txt -> { hits_txt }}.collectFile(name: "contaminated_contigs.txt", newLine: true)
)

if ( !params.remove_human_phix && host_reference_genome == null ) {
// No decontamination //
filtered_contigs = assembly
} else {
filtered_contigs = SEQKIT_GREP.out.filter
}

ch_versions = ch_versions.mix(SEQKIT_GREP.out.versions)

emit:
filtered_contigs = SEQKIT_GREP.out.filter
filtered_contigs = filtered_contigs
versions = ch_versions
}

0 comments on commit 0bfa81c

Please sign in to comment.