Class: ViennaRna::Package::Rnabor
- Inherits:
-
Xbor
- Object
- Base
- Xbor
- ViennaRna::Package::Rnabor
show all
- Defined in:
- lib/vienna_rna/package/rnabor.rb
Constant Summary
collapse
- FLAGS =
{
nodangle: :empty
}
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
bootstrap, #debugger, #initialize, #serialize
included
included
Instance Method Details
#counts ⇒ Object
16
17
18
|
# File 'lib/vienna_rna/package/rnabor.rb', line 16
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
20
21
22
23
24
25
|
# File 'lib/vienna_rna/package/rnabor.rb', line 20
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
27
28
29
|
# File 'lib/vienna_rna/package/rnabor.rb', line 27
def non_zero_shells
self.class.parse(response).map { |row| BigDecimal.new(row[1]) }
end
|
#partition ⇒ Object
8
9
10
|
# File 'lib/vienna_rna/package/rnabor.rb', line 8
def partition
non_zero_shells.inject(&:+)
end
|
#total_count ⇒ Object
12
13
14
|
# File 'lib/vienna_rna/package/rnabor.rb', line 12
def total_count
counts.inject(&:+)
end
|