-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.nf
85 lines (70 loc) · 2.8 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
nextflow.enable.dsl = 2
params.help = 0
if ( params.help != 0 ) {
help = """FUNGAL BARCODING WITH ONT: This pipeline streamlines the conversion of Oxford Nanopore Technologies (ONT) basecaller output into high-quality Internal Transcribed Spacer (ITS) sequences.
|
|Required arguments:
|
| --ONT_DIRECTORY Location of the input file file.
|
| --BLASTDB_PATH Location of the input file file.
|
| --RUN_ID Location of the input file file.
|
|Optional arguments:
|
| --MEDAKA_MODEL Medaka inference model. [default: r1041_e82_400bps_hac_variant_v4.3.0]
|
| --USE_ITSX Set to 0 if you want to ommit extraction of full ITS region using ITSx. [default: 1]
|
| --CHOPPER_MIN_READ_LENGTH Reads shorter than this value wont be used for clusters generation. [default: 150]
|
| --CHOPPER_MAX_READ_LENGTH Reads longer than this value wont be used for clusters generation. [default: 1000]
|
| --REL_ABU_THRESHOLD Output only clusters with barcode-wise relative abundance above this value. [default: 10]
|
""".stripMargin()
println(help)
exit(0)
}
params.help
// Define input barcode directory as a parameter
params.ONT_DIRECTORY
params.BLASTDB_PATH
params.RUN_ID
params.MEDAKA_MODEL = 'r1041_e82_400bps_hac_variant_v4.3.0'
params.USE_ITSX = 1
// Chopper min and max length of reads
params.CHOPPER_MIN_READ_LENGTH = 150
params.CHOPPER_MAX_READ_LENGTH = 1000
// Rel abu threshold on final table [0-100]
params.REL_ABU_THRESHOLD = 10
include {
ont_barcode_workflow
} from './subworkflows/ont_barcode_workflow.nf'
include {
create_final_table
} from './modules/create_final_table/main.nf'
workflow {
def base_dir = params.ONT_DIRECTORY
def cmd = ["bash", "-c", "find ${base_dir} -type d -path '*/pass/barcode*' -prune"]
def folder_list = cmd.execute().text.readLines()
folder_list.each { println "📂 Found: $it" }
def ch_barcodes = Channel.from(folder_list).map { barcode_dir ->
def barcode_name = barcode_dir.tokenize('/')[-1]
def barcode_fullpath = file(barcode_dir).toAbsolutePath()
tuple(
barcode_fullpath, barcode_name, file(barcode_dir), file(params.BLASTDB_PATH)
)
}
barcode_results = ont_barcode_workflow(
params.RUN_ID,
params.MEDAKA_MODEL,
params.USE_ITSX,
params.CHOPPER_MIN_READ_LENGTH,
params.CHOPPER_MAX_READ_LENGTH,
ch_barcodes
).collect()
script_path = file('results_aggregation_script.py')
create_final_table(script_path, barcode_results, params.RUN_ID, params.USE_ITSX, params.REL_ABU_THRESHOLD)
}