-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.nf
174 lines (149 loc) · 5.28 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
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#!/usr/bin/env nextflow
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nf-core/tfactivity
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Github : https://github.com/nf-core/tfactivity
Website: https://nf-co.re/tfactivity
Slack : https://nfcore.slack.com/channels/tfactivity
----------------------------------------------------------------------------------------
*/
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IMPORT FUNCTIONS / MODULES / SUBWORKFLOWS / WORKFLOWS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
include { TFACTIVITY } from './workflows/tfactivity'
include { PIPELINE_INITIALISATION } from './subworkflows/local/utils_nfcore_tfactivity_pipeline'
include { PIPELINE_COMPLETION } from './subworkflows/local/utils_nfcore_tfactivity_pipeline'
include { getGenomeAttribute } from './subworkflows/local/utils_nfcore_tfactivity_pipeline'
include { PREPARE_GENOME } from './subworkflows/local/prepare_genome'
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GENOME PARAMETER VALUES
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
params.fasta = getGenomeAttribute('fasta')
params.gtf = getGenomeAttribute('gtf')
params.blacklist = getGenomeAttribute('blacklist')
params.taxon_id = getGenomeAttribute('taxon_id')
if (!params.motifs && !params.taxon_id) {
error "Please provide either a motifs file or a taxon ID"
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NAMED WORKFLOWS FOR PIPELINE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
//
// WORKFLOW: Run main analysis pipeline depending on type of input
//
workflow NFCORE_TFACTIVITY {
take:
samplesheet // channel: samplesheet read in from --input
samplesheet_bam // channel: samplesheet read in from --input_bam
counts_design // channel: counts design file read in from --counts_design
main:
ch_versions = Channel.empty()
ch_fasta = Channel.value(file(params.fasta, checkIfExists: true))
ch_gtf = Channel.value(file(params.gtf, checkIfExists: true))
ch_blacklist = params.blacklist ? Channel.value(file(params.blacklist, checkIfExists: true)) : Channel.value([])
ch_motifs = params.motifs ? Channel.value(file(params.motifs, checkIfExists: true)) : Channel.empty()
ch_counts = Channel.value(file(params.counts, checkIfExists: true))
ch_taxon_id = (!params.motifs && params.taxon_id) ? Channel.value(params.taxon_id) : Channel.empty()
//
// SUBWORKFLOW: Prepare genome
//
PREPARE_GENOME (
ch_fasta,
ch_gtf
)
ch_extra_counts = counts_design.filter{ meta, file -> file }
ch_versions = ch_versions.mix(PREPARE_GENOME.out.versions)
//
// WORKFLOW: Run pipeline
//
TFACTIVITY (
samplesheet,
PREPARE_GENOME.out.fasta,
PREPARE_GENOME.out.gtf,
ch_blacklist,
ch_motifs,
ch_taxon_id,
PREPARE_GENOME.out.gene_lengths,
PREPARE_GENOME.out.gene_map,
PREPARE_GENOME.out.chrom_sizes,
// ChromHMM
samplesheet_bam,
params.chromhmm_states,
params.chromhmm_threshold,
params.chromhmm_enhancer_marks.split(','),
params.chromhmm_promoter_marks.split(','),
// Peaks
params.window_size,
params.decay,
params.merge_samples,
params.affinity_aggregation,
// Counts
ch_counts,
ch_extra_counts,
Channel.value(file(params.counts_design, checkIfExists: true))
.map{ design -> [[id: "design"], design]},
params.min_count,
params.min_tpm,
params.expression_aggregation,
params.min_count_tf,
params.min_tpm_tf,
// Dynamite
params.dynamite_ofolds,
params.dynamite_ifolds,
params.dynamite_alpha,
params.dynamite_randomize,
// Ranking
params.alpha,
ch_versions
)
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
RUN MAIN WORKFLOW
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
workflow {
main:
//
// SUBWORKFLOW: Run initialisation tasks
//
PIPELINE_INITIALISATION (
params.version,
params.validate_params,
params.monochrome_logs,
args,
params.outdir,
params.input
)
//
// WORKFLOW: Run main workflow
//
NFCORE_TFACTIVITY (
PIPELINE_INITIALISATION.out.samplesheet,
PIPELINE_INITIALISATION.out.samplesheet_bam,
PIPELINE_INITIALISATION.out.counts_design
)
//
// SUBWORKFLOW: Run completion tasks
//
PIPELINE_COMPLETION (
params.email,
params.email_on_fail,
params.plaintext_email,
params.outdir,
params.monochrome_logs,
params.hook_url
)
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
THE END
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/