Sha256: aced8a6a08d622b109d9615ea4b537074c42763f9d175c0f77209021224dca29

Contents?: true

Size: 1.53 KB

Versions: 7

Compression:

Stored size: 1.53 KB

Contents

require 'spec_helper'
require 'genomer-plugin-view/agp'

describe GenomerPluginView::Agp do

  def contig(sequence)
    s = mock!
    stub(s).entry_type{ :sequence }
    stub(s).sequence{ sequence }
    s
  end

  def unresolved(length)
    s = mock!
    stub(s).entry_type{ :unresolved }
    stub(s).sequence{ 'N' * length }
    s
  end

  subject do
    described_class.new(['agp'],{})
  end

  before do
    mock(subject).scaffold do
      contigs
    end
  end

  context "where the scaffold contains a single contig" do

    let (:contigs) do
      [contig('AATGC')]
    end

    it "should return agp output" do
      subject.run.should == <<-EOS.unindent
        ##agp-version	2.0
        scaffold	1	5	1	W	contig00001	1	5	+
      EOS
    end

  end

  context "where the scaffold contains a contig with a gap" do

    let (:contigs) do
      [contig('AAANNNGGG')]
    end

    it "should return agp output" do
      subject.run.should == <<-EOS.unindent
        ##agp-version	2.0
        scaffold	1	3	1	W	contig00001	1	3	+
        scaffold	4	6	2	N	3	scaffold	yes	internal
        scaffold	7	9	3	W	contig00002	1	3	+
      EOS
    end

  end

  context "where the scaffold contains an unresolved region" do

    let (:contigs) do
      [ contig('AAA'), unresolved(3), contig('TTT') ]
    end

    it "should return agp output" do
      subject.run.should == <<-EOS.unindent
        ##agp-version	2.0
        scaffold	1	3	1	W	contig00001	1	3	+
        scaffold	4	6	2	N	3	scaffold	yes	specified
        scaffold	7	9	3	W	contig00002	1	3	+
      EOS
    end

  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
genomer-plugin-view-0.1.0 spec/genomer-view-plugin/agp_spec.rb
genomer-plugin-view-0.0.7 spec/genomer-view-plugin/agp_spec.rb
genomer-plugin-view-0.0.6 spec/genomer-view-plugin/agp_spec.rb
genomer-plugin-view-0.0.5 spec/genomer-view-plugin/agp_spec.rb
genomer-plugin-view-0.0.4 spec/genomer-view-plugin/agp_spec.rb
genomer-plugin-view-0.0.3 spec/genomer-view-plugin/agp_spec.rb
genomer-plugin-view-0.0.2 spec/genomer-view-plugin/agp_spec.rb