| name | rna-structure |
| description | RNA secondary structure prediction and alignment. Use when predicting RNA folding, aligning RNA sequences considering secondary structure, or analyzing ncRNA sequences. |
RNA Structure
RNA secondary structure prediction and alignment.
RNA Folding with ViennaRNA
# Fold single sequence
RNAfold < sequence.fasta > structure.txt
# With constraints
RNAfold -C < sequence.fasta
# Suboptimal structures
RNAsubopt -e 5 < sequence.fasta
Python Interface
import RNA
# Fold sequence
seq = "GGGAAACCCGGGAAACCC"
structure, mfe = RNA.fold(seq)
print(f"Structure: {structure}")
print(f"MFE: {mfe} kcal/mol")
# Partition function
fc = RNA.fold_compound(seq)
structure, mfe = fc.mfe()
fc.pf()
Structural Alignment
# LocARNA for structural alignment
mlocarna sequences.fasta --output output_dir
# Infernal for RNA family alignment
cmscan --tblout results.tbl Rfam.cm query.fasta
Dot-Bracket Notation
def parse_dotbracket(structure):
"""Parse dot-bracket notation."""
pairs = []
stack = []
for i, char in enumerate(structure):
if char == '(':
stack.append(i)
elif char == ')':
if stack:
pairs.append((stack.pop(), i))
return pairs