class ORFFinder

Wrapper class that processes the direct and reverse sequences

Constants

DEFAULT_OPTIONS

Attributes

codon_table[R]

Public Class Methods

new(sequence, codon_table = 1, options = {}, logger = nil) click to toggle source
# File lib/orf_finder.rb, line 17
def initialize(sequence, codon_table = 1, options = {}, logger = nil)
  #
  sequence = Bio::Sequence::NA.new(sequence) if sequence.class == String
  options = DEFAULT_OPTIONS.merge(options.nil? ? {} : options)
  #
  @output = {}
  @output[:direct] = ORF.new(sequence, options, logger) if options[:direct]
  #
  if options[:reverse]
    compl = sequence.complement
    @output[:reverse] = ORF.new(compl, options, logger)
  end
  #
  @codon_table = codon_table
end

Public Instance Methods

aa() click to toggle source
# File lib/orf_finder.rb, line 42
def aa
  res = {}
  @output.each do |key, value|
    res[key] = value.aa(@codon_table)
    res[key][:sequence] = value.sequence.translate(@codon_table).to_s
  end
  res
end
direct() click to toggle source
# File lib/orf_finder.rb, line 51
def direct
  @output[:direct]
end
nt() click to toggle source
# File lib/orf_finder.rb, line 33
def nt
  res = {}
  @output.each do |key, value|
    res[key] = value.nt(@codon_table)
    res[key][:sequence] = value.seq
  end
  res
end
reverse() click to toggle source
# File lib/orf_finder.rb, line 55
def reverse
  @output[:reverse]
end