-
Notifications
You must be signed in to change notification settings - Fork 5
/
blastLocalAllVsAll
executable file
·47 lines (42 loc) · 1.23 KB
/
blastLocalAllVsAll
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
#!/usr/bin/env ruby
require 'ostruct'
require 'optparse'
opt = OpenStruct.new
opt.btab = false
opt.evalue = 1e-9
opt.maxHits = 50
$VERBOSE = nil
opt.blast = "blastp"
ARGV.options {|opts|
opts.banner << " fasta [fasta...fasta...]"
begin
opts.on("-b ", "--blast ", String,
"blast to use (default #{opt.blast})") {|t| opt.blast = t}
opts.on("-e", "--evalue ", Float,
"set BLASTP evalue (default #{opt.evalue})") {|t| opt.evalue = t}
opts.on("-m ", "--maxHits ", Integer,
"max number of BLAST hits (default #{opt.maxHits})") {|t| opt.maxHits = t}
opts.on("-x", "--btab", "run btab (default #{opt.btab})") {|t| opt.btab = t}
opts.parse!
rescue
STDERR.puts $!.message
STDERR.puts opts
exit(1)
end
if (ARGV.size < 1)
STDERR.puts opts
exit(1)
end
}
ARGV.each {|pep1|
ARGV.each {|pep2|
if (pep1 != pep2)
if (Dir.glob("#{pep2}_vs_#{pep1}*").empty?)
system("blastall -p #{opt.blast} -e #{opt.evalue} -b #{opt.maxHits} -v #{opt.maxHits} -d #{pep1} -i #{pep2} > #{pep2}_vs_#{pep1}.blastp")
system("btab #{pep2}_vs_#{pep1}.blastp") if opt.btab
else
STDERR.printf("Skipping #{pep1}_vs_#{pep2} due to existing results...\n")
end
end
}
}