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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e3caa1fa30a20503163a10776ba9800a13068e37
4
- data.tar.gz: 5e175e4cb4289a357b2abf22df61453c495c739b
3
+ metadata.gz: fca3c14697b93c5e9448b78a2ede132d986fd53d
4
+ data.tar.gz: 943aa5b9c759f3ae2322cba50d161b3d6b11c8d6
5
5
  SHA512:
6
- metadata.gz: e9a7283bd2359176e1f8d07a129e97473afeeccc877c99dc139ca8278a76a5504b8ddac7a399cca0b7ec5238a6e59325064380f9e23b764f8a1edf60fdcda2cf
7
- data.tar.gz: a645840bcc5d34930022404c3e7452941d3d3fa401ce1d3747434253cabc210b2dab481bbf679b93aebed7ebf735a5bb0aaf6938d407506598cb48161b1827bd
6
+ metadata.gz: 7f8311c0fdda302afc7f017a3dc496088c5519e7b58ca19180b7c1fdc7a7032c234bb58489ab02a1034ccb6e0048d7af68740e17028fa17f221affe3879065c3
7
+ data.tar.gz: b0ab76d52d3dab09625ecf120d0246d1061d31a9b04adb7e1e739ebcf81dc4af5a8d067e6305a260db30ec47c1fd20810b52e965b65135260fdab4a7f1bf1d78
data/bin/crb-blast CHANGED
@@ -11,7 +11,7 @@ require 'bindeps'
11
11
  opts = Trollop::options do
12
12
  banner <<-EOS
13
13
 
14
- CRB-Blast v0.3.2 by Chris Boursnell <cmb211@cam.ac.uk>
14
+ CRB-Blast v0.4.2 by Chris Boursnell <cmb211@cam.ac.uk>
15
15
 
16
16
  Conditional Reciprocal Best BLAST
17
17
 
data/crb-blast.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'crb-blast'
3
- gem.version = '0.4.1'
3
+ gem.version = '0.4.2'
4
4
  gem.date = '2014-07-23'
5
5
  gem.summary = "Run conditional reciprocal best blast"
6
6
  gem.description = "See summary"
@@ -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')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crb-blast
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Boursnell