1
0
Fork 0
mirror of https://github.com/MillironX/taxprofiler.git synced 2024-11-22 23:19:54 +00:00
taxprofiler/subworkflows/local/shortread_hostremoval.nf

58 lines
2 KiB
Text
Raw Normal View History

2022-04-03 05:58:40 +00:00
//
// Remove host reads via alignment and export off-target reads
//
include { BOWTIE2_BUILD } from '../../modules/nf-core/bowtie2/build/main'
include { BOWTIE2_ALIGN } from '../../modules/nf-core/bowtie2/align/main'
2022-10-31 09:04:51 +00:00
include { SAMTOOLS_INDEX } from '../../modules/nf-core/samtools/index/main'
include { SAMTOOLS_STATS } from '../../modules/nf-core/samtools/stats/main'
include { SAMTOOLS_VIEW } from '../../modules/nf-core/samtools/view/main'
2022-04-03 05:58:40 +00:00
workflow SHORTREAD_HOSTREMOVAL {
2022-04-03 05:58:40 +00:00
take:
reads // [ [ meta ], [ reads ] ]
reference // /path/to/fasta
index // /path/to/index
2022-04-03 05:58:40 +00:00
main:
ch_versions = Channel.empty()
ch_multiqc_files = Channel.empty()
if ( !params.shortread_hostremoval_index ) {
ch_bowtie2_index = BOWTIE2_BUILD ( reference ).index
ch_versions = ch_versions.mix( BOWTIE2_BUILD.out.versions )
} else {
ch_bowtie2_index = index.first()
2022-04-03 05:58:40 +00:00
}
BOWTIE2_ALIGN ( reads, ch_bowtie2_index, true, true)
ch_versions = ch_versions.mix( BOWTIE2_ALIGN.out.versions.first() )
ch_multiqc_files = ch_multiqc_files.mix( BOWTIE2_ALIGN.out.log )
2022-04-03 05:58:40 +00:00
2022-10-31 09:04:51 +00:00
ch_bowtie2_mapped = BOWTIE2_ALIGN.out.bam
.map {
meta, reads ->
[ meta, reads, [] ]
}
2022-10-28 12:24:33 +00:00
2022-10-31 09:04:51 +00:00
SAMTOOLS_VIEW ( ch_bowtie2_mapped, [], [] )
ch_versions = ch_versions.mix( SAMTOOLS_VIEW.out.versions.first() )
SAMTOOLS_INDEX ( SAMTOOLS_VIEW.out.bam )
ch_versions = ch_versions.mix( SAMTOOLS_INDEX.out.versions.first() )
bam_bai = BOWTIE2_ALIGN.out.bam
2022-11-23 08:08:22 +00:00
.join(SAMTOOLS_INDEX.out.bai, remainder: true)
2022-10-28 12:24:33 +00:00
SAMTOOLS_STATS ( bam_bai, reference )
ch_versions = ch_versions.mix(SAMTOOLS_STATS.out.versions.first())
ch_multiqc_files = ch_multiqc_files.mix( SAMTOOLS_STATS.out.stats )
2022-04-03 05:58:40 +00:00
emit:
2022-10-31 09:04:51 +00:00
stats = SAMTOOLS_STATS.out.stats
2022-04-03 05:58:40 +00:00
reads = BOWTIE2_ALIGN.out.fastq // channel: [ val(meta), [ reads ] ]
versions = ch_versions // channel: [ versions.yml ]
2022-04-03 05:58:40 +00:00
mqc = ch_multiqc_files
}