-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPrepare.nf
213 lines (159 loc) · 4.53 KB
/
Prepare.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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
#!/usr/bin/env nextflow
nextflow.enable.dsl=2
// nextflow.enable.configprocessNamesValidation = false
// ##### Not used process to aviod warnings from sge.config ####################
process qc_filters {script:""" """}
process M_get_shared_sampleid {script:""" """}
process M_split_pheno {script:""" """}
process M_prepare_cvrt {script:""" """}
process M_SNP_info {script:""" """}
process M_QTL_analysis {script:""" """}
process M_merge_info_QTL {script:""" """}
process M_QTL_count_wrap {script:""" """}
process M_QTL_results_wrap {script:""" """}
process G_get_shared_sampleid {script:""" """}
process G_split_pheno {script:""" """}
process G_prepare_cvrt {script:""" """}
process G_SNP_info {script:""" """}
process G_QTL_analysis {script:""" """}
process G_merge_info_QTL {script:""" """}
process G_QTL_count_wrap {script:""" """}
process G_QTL_results_wrap {script:""" """}
process move_boxplot {script:""" """}
// ##### MatrixeQTL ############################################################
process M_vcf_to_gds {
publishDir "${params.outdir}/1_data", mode: 'copy'
input:
tuple val(vcf_name), val(vcf_filepath)
output:
path '*.gds', emit: gds
path '*'
script:
"""
0_M_vcf_to_gds.R $vcf_name $vcf_filepath
"""
}
process M_write_gds_list {
publishDir "${params.outdir}/1_data", mode: 'copy'
input:
val vcf_names
output:
path 'gds_list.csv'
path '*'
script:
"""
0_M_write_gds_list.R ${params.outdir} $vcf_names
"""
}
process M_merge_gds {
publishDir "${params.outdir}/1_data", mode: 'copy'
input:
path gds
output:
path 'merged.gds', emit: merged_gds
path '*'
script:
"""
0_M_merge_gds.R $gds
"""
}
process M_PCA {
publishDir "${params.outdir}/1_data", mode: 'copy'
input:
path merged_gds
output:
path '*'
script:
"""
0_M_PCA.R $merged_gds ${params.snpset_PCA_txtfile} ${params.pcair_kinthresh} ${params.pcair_divthresh} ${params.userdef_sampleid_txtfile}
"""
}
// ##### GENESIS ###############################################################
process G_vcf_to_gds {
publishDir "${params.outdir}/1_data", mode: 'copy'
input:
tuple val(vcf_name), val(vcf_filepath)
output:
path '*.gds', emit: gds
path '*'
script:
"""
0_G_vcf_to_gds.R $vcf_name $vcf_filepath
"""
}
process G_write_gds_list {
publishDir "${params.outdir}/1_data", mode: 'copy'
input:
val vcf_names
output:
path 'gds_list.csv'
path '*'
script:
"""
0_G_write_gds_list.R ${params.outdir} $vcf_names
"""
}
process G_merge_gds {
publishDir "${params.outdir}/1_data", mode: 'copy'
input:
path gds
output:
path 'merged.gds', emit: merged_gds
path '*'
script:
"""
0_G_merge_gds.R $gds
"""
}
process G_PCA_GRM {
publishDir "${params.outdir}/1_data", mode: 'copy'
input:
path merged_gds
output:
path '*'
script:
"""
0_G_PCA_GRM.R $merged_gds ${params.snpset_PCA_txtfile} ${params.pcair_kinthresh} ${params.pcair_divthresh} ${params.userdef_sampleid_txtfile}
"""
}
// ##### workflow ##############################################################
workflow {
if (params.pipeline_engine == "matrixeqtl" | params.pipeline_engine == "m") {
if (params.genodat_format == "vcf") {
genovcf = Channel
.fromPath(params.vcf_list)
.splitCsv(header: false)
.map {row -> tuple(row[0], row[1])}
M_vcf_to_gds(genovcf)
M_write_gds_list(params.vcf_list)
}
if (params.start_PC) {
if (params.genodat_format == "vcf") {
M_merge_gds(M_vcf_to_gds.out.gds.collect())
}
if (params.genodat_format == "gds") {
M_merge_gds(params.gds_list)
}
M_PCA(M_merge_gds.out.merged_gds)
}
}
if (params.pipeline_engine == "genesis" | params.pipeline_engine == "g") {
if (params.genodat_format == "vcf") {
genovcf = Channel
.fromPath(params.vcf_list)
.splitCsv(header: false)
.map {row -> tuple(row[0], row[1])}
G_vcf_to_gds(genovcf)
G_write_gds_list(params.vcf_list)
}
if (params.start_PC) {
if (params.genodat_format == "vcf") {
G_merge_gds(G_vcf_to_gds.out.gds.collect())
}
if (params.genodat_format == "gds") {
G_merge_gds(params.gds_list)
}
G_PCA_GRM(G_merge_gds.out.merged_gds)
}
}
}