Sha256: 1881bff9475e4fe8a0cae94ab443fb211402d14d88a556cfcc1401b8f71c7794

Contents?: true

Size: 816 Bytes

Versions: 1

Compression:

Stored size: 816 Bytes

Contents

# Methods for interacting with Primer3 output.
class Bio::Primer3::Result
  attr_accessor :output_hash
  def initialize
    @output_hash ||= {}
  end

  # Was there any primers found? Assumes you were looking for a left primer, with
  # a right primer, which won't always be the case.
  def primer_found?
    @output_hash['PRIMER_PAIR_NUM_RETURNED'].to_i>0 or
    (!@output_hash['PRIMER_LEFT_NUM_RETURNED'].nil? and 
     @output_hash['PRIMER_LEFT_NUM_RETURNED'].to_i>0
     !@output_hash['PRIMER_RIGHT_NUM_RETURNED'].nil? and 
     @output_hash['PRIMER_RIGHT_NUM_RETURNED'].to_i>0)
  end
  alias_method :yeh?, :primer_found?

  # Return the requested part of the result
  def [](key)
    @output_hash[key]
  end

  # set the requested part of the result
  def []=(key,value)
    @output_hash[key] = value
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bio-primer3-0.0.1.pre lib/bio/primer3/result.rb