This repository has been archived by the owner on Apr 5, 2023. It is now read-only.
forked from gtluu/timsconvert
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnextflow.nf
85 lines (68 loc) · 2.21 KB
/
nextflow.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!~/bin nextflow
// params
// required params
params.input = ''
params.experiment = 'lc-tims-ms'
params.ms2_only = true // only convert ms2 spectra?
params.ms1_groupby = 'scan' // group ms1 spectra by 'frame' (will have array of mobilities; in beta) or 'scan' (each spectrum has one RT and mobility)
params.encoding = 64
params.maldi_output_file = 'combined' // choose whether MALDI spectra are output to individual files or a single combined file
params.maldi_plate_map = ''
params.imzml_mode = 'processed'
params.verbose = true
input_ch = Channel.fromPath(params.input, type:'dir', checkIfExists: true)
// Boiler Plate
TOOL_FOLDER = "$baseDir/bin"
params.publishdir = "nf_output"
// Process
process convert {
publishDir "$params.publishdir", mode: 'copy'
input:
file input_file from input_ch
output:
file "spectra/*mzML" into _spectra_ch
script:
def ms2_flag = params.ms2_only == true ? "--ms2_only" : ''
def verbose_flag = params.verbose == true ? "--verbose" : ''
if (params.maldi_plate_map == '')
"""
mkdir spectra
python3 $TOOL_FOLDER/run.py \
--input $input_file \
--experiment ${params.experiment} \
--outdir spectra \
${ms2_flag} \
--ms1_groupby ${params.ms1_groupby} \
--encoding ${params.encoding} \
--maldi_output_file ${params.maldi_output_file} \
--imzml_mode ${params.imzml_mode} \
${verbose_flag}
"""
else if (params.maldi_plate_map != '')
"""
mkdir spectra
python3 $TOOL_FOLDER/run.py \
--input $input_file \
--experiment ${params.experiment} \
--outdir spectra \
${ms2_flag} \
--ms1_groupby ${params.ms1_groupby} \
--encoding ${params.encoding} \
--maldi_output_file ${params.maldi_output_file} \
--maldi_plate_map = ${params.maldi_plate_map} \
--imzml_mode ${params.imzml_mode} \
${verbose_flag}
"""
}
process summarize {
publishDir "$params.publishdir", mode: 'copy'
input:
file "spectra/*" from _spectra_ch.collect()
output:
file "results_file.tsv"
"""
python3 $TOOL_FOLDER/summarize.py \
spectra \
results_file.tsv
"""
}