2022-04-02 15:02:05 +00:00
|
|
|
//
|
|
|
|
// Process long raw reads with porechop
|
|
|
|
//
|
2022-03-18 14:10:44 +00:00
|
|
|
|
2022-03-25 14:21:52 +00:00
|
|
|
include { FASTQC as FASTQC_PROCESSED } from '../../modules/nf-core/modules/fastqc/main'
|
|
|
|
include { PORECHOP } from '../../modules/nf-core/modules/porechop/main'
|
2022-05-01 05:18:14 +00:00
|
|
|
include { FILTLONG } from '../../modules/nf-core/modules/filtlong/main'
|
2022-03-18 14:10:44 +00:00
|
|
|
|
|
|
|
workflow LONGREAD_PREPROCESSING {
|
|
|
|
take:
|
|
|
|
reads
|
|
|
|
|
|
|
|
main:
|
|
|
|
ch_versions = Channel.empty()
|
|
|
|
ch_multiqc_files = Channel.empty()
|
|
|
|
|
2022-05-01 05:18:14 +00:00
|
|
|
if ( params.longread_qc_run_clip && !params.longread_qc_run_filter ) {
|
|
|
|
PORECHOP ( reads )
|
2022-03-18 14:10:44 +00:00
|
|
|
|
2022-05-01 05:18:14 +00:00
|
|
|
ch_processed_reads = PORECHOP.out.reads
|
|
|
|
.map {
|
|
|
|
meta, reads ->
|
|
|
|
def meta_new = meta.clone()
|
|
|
|
meta_new['single_end'] = 1
|
|
|
|
[ meta_new, reads ]
|
2022-03-18 14:10:44 +00:00
|
|
|
|
2022-05-01 05:18:14 +00:00
|
|
|
ch_versions = ch_versions.mix(PORECHOP.out.versions.first())
|
|
|
|
}
|
|
|
|
} else if ( !params.longread_qc_run_clip && params.longread_qc_run_filter ) {
|
|
|
|
|
|
|
|
ch_processed_reads = FILTLONG ( reads.map{ meta, reads -> [meta, [], reads ]} )
|
|
|
|
ch_versions = ch_versions.mix(FILTLONG.out.versions.first())
|
|
|
|
|
|
|
|
} else {
|
|
|
|
PORECHOP ( reads )
|
|
|
|
ch_clipped_reads = PORECHOP.out.reads
|
|
|
|
.map {
|
|
|
|
meta, reads ->
|
|
|
|
def meta_new = meta.clone()
|
|
|
|
meta_new['single_end'] = 1
|
|
|
|
[ meta_new, reads ]
|
|
|
|
}
|
|
|
|
|
|
|
|
ch_processed_reads = FILTLONG ( ch_clipped_reads.map{ meta, reads -> [meta, [], reads ]} ).reads
|
2022-03-18 14:10:44 +00:00
|
|
|
|
2022-05-01 05:18:14 +00:00
|
|
|
ch_versions = ch_versions.mix(PORECHOP.out.versions.first())
|
|
|
|
ch_versions = ch_versions.mix(FILTLONG.out.versions.first())
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-06-03 20:29:04 +00:00
|
|
|
FASTQC_PROCESSED ( ch_processed_reads )
|
2022-05-01 05:18:14 +00:00
|
|
|
ch_multiqc_files = ch_multiqc_files.mix( FASTQC_PROCESSED.out.zip )
|
2022-03-18 14:10:44 +00:00
|
|
|
|
|
|
|
emit:
|
|
|
|
reads = ch_processed_reads // channel: [ val(meta), [ reads ] ]
|
|
|
|
versions = ch_versions // channel: [ versions.yml ]
|
|
|
|
mqc = ch_multiqc_files
|
|
|
|
}
|
|
|
|
|