-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathblast.nf
39 lines (33 loc) · 902 Bytes
/
blast.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
nextflow.enable.dsl=2
params.query = "$HOME/sample.fa"
params.db = "$HOME/tools/blast-db/NR"
params.out = "out.blastn"
params.chunkSize = 200
params.format = "6"
params.blast = "blastp"
params.evalue = "0.0001"
// Validate inputs
db_name = file(params.db).name
db_path = file(params.db).parent
Channel
.fromPath(params.query)
.splitFasta(by: params.chunkSize)
.set { fasta }
/*
* Executes a exonerate job for each chunk emitted by the 'fasta' channel
* and creates as output a channel named 'top_hits' emitting the resulting
* BLAST matches
*/
process blast {
input:
file 'query.fa'
file db_path
output:
file 'blast.txt'
"""
${params.blast} -query query.fa -db $db_path/$db_name -evalue ${params.evalue} -out blast.txt -outfmt "${params.format}" -num_threads $task.cpus
"""
}
workflow {
blast (fasta, db_path).collectFile(name: "$params.out")
}