Sha256: 04ff3e657ed1aa0d7dbb6d0ebcea15338bd9ca04b53654776cf0384288962a51

Contents?: true

Size: 1.87 KB

Versions: 5

Compression:

Stored size: 1.87 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))

describe Scaffolder::GffRecordHelper do

  it "should be included in Bio::GFF::GFF3::Record" do
    Bio::GFF::GFF3::Record.ancestors.should include(described_class)
  end

  subject do
    Bio::GFF::GFF3::Record.new(nil,nil,'CDS',1,3,nil,'+')
  end

  describe "#flip_strand" do

    it "should change strand to '-' when flipped from '+'" do
      subject.flip_strand
      subject.strand.should == '-'
    end

    it "should change strand to '+' when flipped from '-'" do
      subject.strand = '-'
      subject.flip_strand
      subject.strand.should == '+'
    end

  end

  describe "#change_position_by" do

    before do
      subject.change_position_by 3
    end

    it "should increase start position" do
      subject.start.should == 4
    end

    it "should increase end position" do
      subject.end.should == 6
    end

  end

  describe "#reverse_complement_by" do

    before do
      subject.reverse_complement_by 7
    end

    it "should increase start position" do
      subject.start.should == 5
    end

    it "should increase end position" do
      subject.end.should == 7
    end

    it "should flip the stand" do
      subject.strand.should == '-'
    end

  end

  describe "#overlap?" do

    it "should return false when no overlap with a single insert" do
      subject.overlap?(4..6).should be_false
    end

    it "should return true when overlapping with a single insert" do
      subject.overlap?(0..1).should be_true
      subject.overlap?(3..4).should be_true
      subject.overlap?(2..4).should be_true
    end

    it "should return false when no overlap with a multiple inserts" do
      subject.overlap?([4..6,7..9]).should be_false
    end

    it "should return true when overlapping with one of two inserts" do
      subject.overlap?([0..1,4..6]).should be_true
    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
scaffolder-annotation-locator-0.2.0 spec/scaffolder/gff_record_helper_spec.rb
scaffolder-annotation-locator-0.1.4 spec/scaffolder/gff_record_helper_spec.rb
scaffolder-annotation-locator-0.1.2 spec/scaffolder/gff_record_helper_spec.rb
scaffolder-annotation-locator-0.1.1 spec/scaffolder/gff_record_helper_spec.rb
scaffolder-annotation-locator-0.1.0 spec/scaffolder/gff_record_helper_spec.rb