This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Ambiguous Amino Acid In Motif Search

I am currently trying to use Biopython to search for a motif in which an internal amino acid can be any amino acid except for one, is there a way to add an instance of the motif using a character such as 'X' to represent a motif sequence such as "AMXLT" or "AM{N}LT" where the {N} stands for any amino acid except for Asparagine?

Sample Code:

from Bio import motifs
from Bio.Seq import Seq
from Bio.Alphabet import IUPAC
instances = [Seq("AMXLT", IUPAC.protein), Seq("AM{N}LT", IUPAC.protein)]
m = motifs.create(instances)
for record in sequences:
    for pos,seq in m.instances.search(record[1]):
        print record[0], pos,seq
motif motif biopython amino-acids

1 answer

IUPAC.ExtendedIUPACProtein contains X. Alternatively, you can initialize a Motif from a MEME motif etc.

Log in to answer this question.