Question: How To Use The Biopython Motifs Module To Check Whether A Motif Is Present In My List Of Sequences?
0
gravatar for ericmajinglong
6.5 years ago by
United States
ericmajinglong120 wrote:

I have a data set with the following:

Accession    Sequence
CC123456     XNFGYXLAKKK
CC123457     XNFGYXKAKKK

I want to be able to search this data set to look for the motif XLAK, and output a list containing [Accession(String), Present(Boolean)] pairs. However, the Bio.motifs module doesn't have sufficient information to help me write this out.

Sample code that I have thus far looks as follows:

import Bio.motifs as motifs
motifs = motifs.Motif()
motif.add_instance(Seq('XLAK'))

After that line, I get an error saying "Motif object has no attribute 'add_instance'.

We were planning to run over a list of [Accession(String), Sequence(Seq)] pairs and search each Sequence for that motif, and then output a separate list as mentioned above. Can anybody provide a starting point for doing this please?

motif biopython • 4.4k views
ADD COMMENTlink modified 6.5 years ago by Neilfws48k • written 6.5 years ago by ericmajinglong120

May be this might work: from Bio.Motif import Motif
m = Motif()
You have to add the sequence as a Seq object, i.e. from Bio.Seq import Seq
You may have to specify alphabet also from Bio.Alphabet import IUPAC
As per the manual.

ADD REPLYlink written 6.5 years ago by Olivier440
0
gravatar for Neilfws
6.5 years ago by
Neilfws48k
Sydney, Australia
Neilfws48k wrote:

Error means what it says: add_instance is not a method that you can call on that object. Here's the documentation for Bio.motifs.

Usage of Bio.motifs (available since version 1.61) is described in the Biopython tutorial, including how to create an instance of Motif from a Seq instance.

ADD COMMENTlink written 6.5 years ago by Neilfws48k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 979 users visited in the last hour