Skip to content

Commit af66142

Browse files
committed
Improve PREPARE_GENOME structure
1 parent 2c6c0d8 commit af66142

File tree

1 file changed

+48
-11
lines changed

1 file changed

+48
-11
lines changed

subworkflows/local/prepare_genome.nf

Lines changed: 48 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,32 +40,69 @@ workflow PREPARE_GENOME {
4040
SEQKIT_SPLIT(ch_fasta)
4141
ch_versions = ch_versions.mix(SEQKIT_SPLIT.out.versions)
4242

43-
if (!params.bowtie && detection_tools.contains('mapsplice')) {
43+
if (params.bowtie) {
44+
ch_bowtie = Channel.value([[id: "bowtie"], file(params.bowtie, checkIfExists: true)])
45+
}
46+
else if (detection_tools.contains('mapsplice')) {
4447
BOWTIE_BUILD(ch_fasta)
4548
ch_versions = ch_versions.mix(BOWTIE_BUILD.out.versions)
49+
ch_bowtie = BOWTIE_BUILD.out.index
50+
}
51+
else {
52+
ch_bowtie = Channel.empty()
4653
}
4754

48-
if (!params.bowtie2 && detection_tools.contains('find_circ')) {
55+
if (params.bowtie2) {
56+
ch_bowtie2 = Channel.value([[id: "bowtie2"], file(params.bowtie2, checkIfExists: true)])
57+
}
58+
else if (detection_tools.contains('find_circ')) {
4959
BOWTIE2_BUILD(ch_fasta)
5060
ch_versions = ch_versions.mix(BOWTIE2_BUILD.out.versions)
61+
ch_bowtie2 = BOWTIE2_BUILD.out.index
62+
}
63+
else {
64+
ch_bowtie2 = Channel.empty()
5165
}
5266

53-
if (!params.bwa && detection_tools.contains('ciriquant')) {
67+
if (params.bwa) {
68+
ch_bwa = Channel.value([[id: "bwa"], file(params.bwa, checkIfExists: true)])
69+
}
70+
else if (detection_tools.contains('ciriquant')) {
5471
BWA_INDEX(ch_fasta)
5572
ch_versions = ch_versions.mix(BWA_INDEX.out.versions)
73+
ch_bwa = BWA_INDEX.out.index
74+
}
75+
else {
76+
ch_bwa = Channel.empty()
5677
}
5778

58-
if (!params.hisat2 && detection_tools.contains('ciriquant')) {
79+
ch_hisat2_splice_sites = Channel.empty()
80+
if (params.hisat2) {
81+
ch_hisat2 = Channel.value([[id: "hisat2"], file(params.hisat2, checkIfExists: true)])
82+
}
83+
else if (detection_tools.contains('ciriquant')) {
5984
HISAT2_EXTRACTSPLICESITES(ch_gtf)
6085
ch_versions = ch_versions.mix(HISAT2_EXTRACTSPLICESITES.out.versions)
86+
ch_hisat2_splice_sites = HISAT2_EXTRACTSPLICESITES.out.txt
6187

6288
HISAT2_BUILD(ch_fasta, ch_gtf, HISAT2_EXTRACTSPLICESITES.out.txt)
6389
ch_versions = ch_versions.mix(HISAT2_BUILD.out.versions)
90+
ch_hisat2 = HISAT2_BUILD.out.index
91+
}
92+
else {
93+
ch_hisat2 = Channel.empty()
6494
}
6595

66-
if (!params.star && detection_tools.intersect(['circexplorer2', 'circrna_finder', 'dcc', 'mapsplice']).size() > 0) {
96+
if (params.star) {
97+
ch_star = Channel.value([[id: "star"], file(params.star, checkIfExists: true)])
98+
}
99+
else if (detection_tools.intersect(['circexplorer2', 'circrna_finder', 'dcc', 'mapsplice']).size() > 0) {
67100
STAR_GENOMEGENERATE(ch_fasta, ch_gtf)
68101
ch_versions = ch_versions.mix(STAR_GENOMEGENERATE.out.versions)
102+
ch_star = STAR_GENOMEGENERATE.out.index
103+
}
104+
else {
105+
ch_star = Channel.empty()
69106
}
70107

71108
SAMTOOLS_FAIDX(ch_fasta, [[], []])
@@ -81,13 +118,13 @@ workflow PREPARE_GENOME {
81118
emit:
82119
gtf = ch_gtf
83120
faidx = SAMTOOLS_FAIDX.out.fai
84-
bowtie = params.bowtie ?: BOWTIE_BUILD.out.index
85-
bowtie2 = params.bowtie2 ? Channel.value([[id: "bowtie2"], file(params.bowtie2, checkIfExists: true)]) : BOWTIE2_BUILD.out.index.collect()
86-
bwa = params.bwa ? Channel.value([[id: "bwa"], file(params.bwa, checkIfExists: true)]) : BWA_INDEX.out.index.collect()
87-
hisat2 = params.hisat2 ? Channel.value([[id: "hisat2"], file(params.hisat2, checkIfExists: true)]) : HISAT2_BUILD.out.index.collect()
88-
star = params.star ? Channel.value([[id: "star"], file(params.star, checkIfExists: true)]) : STAR_GENOMEGENERATE.out.index.collect()
121+
bowtie = ch_bowtie
122+
bowtie2 = ch_bowtie2
123+
bwa = ch_bwa
124+
hisat2 = ch_hisat2
125+
star = ch_star
89126
circexplorer2 = ch_circexplorer2_reference
90127
chromosomes = SEQKIT_SPLIT.out.split
91-
splice_sites = HISAT2_EXTRACTSPLICESITES.out.txt.collect()
128+
splice_sites = ch_hisat2_splice_sites.collect()
92129
versions = ch_versions
93130
}

0 commit comments

Comments
 (0)