bio-blast-xmlparser 0.0.0
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.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/BSDL +22 -0
- data/COPYING +56 -0
- data/COPYING.ja +51 -0
- data/Gemfile +6 -0
- data/LEGAL +8 -0
- data/README.md +70 -0
- data/Rakefile +20 -0
- data/bio-blast-xmlparser.gemspec +30 -0
- data/lib/bio-blast-xmlparser.rb +5 -0
- data/lib/bio-blast-xmlparser/version.rb +5 -0
- data/lib/bio/appl/blast/xmlparser.rb +212 -0
- metadata +141 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 333be41963201a98ec5ccc9111a926c2a52e5319d818d1d8cc558841c6358b76
|
|
4
|
+
data.tar.gz: 374b3e83c1c510c076939a5d50afa212976f055d523dbb1d47c52a5856db0e9b
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 1d36669fb7ce725aee774f2b12c64fb887aad629350ba745ce06452fe3c90d6f4d80bb3de2870074bb6d83c728156a9b7f8d3945c76d214e38529bbd933aec36
|
|
7
|
+
data.tar.gz: b04d347147021e207cb2bfb0062de62eaa33b3643a85c99e5ed623c54716c17637c4d0225b19baf66985e6b32f67788dd2bc2ca0982f7c251949e4c4aa6fed28
|
data/.gitignore
ADDED
data/BSDL
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (C) 1993-2013 Yukihiro Matsumoto. All rights reserved.
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without
|
|
4
|
+
modification, are permitted provided that the following conditions
|
|
5
|
+
are met:
|
|
6
|
+
1. Redistributions of source code must retain the above copyright
|
|
7
|
+
notice, this list of conditions and the following disclaimer.
|
|
8
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
9
|
+
notice, this list of conditions and the following disclaimer in the
|
|
10
|
+
documentation and/or other materials provided with the distribution.
|
|
11
|
+
|
|
12
|
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
13
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
14
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
15
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
16
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
17
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
18
|
+
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
19
|
+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
20
|
+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
21
|
+
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
22
|
+
SUCH DAMAGE.
|
data/COPYING
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
bio-blast-xmlparser is copyrighted free software by BioRuby Project <staff@bioruby.org>.
|
|
2
|
+
You can redistribute it and/or modify it under either the terms of the
|
|
3
|
+
2-clause BSDL (see the file BSDL), or the conditions below:
|
|
4
|
+
|
|
5
|
+
1. You may make and give away verbatim copies of the source form of the
|
|
6
|
+
software without restriction, provided that you duplicate all of the
|
|
7
|
+
original copyright notices and associated disclaimers.
|
|
8
|
+
|
|
9
|
+
2. You may modify your copy of the software in any way, provided that
|
|
10
|
+
you do at least ONE of the following:
|
|
11
|
+
|
|
12
|
+
a) place your modifications in the Public Domain or otherwise
|
|
13
|
+
make them Freely Available, such as by posting said
|
|
14
|
+
modifications to Usenet or an equivalent medium, or by allowing
|
|
15
|
+
the author to include your modifications in the software.
|
|
16
|
+
|
|
17
|
+
b) use the modified software only within your corporation or
|
|
18
|
+
organization.
|
|
19
|
+
|
|
20
|
+
c) give non-standard binaries non-standard names, with
|
|
21
|
+
instructions on where to get the original software distribution.
|
|
22
|
+
|
|
23
|
+
d) make other distribution arrangements with the author.
|
|
24
|
+
|
|
25
|
+
3. You may distribute the software in object code or binary form,
|
|
26
|
+
provided that you do at least ONE of the following:
|
|
27
|
+
|
|
28
|
+
a) distribute the binaries and library files of the software,
|
|
29
|
+
together with instructions (in the manual page or equivalent)
|
|
30
|
+
on where to get the original distribution.
|
|
31
|
+
|
|
32
|
+
b) accompany the distribution with the machine-readable source of
|
|
33
|
+
the software.
|
|
34
|
+
|
|
35
|
+
c) give non-standard binaries non-standard names, with
|
|
36
|
+
instructions on where to get the original software distribution.
|
|
37
|
+
|
|
38
|
+
d) make other distribution arrangements with the author.
|
|
39
|
+
|
|
40
|
+
4. You may modify and include the part of the software into any other
|
|
41
|
+
software (possibly commercial). But some files in the distribution
|
|
42
|
+
are not written by the author, so that they are not under these terms.
|
|
43
|
+
|
|
44
|
+
For the list of those files and their copying conditions, see the
|
|
45
|
+
file LEGAL.
|
|
46
|
+
|
|
47
|
+
5. The scripts and library files supplied as input to or produced as
|
|
48
|
+
output from the software do not automatically fall under the
|
|
49
|
+
copyright of the software, but belong to whomever generated them,
|
|
50
|
+
and may be sold commercially, and may be aggregated with this
|
|
51
|
+
software.
|
|
52
|
+
|
|
53
|
+
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
|
54
|
+
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
|
55
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
56
|
+
PURPOSE.
|
data/COPYING.ja
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
本プログラムはフリーソフトウェアです.2-clause BSDL
|
|
2
|
+
または以下に示す条件で本プログラムを再配布できます
|
|
3
|
+
2-clause BSDLについてはBSDLファイルを参照して下さい.
|
|
4
|
+
|
|
5
|
+
1. 複製は制限なく自由です.
|
|
6
|
+
|
|
7
|
+
2. 以下の条件のいずれかを満たす時に本プログラムのソースを
|
|
8
|
+
自由に変更できます.
|
|
9
|
+
|
|
10
|
+
(a) ネットニューズにポストしたり,作者に変更を送付する
|
|
11
|
+
などの方法で,変更を公開する.
|
|
12
|
+
|
|
13
|
+
(b) 変更した本プログラムを自分の所属する組織内部だけで
|
|
14
|
+
使う.
|
|
15
|
+
|
|
16
|
+
(c) 変更点を明示したうえ,ソフトウェアの名前を変更する.
|
|
17
|
+
そのソフトウェアを配布する時には変更前の本プログラ
|
|
18
|
+
ムも同時に配布する.または変更前の本プログラムのソー
|
|
19
|
+
スの入手法を明示する.
|
|
20
|
+
|
|
21
|
+
(d) その他の変更条件を作者と合意する.
|
|
22
|
+
|
|
23
|
+
3. 以下の条件のいずれかを満たす時に本プログラムをコンパイ
|
|
24
|
+
ルしたオブジェクトコードや実行形式でも配布できます.
|
|
25
|
+
|
|
26
|
+
(a) バイナリを受け取った人がソースを入手できるように,
|
|
27
|
+
ソースの入手法を明示する.
|
|
28
|
+
|
|
29
|
+
(b) 機械可読なソースコードを添付する.
|
|
30
|
+
|
|
31
|
+
(c) 変更を行ったバイナリは名前を変更したうえ,オリジナ
|
|
32
|
+
ルのソースコードの入手法を明示する.
|
|
33
|
+
|
|
34
|
+
(d) その他の配布条件を作者と合意する.
|
|
35
|
+
|
|
36
|
+
4. 他のプログラムへの引用はいかなる目的であれ自由です.た
|
|
37
|
+
だし,本プログラムに含まれる他の作者によるコードは,そ
|
|
38
|
+
れぞれの作者の意向による制限が加えられる場合があります.
|
|
39
|
+
|
|
40
|
+
それらファイルの一覧とそれぞれの配布条件などに付いては
|
|
41
|
+
LEGALファイルを参照してください.
|
|
42
|
+
|
|
43
|
+
5. 本プログラムへの入力となるスクリプトおよび,本プログラ
|
|
44
|
+
ムからの出力の権利は本プログラムの作者ではなく,それぞ
|
|
45
|
+
れの入出力を生成した人に属します.また,本プログラムに
|
|
46
|
+
組み込まれるための拡張ライブラリについても同様です.
|
|
47
|
+
|
|
48
|
+
6. 本プログラムは無保証です.作者は本プログラムをサポート
|
|
49
|
+
する意志はありますが,プログラム自身のバグあるいは本プ
|
|
50
|
+
ログラムの実行などから発生するいかなる損害に対しても責
|
|
51
|
+
任を持ちません.
|
data/Gemfile
ADDED
data/LEGAL
ADDED
data/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# BioRuby BLAST XMLParser Plugin
|
|
2
|
+
|
|
3
|
+
[](http://travis-ci.org/bioruby/bio-blast-xmlparser)
|
|
4
|
+
|
|
5
|
+
bio-blast-xmlparser is a plugin of BioRuby, providing fast BLAST
|
|
6
|
+
XML result parser by using XMLParser native extension.
|
|
7
|
+
The code was formerly a part of the [BioRuby](http://bioruby.org/)
|
|
8
|
+
core ("bio" gem), and because of the dependency to the native XMLParser
|
|
9
|
+
extension, it was moved to this gem.
|
|
10
|
+
|
|
11
|
+
This gem is also developed as part of an effort to
|
|
12
|
+
[modularize](http://bioruby.open-bio.org/wiki/Plugins) BioRuby.
|
|
13
|
+
Many more plugins are available at [biogems.info](http://www.biogems.info/).
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## Requirements
|
|
17
|
+
|
|
18
|
+
bio-blast-xmlparser uses `xmplarser` gem that needs
|
|
19
|
+
[expat XML Parser Toolkit]{http://www.jclark.com/xml/expat.html}
|
|
20
|
+
installed on the system.
|
|
21
|
+
|
|
22
|
+
On Debian/Ubuntu:
|
|
23
|
+
|
|
24
|
+
# apt-get install libexpat-dev
|
|
25
|
+
|
|
26
|
+
On RedHat/CentOS:
|
|
27
|
+
|
|
28
|
+
# yum install expat-devel
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
Add this line to your application's Gemfile:
|
|
34
|
+
|
|
35
|
+
```ruby
|
|
36
|
+
gem 'bio-blast-xmlparser'
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
And then execute:
|
|
40
|
+
|
|
41
|
+
$ bundle
|
|
42
|
+
|
|
43
|
+
Or install it yourself as:
|
|
44
|
+
|
|
45
|
+
$ gem install bio-blast-xmlparser
|
|
46
|
+
|
|
47
|
+
## Usage
|
|
48
|
+
|
|
49
|
+
The existance of the gem is automatically detected by BioRuby core components.
|
|
50
|
+
|
|
51
|
+
## Development
|
|
52
|
+
|
|
53
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
|
54
|
+
To release a new version, update the version number in `version.rb`,
|
|
55
|
+
and then run `bundle exec rake release`, which will create a git tag
|
|
56
|
+
for the version, push git commits and tags, and push the `.gem` file
|
|
57
|
+
to [rubygems.org](https://rubygems.org).
|
|
58
|
+
|
|
59
|
+
## Contributing
|
|
60
|
+
|
|
61
|
+
Bug reports and pull requests are welcome on GitHub at
|
|
62
|
+
https://github.com/bioruby/bioruby-blast-xmlparser
|
|
63
|
+
|
|
64
|
+
## Cite
|
|
65
|
+
|
|
66
|
+
If you use this software, please cite one of
|
|
67
|
+
|
|
68
|
+
* [BioRuby: bioinformatics software for the Ruby programming language](http://dx.doi.org/10.1093/bioinformatics/btq475)
|
|
69
|
+
* [Biogem: an effective tool-based approach for scaling up open source software development in bioinformatics](http://dx.doi.org/10.1093/bioinformatics/bts080)
|
|
70
|
+
|
data/Rakefile
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require "bundler/gem_tasks"
|
|
2
|
+
require 'rdoc/task'
|
|
3
|
+
require 'rake/testtask'
|
|
4
|
+
|
|
5
|
+
task :default => :test
|
|
6
|
+
|
|
7
|
+
Rake::TestTask.new do |t|
|
|
8
|
+
t.test_files = FileList["test/**/test_*.rb"]
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
Rake::RDocTask.new do |r|
|
|
12
|
+
r.rdoc_dir = "rdoc"
|
|
13
|
+
r.rdoc_files.include("README.md",
|
|
14
|
+
"COPYING", "COPYING.ja", "BSDL", "LEGAL",
|
|
15
|
+
"lib/**/*.rb")
|
|
16
|
+
r.main = "README.md"
|
|
17
|
+
r.options << '--title' << 'BioRuby BLAST XMLParser Plugin API documentation'
|
|
18
|
+
r.options << '--line-numbers'
|
|
19
|
+
end
|
|
20
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require "bio-blast-xmlparser/version"
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "bio-blast-xmlparser"
|
|
8
|
+
spec.version = Bio::BlastXMLParser::VERSION
|
|
9
|
+
spec.authors = ["BioRuby project"]
|
|
10
|
+
spec.email = ["staff@bioruby.org"]
|
|
11
|
+
|
|
12
|
+
spec.summary = %q{BioRuby BLAST XMLParser plugin}
|
|
13
|
+
spec.description = %q{BioRuby BLAST XMLParser plugin: a plugin of BioRuby BLAST XML result parser by using the XMLParser extension. This was formerly a part of the BioRuby core ("bio" gem) and split to this gem because of the external XMLParser dependency.}
|
|
14
|
+
spec.homepage = "https://github.com/bioruby/bioruby-blast-xmlparser"
|
|
15
|
+
|
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
|
18
|
+
end
|
|
19
|
+
spec.bindir = "bin"
|
|
20
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
21
|
+
spec.require_paths = ["lib"]
|
|
22
|
+
|
|
23
|
+
spec.add_runtime_dependency "bio", ">= 2.0.0"
|
|
24
|
+
spec.add_runtime_dependency "xmlparser", "~> 0.7.2"
|
|
25
|
+
|
|
26
|
+
spec.add_development_dependency "bundler", ">= 1.15"
|
|
27
|
+
spec.add_development_dependency "rake", ">= 10.0"
|
|
28
|
+
spec.add_development_dependency "rdoc", ">= 5"
|
|
29
|
+
spec.add_development_dependency "test-unit", "~> 3"
|
|
30
|
+
end
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
#
|
|
2
|
+
# = bio/appl/blast/xmlparser.rb - BLAST XML output (-m 7) parser by XMLParser
|
|
3
|
+
#
|
|
4
|
+
# Copyright:: Copyright (C) 2001
|
|
5
|
+
# Mitsuteru C. Nakao <n@bioruby.org>
|
|
6
|
+
# Copyright:: Copyright (C) 2003
|
|
7
|
+
# Toshiaki Katayama <k@bioruby.org>
|
|
8
|
+
# License:: The Ruby License
|
|
9
|
+
#
|
|
10
|
+
# $Id:$
|
|
11
|
+
#
|
|
12
|
+
# == Description
|
|
13
|
+
#
|
|
14
|
+
# A parser for blast XML report (format 7) based on the XMLParser.
|
|
15
|
+
# This file is automatically loaded by bio/appl/blast/report.rb if
|
|
16
|
+
# the XMLParser installed.
|
|
17
|
+
#
|
|
18
|
+
# BioRuby provides two implements of the paser for the blast XML format report
|
|
19
|
+
# (format 7) based on the XMLParser and the REXML.
|
|
20
|
+
#
|
|
21
|
+
|
|
22
|
+
require 'xmlparser'
|
|
23
|
+
|
|
24
|
+
module Bio
|
|
25
|
+
class Blast
|
|
26
|
+
class Report
|
|
27
|
+
|
|
28
|
+
# Specify to use XMLParser to parse XML (-m 7) output.
|
|
29
|
+
def self.xmlparser(data)
|
|
30
|
+
self.new(data, :xmlparser)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
private
|
|
34
|
+
|
|
35
|
+
def xmlparser_parse(xml)
|
|
36
|
+
parser = XMLParser.new
|
|
37
|
+
def parser.default; end
|
|
38
|
+
|
|
39
|
+
begin
|
|
40
|
+
tag_stack = Array.new
|
|
41
|
+
hash = Hash.new
|
|
42
|
+
|
|
43
|
+
parser.parse(xml) do |type, name, data|
|
|
44
|
+
case type
|
|
45
|
+
when XMLParser::START_ELEM
|
|
46
|
+
tag_stack.push(name)
|
|
47
|
+
hash.update(data)
|
|
48
|
+
case name
|
|
49
|
+
when 'Iteration'
|
|
50
|
+
iteration = Iteration.new
|
|
51
|
+
@iterations.push(iteration)
|
|
52
|
+
when 'Hit'
|
|
53
|
+
hit = Hit.new
|
|
54
|
+
hit.query_id = @query_id
|
|
55
|
+
hit.query_def = @query_def
|
|
56
|
+
hit.query_len = @query_len
|
|
57
|
+
@iterations.last.hits.push(hit)
|
|
58
|
+
when 'Hsp'
|
|
59
|
+
hsp = Hsp.new
|
|
60
|
+
@iterations.last.hits.last.hsps.push(hsp)
|
|
61
|
+
end
|
|
62
|
+
when XMLParser::END_ELEM
|
|
63
|
+
case name
|
|
64
|
+
when /^BlastOutput/
|
|
65
|
+
xmlparser_parse_program(name,hash)
|
|
66
|
+
hash = Hash.new
|
|
67
|
+
when /^Parameters$/
|
|
68
|
+
xmlparser_parse_parameters(hash)
|
|
69
|
+
hash = Hash.new
|
|
70
|
+
when /^Iteration/
|
|
71
|
+
xmlparser_parse_iteration(name, hash)
|
|
72
|
+
hash = Hash.new
|
|
73
|
+
when /^Hit/
|
|
74
|
+
xmlparser_parse_hit(name, hash)
|
|
75
|
+
hash = Hash.new
|
|
76
|
+
when /^Hsp$/
|
|
77
|
+
xmlparser_parse_hsp(hash)
|
|
78
|
+
hash = Hash.new
|
|
79
|
+
when /^Statistics$/
|
|
80
|
+
xmlparser_parse_statistics(hash)
|
|
81
|
+
hash = Hash.new
|
|
82
|
+
end
|
|
83
|
+
tag_stack.pop
|
|
84
|
+
when XMLParser::CDATA
|
|
85
|
+
if hash[tag_stack.last].nil?
|
|
86
|
+
hash[tag_stack.last] = data unless data.strip.empty?
|
|
87
|
+
else
|
|
88
|
+
hash[tag_stack.last].concat(data) if data
|
|
89
|
+
end
|
|
90
|
+
when XMLParser::PI
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
rescue XMLParserError
|
|
94
|
+
line = parser.line
|
|
95
|
+
column = parser.column
|
|
96
|
+
print "Parse error at #{line}(#{column}) : #{$!}\n"
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def xmlparser_parse_program(tag, hash)
|
|
102
|
+
case tag
|
|
103
|
+
when 'BlastOutput_program'
|
|
104
|
+
@program = hash[tag]
|
|
105
|
+
when 'BlastOutput_version'
|
|
106
|
+
@version = hash[tag]
|
|
107
|
+
when 'BlastOutput_reference'
|
|
108
|
+
@reference = hash[tag]
|
|
109
|
+
when 'BlastOutput_db'
|
|
110
|
+
@db = hash[tag].strip
|
|
111
|
+
when 'BlastOutput_query-ID'
|
|
112
|
+
@query_id = hash[tag]
|
|
113
|
+
when 'BlastOutput_query-def'
|
|
114
|
+
@query_def = hash[tag]
|
|
115
|
+
when 'BlastOutput_query-len'
|
|
116
|
+
@query_len = hash[tag].to_i
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def xmlparser_parse_parameters(hash)
|
|
121
|
+
hash.each do |k, v|
|
|
122
|
+
xml_set_parameter(k, v)
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def xmlparser_parse_iteration(tag, hash)
|
|
127
|
+
case tag
|
|
128
|
+
when 'Iteration_iter-num'
|
|
129
|
+
@iterations.last.num = hash[tag].to_i
|
|
130
|
+
when 'Iteration_message'
|
|
131
|
+
@iterations.last.message = hash[tag].to_s
|
|
132
|
+
|
|
133
|
+
# for new BLAST XML format
|
|
134
|
+
when 'Iteration_query-ID'
|
|
135
|
+
@iterations.last.query_id = hash[tag].to_s
|
|
136
|
+
when 'Iteration_query-def'
|
|
137
|
+
@iterations.last.query_def = hash[tag].to_s
|
|
138
|
+
when 'Iteration_query-len'
|
|
139
|
+
@iterations.last.query_len = hash[tag].to_i
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
def xmlparser_parse_hit(tag, hash)
|
|
144
|
+
hit = @iterations.last.hits.last
|
|
145
|
+
case tag
|
|
146
|
+
when 'Hit_num'
|
|
147
|
+
hit.num = hash[tag].to_i
|
|
148
|
+
when 'Hit_id'
|
|
149
|
+
hit.hit_id = hash[tag].clone
|
|
150
|
+
when 'Hit_def'
|
|
151
|
+
hit.definition = hash[tag].clone
|
|
152
|
+
when 'Hit_accession'
|
|
153
|
+
hit.accession = hash[tag].clone
|
|
154
|
+
when 'Hit_len'
|
|
155
|
+
hit.len = hash[tag].clone.to_i
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
def xmlparser_parse_hsp(hash)
|
|
160
|
+
hsp = @iterations.last.hits.last.hsps.last
|
|
161
|
+
hsp.num = hash['Hsp_num'].to_i
|
|
162
|
+
hsp.bit_score = hash['Hsp_bit-score'].to_f
|
|
163
|
+
hsp.score = hash['Hsp_score'].to_i
|
|
164
|
+
hsp.evalue = hash['Hsp_evalue'].to_f
|
|
165
|
+
hsp.query_from = hash['Hsp_query-from'].to_i
|
|
166
|
+
hsp.query_to = hash['Hsp_query-to'].to_i
|
|
167
|
+
hsp.hit_from = hash['Hsp_hit-from'].to_i
|
|
168
|
+
hsp.hit_to = hash['Hsp_hit-to'].to_i
|
|
169
|
+
hsp.pattern_from = hash['Hsp_pattern-from'].to_i
|
|
170
|
+
hsp.pattern_to = hash['Hsp_pattern-to'].to_i
|
|
171
|
+
hsp.query_frame = hash['Hsp_query-frame'].to_i
|
|
172
|
+
hsp.hit_frame = hash['Hsp_hit-frame'].to_i
|
|
173
|
+
hsp.identity = hash['Hsp_identity'].to_i
|
|
174
|
+
hsp.positive = hash['Hsp_positive'].to_i
|
|
175
|
+
hsp.gaps = hash['Hsp_gaps'].to_i
|
|
176
|
+
hsp.align_len = hash['Hsp_align-len'].to_i
|
|
177
|
+
hsp.density = hash['Hsp_density'].to_i
|
|
178
|
+
hsp.qseq = hash['Hsp_qseq']
|
|
179
|
+
hsp.hseq = hash['Hsp_hseq']
|
|
180
|
+
hsp.midline = hash['Hsp_midline']
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
def xmlparser_parse_statistics(hash)
|
|
184
|
+
labels = {
|
|
185
|
+
'db-num' => 'Statistics_db-num',
|
|
186
|
+
'db-len' => 'Statistics_db-len',
|
|
187
|
+
'hsp-len' => 'Statistics_hsp-len',
|
|
188
|
+
'eff-space' => 'Statistics_eff-space',
|
|
189
|
+
'kappa' => 'Statistics_kappa',
|
|
190
|
+
'lambda' => 'Statistics_lambda',
|
|
191
|
+
'entropy' => 'Statistics_entropy'
|
|
192
|
+
}
|
|
193
|
+
labels.each do |k,v|
|
|
194
|
+
case k
|
|
195
|
+
when 'db-num', 'db-len', 'hsp-len'
|
|
196
|
+
@iterations.last.statistics[k] = hash[v].to_i
|
|
197
|
+
else
|
|
198
|
+
@iterations.last.statistics[k] = hash[v].to_f
|
|
199
|
+
end
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
end # class Report
|
|
204
|
+
end # class Blast
|
|
205
|
+
end # module Bio
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
=begin
|
|
209
|
+
|
|
210
|
+
This file is automatically loaded by bio/appl/blast/report.rb
|
|
211
|
+
|
|
212
|
+
=end
|
metadata
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: bio-blast-xmlparser
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- BioRuby project
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2019-06-14 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bio
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 2.0.0
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: 2.0.0
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: xmlparser
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: 0.7.2
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: 0.7.2
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: bundler
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '1.15'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '1.15'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rake
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '10.0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '10.0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: rdoc
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '5'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '5'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: test-unit
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - "~>"
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '3'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - "~>"
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '3'
|
|
97
|
+
description: 'BioRuby BLAST XMLParser plugin: a plugin of BioRuby BLAST XML result
|
|
98
|
+
parser by using the XMLParser extension. This was formerly a part of the BioRuby
|
|
99
|
+
core ("bio" gem) and split to this gem because of the external XMLParser dependency.'
|
|
100
|
+
email:
|
|
101
|
+
- staff@bioruby.org
|
|
102
|
+
executables: []
|
|
103
|
+
extensions: []
|
|
104
|
+
extra_rdoc_files: []
|
|
105
|
+
files:
|
|
106
|
+
- ".gitignore"
|
|
107
|
+
- BSDL
|
|
108
|
+
- COPYING
|
|
109
|
+
- COPYING.ja
|
|
110
|
+
- Gemfile
|
|
111
|
+
- LEGAL
|
|
112
|
+
- README.md
|
|
113
|
+
- Rakefile
|
|
114
|
+
- bio-blast-xmlparser.gemspec
|
|
115
|
+
- lib/bio-blast-xmlparser.rb
|
|
116
|
+
- lib/bio-blast-xmlparser/version.rb
|
|
117
|
+
- lib/bio/appl/blast/xmlparser.rb
|
|
118
|
+
homepage: https://github.com/bioruby/bioruby-blast-xmlparser
|
|
119
|
+
licenses: []
|
|
120
|
+
metadata: {}
|
|
121
|
+
post_install_message:
|
|
122
|
+
rdoc_options: []
|
|
123
|
+
require_paths:
|
|
124
|
+
- lib
|
|
125
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
126
|
+
requirements:
|
|
127
|
+
- - ">="
|
|
128
|
+
- !ruby/object:Gem::Version
|
|
129
|
+
version: '0'
|
|
130
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
|
+
requirements:
|
|
132
|
+
- - ">="
|
|
133
|
+
- !ruby/object:Gem::Version
|
|
134
|
+
version: '0'
|
|
135
|
+
requirements: []
|
|
136
|
+
rubyforge_project:
|
|
137
|
+
rubygems_version: 2.7.6.2
|
|
138
|
+
signing_key:
|
|
139
|
+
specification_version: 4
|
|
140
|
+
summary: BioRuby BLAST XMLParser plugin
|
|
141
|
+
test_files: []
|