-
Notifications
You must be signed in to change notification settings - Fork 0
/
ncbi-blast+.nf
76 lines (64 loc) · 2.51 KB
/
ncbi-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
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
#!/usr/bin/env nextflow
/*
* Parameters for execution
*/
params.subject = ""
params.subject_type = "nucleotide"
params.query = ""
params.blast_type = ""
/*
* Read in the files
*/
subject_fasta = file(params.subject)
query_fasta = file(params.query)
/*
* Index subject file
*/
process indexReference {
publishDir "$baseDir/data/references/"
input:
file subject_fasta
output:
file "${params.subject}.*" into indices
clusterOptions = {"-l select=1:ncpus=1:mem=5gb,walltime=04:00:00"}
module 'singularity'
script:
"""
singularity run -B /scratch2 ~/singularity_containers/ncbi_blast+.simg makeblastdb -in ${subject_fasta} -dbtype ${params.subject_type} -parse_seqids
"""
}
/*
* BLAST the sequences against the database
*/
process blastSequences {
publishDir "$baseDir/results/"
input:
file "${params.subject}.*" from indices
file query_fasta
output:
file "blast_result"
clusterOptions = {"-l select=1:ncpus=2:mem=3gb,walltime=05:00:00"}
module 'singularity'
script:
// if-else so more different parameters may be added accordingly (at a later date)
if( params.blast_type == "blastn"){
"""
singularity run -B /scratch2 ~/singularity_containers/ncbi_blast+.simg blastn -db $baseDir/data/references/${params.subject} -query ${query_fasta} -evalue 1e-5 -num_threads 2 -outfmt 6 > blast_result
"""}
else if( params.blast_type == "tblastn"){
"""
singularity run -B /scratch2 ~/singularity_containers/ncbi_blast+.simg tblastn -db $baseDir/data/references/${params.subject} -query ${query_fasta} -evalue 1e-5 -num_threads 2 -outfmt 6 > blast_result
"""}
else if( params.blast_type == "blastp"){
"""
singularity run -B /scratch2 ~/singularity_containers/ncbi_blast+.simg blastp -db $baseDir/data/references/${params.subject} -query ${query_fasta} -evalue 1e-5 -num_threads 2 -outfmt 6 > blast_result
"""}
else if( params.blast_type == "blastx"){
"""
singularity run -B /scratch2 ~/singularity_containers/ncbi_blast+.simg blastx -db $baseDir/data/references/${params.subject} -query ${query_fasta} -evalue 1e-5 -num_threads 2 -outfmt 6 > blast_result
"""}
else if( params.blast_type == "tblastx"){
"""
singularity run -B /scratch2 ~/singularity_containers/ncbi_blast+.simg tblastx -db $baseDir/data/references/${params.subject} -query ${query_fasta} -evalue 1e-5 -num_threads 2 -outfmt 6 > blast_result
"""}
}