Sha256: c02cd7b6fcc55d2ccc3e04e9d69356d79d6bd45f260cfd0efe429f92788ced8b

Contents?: true

Size: 868 Bytes

Versions: 1

Compression:

Stored size: 868 Bytes

Contents

require 'scaffolder'

module Scaffolder::Test
  class Annotation

    [:seqname,:start,:end,:strand,:phase,:feature,:attributes].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,
        self.attributes.to_a)
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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