generated from Wang-Bioinformatics-Lab/Nextflow_Workflow_Template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nf_workflow.nf
143 lines (112 loc) · 3.79 KB
/
nf_workflow.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#!/usr/bin/env nextflow
nextflow.enable.dsl=2
// Parameters
params.inputfiles1 = "/mnt/c/test_data/no_ms2/exctrl/"
params.inputfiles2 = "/mnt/c/test_data/no_ms2/sample/"
params.inputfiles1_name = "exctrl"
params.inputfiles2_name = "sample"
params.normalize_ints = 1
params.peak_value = 'peak_area'
// Analysis Parameters
params.mz_tolerance = 10
params.rt_min = 1
params.rt_max = 9
params.pk_height_min = 1e4
params.num_data_min = 5
params.frag_mz_tol = 0.05
params.msms_score_min = 0.5
params.msms_matches_min = 3
// FTICR Parameters
params.fticr = 0
params.formula_match = 0
// Cosmograph Parameters
params.max_log_change = 0.5
// Pathway and Set Cover Parameters
params.max_pval = 0.05
params.publishdir = "$baseDir"
TOOL_FOLDER = "$baseDir/bin/envnet/envnet/use"
SCRIPTS_FOLDER = "$baseDir/bin/scripts"
process collectNetworkHits {
publishDir "$params.publishdir/nf_output/results", mode: 'copy'
conda "$TOOL_FOLDER/environment_analysis.yml"
input:
path mzml_files1
path mzml_files2
output:
path "all_ms1_data.csv", emit: all_ms1_data
path "all_ms2_data.csv", emit: all_ms2_data
path "output_group1-vs-group2.csv", emit: output_file
path "AnnotatedENVnet.graphml", emit: graph_file
"""
python $TOOL_FOLDER/analyze_metatlas_data_cli.py \
--files_group1 $mzml_files1 \
--files_group2 $mzml_files2 \
--files_group1_name "$params.inputfiles1_name" \
--files_group2_name "$params.inputfiles2_name" \
--fticr $params.fticr \
--formula_match $params.formula_match \
--mz_tol $params.mz_tolerance \
--rt_min $params.rt_min \
--rt_max $params.rt_max \
--pk_height_min $params.pk_height_min \
--num_data_min $params.num_data_min \
--frag_mz_tol $params.frag_mz_tol \
--msms_score_min $params.msms_score_min \
--msms_matches_min $params.msms_matches_min \
--normalize_intensities $params.normalize_ints \
--peak_value $params.peak_value \
"""
}
process formatCosmographOutput {
publishDir "$params.publishdir/nf_output/results", mode: 'copy'
conda "$TOOL_FOLDER/environment_analysis.yml"
input:
path graph_file
path output_file
output:
path "cosmograph_edges.csv"
path "cosmograph_metadata.csv"
"""
python $SCRIPTS_FOLDER/make_cosmograph_output.py \
--graph_file $graph_file \
--output_file $output_file \
--max_log_change $params.max_log_change \
"""
}
process generateCompoundClassOutputs {
publishDir "$params.publishdir/nf_output/results", mode: 'copy'
conda "$TOOL_FOLDER/environment_analysis.yml"
input:
path all_ms1_data
path all_ms2_data
path output_file
output:
path "set_cover_plots/*"
path "compound_class_plots/*"
"""
python $SCRIPTS_FOLDER/make_class_and_cover_output.py \
--cover_plots_dir set_cover_plots \
--compound_plots_dir compound_class_plots \
--files_group1_name "$params.inputfiles1_name" \
--files_group2_name "$params.inputfiles2_name" \
--ms1_file_path $all_ms1_data \
--ms2_file_path $all_ms2_data \
--output_file_path $output_file \
--max_p_val $params.max_pval \
"""
}
workflow {
files1 = Channel.fromPath("${params.inputfiles1}/*").collect()
def files2
if (params.inputfiles2 && params.inputfiles2.trim()) {
files2 = Channel.fromPath("${params.inputfiles2}/*").collect()
} else {
files2 = Channel.of(["${baseDir}/tests/integration/data/dummy.txt"])
}
collectNetworkHits(files1, files2)
formatCosmographOutput(collectNetworkHits.out.graph_file,
collectNetworkHits.out.output_file)
generateCompoundClassOutputs(collectNetworkHits.out.all_ms1_data,
collectNetworkHits.out.all_ms2_data,
collectNetworkHits.out.output_file)
}