Class: ViennaRna::Package::TabuPath::Path
- Inherits:
-
Object
- Object
- ViennaRna::Package::TabuPath::Path
- Defined in:
- lib/vienna_rna/package/tabu_path.rb
Instance Attribute Summary collapse
-
#barrier ⇒ Object
readonly
Returns the value of attribute barrier.
-
#best_weight ⇒ Object
readonly
Returns the value of attribute best_weight.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#rna ⇒ Object
readonly
Returns the value of attribute rna.
Instance Method Summary collapse
- #full_path? ⇒ Boolean
-
#initialize(rna, output) ⇒ Path
constructor
A new instance of Path.
- #inspect ⇒ Object
- #length ⇒ Object
Constructor Details
#initialize(rna, output) ⇒ Path
Returns a new instance of Path.
30 31 32 33 34 |
# File 'lib/vienna_rna/package/tabu_path.rb', line 30 def initialize(rna, output) @rna = rna @path = output.split(?\n)[0..-2].unshift(rna.str_1) @barrier, _, @best_weight = output.split(?\n)[-1].gsub(/[^\d\.]/, " ").strip.split(/\s+/).map(&:to_f) end |
Instance Attribute Details
#barrier ⇒ Object (readonly)
Returns the value of attribute barrier.
28 29 30 |
# File 'lib/vienna_rna/package/tabu_path.rb', line 28 def @barrier end |
#best_weight ⇒ Object (readonly)
Returns the value of attribute best_weight.
28 29 30 |
# File 'lib/vienna_rna/package/tabu_path.rb', line 28 def best_weight @best_weight end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
28 29 30 |
# File 'lib/vienna_rna/package/tabu_path.rb', line 28 def path @path end |
#rna ⇒ Object (readonly)
Returns the value of attribute rna.
28 29 30 |
# File 'lib/vienna_rna/package/tabu_path.rb', line 28 def rna @rna end |
Instance Method Details
#full_path? ⇒ Boolean
40 41 42 |
# File 'lib/vienna_rna/package/tabu_path.rb', line 40 def full_path? rna.str_1 == path.first && rna.str_2 == path.last end |
#inspect ⇒ Object
44 45 46 |
# File 'lib/vienna_rna/package/tabu_path.rb', line 44 def inspect "#<#{self.class.name} with barrier %.2f and length %d on #{rna.inspect}>" % [, best_weight] end |
#length ⇒ Object
36 37 38 |
# File 'lib/vienna_rna/package/tabu_path.rb', line 36 def length path.length end |