Module: ViennaRna::Global::RnaExtensions::TwoStructureBasedMethods
- Defined in:
- lib/vienna_rna/global/rna_extensions.rb
Instance Method Summary collapse
Instance Method Details
#bp_distance(structure_1, structure_2) ⇒ Object
84 85 86 87 88 89 90 91 |
# File 'lib/vienna_rna/global/rna_extensions.rb', line 84 def bp_distance(structure_1, structure_2) # Takes two structures and calculates the distance between them by |symmetric difference(bp_in_a, bp_in_b)| raise "The two structures are not the same length" unless structure_1.length == structure_2.length bp_set_1, bp_set_2 = base_pairs(structure_1), base_pairs(structure_2) ((bp_set_1 - bp_set_2) + (bp_set_2 - bp_set_1)).count end |