crb-blast 0.5.0 → 0.6.3.b

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: f89145eb1bb4b80cc97d2e31ea2c3ea0607c0e97
4
- data.tar.gz: 7b4e48dc974fbec26342d47ddb5080d4b51b2aee
3
+ metadata.gz: bf6e729c7f540f1aa50dbc880c9d605325dc6e07
4
+ data.tar.gz: db98e708ebb7412c63753038d6a32b62d68972d3
5
5
  SHA512:
6
- metadata.gz: 73ff1b0f0598d988db1b2cea4cb825195ba895c083db6bdc101fc42c178935ae37a7699f08925c471e48d65b4ea59d03f852bb0bd8fe26db8f7dec2cf85abc25
7
- data.tar.gz: 08676fab1f78f3e2db3196283c1ff6f467f3af5d0d9112901f5c8b959639a4e6b6035d2673abd258ab77219821a69e0e2f51aaffd1ad4c119ccb931b095b96d7
6
+ metadata.gz: 26a19961c0f8c6c702b339933a3a807eddc44ff14c10bd2824918cab6c2b8f22fa244eddbe8c70f4053613e3cd16fb16ec17692c2398d998bb83b10da2b2de89
7
+ data.tar.gz: 19e35ef6a261214882c42200ecb0800d7eb86d39d9cb6e58165d5c07bc630e067abfade70d4b4e3eca9052357ff4fb91a591075b7f16c0d960245ab3fa82e39e
@@ -4,7 +4,7 @@ require File.expand_path('../lib/crb-blast/version', __FILE__)
4
4
  Gem::Specification.new do |gem|
5
5
  gem.name = 'crb-blast'
6
6
  gem.version = CRB_Blast::VERSION::STRING.dup
7
- gem.date = '2014-12-07'
7
+ gem.date = '2015-05-19'
8
8
  gem.summary = "Run conditional reciprocal best blast"
9
9
  gem.description = "See summary"
10
10
  gem.authors = ["Chris Boursnell", "Richard Smith-Unna"]
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
19
19
  gem.add_dependency 'bio', '~> 1.4', '>= 1.4.3'
20
20
  gem.add_dependency 'fixwhich', '~> 1.0', '>= 1.0.2'
21
21
  gem.add_dependency 'threach', '~> 0.2', '>= 0.2.0'
22
- gem.add_dependency 'bindeps', '~> 1.0', '>= 1.0.1'
22
+ gem.add_dependency 'bindeps', '~> 1.0', '>= 1.0.3'
23
23
 
24
24
  gem.add_development_dependency 'rake', '~> 10.3', '>= 10.3.2'
25
25
  gem.add_development_dependency 'turn', '~> 0.9', '>= 0.9.7'
@@ -228,6 +228,12 @@ module CRB_Blast
228
228
  cmd1 = "#{bin1} -query #{thread} -db #{@working_dir}/#{@target_name} "
229
229
  cmd1 << " -out #{thread}.blast -evalue #{evalue} "
230
230
  cmd1 << " -outfmt \"6 std qlen slen\" "
231
+ if bin1=~/blastn/
232
+ cmd1 << " -dust no "
233
+ elsif bin1=~/blastx/ or bin1=~/blastp/ or bin1=~/tblastn/
234
+ cmd1 << " -seg no "
235
+ end
236
+ cmd1 << " -soft_masking false "
231
237
  cmd1 << " -max_target_seqs 50 "
232
238
  cmd1 << " -num_threads 1"
233
239
  if !File.exists?("#{thread}.blast")
@@ -357,14 +363,14 @@ module CRB_Blast
357
363
  if File.exists?("#{@output1}") and File.exists?("#{@output2}")
358
364
  File.open("#{@output1}").each_line do |line|
359
365
  cols = line.chomp.split("\t")
360
- hit = Hit.new(cols)
366
+ hit = Hit.new(cols, @query_is_prot, @target_is_prot)
361
367
  @query_results[hit.query] = [] if !@query_results.has_key?(hit.query)
362
368
  @query_results[hit.query] << hit
363
369
  q_count += 1
364
370
  end
365
371
  File.open("#{@output2}").each_line do |line|
366
372
  cols = line.chomp.split("\t")
367
- hit = Hit.new(cols)
373
+ hit = Hit.new(cols, @target_is_prot, @query_is_prot)
368
374
  @target_results[hit.query] = [] if !@target_results.has_key?(hit.query)
369
375
  @target_results[hit.query] << hit
370
376
  t_count += 1
@@ -396,9 +402,7 @@ module CRB_Blast
396
402
  e = target_hit.evalue.to_f
397
403
  e = 1e-200 if e==0
398
404
  e = -Math.log10(e)
399
- if !@reciprocals.key?(query_id)
400
- @reciprocals[query_id] = []
401
- end
405
+ @reciprocals[query_id] ||= []
402
406
  @reciprocals[query_id] << target_hit
403
407
  hits += 1
404
408
  @longest = target_hit.alnlen if target_hit.alnlen > @longest
@@ -461,11 +465,11 @@ module CRB_Blast
461
465
  if e >= fitting[l]
462
466
  if !@reciprocals.key?(id)
463
467
  @reciprocals[id] = []
464
- found=false
468
+ found = false
465
469
  @reciprocals[id].each do |existing_hit|
466
470
  if existing_hit.query == hit.query &&
467
471
  existing_hit.target == hit.target
468
- found=true
472
+ found = true
469
473
  end
470
474
  end
471
475
  if !found
@@ -488,6 +492,22 @@ module CRB_Blast
488
492
  @target_results = nil
489
493
  end
490
494
 
495
+ # delete blast database files
496
+ def tidy_up
497
+ Dir["*nin"].each do |file|
498
+ File.delete(file)
499
+ end
500
+ Dir["*nhr"].each do |file|
501
+ File.delete(file)
502
+ end
503
+ Dir["*nsq"].each do |file|
504
+ File.delete(file)
505
+ end
506
+ Dir["*blast"].each do |file|
507
+ File.delete(file)
508
+ end
509
+ end
510
+
491
511
  def run evalue=1e-5, threads=1, split=true
492
512
  makedb
493
513
  run_blast evalue, threads, split
@@ -4,10 +4,10 @@ module CRB_Blast
4
4
  # Fields: query id, subject id, % identity, alignment length, mismatches,
5
5
  # gap opens, q. start, q. end, s. start, s. end, evalue, bit score
6
6
  attr_accessor :query, :target, :id, :alnlen, :mismatches, :gaps, :qstart,
7
- :qend, :tstart, :tend, :evalue, :bitscore, :qlen, :tlen
7
+ :qend, :tstart, :tend, :evalue, :bitscore, :qlen, :tlen, :qprot, :tprot
8
8
 
9
- def initialize(list)
10
- raise(RuntimeError, "unexpected number of columns") unless list.length==14
9
+ def initialize(list, qprot, tprot)
10
+ raise(RuntimeError, "unexpected number of columns") if list.length < 14
11
11
  @query = list[0].split(/[\|\ ]/).first
12
12
  @target = list[1].split(/[\|\ ]/).first
13
13
  @id = list[2]
@@ -22,11 +22,13 @@ module CRB_Blast
22
22
  @bitscore = list[11].to_f
23
23
  @qlen = list[12].to_f
24
24
  @tlen = list[13].to_f
25
+ @qprot = qprot # bool
26
+ @tprot = tprot # bool
25
27
  end
26
28
 
27
29
  def to_s
28
30
  s = "#{@query}\t#{@target}\t#{@id}\t#{@alnlen}\t#{@evalue}\t#{@bitscore}\t"
29
- s << "#{@qstart}..#{@qend}\t#{@tstart}..#{@tend}"
31
+ s << "#{@qstart}..#{@qend}\t#{@tstart}..#{@tend}\t#{@qlen}\t#{@tlen}"
30
32
  return s
31
33
  end
32
34
  end
@@ -2,11 +2,11 @@ module CRB_Blast
2
2
 
3
3
  module VERSION
4
4
  MAJOR = 0
5
- MINOR = 5
6
- PATCH = 0
7
- BUILD = nil
5
+ MINOR = 6
6
+ PATCH = 3
7
+ BUILD = 'b'
8
8
 
9
9
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
10
10
  end
11
11
 
12
- end
12
+ end
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.5.0
4
+ version: 0.6.3.b
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Boursnell
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-12-07 00:00:00.000000000 Z
12
+ date: 2015-05-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: trollop
@@ -94,7 +94,7 @@ dependencies:
94
94
  version: '1.0'
95
95
  - - ">="
96
96
  - !ruby/object:Gem::Version
97
- version: 1.0.1
97
+ version: 1.0.3
98
98
  type: :runtime
99
99
  prerelease: false
100
100
  version_requirements: !ruby/object:Gem::Requirement
@@ -104,7 +104,7 @@ dependencies:
104
104
  version: '1.0'
105
105
  - - ">="
106
106
  - !ruby/object:Gem::Version
107
- version: 1.0.1
107
+ version: 1.0.3
108
108
  - !ruby/object:Gem::Dependency
109
109
  name: rake
110
110
  requirement: !ruby/object:Gem::Requirement
@@ -242,9 +242,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
242
242
  version: '0'
243
243
  required_rubygems_version: !ruby/object:Gem::Requirement
244
244
  requirements:
245
- - - ">="
245
+ - - ">"
246
246
  - !ruby/object:Gem::Version
247
- version: '0'
247
+ version: 1.3.1
248
248
  requirements: []
249
249
  rubyforge_project:
250
250
  rubygems_version: 2.2.2