class Bio::DB::Primer3::PrimerPair
Attributes
left[R]
record[R]
right[R]
Public Class Methods
new(record, index)
click to toggle source
# File lib/bio/db/primer3.rb, line 705 def initialize(record, index) raise Primer3Exception.new(), "Index #{index} is greater than the number of records" unless index < record.size @record = record @left = Primer.new @right = Primer.new @values = Hash.new @left.set_value("added", false) @right.set_value("added", false) @left.pair = self @right.pair = self index_s = index.to_s record.properties.each do |key, value| tokens = key.to_s.split("_") if tokens.size > 2 and tokens[2] == index_s primer = nil primer = @right if tokens[1] == "right" primer = @left if tokens[1] == "left" if primer != nil primer.set_value("added", true) if tokens.size == 3 primer.set_value("coordinates", parse_coordinates(value) ) else to_add = value to_add = value.to_f unless tokens[3]=="sequence" n_key = tokens[3..6].join("_") primer.set_value(n_key, to_add) end else n_key = tokens[3..6].join("_") @values[n_key] = value end end end raise Primer3Exception.new(), "The pair is not complete (l:#{left.added}, r:#{right.added})" if @left.added == false or @right.added == false end
Public Instance Methods
<=>(anOther)
click to toggle source
# File lib/bio/db/primer3.rb, line 701 def <=>(anOther) penalty.to_f <=> anOther.penalty.to_f end
method_missing(m, *args, &block)
click to toggle source
# File lib/bio/db/primer3.rb, line 747 def method_missing(m, *args, &block) return @values[m.to_s] if @values[m.to_s] raise NoMethodError.new(), "There's no method called #{m}. Available methods: #{@values.keys.to_s}" end
parse_coordinates(str)
click to toggle source
# File lib/bio/db/primer3.rb, line 690 def parse_coordinates(str) coords = str.split(',') coords[0] = coords[0].to_i coords[1] = coords[1].to_i coords end
size()
click to toggle source
# File lib/bio/db/primer3.rb, line 697 def size return product_size.to_i end