Class: ViennaRna::Subopt
Instance Attribute Summary collapse
-
#structures ⇒ Object
readonly
Returns the value of attribute structures.
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
batch, bootstrap, #debugger, debugger, exec_exists?, #exec_name, #exec_sequence_format, #initialize, method_added, #pre_run_check, run, #run, #run_with_hooks, #stringify_flags
Constructor Details
This class inherits a constructor from ViennaRna::Base
Instance Attribute Details
#structures ⇒ Object (readonly)
Returns the value of attribute structures.
3 4 5 |
# File 'lib/vienna_rna/modules/subopt.rb', line 3 def structures @structures end |
Instance Method Details
#bin(count = 1) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/vienna_rna/modules/subopt.rb', line 9 def bin(count = 1) run(p: count).structures.inject(Hash.new { |hash, key| hash[key] = 0 }) do |hash, structure| hash.tap do hash[structure] += 1 end end end |
#post_process ⇒ Object
5 6 7 |
# File 'lib/vienna_rna/modules/subopt.rb', line 5 def post_process @structures = @response.split(/\n/)[1..-1].map { |output| Rna.init_from_string(data.seq, output.split(/\s+/).first) } end |