sample_fc#
- RNAdist.sampling.ed_sampling.sample_fc(fc: RNA.fold_compound, nr_samples: int, undirected: bool = True)#
Samples structures for a sequence and returns pairwise distances of nucleotides
Warning
This function might produce nonsense output if the fc is not set up correctly. If you do not know how to do this consider using
sample()
- Parameters:
fc (RNA.fold_compound) – ViennaRNA fold compound.
nr_samples (int) – How many samples should be drawn
undirected (bool) – Whether to use undirected or directed Graph to calculate distances
- Returns:
N x N
matrixcontaining approximated expected distances from nucleotide
i
toj
atmatrix[i][j]
- Return type:
np.ndarray
It is possible to sample expected distances using the ViennaRNA fold compound as follows. Please make sure to enable unique multiloop decomposition via
uniq_ML=1
.>>> import RNA >>> seq = "GGGCUAUUAGCUCAGUUGGUUAGAGCGCACCCCUGAUAAGGGUGAGGUCGCUGAUUCGAAUUCAGCAUAGCCCA" >>> fc = RNA.fold_compound(seq, RNA.md(uniq_ML=1)) >>> x = sample_fc(fc) >>> x[0, -1] 2.004000000000001