-
Notifications
You must be signed in to change notification settings - Fork 2
/
blast-parallel-dsl2.nf
62 lines (48 loc) · 1.08 KB
/
blast-parallel-dsl2.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
#!/usr/bin/env nextflow
params.db = "$baseDir/blast-db/tiny"
params.query = "$baseDir/data/sample.fa"
params.chunk = 1
db = file(params.db)
/*
* Extends a BLAST query for each entry in the 'chunks' channel
*/
process blast {
input:
path 'query.fa'
output:
path top_hits
"""
blastp -db ${db} -query query.fa -outfmt 6 > blast_result
cat blast_result | head -n 10 | cut -f 2 > top_hits
"""
}
/*
* Find out the top 10 matches returned by the BLAST query
*/
process extract {
input:
path top_hits
output:
path 'sequences'
"blastdbcmd -db ${db} -entry_batch top_hits | head -n 10 > sequences"
}
/*
* Aligns a T-Coffee MSA and print it
*/
process align {
debug true
input:
path all_seq
"t_coffee $all_seq 2>/dev/null | tee align_result"
}
/*
* main flow
*/
workflow {
Channel.fromPath(params.query) |
splitFasta(by: params.chunk, file:true) |
blast |
extract |
collectFile(name:'all_seq') | // Collect all hits to a single file called 'all_seq'
align
}