No commit activity in last 3 years
No release in over 3 years
This is very scrappy at the moment, and will need to be seriously cleaned up. It does what I need it to do for now. I'll fix it up in the coming weeks. Promise :)
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.4.1
~> 1.0.0
~> 1.6.0
>= 0

Runtime

>= 2.0.5
 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

  • libxml

If 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")
end

Each 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 © 2011 robsyme. See LICENSE.txt for further details.