Sha256: 394675e0db2871b57618df1c03d1a605572130922b5aac7fc0a6b7bcd7d2d557

Contents?: true

Size: 1.43 KB

Versions: 4

Compression:

Stored size: 1.43 KB

Contents

# RSpec for BioRuby-GFF3-Plugin. Run with something like:
#
#   rspec -I ../bioruby/lib/ spec/gffdb_spec.rb 
#
# Copyright (C) 2010 Pjotr Prins <pjotr.prins@thebird.nl>
#
$: << "../lib"


require 'bio-gff3'

include Bio::GFFbrowser

describe FastLineParser, "GFF3 Fast line parser" do
  include Bio::GFFbrowser::FastLineParser

  it "should parse attributes" do 
    parse_attributes_fast("id=1").should == { "id"=>"1" }
    parse_attributes_fast("id=1;parent=45").should == { "id"=>"1", "parent" => "45" }
  end
  it "should parse escaped attributes" do 
    parse_attributes_fast("id%3D1=1").should == { "id%3D1"=>"1" }
    parse_attributes_fast("id=1%3Bparent=45").should == { "id"=>"1%3Bparent=45" }
  end
  it "should parse records" do 
    parse_line_fast("ctg123\t.\tCDS\t1201\t1500\t.\t+\t0\tID=cds00001;Parent=mRNA00001;Name=edenprotein.1").should == ["ctg123", ".", "CDS", "1201", "1500", ".", "+", "0", "ID=cds00001;Parent=mRNA00001;Name=edenprotein.1"]
  end
  it "should handle a Record interface" do
    fields = 
    parse_line_fast("ctg123\t.\tCDS\t1201\t1500\t.\t+\t0\tID=cds00001;Parent=mRNA00001;Name=edenprotein.1")
    rec = Bio::GFFbrowser::FastLineRecord.new(fields)
    rec.seqname.should == "ctg123"
    rec.id.should == "cds00001"
    rec.phase.should == 0
    rec.start.should == 1201
    rec.end.should == 1500
    rec.score.should == 0.0
    rec.strand.should == '+'
    rec.feature.should == 'CDS'
    rec.source.should == '.'
  end
end


Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bio-gff3-0.9.1 spec/gffparserec.rb
bio-gff3-0.9.0 spec/gffparserec.rb
bio-gff3-0.8.7 spec/gffparserec.rb
bio-gff3-0.8.6 spec/gffparserec.rb