Class: ORFFinder
- Inherits:
-
Object
- Object
- ORFFinder
- Defined in:
- lib/orf_finder.rb
Overview
Wrapper class that processes the direct and reverse sequences
Constant Summary collapse
- DEFAULT_OPTIONS =
{ start: %w(atg), stop: %w(tag taa tga), reverse: true, direct: true, min: 6, debug: false }
Instance Attribute Summary collapse
-
#codon_table ⇒ Object
readonly
Returns the value of attribute codon_table.
Instance Method Summary collapse
- #aa ⇒ Object
- #direct ⇒ Object
-
#initialize(sequence, codon_table = 1, options = {}, logger = nil) ⇒ ORFFinder
constructor
A new instance of ORFFinder.
- #nt ⇒ Object
- #reverse ⇒ Object
Constructor Details
#initialize(sequence, codon_table = 1, options = {}, logger = nil) ⇒ ORFFinder
Returns a new instance of ORFFinder.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/orf_finder.rb', line 17 def initialize(sequence, codon_table = 1, = {}, logger = nil) # sequence = Bio::Sequence::NA.new(sequence) if sequence.class == String = DEFAULT_OPTIONS.merge(.nil? ? {} : ) # @output = {} @output[:direct] = ORF.new(sequence, , logger) if [:direct] # if [:reverse] compl = sequence.complement @output[:reverse] = ORF.new(compl, , logger) end # @codon_table = codon_table end |
Instance Attribute Details
#codon_table ⇒ Object (readonly)
Returns the value of attribute codon_table.
8 9 10 |
# File 'lib/orf_finder.rb', line 8 def codon_table @codon_table end |
Instance Method Details
#aa ⇒ Object
42 43 44 45 46 47 48 49 |
# 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 ⇒ Object
51 52 53 |
# File 'lib/orf_finder.rb', line 51 def direct @output[:direct] end |
#nt ⇒ Object
33 34 35 36 37 38 39 40 |
# 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 ⇒ Object
55 56 57 |
# File 'lib/orf_finder.rb', line 55 def reverse @output[:reverse] end |