-
Notifications
You must be signed in to change notification settings - Fork 0
/
processes.nf
85 lines (68 loc) · 1.65 KB
/
processes.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
params.outdir = "results/"
process findSequences {
input:
path pyscript
path pred_file
val feature_id
output:
path "seq_ranges_*.txt", emit: ranges
script:
suffix = "seq_ranges_${pred_file.getFileName()}"
"""
python3 ${pyscript} ${pred_file} ${suffix} ${feature_id}
"""
}
process extractSequences {
input:
path pyscript
path ranges
path fasta
output:
path "seqs_*.fa"
script:
outname = "seqs_${ranges.getFileName()}".split('\\.')[0] + "__" + "${fasta.getFileName()}".split('\\.')[0] + ".fa"
"""
python3 ${pyscript} ${ranges} ${fasta} ${outname}
"""
}
process findAndExtractPair {
input:
path findscript
path extrscript
tuple val(id) path(predFile) path(fastaFile)
val featureID
output:
path "seqs_pair_*.fa"
script:
outname = "seqs_pair_${predFile.getFileName().toString().split("\\.")[0]}_${fastaFile.getFileName().toString().split("\\.")[0]}.fa"
"""
python3 ${findscript} ${predFile} seqs.txt ${featureID}
python3 ${extrscript} seqs.txt ${fastaFile} ${outname}
"""
}
process countKmers {
input:
path pyscript
path seqs
val kmer
output:
path "seq_kmers_*.txt"
script:
"""
#!/usr/bin/env bash
python3 ${pyscript} ${seqs} "seq_kmers_${seqs.getFileName().toString().split("\\.")[0]}.txt" ${kmer}
"""
}
process sumKmers {
publishDir params.outdir, mode: "move", overwrite: false
input:
path pyscript
path kmers
output:
path "total_kmers.txt"
script:
"""
#!/usr/bin/env bash
python3 ${pyscript} ${kmers} total_kmers.txt
"""
}