This repository has been archived by the owner on May 6, 2024. It is now read-only.
forked from bigbio/quantms
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfile_preparation.nf
67 lines (56 loc) · 2.06 KB
/
file_preparation.nf
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//
// Raw file conversion and mzml indexing
//
include { THERMORAWFILEPARSER } from '../../modules/local/thermorawfileparser/main'
include { MZMLINDEXING } from '../../modules/local/openms/mzmlindexing/main'
include { OPENMSPEAKPICKER } from '../../modules/local/openms/openmspeakpicker/main'
workflow FILE_PREPARATION {
take:
ch_mzmls // channel: [ val(meta), raw/mzml ]
main:
ch_versions = Channel.empty()
ch_results = Channel.empty()
//
// Divide mzml files
//
ch_mzmls
.branch {
raw: WorkflowQuantms.hasExtension(it[1], 'raw')
mzML: WorkflowQuantms.hasExtension(it[1], 'mzML')
}
.set { ch_branched_input }
//TODO we could also check for outdated mzML versions and try to update them
ch_branched_input.mzML
.branch {
nonIndexedMzML: file(it[1]).withReader {
f = it; 1.upto(5) {
if (f.readLine().contains("indexedmzML")) return false;
}
return true;
}
inputIndexedMzML: file(it[1]).withReader {
f = it; 1.upto(5) {
if (f.readLine().contains("indexedmzML")) return true;
}
return false;
}
}
.set { ch_branched_input_mzMLs }
ch_results = ch_results.mix(ch_branched_input_mzMLs.inputIndexedMzML)
THERMORAWFILEPARSER( ch_branched_input.raw )
ch_versions = ch_versions.mix(THERMORAWFILEPARSER.out.version)
ch_results = ch_results.mix(THERMORAWFILEPARSER.out.mzmls_converted)
MZMLINDEXING( ch_branched_input_mzMLs.nonIndexedMzML )
ch_versions = ch_versions.mix(MZMLINDEXING.out.version)
ch_results = ch_results.mix(MZMLINDEXING.out.mzmls_indexed)
if (params.openms_peakpicking){
OPENMSPEAKPICKER (
ch_results
)
ch_versions = ch_versions.mix(OPENMSPEAKPICKER.out.version)
ch_results = OPENMSPEAKPICKER.out.mzmls_picked
}
emit:
results = ch_results // channel: [val(mzml_id), indexedmzml]
version = ch_versions // channel: [ *.version.txt ]
}