scbi_blast 0.0.30 → 0.0.31
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -0
- data/Manifest.txt +1 -1
- data/README.rdoc +76 -8
- data/lib/scbi_blast/batch_blast.rb +101 -85
- data/lib/scbi_blast/blast_hit.rb +70 -57
- data/lib/scbi_blast/blast_query.rb +44 -17
- data/lib/scbi_blast/blast_simplexml_result.rb +28 -14
- data/lib/scbi_blast/blast_table_result.rb +164 -149
- data/lib/scbi_blast/blast_xml_result.rb +105 -94
- data/lib/scbi_blast/dust_masker.rb +59 -44
- data/lib/scbi_blast.rb +23 -1
- metadata +7 -5
@@ -1,103 +1,118 @@
|
|
1
|
-
|
1
|
+
# Copyright (c) 2010 Dario Guerrero & Almudena Bocinos
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# 'Software'), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
17
|
+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
18
|
+
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
19
|
+
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
20
|
+
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
|
23
|
+
# DustQuery class
|
2
24
|
class DustQuery
|
3
|
-
|
25
|
+
|
4
26
|
attr_accessor :query_id,:dust
|
5
|
-
|
27
|
+
|
6
28
|
def initialize(query_id)
|
7
29
|
@dust=[]
|
8
30
|
@query_id = query_id
|
9
31
|
end
|
10
|
-
|
32
|
+
|
11
33
|
def push(interval)
|
12
34
|
@dust.push interval
|
13
35
|
end
|
14
|
-
|
36
|
+
|
15
37
|
def inspect
|
16
38
|
res= "Query #{query_id}:"
|
17
39
|
@dust.each do |d|
|
18
40
|
res += " from #{d[0]} to #{d[1]}"
|
19
41
|
end
|
20
42
|
end
|
21
|
-
|
43
|
+
|
22
44
|
end
|
23
45
|
|
46
|
+
# DustMasker launcher class
|
24
47
|
class DustMasker
|
25
48
|
|
26
|
-
|
49
|
+
# initializator
|
50
|
+
def initialize(extra_params = '')
|
27
51
|
|
28
|
-
|
52
|
+
@format = 'interval'
|
29
53
|
@extra_params=extra_params
|
30
|
-
|
31
|
-
end
|
32
54
|
|
33
|
-
|
55
|
+
end
|
56
|
+
|
57
|
+
# returns command to be executed
|
58
|
+
def get_cmd(extra_params = '')
|
34
59
|
|
35
60
|
cmd = 'dustmasker '+@extra_params + '-outfmt '+ @format + ' 2>/dev/null'
|
36
61
|
return cmd
|
37
62
|
|
38
|
-
end
|
63
|
+
end
|
39
64
|
|
40
|
-
|
65
|
+
# do the processing with dustmasker to a set of sequences in fasta stored in a string
|
66
|
+
def do_dust(seq_fasta)
|
41
67
|
intervals=[]
|
42
|
-
|
68
|
+
|
43
69
|
if !seq_fasta.nil? && !seq_fasta.empty?
|
44
|
-
|
70
|
+
|
45
71
|
if seq_fasta.is_a?(Array)
|
46
72
|
seq_fasta=seq_fasta.join("\n")
|
47
73
|
end
|
48
|
-
|
74
|
+
|
49
75
|
cmd = get_cmd(@extra_params)
|
50
76
|
if !seq_fasta.index('>')
|
51
77
|
raise "Data passed to dust must be in fasta format"
|
52
78
|
end
|
53
79
|
|
54
80
|
# puts seq_fasta
|
55
|
-
|
81
|
+
res=''
|
56
82
|
|
57
|
-
# Ojo, que una vez nos ibamos a volver locos buscando porque esto no devolvia todos los hits que se encontraban al ejecutar el blast a mano, y era porque en el blast a mano le estabamos pasando la secuencia completa mientras que en el MID le estabamos pasando
|
83
|
+
# Ojo, que una vez nos ibamos a volver locos buscando porque esto no devolvia todos los hits que se encontraban al ejecutar el blast a mano, y era porque en el blast a mano le estabamos pasando la secuencia completa mientras que en el MID le estabamos pasando solo los 20 primeros nt.
|
58
84
|
IO.popen(cmd,'w+') {|blast|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
85
|
+
blast.sync = true
|
86
|
+
# blast.write(">seq\n")
|
87
|
+
blast.write(seq_fasta)
|
88
|
+
blast.close_write
|
89
|
+
res = blast.readlines
|
90
|
+
blast.close_read
|
65
91
|
}
|
66
|
-
|
92
|
+
|
67
93
|
if !$?.exitstatus.nil? && $?.exitstatus>0
|
68
94
|
raise "Error while doing #{cmd} to seq: #{seq_fasta}"
|
69
95
|
end
|
70
|
-
|
71
|
-
# puts $?.class
|
72
|
-
# puts res
|
73
|
-
#parse results
|
74
|
-
|
75
|
-
# >seq
|
76
|
-
# 3 - 346
|
77
|
-
# 354 - 683
|
78
|
-
# .
|
79
|
-
|
96
|
+
|
80
97
|
|
81
98
|
res.each do |line|
|
82
99
|
# puts "LINEA:" + line
|
83
|
-
if line =~ /^>(.*)$/
|
100
|
+
if line =~ /^>(.*)$/
|
84
101
|
intervals.push DustQuery.new($1)
|
85
102
|
elsif line =~ /^(\d+)\s\-\s(\d+)/
|
86
103
|
# puts "Algo #{$1}, #{$2}"
|
87
104
|
intervals.last.push [$1.to_i,$2.to_i]
|
88
105
|
end
|
89
|
-
|
106
|
+
|
90
107
|
end
|
91
108
|
end
|
92
|
-
|
93
|
-
return intervals
|
94
109
|
|
95
|
-
|
110
|
+
return intervals
|
96
111
|
|
97
|
-
|
98
|
-
|
99
|
-
end
|
112
|
+
end
|
100
113
|
|
101
|
-
|
114
|
+
def close
|
102
115
|
|
116
|
+
end
|
103
117
|
|
118
|
+
end
|
data/lib/scbi_blast.rb
CHANGED
@@ -1,3 +1,25 @@
|
|
1
|
+
# Copyright (c) 2010 Dario Guerrero & Almudena Bocinos
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# 'Software'), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
17
|
+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
18
|
+
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
19
|
+
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
20
|
+
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
|
1
23
|
$: << File.join(File.dirname(__FILE__),File.basename(__FILE__,File.extname(__FILE__)))
|
2
24
|
|
3
25
|
require 'batch_blast'
|
@@ -9,7 +31,7 @@ require 'blast_hit'
|
|
9
31
|
require 'blast_table_result'
|
10
32
|
|
11
33
|
module ScbiBlast
|
12
|
-
VERSION = '0.0.
|
34
|
+
VERSION = '0.0.31'
|
13
35
|
end
|
14
36
|
|
15
37
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: scbi_blast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.31
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Dario Guerrero & Almudena Bocinos
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-04-
|
13
|
+
date: 2011-04-28 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: hoe
|
@@ -23,7 +23,9 @@ dependencies:
|
|
23
23
|
version: 2.8.0
|
24
24
|
type: :development
|
25
25
|
version_requirements: *id001
|
26
|
-
description:
|
26
|
+
description: |-
|
27
|
+
scbi_blast is a ruby gem to handle blast+ executions without the need of temporary files,
|
28
|
+
it has been developed at [SCBI](http://www.scbi.uma.es) by Almudena Bocinos & Dario Guerrero.
|
27
29
|
email:
|
28
30
|
- dariogf@gmail.com, alkoke@gmail.com
|
29
31
|
executables: []
|
@@ -56,7 +58,7 @@ files:
|
|
56
58
|
- lib/scbi_blast/blast_simplexml_result.rb
|
57
59
|
- lib/scbi_blast/batch_blast.rb
|
58
60
|
- lib/scbi_blast/dust_masker.rb
|
59
|
-
homepage: http://
|
61
|
+
homepage: http://www.scbi.uma.es/downloads
|
60
62
|
licenses: []
|
61
63
|
|
62
64
|
post_install_message: PostInstall.txt
|
@@ -83,7 +85,7 @@ rubyforge_project: scbi_blast
|
|
83
85
|
rubygems_version: 1.7.2
|
84
86
|
signing_key:
|
85
87
|
specification_version: 3
|
86
|
-
summary:
|
88
|
+
summary: scbi_blast is a ruby gem to handle blast+ executions without the need of temporary files, it has been developed at [SCBI](http://www.scbi.uma.es) by Almudena Bocinos & Dario Guerrero.
|
87
89
|
test_files:
|
88
90
|
- test/test_helper.rb
|
89
91
|
- test/test_scbi_blast.rb
|