-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathReport.nf
123 lines (93 loc) · 3.7 KB
/
Report.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
#!/usr/bin/env nextflow
nextflow.enable.dsl=2
// nextflow.enable.configprocessNamesValidation = false
log.info """\
QTL Pipeline - Report
================================
Output Directory : $params.outdir
================================
"""
params.output_result_csv = false
// ##### Not used process to aviod warnings from sge.config ####################
process qc_filters {script:""" """}
process M_vcf_to_gds {script:""" """}
process M_write_gds_list {script:""" """}
process M_merge_gds {script:""" """}
process M_PCA {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 G_vcf_to_gds {script:""" """}
process G_write_gds_list {script:""" """}
process G_merge_gds {script:""" """}
process G_PCA_GRM {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:""" """}
// ##### MatrixeQTL ############################################################
process M_QTL_results_wrap {
publishDir "${params.outdir}/5_Results_Summary", mode: 'move'
input:
path phenodat_chunk
val QTL_assoc_winfo_dir
output:
path '*'
script:
"""
5_M_wrap_QTL_results.R $phenodat_chunk $QTL_assoc_winfo_dir ${params.output_result_csv} ${params.plot_mac} ${params.plot_resolution} ${params.plot_size}
"""
}
// ##### GENESIS ###############################################################
process G_QTL_results_wrap {
publishDir "${params.outdir}/5_Results_Summary", mode: 'move'
input:
path individual_phenodat
val QTL_assoc_winfo_dir
output:
path '*'
script:
"""
5_G_wrap_QTL_results.R $individual_phenodat $QTL_assoc_winfo_dir ${params.output_result_csv} ${params.plot_mac} ${params.plot_resolution} ${params.plot_size}
"""
}
// ##### shared ################################################################
process move_boxplot {
publishDir "${params.outdir}/5_Results_Summary/top_SNP_boxplots", mode: 'copy'
input:
val QTL_assoc_dir
output:
path '*'
script:
"""
if ls $QTL_assoc_dir/*.png >/dev/null 2>/dev/null; then
mv $QTL_assoc_dir/*.png .
fi
# discard all standard ls output and all error, `2`, to /dev/null.
# if ls command is not an error, i.e. png files exists, execute mv command.
echo "If no png file appears, it means there are no genotype-phenotype boxplot found. \nIf you think this is a mistake, check 3_individual_results/ folder. \n" > finished.txt
"""
}
// ##### workflow ##############################################################
workflow {
if (params.pipeline_engine == "matrixeqtl" | params.pipeline_engine == "m") {
phenodat_chunk = channel.fromPath("${params.outdir}/1_phenotype_data_chunk/phenodat_*.rds").flatten()
QTL_assoc_winfo_dir = "${params.outdir}/4_individual_results_SNPinfo/"
M_QTL_results_wrap(phenodat_chunk, QTL_assoc_winfo_dir)
}
if (params.pipeline_engine == "genesis" | params.pipeline_engine == "g") {
individual_phenodat = channel.fromPath("${params.outdir}/1_phenotype_data/*.rds").flatten()
QTL_assoc_winfo_dir = "${params.outdir}/4_individual_results_SNPinfo/"
G_QTL_results_wrap(individual_phenodat, QTL_assoc_winfo_dir)
}
if (params.draw_genopheno_boxplot == "true") {
move_boxplot("${params.outdir}/3_individual_results")
}
}