scbi_blast 0.0.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,42 @@
1
+ <?xml version="1.0"?>
2
+ <!DOCTYPE BlastOutput PUBLIC "-//NCBI//NCBI BlastOutput/EN" "NCBI_BlastOutput.dtd">
3
+ <BlastOutput>
4
+ <BlastOutput_program>blastn</BlastOutput_program>
5
+ <BlastOutput_version>BLASTN 2.2.22+</BlastOutput_version>
6
+ <BlastOutput_reference>Stephen F. Altschul, Thomas L. Madden, Alejandro A. Sch&amp;auml;ffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), &quot;Gapped BLAST and PSI-BLAST: a new generation of protein database search programs&quot;, Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
7
+ <BlastOutput_db>../DB/formatted/mids.fasta</BlastOutput_db>
8
+ <BlastOutput_query-ID>1</BlastOutput_query-ID>
9
+ <BlastOutput_query-def>No definition line</BlastOutput_query-def>
10
+ <BlastOutput_query-len>29</BlastOutput_query-len>
11
+ <BlastOutput_param>
12
+ <Parameters>
13
+ <Parameters_expect>10</Parameters_expect>
14
+ <Parameters_sc-match>1</Parameters_sc-match>
15
+ <Parameters_sc-mismatch>-3</Parameters_sc-mismatch>
16
+ <Parameters_gap-open>5</Parameters_gap-open>
17
+ <Parameters_gap-extend>2</Parameters_gap-extend>
18
+ <Parameters_filter>L;m;</Parameters_filter>
19
+ </Parameters>
20
+ </BlastOutput_param>
21
+ <BlastOutput_iterations>
22
+ <Iteration>
23
+ <Iteration_iter-num>1</Iteration_iter-num>
24
+ <Iteration_query-ID>1</Iteration_query-ID>
25
+ <Iteration_query-def>No definition line</Iteration_query-def>
26
+ <Iteration_query-len>29</Iteration_query-len>
27
+ <Iteration_hits></Iteration_hits>
28
+ <Iteration_stat>
29
+ <Statistics>
30
+ <Statistics_db-num>24</Statistics_db-num>
31
+ <Statistics_db-len>252</Statistics_db-len>
32
+ <Statistics_hsp-len>0</Statistics_hsp-len>
33
+ <Statistics_eff-space>3168</Statistics_eff-space>
34
+ <Statistics_kappa>0.710602795216363</Statistics_kappa>
35
+ <Statistics_lambda>1.37406312246009</Statistics_lambda>
36
+ <Statistics_entropy>1.30724660390929</Statistics_entropy>
37
+ </Statistics>
38
+ </Iteration_stat>
39
+ <Iteration_message>No hits found</Iteration_message>
40
+ </Iteration>
41
+ </BlastOutput_iterations>
42
+ </BlastOutput>
@@ -0,0 +1,4 @@
1
+ require 'stringio'
2
+ require 'test/unit'
3
+ require File.dirname(__FILE__) + '/../lib/scbi_blast.rb'
4
+
@@ -0,0 +1,178 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+ require 'json'
3
+
4
+ class TestScbiBlast < Test::Unit::TestCase
5
+
6
+ def setup
7
+
8
+ end
9
+
10
+ def test_blast
11
+ blast=BatchBlast.new('-db ~/progs/ruby/DB/formatted/mids.fasta')
12
+
13
+ seqs=[">GFIJCBT03F4XVR","GACTACACGACGACCTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTNTTTTTNTTTTATTTTATTTTATTTATTATATATATATATATATATATATATATANNNNCNCACACANACACNNGAGNGNGNGNGAGNGAGNGAGTAGTAGTAGTAGTGTATATATACTACTACTACTACTACACACGACGACGTACGTACGTACGTACGTACGTACGTACGTACGTAACGTAAGTAAGTAGTAGTAGTAGTAGTAGTAGTAGTAGTAGTAGTAGTATATATATATATAGTAGTAGTAGTAGTAGTAGTAGTACGTACGTACGTACGTACGTACGTACGTACGACGACGACGACGACGACGACGACGAGATATATACTACTAACTAACTAACAACGTACGACGACGACGACGACGACGTACGTACGTACGTACGTACGTACTACTACTACTACGTACGTACGTACGTACGTACGTACGTACGTAGTAGTAGTAGTACGTACGTACGTCGTCGTCGTCGTCGTCGTCGTCGTACGTACGACGACGACGAGAGNGNGNNNNNNNNNNNN",">GFIJCBT03G3M1I","GACTACACGACGACTTTATTTATTATTTATTTATTTATTTATTTATTTATTTATTTATTTATTTTATTTTATTTTATTTTTATTTTTATTTTTATTTTTATTTTTTATTTTTTATTTTTTATTTTTTATTTTTTTATTTTTTTATTTTTTTATTTTTTTATTTTTTTTATTTTTTTTATTTTTTTTATTTTTTTTATTTTTTTTATTTTTTTTTATTTTTTTTTATTTTTTTTTAGTTTTTTTTTAGTTTTTTTTTAGTTTTTTTTTTAGTTTTTTTTTTAGTTTTTTTTTTAGTTTTTTTTTTTAGTTTTTTTTTTTAGTTTTTTTTTTTAGTTTTTTTTTTTTAGTTTTTTTTTTTTAGTTTTTTTTTTTTAGTTTTTTTTTTTTAGTTTTTTTTTTTTTAGTTTTTTTTTTTTAGTTTTTTTTTTTTTAGTTTTTTTTTTTTTAGTTTTTTTTTTTTTAGTTTTTTTTTTTTTAGTTTTTTTTTTTTTACGTTTTTTTTTTTTTAGTTTTTTTTTTTTTAGTTTTTTTTTTTTTAGTTTTTTTTTTTTTAGTTTTTTTTTTTTAGTTTTTTTTTTTTTACGTTTTTTTTTTTTACGTTTTTTTTTTTTTACGTTTTTTTTTTTTTAGTTTTTTTTTTTTTACGTTTTTTTTTTTTACGTTTTTTTTTTTTTACGTTTTTTTTTTTTAGTTTTTTTTTTTTAGTTTTTTTTTTTTACGTTTTTTTTTTTTAGTTTTTTTTTTTTACGTTTTTTTTTTTTAGTTTTTTTTTTTTACGTTTTTTTTTTTTAGTTTTTTTTTTTTAGTTTTTTTTTTTTTAGTTTTTTTTTTTTAGTTTTTTTTTTTTAGTTTTTTTTTTTTAGTTTTTTTTTTTTACGTTTTTTTTTTTTAGTTTTTTTTTTTTACGTTTTTTTTTTTTAGTTTTTTTTTTTTAGTTTTTTTTTTTTTTTTTTTNNNNNNNN"]
14
+
15
+ res=blast.do_blast(seqs)
16
+
17
+ puts res.inspect
18
+ end
19
+
20
+ def test_querys
21
+ res = BlastSimplexmlResult.new(File.join(File.dirname(__FILE__),'blast.xml'))
22
+ # puts "BLAST.XML"
23
+ # puts res.inspect
24
+ assert_equal(2,res.querys.count)
25
+ assert_equal(2,res.querys[0].hits.count)
26
+ assert_equal(2,res.querys[1].hits.count)
27
+
28
+ end
29
+
30
+ def test_hits
31
+ assert true
32
+ end
33
+
34
+ def test_empty_blast
35
+ res = BlastSimplexmlResult.new(File.join(File.dirname(__FILE__),'empty_blast.xml'))
36
+ # puts "EMPTY_BLAST.XML"
37
+ # puts res.inspect
38
+ assert_equal(1,res.querys.count)
39
+ assert_equal(0,res.querys[0].hits.count)
40
+
41
+ end
42
+
43
+ def test_empty_results
44
+ res = BlastSimplexmlResult.new('')
45
+ # puts "EMPTY_RESULTS.XML"
46
+ # puts res.inspect
47
+ assert_equal(0,res.querys.count)
48
+
49
+ end
50
+
51
+ def test_table_result_with_empty_querys
52
+ res = BlastTableResult.new(File.join(File.dirname(__FILE__),'sp_blast_result.txt'))
53
+ # puts "TABLE RESULTS.XML"
54
+ # puts res.inspect
55
+ assert_equal(4,res.querys.count)
56
+ assert_equal(0,res.querys[2].hits.count)
57
+ assert_equal('RL1',res.querys[0].hits[0].subject_id)
58
+ assert_equal('dos',res.querys[1].query_id)
59
+ assert_equal('tres',res.querys[2].query_id)
60
+ # res.querys.each do |q|
61
+ # puts q.query_id
62
+ # end
63
+
64
+
65
+ end
66
+
67
+
68
+ def test_dust
69
+ dust_masker=DustMasker.new()
70
+
71
+ seqs=[]
72
+
73
+ # seqs.push ">name"
74
+ # seqs.push 'ATATACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTAACTAACTAACTAACTAACTAACTAACTAACTAACGTAACGTAACTAACTAACGTAACTAACTAACTAACGTAACGTAACGTAACGTAACGTAACGTAACGTAACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGGTACGTACGTACGTACGTACGACGACGACGAGAGAGAGAGNGNNNactacgactacgatcgATATACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTAACTAACTAACTAACTAACTAACTAACTAACTAACGTAACGTAACTAACTAACGTAACTAACTAACTAACGTAACGTAACGTAACGTAACGTAACGTAACGTAACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGGTACGTACGTACGTACGTACGACGACGACGAGAGAGAGAGNGNNN'
75
+
76
+ seqs=[">GFIJCBT03F4XVR","GACTACACGACGACCTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTNTTTTTNTTTTATTTTATTTTATTTATTATATATATATATATATATATATATATANNNNCNCACACANACACNNGAGNGNGNGNGAGNGAGNGAGTAGTAGTAGTAGTGTATATATACTACTACTACTACTACACACGACGACGTACGTACGTACGTACGTACGTACGTACGTACGTAACGTAAGTAAGTAGTAGTAGTAGTAGTAGTAGTAGTAGTAGTAGTAGTATATATATATATAGTAGTAGTAGTAGTAGTAGTAGTACGTACGTACGTACGTACGTACGTACGTACGACGACGACGACGACGACGACGACGAGATATATACTACTAACTAACTAACAACGTACGACGACGACGACGACGACGTACGTACGTACGTACGTACGTACTACTACTACTACGTACGTACGTACGTACGTACGTACGTACGTAGTAGTAGTAGTACGTACGTACGTCGTCGTCGTCGTCGTCGTCGTCGTACGTACGACGACGACGAGAGNGNGNNNNNNNNNNNN",">GFIJCBT03G3M1I","GACTACACGACGACTTTATTTATTATTTATTTATTTATTTATTTATTTATTTATTTATTTATTTTATTTTATTTTATTTTTATTTTTATTTTTATTTTTATTTTTTATTTTTTATTTTTTATTTTTTATTTTTTTATTTTTTTATTTTTTTATTTTTTTATTTTTTTTATTTTTTTTATTTTTTTTATTTTTTTTATTTTTTTTATTTTTTTTTATTTTTTTTTATTTTTTTTTAGTTTTTTTTTAGTTTTTTTTTAGTTTTTTTTTTAGTTTTTTTTTTAGTTTTTTTTTTAGTTTTTTTTTTTAGTTTTTTTTTTTAGTTTTTTTTTTTAGTTTTTTTTTTTTAGTTTTTTTTTTTTAGTTTTTTTTTTTTAGTTTTTTTTTTTTAGTTTTTTTTTTTTTAGTTTTTTTTTTTTAGTTTTTTTTTTTTTAGTTTTTTTTTTTTTAGTTTTTTTTTTTTTAGTTTTTTTTTTTTTAGTTTTTTTTTTTTTACGTTTTTTTTTTTTTAGTTTTTTTTTTTTTAGTTTTTTTTTTTTTAGTTTTTTTTTTTTTAGTTTTTTTTTTTTAGTTTTTTTTTTTTTACGTTTTTTTTTTTTACGTTTTTTTTTTTTTACGTTTTTTTTTTTTTAGTTTTTTTTTTTTTACGTTTTTTTTTTTTACGTTTTTTTTTTTTTACGTTTTTTTTTTTTAGTTTTTTTTTTTTAGTTTTTTTTTTTTACGTTTTTTTTTTTTAGTTTTTTTTTTTTACGTTTTTTTTTTTTAGTTTTTTTTTTTTACGTTTTTTTTTTTTAGTTTTTTTTTTTTAGTTTTTTTTTTTTTAGTTTTTTTTTTTTAGTTTTTTTTTTTTAGTTTTTTTTTTTTAGTTTTTTTTTTTTACGTTTTTTTTTTTTAGTTTTTTTTTTTTACGTTTTTTTTTTTTAGTTTTTTTTTTTTAGTTTTTTTTTTTTTTTTTTTNNNNNNNN"]
77
+
78
+ res = dust_masker.do_dust(seqs.join("\n"))
79
+ # puts res.to_json
80
+ assert_equal(res.count,2)
81
+ assert_equal(res[0].dust.count,4)
82
+ assert_equal(res[0].query_id,'GFIJCBT03F4XVR')
83
+
84
+ assert_equal(res[0].dust[0][0],15)
85
+ assert_equal(res[0].dust[0][1],99)
86
+ assert_equal(res[0].dust[1][0],118)
87
+ assert_equal(res[0].dust[1][1],139)
88
+
89
+
90
+ assert_equal(res[1].dust[0][0],14)
91
+ assert_equal(res[1].dust[0][1],961)
92
+
93
+
94
+ end
95
+
96
+ def test_dust_partial_ok
97
+ dust_masker=DustMasker.new()
98
+
99
+ seqs=[]
100
+
101
+ # seqs.push ">name"
102
+ # seqs.push 'ATATACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTAACTAACTAACTAACTAACTAACTAACTAACTAACGTAACGTAACTAACTAACGTAACTAACTAACTAACGTAACGTAACGTAACGTAACGTAACGTAACGTAACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGGTACGTACGTACGTACGTACGACGACGACGAGAGAGAGAGNGNNNactacgactacgatcgATATACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTACTAACTAACTAACTAACTAACTAACTAACTAACTAACGTAACGTAACTAACTAACGTAACTAACTAACTAACGTAACGTAACGTAACGTAACGTAACGTAACGTAACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGGTACGTACGTACGTACGTACGACGACGACGAGAGAGAGAGNGNNN'
103
+
104
+ seqs=">GFIJCBT03G3M1I"
105
+
106
+ res = dust_masker.do_dust(seqs)
107
+ # puts res.to_json
108
+ # assert_equal(res.count,2)
109
+ # assert_equal(res[0].dust.count,4)
110
+ # assert_equal(res[0].query_id,'GFIJCBT03F4XVR')
111
+ #
112
+ # assert_equal(res[0].dust[0][0],15)
113
+ # assert_equal(res[0].dust[0][1],99)
114
+ # assert_equal(res[0].dust[1][0],118)
115
+ # assert_equal(res[0].dust[1][1],139)
116
+ #
117
+ #
118
+ # assert_equal(res[1].dust[0][0],14)
119
+ # assert_equal(res[1].dust[0][1],961)
120
+
121
+
122
+ end
123
+
124
+
125
+ def test_no_dust
126
+ dust_masker=DustMasker.new()
127
+ seqs=[]
128
+
129
+ seqs.push ">name"
130
+ seqs.push 'actggtacgacgtacaccagtactacgatcgtacgtacggatcgatcgatcgttagtgtacgtacgttgtacgtactgac'
131
+
132
+ res = dust_masker.do_dust(seqs.join("\n"))
133
+ assert_equal(res.count,1)
134
+ assert_equal(res[0].query_id,'name')
135
+ assert_equal(res[0].dust.count,0)
136
+
137
+ end
138
+
139
+ def test_empty_dust
140
+ dust_masker=DustMasker.new()
141
+ seqs=[]
142
+
143
+ # seqs.push ">name"
144
+ # seqs.push 'actggtacgacgtacaccagtactacgatcgtacgtacggatcgatcgatcgttagtgtacgtacgttgtacgtactgac'
145
+
146
+ res = dust_masker.do_dust(seqs.join("\n"))
147
+ assert_equal(res.count,0)
148
+
149
+ res = dust_masker.do_dust(nil)
150
+ assert_equal(res.count,0)
151
+
152
+
153
+ end
154
+
155
+ def test_dust_fail
156
+ dust_masker=DustMasker.new()
157
+ # seqs=[]
158
+ # seqs.push ">name"
159
+ # seqs.push 'actggtacgacgtacaccagtactacgatcgtacgtacggatcgatcgatcgttagtgtacgtacgttgtacgtactgac'
160
+
161
+ res = dust_masker.do_dust(">name")
162
+ assert_equal(res.count,0)
163
+
164
+ end
165
+
166
+ def test_dust_bad_fasta
167
+ dust_masker=DustMasker.new()
168
+ # seqs=[]
169
+ # seqs.push ">name"
170
+ # seqs.push 'actggtacgacgtacaccagtactacgatcgtacgtacggatcgatcgatcgttagtgtacgtacgttgtacgtactgac'
171
+
172
+ assert_raise(RuntimeError) {
173
+ res = dust_masker.do_dust("name")
174
+ }
175
+
176
+ end
177
+
178
+ end
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: scbi_blast
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.30
6
+ platform: ruby
7
+ authors:
8
+ - Dario Guerrero & Almudena Bocinos
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-04-26 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: hoe
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.8.0
24
+ type: :development
25
+ version_requirements: *id001
26
+ description: FIX (describe your package)
27
+ email:
28
+ - dariogf@gmail.com, alkoke@gmail.com
29
+ executables: []
30
+
31
+ extensions: []
32
+
33
+ extra_rdoc_files:
34
+ - History.txt
35
+ - Manifest.txt
36
+ - PostInstall.txt
37
+ files:
38
+ - History.txt
39
+ - Manifest.txt
40
+ - PostInstall.txt
41
+ - README.rdoc
42
+ - Rakefile
43
+ - lib/scbi_blast.rb
44
+ - script/console
45
+ - script/destroy
46
+ - script/generate
47
+ - test/test_helper.rb
48
+ - test/test_scbi_blast.rb
49
+ - test/blast.xml
50
+ - test/empty_blast.xml
51
+ - test/blast.txt
52
+ - lib/scbi_blast/blast_hit.rb
53
+ - lib/scbi_blast/blast_query.rb
54
+ - lib/scbi_blast/blast_table_result.rb
55
+ - lib/scbi_blast/blast_xml_result.rb
56
+ - lib/scbi_blast/blast_simplexml_result.rb
57
+ - lib/scbi_blast/batch_blast.rb
58
+ - lib/scbi_blast/dust_masker.rb
59
+ homepage: http://github.com/#{github_username}/#{project_name}
60
+ licenses: []
61
+
62
+ post_install_message: PostInstall.txt
63
+ rdoc_options:
64
+ - --main
65
+ - README.rdoc
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: "0"
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: "0"
80
+ requirements: []
81
+
82
+ rubyforge_project: scbi_blast
83
+ rubygems_version: 1.7.2
84
+ signing_key:
85
+ specification_version: 3
86
+ summary: FIX (describe your package)
87
+ test_files:
88
+ - test/test_helper.rb
89
+ - test/test_scbi_blast.rb