forked from robsyme/nextflow-annotate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
genemark-annotate.nf
executable file
·53 lines (41 loc) · 1.31 KB
/
genemark-annotate.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
#!/usr/bin/env nextflow
params.genome = '**/scaffolds.fasta'
(strainNames, genomes) = Channel.fromPath(params.genome).separate(2) { path -> [path.getParent().getBaseName(), path] };
nameAndSequence = strainNames.merge( genomes ) {name, file -> [name, file]}
process cleanGenome {
input:
set strainName, 'raw.fasta' from nameAndSequence
output:
set strainName, 'genome.fasta' into cleanGenome
"""
rename-fasta raw.fasta "${strainName}_scaffold" > genome.fasta
"""
}
process trainAndCallGenes {
input:
set strainName, 'genome.fasta' from cleanGenome
output:
set strainName, 'genemark.gtf', 'genome.fasta' into basicGTF
"""
gmes_petap.pl --ES --fungus --sequence genome.fasta
"""
}
process gtfToGFF3 {
input:
set strainName, 'genemark.gtf' 'genome.fasta' from basicGTF
output:
set strainName, 'out.gff3.gz' into renamedAnnotations
"""
gt gtf_to_gff3 -tidy genemark.gtf \
| gt gff3 -sort -tidy \
| rename-gff-ids $strainName > out.gff3
rename-codons $strainName genemark.gtf >> out.gff3
sort -k1,1 -k4,4n out.gff3 > tmp && mv tmp out.gff3
echo "##FASTA" >> out.gff3
awk '/^>/ {print \$0, "[${strainName}]"} !/^>/ {print \$0}' genome.fasta >> out.gff3
gzip --best out.gff3
"""
}
renamedAnnotations.subscribe { strainName, gff ->
gff.copyTo("${strainName}.gff3.gz")
}