crb-blast 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/crb-blast +1 -1
- data/crb-blast.gemspec +1 -1
- data/lib/crb-blast/crb-blast.rb +5 -0
- data/test/test_test2.rb +12 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fca3c14697b93c5e9448b78a2ede132d986fd53d
|
4
|
+
data.tar.gz: 943aa5b9c759f3ae2322cba50d161b3d6b11c8d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f8311c0fdda302afc7f017a3dc496088c5519e7b58ca19180b7c1fdc7a7032c234bb58489ab02a1034ccb6e0048d7af68740e17028fa17f221affe3879065c3
|
7
|
+
data.tar.gz: b0ab76d52d3dab09625ecf120d0246d1061d31a9b04adb7e1e739ebcf81dc4af5a8d067e6305a260db30ec47c1fd20810b52e965b65135260fdab4a7f1bf1d78
|
data/bin/crb-blast
CHANGED
data/crb-blast.gemspec
CHANGED
data/lib/crb-blast/crb-blast.rb
CHANGED
@@ -220,6 +220,7 @@ module CRB_Blast
|
|
220
220
|
if !File.exist?(@output1)
|
221
221
|
blasts=[]
|
222
222
|
files = split_input(@query, threads)
|
223
|
+
threads = [threads, files.length].min
|
223
224
|
files.threach(threads) do |thread|
|
224
225
|
cmd1 = "#{bin1} -query #{thread} -db #{@working_dir}/#{@target_name} "
|
225
226
|
cmd1 << " -out #{thread}.blast -evalue #{evalue} "
|
@@ -254,6 +255,7 @@ module CRB_Blast
|
|
254
255
|
if !File.exist?(@output2)
|
255
256
|
blasts=[]
|
256
257
|
files = split_input(@target, threads)
|
258
|
+
threads = [threads, files.length].min
|
257
259
|
files.threach(threads) do |thread|
|
258
260
|
cmd2 = "#{bin2} -query #{thread} -db #{@working_dir}/#{@query_name} "
|
259
261
|
cmd2 << " -out #{thread}.blast -evalue #{evalue} "
|
@@ -295,8 +297,10 @@ module CRB_Blast
|
|
295
297
|
input = {}
|
296
298
|
name = nil
|
297
299
|
seq=""
|
300
|
+
sequences=0
|
298
301
|
File.open(filename).each_line do |line|
|
299
302
|
if line =~ /^>(.*)$/
|
303
|
+
sequences+=1
|
300
304
|
if name
|
301
305
|
input[name]=seq
|
302
306
|
seq=""
|
@@ -310,6 +314,7 @@ module CRB_Blast
|
|
310
314
|
# construct list of output file handles
|
311
315
|
outputs=[]
|
312
316
|
output_files=[]
|
317
|
+
pieces = [pieces, sequences].min
|
313
318
|
pieces.times do |n|
|
314
319
|
outfile = "#{filename}_chunk_#{n}.fasta"
|
315
320
|
outfile = File.expand_path(outfile)
|
data/test/test_test2.rb
CHANGED
@@ -43,6 +43,18 @@ class Test2CRBBlast < Test::Unit::TestCase
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
+
should 'break input file into no more pieces than there are sequences' do
|
47
|
+
files = @blaster.split_input('test/query.fasta', 16)
|
48
|
+
assert_equal 11, files.size
|
49
|
+
files.each do |file|
|
50
|
+
assert File.exist?(file)
|
51
|
+
end
|
52
|
+
# little teardown
|
53
|
+
files.each do |file|
|
54
|
+
File.delete(file)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
46
58
|
should 'run blast should check if the databases exist yet' do
|
47
59
|
tmp = CRB_Blast::CRB_Blast.new('test/query2.fasta',
|
48
60
|
'test/target2.fasta')
|