Sha256: 2af58e9a0cff2a47f8de5fdd9436b8d12ef007204efab762112b78e2c60350a7
Contents?: true
Size: 1 KB
Versions: 2
Compression:
Stored size: 1 KB
Contents
require 'rspec/expectations' require 'bio-bgzf' require 'tempfile' describe Bio::BGZF do it "should be able to pack strings to BGZF blocks" do Bio::BGZF.should respond_to(:pack).with(1).argument Bio::BGZF.pack("asdfghjkl").should be_instance_of String end it "should be able to read BGZF blocks from a samtools file" do File.open("test/data/mm8.chrM.maf.gz") do |f| r = Bio::BGZF::Reader.new(f) r.each_block do |block, pos| block.size.should <= 65536 pos.should.is_a? Integer Bio::BGZF::vo_data_offset(pos).should == 0 end end end it "should be able to iteratively read BGZF blocks from stream" do str = '' 1000.times { str += (Random.rand(26) + 65).chr } file = Tempfile.new 'bgzfstring' str.chars.each_slice(42).map(&:join).each do |s| file.write(Bio::BGZF.pack s) end file.flush file.rewind str2 = '' r = Bio::BGZF::Reader.new(file) r.each_block {|block| str2 += block } str2.should == str end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bio-bgzf-0.2.1 | spec/bio-bgzf_spec.rb |
bio-bgzf-0.2.0 | spec/bio-bgzf_spec.rb |