Class: ViennaRna::Package::EnergyGrid2d
- Inherits:
-
Base
- Object
- Base
- ViennaRna::Package::EnergyGrid2d
show all
- Includes:
- Enumerable
- Defined in:
- lib/vienna_rna/package/energy_grid_2d.rb
Defined Under Namespace
Modules: EnergyGrid2dWrapper
Classes: Row2d
Instance Attribute Summary
Attributes inherited from Base
#data, #response, #runtime
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
bootstrap, #debugger, exec_exists?, #exec_name, #exec_sequence_format, #initialize, method_added, #pre_run_check, run, #run, #run_with_hooks, #serialize, #stringify_flags
Class Method Details
.aligned_distributions(*energy_grids) ⇒ Object
36
37
38
39
40
41
42
|
# File 'lib/vienna_rna/package/energy_grid_2d.rb', line 36
def self.aligned_distributions(*energy_grids)
point_set = set_of_points(*energy_grids)
energy_grids.map do |grid|
(grid.distribution + (point_set - grid.map(&:position)).map { |i, j| Row2d.new(i, j, 0, Float::INFINITY) }).sort
end
end
|
.inherited(subclass) ⇒ Object
6
7
8
|
# File 'lib/vienna_rna/package/energy_grid_2d.rb', line 6
def self.inherited(subclass)
subclass.class_eval { prepend EnergyGrid2dWrapper }
end
|
.set_of_points(*energy_grids) ⇒ Object
44
45
46
|
# File 'lib/vienna_rna/package/energy_grid_2d.rb', line 44
def self.set_of_points(*energy_grids)
energy_grids.inject([]) { |list, grid| list + grid.map(&:position) }.uniq.sort
end
|
Instance Method Details
#each(&block) ⇒ Object
48
49
50
|
# File 'lib/vienna_rna/package/energy_grid_2d.rb', line 48
def each(&block)
distribution.each(&block)
end
|
#inspect ⇒ Object
64
65
66
|
# File 'lib/vienna_rna/package/energy_grid_2d.rb', line 64
def inspect
"#<#{self.class.name} on #{data.inspect}>"
end
|
#quick_plot(num_colors: 8) ⇒ Object
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/vienna_rna/package/energy_grid_2d.rb', line 52
def quick_plot(num_colors: 8)
Graphing::R.matrix_heatmap(
distribution.map(&:i),
distribution.map(&:j),
distribution.map { |row| Math.log(row.p) },
title: "#{self.class.name} Matrix Heatmap",
x_label: "Distance from structure 2",
y_label: "Distance from structure 1",
num_colors: num_colors
)
end
|