-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathancestral_gene.nf
executable file
·86 lines (72 loc) · 2.22 KB
/
ancestral_gene.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
#!/usr/bin/env nextflow
//
// MODULE IMPORT BLOCK
//
include { EXTRACT_ANCESTRAL } from '../../modules/local/extract_ancestral'
include { ASSIGN_ANCESTRAL } from '../../modules/local/assign_ancestral'
include { BEDTOOLS_SORT } from '../../modules/nf-core/bedtools/sort/main'
include { UCSC_BEDTOBIGBED } from '../../modules/nf-core/ucsc/bedtobigbed/main'
workflow ANCESTRAL_GENE {
take:
busco_dir // Channel: tuple [val(meta),/path/to/busco/output/dir]
dot_genome // Channel: tuple [val(meta), [ datafile ]]
buscogene_as // Channel: val(dot_as location)
ancestral_table // Channel: val(ancestral_table location)
main:
ch_versions = Channel.empty()
ch_grab = GrabFiles(busco_dir)
//
// MODULE: EXTRACTS ANCESTRALLY LINKED BUSCO GENES FROM FULL TABLE
//
EXTRACT_ANCESTRAL(
ch_grab,
ancestral_table
)
ch_versions = ch_versions.mix(EXTRACT_ANCESTRAL.out.versions)
//
// LOGIC: STRIP OUT METADATA
//
ch_grab
.map { meta, fulltable
-> fulltable
}
.set { assignanc_input }
//
// MODULE: ASSIGN EXTRACTED GENES TO ANCESTRAL GROUPS
//
ASSIGN_ANCESTRAL(
EXTRACT_ANCESTRAL.out.comp_location,
assignanc_input
)
ch_versions = ch_versions.mix(EXTRACT_ANCESTRAL.out.versions)
//
// MODULES: SORT THE BED FILE
//
BEDTOOLS_SORT(
ASSIGN_ANCESTRAL.out.assigned_bed,
[]
)
ch_versions = ch_versions.mix(BEDTOOLS_SORT.out.versions)
//
// MODULES: CONVERT BED TO INDEXED BIGBED
//
UCSC_BEDTOBIGBED(
BEDTOOLS_SORT.out.sorted,
dot_genome.map{ it[1] }, // Pull file from tuple(meta, file)
buscogene_as
)
ch_versions = ch_versions.mix(UCSC_BEDTOBIGBED.out.versions)
emit:
ch_ancestral_bigbed = UCSC_BEDTOBIGBED.out.bigbed
versions = ch_versions.ifEmpty(null)
}
process GrabFiles {
label 'process_tiny'
tag "${meta.id}"
executor 'local'
input:
tuple val(meta), path("in")
output:
tuple val(meta), path("in/*/*/full_table.tsv")
"true"
}