Class: ViennaRna::Rnabor
- Inherits:
-
Xbor
show all
- Defined in:
- lib/vienna_rna/modules/rnabor.rb
Constant Summary
collapse
- FLAGS =
{
nodangle: :empty
}
Constants inherited
from Xbor
Xbor::BASE_FLAGS
Instance Attribute Summary
Attributes inherited from Base
#data, #response, #runtime
Instance Method Summary
collapse
Methods inherited from Xbor
bootstrap_from_file, #expected_k, #full_distribution, #inspect, #k_p_points, parse, #quick_plot, #run_command
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
Instance Method Details
#counts ⇒ Object
18
19
20
|
# File 'lib/vienna_rna/modules/rnabor.rb', line 18
def counts
(non_zero_counts = self.class.parse(response).map { |row| BigDecimal.new(row[2]).to_i }) + [0] * (data.seq.length - non_zero_counts.length + 1)
end
|
#distribution(options = {}) ⇒ Object
22
23
24
25
26
27
|
# File 'lib/vienna_rna/modules/rnabor.rb', line 22
def distribution(options = {})
options = { precision: 4 }.merge(options)
distribution_before_precision = (non_zero_distribution = non_zero_shells.map { |i| i / partition }) + [0.0] * (data.seq.length - non_zero_distribution.length + 1)
distribution_before_precision.map { |value| options[:precision].zero? ? value : (value * 10 ** options[:precision]).truncate / 10.0 ** options[:precision] }
end
|
#non_zero_shells ⇒ Object
29
30
31
|
# File 'lib/vienna_rna/modules/rnabor.rb', line 29
def non_zero_shells
self.class.parse(response).map { |row| BigDecimal.new(row[1]) }
end
|
#partition ⇒ Object
10
11
12
|
# File 'lib/vienna_rna/modules/rnabor.rb', line 10
def partition
non_zero_shells.inject(&:+)
end
|
#total_count ⇒ Object
14
15
16
|
# File 'lib/vienna_rna/modules/rnabor.rb', line 14
def total_count
counts.inject(&:+)
end
|