Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/robsyme/bioruby-lazyblastxml
A plugin that allows you to parse large blast XML output files lazily, reading only what you need.
https://github.com/robsyme/bioruby-lazyblastxml
Last synced: 24 days ago
JSON representation
A plugin that allows you to parse large blast XML output files lazily, reading only what you need.
- Host: GitHub
- URL: https://github.com/robsyme/bioruby-lazyblastxml
- Owner: robsyme
- License: mit
- Created: 2011-05-13T09:31:22.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2011-06-01T02:18:02.000Z (over 13 years ago)
- Last Synced: 2024-09-14T23:15:20.191Z (about 2 months ago)
- Language: Ruby
- Homepage:
- Size: 109 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rdoc
- License: LICENSE.txt
Awesome Lists containing this project
README
= bio-lazyblastxml
Provides a libxml-based lazy parser for reading through large blast xml files with a small memory footprint.
== Requirements
* Ruby 1.9.x
* libxmlIf you're on ubuntu, libxml is most easily installed with:
sudo apt-get install libxml-ruby
And then install the gem with
gem install bio-lazyblastxml
# If you need to be root to install gems, try:
sudo gem install bio-lazyblastxml== Overview
The parsers uses a LibXML::Reader instance to read the XML file one line at a time, keeping very little in memory. You can think of the parser as having a very short memory, only able to recall the object that it happens to be looking at right now. The parser only runs through the document once unless Bio::LazyBlast#rewind is called.
== Example Usage
Each report is an enumerable that yields iterations.
Each iteration is an enumerable that yields hits (if there are any hits).require 'bio-lazyblastxml'
# Generate your new report object
report = Bio::LazyBlast::Report.new('my_huge_blastfile.xml')
# How many hits does each query have?
report.each_iteration do |iteration|
puts [iteration.query_def, iteration.count].join("\t")
endEach hit is an enumerable that yields hsps:
require 'bio-lazyblastxml'
# Generate your new report object
report = Bio::LazyBlast::Report.new('my_huge_blastfile.xml')
report.each_iteration do |iteration|
iteration.each_hit do |hit|
# Sum up the lengths of all the hsps
hsp_length_sum = hit.inject(0){|count,hsp| count += hsp.align_len}
puts [iteration.query_def, hit.definition, hsp_length_sum].join("\t")
end
end== Contributing to bio-lazyblastxml
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
* Fork the project
* Start a feature/bugfix branch
* Commit and push until you are happy with your contribution
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.== Copyright
Copyright (c) 2011 robsyme. See LICENSE.txt for
further details.