forked from uw-maccosslab/nf-pdc-dia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.nf
117 lines (97 loc) · 4.19 KB
/
main.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
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
// Sub workflows
include { get_pdc_files; get_pdc_study_metadata } from "./nf-submodules/workflows/get_pdc_files.nf"
include { skyline_import } from "./nf-submodules/workflows/skyline_import.nf"
include { get_input_files } from "./nf-submodules/workflows/get_input_files.nf"
include { encyclopedia_search } from "./nf-submodules/workflows/encyclopedia_search.nf"
include { get_mzml_files } from "./nf-submodules/workflows/get_ms_data_files.nf"
include { generate_dia_qc_report } from "./nf-submodules/workflows/generate_qc_report.nf"
include { s3_upload } from "./nf-submodules/workflows/s3_transfer.nf"
include { export_version_info } from './workflows/export_version_info.nf'
// modules
include { UNZIP_SKY_FILE } from "./nf-submodules/modules/skyline.nf"
include { SKYLINE_ANNOTATE_DOCUMENT } from "./nf-submodules/modules/skyline.nf"
include { PANORAMA_IMPORT_SKYLINE } from "./nf-submodules/modules/panorama.nf"
include { PANORAMA_UPLOAD_FILE as UPLOAD_QC_REPORTS } from "./nf-submodules/modules/panorama.nf"
include { EXPORT_GENE_REPORTS } from "./nf-submodules/modules/qc_report.nf"
workflow {
// get mzml files
if(params.ms_data_dir == null) {
get_pdc_files()
wide_mzml_ch = get_pdc_files.out.wide_mzml_ch
annotations_csv = get_pdc_files.out.annotations_csv
metadata = get_pdc_files.out.metadata
} else {
get_pdc_study_metadata()
get_mzml_files(params.ms_data_dir, '*', 'raw')
wide_mzml_ch = get_mzml_files.out.mzml_ch
annotations_csv = get_pdc_study_metadata.out.annotations_csv
metadata = get_pdc_study_metadata.out.metadata
}
// get fasta, spectral library, and Skyline template.
get_input_files()
// set up some convenience variables
fasta = get_input_files.out.fasta
spectral_library = get_input_files.out.spectral_library
skyline_template_zipfile = get_input_files.out.skyline_template_zipfile
// search wide-window data using chromatogram library
encyclopedia_search (
wide_mzml_ch,
fasta,
spectral_library,
true,
"quant",
params.encyclopedia.params
)
encyclopedia_search_output = encyclopedia_search.out.elib
quant_elib = encyclopedia_search.out.elib
// create Skyline document
skyline_import(
skyline_template_zipfile,
fasta,
quant_elib,
wide_mzml_ch
)
// Annotate Skyline document
UNZIP_SKY_FILE(skyline_import.out.skyline_results)
SKYLINE_ANNOTATE_DOCUMENT(UNZIP_SKY_FILE.out.sky_file,
UNZIP_SKY_FILE.out.sky_artifacts.collect(),
annotations_csv)
// Import Skyline document to Panorama
if( params.panorama.skyline_folder != null ) {
PANORAMA_IMPORT_SKYLINE(params.panorama.skyline_folder,
SKYLINE_ANNOTATE_DOCUMENT.out.sky_zip_file)
}
// Generate and upload QC report
generate_dia_qc_report(UNZIP_SKY_FILE.out.sky_file,
UNZIP_SKY_FILE.out.sky_artifacts.collect(),
"${params.pdc_study_id}",
"${params.pdc_study_id} DIA QC report",
annotations_csv)
// Export other reports
EXPORT_GENE_REPORTS(generate_dia_qc_report.out.qc_report_db)
EXPORT_GENE_REPORTS.out.gene_reports | flatten | set{ gene_reports }
if( params.panorama.reports_folder != null ) {
UPLOAD_QC_REPORTS(params.panorama.reports_folder
generate_dia_qc_report.out.qc_reports)
}
qc_reports = generate_dia_qc_report.out.qc_reports.concat(
generate_dia_qc_report.out.qc_report_qmd,
generate_dia_qc_report.out.qc_report_db
)
// export version information
export_version_info(fasta, spectral_library, wide_mzml_ch)
// upload results to s3
if( params.s3_upload.bucket_name != null ) {
s3_upload(
wide_mzml_ch,
encyclopedia_search.out.search_files,
encyclopedia_search.out.elib,
SKYLINE_ANNOTATE_DOCUMENT.out.sky_zip_file,
qc_reports,
export_version_info.out.version_info,
gene_reports
)
}
}