This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to convert MEME MOTIF to all potential sequences?

Dear all,

I have a list of RNA motifs in the standard MEME format (MOTIF CYUACUCUCAGAYCC MEME) and would like to check for characteristics. For this I need the general RNA sequence (AUGCs) so my question therefore is: how can I obtain all possible RNA sequences from the compacted MEME sequence format?

Thanks in advance!

rna meme motif sequences

1 answer

This can easily by done with biopython, see this answer on StackOverflow for full code/explanation. I've posted the necessary function below.

from Bio import Seq
from itertools import product

def extend_ambiguous_dna(seq):
   """return list of all possible sequences given an ambiguous DNA input"""
   d = Seq.IUPAC.IUPACData.ambiguous_dna_values
   return [ list(map("".join, product(*map(d.get, seq)))) ]

Many thanks! Just what I need.

Log in to answer this question.