Class: Wrnap::Package::Subopt
Instance Attribute Summary collapse
-
#structures ⇒ Object
readonly
Returns the value of attribute structures.
Attributes inherited from Base
#data, #flags, #response, #runtime
Instance Method Summary collapse
Methods inherited from Base
bootstrap, #debugger, #initialize, #inspect
Methods included from Global::Yaml
Methods included from Global::Chainer
Methods included from Global::Runner
Constructor Details
This class inherits a constructor from Wrnap::Package::Base
Instance Attribute Details
#structures ⇒ Object (readonly)
Returns the value of attribute structures.
4 5 6 |
# File 'lib/wrnap/package/subopt.rb', line 4 def structures @structures end |
Instance Method Details
#bin(count = 1) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/wrnap/package/subopt.rb', line 17 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
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/wrnap/package/subopt.rb', line 6 def post_process @structures = response.split(/\n/)[1..-1].map do |output| structure, mfe = output.split(/\s+/) RNA.from_string(data.seq, structure).tap do |rna| rna.instance_variable_set(:@mfe, mfe.to_f) rna.class_eval { attr_reader :mfe } end end end |