-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.nf
More file actions
188 lines (168 loc) · 6.04 KB
/
main.nf
File metadata and controls
188 lines (168 loc) · 6.04 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
#!/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
----------------------------------------------------------------------------------------
*/
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GENOME PARAMETER VALUES
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
params.fasta = getGenomeAttribute('fasta')
params.gtf = getGenomeAttribute('gtf')
params.blacklist = getGenomeAttribute('blacklist')
params.taxon_id = getGenomeAttribute('taxon_id')
params.snps = getGenomeAttribute('snps')
params.sneep_scale_file = getGenomeAttribute('sneep_scale_file')
params.sneep_motif_file = getGenomeAttribute('sneep_motif_file')
params.tflink_file = getGenomeAttribute('tflink_file')
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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 { PREPARE_GENOME } from './subworkflows/local/prepare_genome'
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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()
fasta = file(params.fasta, checkIfExists: true)
gtf = file(params.gtf, checkIfExists: true)
ch_blacklist = channel.value(params.blacklist ? file(params.blacklist, checkIfExists: true) : [])
ch_motifs = params.motifs ? file(params.motifs, checkIfExists: true) : null
ch_counts = channel.value(file(params.counts, checkIfExists: true))
snps = params.snps ? file(params.snps, checkIfExists: true) : null
sneep_scale_file = params.sneep_scale_file ? file(params.sneep_scale_file, checkIfExists: true) : null
sneep_motif_file = params.sneep_motif_file ? file(params.sneep_motif_file, checkIfExists: true) : null
tflink_file = params.tflink_file ? file(params.tflink_file, checkIfExists: true) : null
//
// SUBWORKFLOW: Prepare genome
//
PREPARE_GENOME(
fasta,
gtf,
)
ch_extra_counts = counts_design.filter { _meta, file -> file }
ch_versions = ch_versions.mix(PREPARE_GENOME.out.versions)
//
// WORKFLOW: Run pipeline
//
TFACTIVITY(
samplesheet,
sneep_scale_file,
sneep_motif_file,
PREPARE_GENOME.out.fasta,
PREPARE_GENOME.out.gtf,
ch_blacklist,
ch_motifs,
params.taxon_id,
PREPARE_GENOME.out.gene_lengths,
PREPARE_GENOME.out.gene_map,
PREPARE_GENOME.out.chrom_sizes,
samplesheet_bam,
params.chromhmm_states,
params.chromhmm_threshold,
params.chromhmm_enhancer_marks.split(','),
params.chromhmm_promoter_marks.split(','),
params.merge_samples,
params.affinity_aggregation,
params.duplicate_motifs,
ch_counts,
ch_extra_counts,
channel.value([[id: "design"], file(params.counts_design, checkIfExists: true)]),
params.min_count,
params.min_tpm,
params.expression_aggregation,
params.min_count_tf,
params.min_tpm_tf,
params.dynamite_ofolds,
params.dynamite_ifolds,
params.dynamite_alpha,
params.dynamite_randomize,
params.alpha,
snps,
tflink_file,
ch_versions,
params.skip_fimo,
params.skip_sneep,
params.skip_chromhmm,
params.skip_rose,
params.outdir,
)
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
RUN MAIN WORKFLOW
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
workflow {
//
// SUBWORKFLOW: Run initialisation tasks
//
PIPELINE_INITIALISATION(
params.version,
params.validate_params,
args,
params.outdir,
params.help,
params.help_full,
params.show_hidden,
params.input,
params.input_bam,
params.counts_design,
)
//
// 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,
)
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FUNCTIONS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
//
// Get attribute from genome config file e.g. fasta
//
def getGenomeAttribute(attribute) {
if (params.genomes && params.genome && params.genomes.containsKey(params.genome)) {
if (params.genomes[params.genome].containsKey(attribute)) {
return params.genomes[params.genome][attribute]
}
}
return null
}