-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.nf
More file actions
151 lines (128 loc) · 5.54 KB
/
main.nf
File metadata and controls
151 lines (128 loc) · 5.54 KB
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
#!/usr/bin/env nextflow
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PyocinTyper
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Github : https://github.com/GaTechBrownLab/PyocinTyper
Author: Iris Irby, irisirby2018@gmail.com
----------------------------------------------------------------------------------------
*/
//
// HELP MESSAGE
//
def helpMessage() {
log.info"""
=========================================
PyocinTyper
=========================================
Usage:
nextflow run main.nf -with-conda --pt_option <group|individual>
--input_files = "./data/*.gbff" --outdir "/results"
Required arguments:
--pt_option Specifiy if you are typing multiple pyocins <group>
or a single pyocin <individual>
--input_files Path to input genbank (.gbff) files
Directory pattern for individual: "./data/strain.gbff"
Directory pattern for group: "./data/*.gbff"
--outdir Output directory for results
Blast thresholds:
--R_pyocin_PID_cutoff Percent identity cutoff for R pyocins
(default: 70)
--R_pyocin_NID_cutoff Nucleotide identity cutoff for R pyocins
(default: 70)
--F_pyocin_PID_cutoff Percent identity cutoff for F pyocins
(default: 65)
--F_pyocin_NID_cutoff Nucleotide identity cutoff for F pyocins
(default: 65)
--tail_PID_cutoff Percent identity cutoff for tail fibers
(default: 95)
--tail_NID_cutoff Nucleotide identity cutoff for tail fibers
(default: 95)
vclust parameters:
--vclust_ani Clustering level for vclust ani
(default: 0.70)
--vclust_algorithm Algorithm for vclust
(default: cd-hit)
--vclust_qcov Query coverage for vclust
(default: 0.70)
--vlust_rcov Reference coverage for vclust
(default: 0.70)
--vlcust_len_ratio Length ratio for vclust
(default: 0.70)
Performance options:
--phispy_threads Specify number of threads for PhiSpy
(default: 1)
--blast_threads Specify number of threads for blast
(default: 1)
""".stripIndent()
}
//
// IMPORT WORKFLOWS
//
include { PYOCIN_TYPER_GROUP } from './workflows/PYOCIN_TYPER_GROUP.nf'
include { PYOCIN_TYPER_INDIVIDUAL } from './workflows/PYOCIN_TYPER_INDIVIDUAL.nf'
//
// RUN MAIN WORKFLOW
//
workflow {
main:
// Show help message
if (params.help){
helpMessage()
exit 0
}
// Validate parameters
if (!params.input_files) {
exit 1, "No input file provided! Please set `--input_files` to a valid path."
}
if (!params.outdir) {
exit 1, "No output directory provided! Please set `--outdir` to a valid path."
}
// Make channels from parameters
input_files_ch = Channel.fromPath( params.input_files )
// Validate channels
input_files_ch
.collect()
.map { files ->
def file_count = files.size()
if (!params.pt_option || !(params.pt_option in ['group', 'individual'])) {
exit 1, "No pt_option or incorrect pt_option specified! Please specify '--pt_option' to 'group' or 'individual'."
}
if (params.pt_option== 'group' && file_count <= 1) {
exit 1, "'--pt_option group' requires more than one input file."
}
if (params.pt_option == 'individual' && file_count != 1) {
exit 1, "'--pt_option individual' requires a single input file."
}
// Optionally re-emit as channel if you still want to use it downstream
input_files_ch = Channel.from(files)
}
// Read in reference files
R_pyocin_ch = Channel.fromPath( "./references/PAO1_R_Pyocin.fasta" )
.map { file -> tuple( "PAO1_R_Pyocin", file, params.R_pyocin_PID_cutoff, params.R_pyocin_NID_cutoff ) }
F_pyocin_ch = Channel.fromPath( "./references/PAO1_F_Pyocin.fasta" )
.map { file -> tuple( "PAO1_F_Pyocin", file, params.F_pyocin_PID_cutoff, params.F_pyocin_NID_cutoff ) }
R_and_F_ch = R_pyocin_ch
.mix( F_pyocin_ch )
R1_ch = Channel.fromPath( "./references/R1_800bp.fasta" )
R2_ch = Channel.fromPath( "./references/R2_800bp.fasta" )
R5_ch = Channel.fromPath( "./references/R5_800bp.fasta" )
// Run workflow
if (params.pt_option == "group") {
PYOCIN_TYPER_GROUP(
input_files_ch,
R_and_F_ch,
R1_ch,
R2_ch,
R5_ch
)
} else if (params.pt_option == "individual") {
PYOCIN_TYPER_INDIVIDUAL(
input_files_ch,
R_and_F_ch,
R1_ch,
R2_ch,
R5_ch
)
}
}