-
Notifications
You must be signed in to change notification settings - Fork 4
/
test_reads.nf
87 lines (70 loc) · 2.16 KB
/
test_reads.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
#!/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 {
parse_manifest;
shard_genes;
corncob;
join
} from './modules/test_reads'
// Standalone entrypoint
workflow {
// Show help message if the user specifies the --help flag at runtime
helpers.help_message(
"""
Test for differences in the relative abundance of genes between groups of specimens
Uses the corncob algorithm to test for significant differences in the proportional
abundance of genes between different groups of samples.
Parameters:
--gene_abund Read alignment data output by the `align_reads` tool
--manifest Table describing the experimental design, with `specimen` values matching the gene abundance table (CSV)
--formula Formula to test, using manifest column names as variables (e.g. GROUP, or TREATMENT + GROUP)
--output Folder where output files will be written
""",
params.help
)
// Make sure that the required parameters were provided
helpers.require_param(params.gene_abund, "gene_abund")
helpers.require_param(params.manifest, "manifest")
helpers.require_param(params.formula, "formula")
helpers.require_param(params.output, "output")
// Get the file with the gene abundances
gene_abund = file(
"${params.gene_abund}",
checkIfExists: true,
type: "file",
glob: false
)
// Get the file with the manifest
manifest = file(
"${params.manifest}",
checkIfExists: true,
type: "file",
glob: false
)
// Parse the manifest
parse_manifest(
manifest,
gene_abund
)
// Shard the genes
shard_genes(
parse_manifest.out,
gene_abund
)
// Test each gene
corncob(
parse_manifest.out,
shard_genes
.out
.flatten()
)
// Join the results
join(
corncob.out.toSortedList()
)
}