Sha256: 7a185d370484582e8265380c4f3fa34e33738d61b3057bf8e9d19c0e479e5397

Contents?: true

Size: 826 Bytes

Versions: 1

Compression:

Stored size: 826 Bytes

Contents

require 'scaffolder'

module Scaffolder::Test
  class Annotation

    [:seqname,:start,:end,:strand,:phase,:feature].each do |attribute|
      define_method(attribute) do |*arg|
        unless arg.first
          return @options[attribute]
        end
        @options[attribute] = arg.first
        return self
      end
    end

    def initialize(options = Hash.new)
      defaults = {:seqname => 'record', :start => 1, :end     => 10,
                  :strand  => '+',      :phase => 1, :feature => 'CDS'}
      @options = defaults.merge(options)
    end

    def initialize_copy(source)
      super
      @options = @options.dup
    end

    def to_gff3_record
      Bio::GFF::GFF3::Record.new(
        self.seqname, nil, self.feature, self.start,
        self.end,     nil, self.strand,  self.phase)
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scaffolder-test-helpers-0.4.0 lib/scaffolder/test/annotation.rb