Sha256: 4c46f95f09cafc46fefed44e01571ebdc38722e498b2e650445ab695d2475a59

Contents?: true

Size: 691 Bytes

Versions: 1

Compression:

Stored size: 691 Bytes

Contents

require 'yaml'
require 'digest/sha1'
require 'scaffolder'
require 'scaffolder/tool'

class Scaffolder::Tool::Sequence < Scaffolder::Tool

  def self.description
    "Generate the fasta output for the scaffold"
  end

  def execute
    s = sequence(scaffold)
    Bio::Sequence.new(s).output(:fasta,:header => header(s,@settings))
  end

  private

  def sequence(scaffold)
    scaffold.map{|entry| entry.sequence}.join
  end

  def header(sequence,opts={})
    header = Array.new
    header << opts[:definition] if opts[:definition]
    if opts[:'with-sequence-digest']
      digest = Digest::SHA1.hexdigest(sequence)
      header << "[sha1=#{digest}]"
    end



    header * ' '
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scaffolder-tools-0.1.3 lib/scaffolder/tool/sequence.rb