-
Notifications
You must be signed in to change notification settings - Fork 88
Expand file tree
/
Copy pathpreprocessing_fastp.nf
More file actions
52 lines (42 loc) · 2.05 KB
/
preprocessing_fastp.nf
File metadata and controls
52 lines (42 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//
// Process short raw reads with FastP
//
include { FASTP as FASTP_SINGLE } from '../../modules/nf-core/fastp/main'
include { FASTP as FASTP_PAIRED } from '../../modules/nf-core/fastp/main'
workflow PREPROCESSING_FASTP {
take:
reads // [[meta], [reads]]
adapterlist // <adapterlist>.fasta
main:
ch_versions = Channel.empty()
ch_multiqc_files = Channel.empty()
ch_input_for_fastp = reads
.branch{
single: it[0]['single_end'] == true
paired: it[0]['single_end'] == false
}
FASTP_SINGLE ( ch_input_for_fastp.single, adapterlist, false, false )
ch_versions = ch_versions.mix(FASTP_SINGLE.out.versions.first())
ch_multiqc_files = ch_multiqc_files.mix( FASTP_SINGLE.out.json )
// Last parameter here turns on merging of PE data
FASTP_PAIRED ( ch_input_for_fastp.paired, adapterlist, false, !params.preprocessing_skippairmerging )
ch_versions = ch_versions.mix(FASTP_PAIRED.out.versions.first())
ch_multiqc_files = ch_multiqc_files.mix( FASTP_PAIRED.out.json )
if ( !params.preprocessing_skippairmerging ) {
ch_fastp_reads_prepped_pe = FASTP_PAIRED.out.reads_merged
.map {
meta, reads_ ->
def meta_new = meta.clone()
meta_new['single_end'] = true
[ meta_new, [ reads_ ].flatten() ]
}
ch_fastp_reads_prepped = ch_fastp_reads_prepped_pe.mix( FASTP_SINGLE.out.reads )
} else {
ch_fastp_reads_prepped = FASTP_PAIRED.out.reads
.mix( FASTP_SINGLE.out.reads )
}
emit:
reads = ch_fastp_reads_prepped // channel: [ val(meta), [ reads ] ]
versions = ch_versions // channel: [ versions.yml ]
mqc = ch_multiqc_files
}