forked from CCRGeneticsBranch/Oncogenomics_NF_WF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.nf
executable file
·117 lines (88 loc) · 3.75 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
117
// Using DSL-2
nextflow.enable.dsl=2
import groovy.json.JsonSlurper
log.info """\
E X O M E - R N A S E Q - N F P I P E L I N E
===================================
NF version : $nextflow.version
runName : $workflow.runName
username : $workflow.userName
configs : $workflow.configFiles
profile : $workflow.profile
cmd line : $workflow.commandLine
start time : $workflow.start
projectDir : $workflow.projectDir
launchDir : $workflow.launchDir
workdDir : $workflow.workDir
homeDir : $workflow.homeDir
"""
.stripIndent()
//import workflows
include {RNAseq_only} from './workflows/RNAseq_only.nf'
include {RNAseq_multiple_libs} from './workflows/RNAseq_multiple_libs.nf'
include {Exome_only_WF} from './workflows/Exome_only_WF.nf'
include {Tumor_multiple_libs} from './workflows/Tumor_multiple_libs.nf'
include {Tumor_Normal_WF} from './workflows/Tumor_Normal_WF.nf'
include {Tumor_Normal_RNAseq_WF} from './workflows/Tumor_Normal_RNAseq_WF.nf'
include {Tumor_RNAseq_WF} from './workflows/Tumor_RNAseq_WF.nf'
include {Mouse_RNA} from './workflows/Mouse_RNA.nf'
// Launch workflow by checking the samplesheet availability
workflow {
if (fileExists("Exome.csv")) {
Exome_only_WF()
} else if (fileExists("Tumor_lib.csv")) {
Tumor_multiple_libs()
} else if (fileExists("Tumor_RNAseq_Normal.csv")) {
Tumor_Normal_RNAseq_WF()
} else if (fileExists("RNAseq.csv")) {
RNAseq_only()
} else if (fileExists("RNA_lib.csv")) {
RNAseq_multiple_libs()
} else if (fileExists("Tumor_Normal.csv")) {
Tumor_Normal_WF()
} else if (fileExists("Tumor_RNAseq.csv")) {
Tumor_RNAseq_WF()
} else if (fileExists("mouse_rnaseq.csv")) {
Mouse_RNA()
} else {
println("No workflow to run. Required file is missing.")
}
/*
get_project_list()
*/
}
/*
process get_project_list {
output:
path "list.txt"
script:
"""
python3 /data/khanlab/projects/processed_DATA/nf_samplesheets/projectlist.py /data/khanlab/projects/processed_DATA/nf_samplesheets/PAXCPA_PAXCPA.csv > list.txt
"""
}
*/
workflow.onComplete {
if (workflow.success) {
if (workflow.profile == "biowulf_mouse_RNA_slurm") {
// Special handling for the mouse workflow
def successFile = new File("${workflow.launchDir}/completed.txt")
successFile.createNewFile()
def fullMessage = "Mouse RNAseq workflow completed successfully. Results are located at ${workflow.launchDir}"
sendMail(to: "${workflow.userName}@mail.nih.gov", subject: 'Mouse RNAseq Workflow Complete', body: fullMessage, mimeType: 'text/plain')
} else {
def successFile = new File("${workflow.launchDir}/successful.txt")
successFile.createNewFile()
def htmlFile = new File("${workflow.launchDir}/qc/genotyping.html")
def htmlContent = htmlFile.text
def fullMessage = "${htmlContent}"
//sendMail(to: "${workflow.userName}@mail.nih.gov" , subject: 'khanlab ngs-pipeline execution successful', body: fullMessage, mimeType: 'text/html')
sendMail(to: "${workflow.userName}@mail.nih.gov" , cc: 'wenxi@mail.nih.gov, gangalapudiv2@mail.nih.gov,' , subject: 'khanlab ngs-pipeline execution successful', body: fullMessage, mimeType: 'text/html')
}
} else {
fullMessage = "Workflow completed with errors. Error log is located at ${workflow.launchDir}"
sendMail(to: "${workflow.userName}@mail.nih.gov" , cc: 'gangalapudiv2@mail.nih.gov', subject: 'khanlab ngs-pipeline execution failed', body: fullMessage, mimeType: 'text/html')
}
}
def fileExists(String filePath) {
new File(filePath).exists()
}