-
Notifications
You must be signed in to change notification settings - Fork 4
/
ani.nf
57 lines (43 loc) · 1.42 KB
/
ani.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
#!/usr/bin/env nextflow
// Using DSL-2
nextflow.enable.dsl=2
// Import helpers
GroovyShell shell = new GroovyShell()
def helpers = shell.parse(new File("${workflow.projectDir}/helpers.gvy"))
// Import sub-workflows
include { ani } from './modules/ani'
include { clean_genomes } from './modules/processes/align_genomes'
// Standalone entrypoint
workflow {
// Show help message if the user specifies the --help flag at runtime
helpers.help_message(
"""
Compute ANI for a set of genomes
Parameters:
--genomes Folder containing the set of genome nucleotide FASTAs to compare
--output Folder where output files will be written
""",
params.help
)
// Make sure that the required parameters were provided
helpers.require_param(params.output, "output")
helpers.require_param(params.genomes, "genomes")
// Remove any trailing slash from the genome folder
genome_folder = params.genomes.replaceAll('/$', '')
// Get all of the genomes
Channel
.fromPath("${genome_folder}/*")
.ifEmpty { error "Cannot find any files at ${genome_folder}/*" }
.set { genomes_ch }
// Clean all of those genomes
clean_genomes(
genomes_ch
.map {
it -> [it.name, it]
}
)
// Calculate the ANI for all of those genomes
ani(
clean_genomes.out
)
}