Sha256: db3683effa438a3ab1d3960b8c85d1e5758b6fe0388a5e41f00766b647e4c440

Contents?: true

Size: 714 Bytes

Versions: 1

Compression:

Stored size: 714 Bytes

Contents

require 'scaffolder'

module Scaffolder::Test
  class Sequence

    def initialize(options = {})
      @options = options
    end

    [:name,:sequence,:reverse,:start,:stop].each do |attribute|
      define_method(attribute) do |*arg|
        unless arg.first
          return @options[attribute]
        end
        @options[attribute] = arg.first
        return self
      end
    end

    def to_hash
      hash = {'source' => name}
      [:start,:stop,:reverse].each do |attribute|
        hash[attribute.to_s] = @options[attribute] if @options[attribute]
      end
      {'sequence' => hash}
    end

    def to_fasta
      Bio::Sequence.new(sequence).output(:fasta,:header => name).strip
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scaffolder-test-helpers-0.2.0 lib/scaffolder/test/sequence.rb