Module: Wrnap::Rna::Extensions::TwoStructureBasedMethods
- Defined in:
- lib/wrnap/rna/extensions.rb
Instance Method Summary collapse
Instance Method Details
#bp_distance(structure_1, structure_2) ⇒ Object
163 164 165 166 167 168 169 170 |
# File 'lib/wrnap/rna/extensions.rb', line 163 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 |