-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconvert_to_mgf.nf
77 lines (60 loc) · 2.35 KB
/
convert_to_mgf.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
#!/usr/bin/env nextflow
nextflow.enable.dsl=2
// Required Parameters
params.ctm_raws = "$PWD/raws" // Directory containing .raw/.d-files
params.ctm_outdir = "$PWD/results" // Output-Directory where the MGFs will be stored
params.ctm_export_data = "true" // Boolean, if true, will export data into ctm_outdir
// Optional Parameters
params.ctm_additional_params_thermo = "" // Additional paramaters which may be set for conversion
params.ctm_additional_params_alphatims = "" // Additional paramaters which may be set for conversion
params.ctm_num_forks_conversion = Runtime.runtime.availableProcessors() // The maximum number of parallel conversions done at once.
// Standalone Workflow
workflow {
// Convert to .mgf
raw_files = Channel.fromPath(params.ctm_raws + "/*.raw")
d_files = Channel.fromPath(params.ctm_raws + "/*.d", type: "dir")
convert_to_mgf(raw_files, d_files)
}
// Importable Workflow
workflow convert_to_mgf {
take:
// Takes .raw and .d
raw_files
d_files
main:
// Convert the files to .mgf
convert_raw_via_thermorawfileparser(raw_files)
convert_d_via_alphatims(d_files)
results = convert_raw_via_thermorawfileparser.out.concat(
convert_d_via_alphatims.out
)
emit:
// Return each input as .mgf, converted from a .raw/.d-file
results
}
process convert_raw_via_thermorawfileparser {
maxForks params.ctm_num_forks_conversion
cpus 2 // Currently limited to two conversions at once (due to TRFP: https://github.com/compomics/ThermoRawFileParser/issues/23 )
container 'quay.io/biocontainers/thermorawfileparser:1.4.3--ha8f3691_0'
publishDir "${params.ctm_outdir}/", mode:'copy', enabled:"${params.ctm_export_data}"
input:
path raw
output:
path "${raw.baseName}.mgf"
"""
thermorawfileparser ${params.ctm_additional_params_thermo} --format=0 --output_file=${raw.baseName}.mgf --input=${raw}
"""
}
process convert_d_via_alphatims {
maxForks params.ctm_num_forks_conversion
cpus 2 // hardcoded limit
container 'luxii/progfastagen:latest'
publishDir "${params.ctm_outdir}/", mode:'copy', enabled:"${params.ctm_export_data}"
input:
path raw
output:
path "${raw.baseName}.mgf"
"""
alphatims export mgf --threads 2 ${params.ctm_additional_params_alphatims} -o . ${raw}
"""
}