sample_distance_ij#

RNAdist.sampling.ed_sampling.sample_distance_ij(fc: RNA.fold_compound, i: int, j: int, nr_samples: int = 1000) float#

Samples structures redundantly and returns the approximated expected distance between nucleotide i and j.

Warning

Nucleotide indices are Zero based. This is in contrast to ViennaRNA

Parameters:
  • fc (RNA.fold_compound) – ViennaRNA fold compound.

  • i (int) – nucleotide index of the first nt in the RNA string. Zero based.

  • j (int) – nucleotide index of the second nt in the RNA string. Zero based.

  • nr_samples (int) – Number of structures to draw for expected distance approximation

Returns:

Approximated expected distance between nucleotides i and j.

Return type:

float

>>> import RNA
>>> seq = "GGGCUAUUAGCUCAGUUGGUUAGAGCGCACCCCUGAUAAGGGUGAGGUCGCUGAUUCGAAUUCAGCAUAGCCCA"
>>> fc = RNA.fold_compound(seq, RNA.md(uniq_ML=1))
>>> sample_distance_ij(fc, 0, 20, nr_samples=10000)
16.19550000000088