2022-04-02 15:02:05 +00:00
|
|
|
//
|
|
|
|
// Process long raw reads with porechop
|
|
|
|
//
|
2022-03-18 14:10:44 +00:00
|
|
|
|
2022-10-05 11:40:43 +00:00
|
|
|
include { FASTQC as FASTQC_PROCESSED } from '../../modules/nf-core/fastqc/main'
|
2022-10-18 15:43:16 +00:00
|
|
|
include { FALCO as FALCO_PROCESSED } from '../../modules/nf-core/falco/main'
|
|
|
|
|
2022-11-01 16:34:37 +00:00
|
|
|
include { PORECHOP_PORECHOP } from '../../modules/nf-core/porechop/porechop/main'
|
2022-10-05 11:40:43 +00:00
|
|
|
include { FILTLONG } from '../../modules/nf-core/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-08-30 12:08:05 +00:00
|
|
|
if ( !params.longread_qc_skipadaptertrim && params.longread_qc_skipqualityfilter) {
|
2022-11-01 16:34:37 +00:00
|
|
|
PORECHOP_PORECHOP ( reads )
|
2022-03-18 14:10:44 +00:00
|
|
|
|
2022-11-01 16:34:37 +00:00
|
|
|
ch_processed_reads = PORECHOP_PORECHOP.out.reads
|
2023-03-07 12:40:21 +00:00
|
|
|
.map { meta, reads -> [ meta + [single_end: 1], reads ] }
|
2022-03-18 14:10:44 +00:00
|
|
|
|
2022-11-01 16:34:37 +00:00
|
|
|
ch_versions = ch_versions.mix(PORECHOP_PORECHOP.out.versions.first())
|
|
|
|
ch_multiqc_files = ch_multiqc_files.mix( PORECHOP_PORECHOP.out.log )
|
2022-07-19 11:50:39 +00:00
|
|
|
|
2022-08-30 12:08:05 +00:00
|
|
|
} else if ( params.longread_qc_skipadaptertrim && !params.longread_qc_skipqualityfilter) {
|
2022-05-01 05:18:14 +00:00
|
|
|
|
2023-03-07 12:40:21 +00:00
|
|
|
ch_processed_reads = FILTLONG ( reads.map { meta, reads -> [meta, [], reads ] } )
|
2022-05-01 05:18:14 +00:00
|
|
|
ch_versions = ch_versions.mix(FILTLONG.out.versions.first())
|
2022-07-19 14:44:08 +00:00
|
|
|
ch_multiqc_files = ch_multiqc_files.mix( FILTLONG.out.log )
|
2022-05-01 05:18:14 +00:00
|
|
|
|
|
|
|
} else {
|
2022-11-01 16:34:37 +00:00
|
|
|
PORECHOP_PORECHOP ( reads )
|
|
|
|
ch_clipped_reads = PORECHOP_PORECHOP.out.reads
|
2023-03-07 12:40:21 +00:00
|
|
|
.map { meta, reads -> [ meta + [single_end: 1], reads ] }
|
|
|
|
|
|
|
|
ch_processed_reads = FILTLONG ( ch_clipped_reads.map { meta, reads -> [meta, [], reads ] } ).reads
|
2022-03-18 14:10:44 +00:00
|
|
|
|
2022-11-01 16:34:37 +00:00
|
|
|
ch_versions = ch_versions.mix(PORECHOP_PORECHOP.out.versions.first())
|
2022-05-01 05:18:14 +00:00
|
|
|
ch_versions = ch_versions.mix(FILTLONG.out.versions.first())
|
2022-11-01 16:34:37 +00:00
|
|
|
ch_multiqc_files = ch_multiqc_files.mix( PORECHOP_PORECHOP.out.log )
|
2022-07-29 07:52:49 +00:00
|
|
|
ch_multiqc_files = ch_multiqc_files.mix( FILTLONG.out.log )
|
2022-05-01 05:18:14 +00:00
|
|
|
}
|
|
|
|
|
2022-10-20 14:55:57 +00:00
|
|
|
if (params.preprocessing_qc_tool == 'fastqc') {
|
2022-10-18 15:43:16 +00:00
|
|
|
FASTQC_PROCESSED ( ch_processed_reads )
|
2022-10-25 09:13:26 +00:00
|
|
|
ch_versions = ch_versions.mix( FASTQC_PROCESSED.out.versions )
|
2022-10-18 15:43:16 +00:00
|
|
|
ch_multiqc_files = ch_multiqc_files.mix( FASTQC_PROCESSED.out.zip )
|
2022-10-20 14:55:57 +00:00
|
|
|
|
|
|
|
} else if (params.preprocessing_qc_tool == 'falco') {
|
|
|
|
FALCO_PROCESSED ( ch_processed_reads )
|
2022-10-25 09:13:26 +00:00
|
|
|
ch_versions = ch_versions.mix( FALCO_PROCESSED.out.versions )
|
2022-10-20 14:55:57 +00:00
|
|
|
ch_multiqc_files = ch_multiqc_files.mix( FALCO_PROCESSED.out.txt )
|
2022-10-18 15:43:16 +00:00
|
|
|
}
|
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
|
|
|
|
}
|
|
|
|
|