Module: Wrnap::Global::Extensions::TwoStructureBasedMethods
- Defined in:
- lib/wrnap/global/rna/extensions.rb
Instance Method Summary collapse
Instance Method Details
#bp_distance(structure_1, structure_2) ⇒ Object
104 105 106 107 108 109 110 111 |
# File 'lib/wrnap/global/rna/extensions.rb', line 104 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 |