Sha256: a7b98a3188d80a5d64cd1ffe7c9544b9c921e08c6d915179e2af762300638050

Contents?: true

Size: 797 Bytes

Versions: 2

Compression:

Stored size: 797 Bytes

Contents

require 'scaffolder'

module Scaffolder::Test
  class Sequence

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

    def initialize_copy(source)
      super
      @options = @options.dup
    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

2 entries across 2 versions & 1 rubygems

Version Path
scaffolder-test-helpers-0.2.2 lib/scaffolder/test/sequence.rb
scaffolder-test-helpers-0.2.1 lib/scaffolder/test/sequence.rb