Tregwiki:Biopython-Meme example

From OpenWetWare

Jump to: navigation, search
import Bio.AlignAce.Motif as motif
from Bio.Seq import Seq
from Bio.Alphabet import IUPAC
m = motif.Motif()
a = IUPAC.unambiguous_dna
m.add_instance(Seq("ATATAT",a))
m.add_instance(Seq("ATATTT",a))
m.set_mask("******")
print m.__str__()

t = Seq("ATTATTATTATTATTATATATTT",a)

for o in m.search_instances(t): # search for exact matches
   print o

for o in m.search_pwm(t): # scan the whole sequence and score all positions
   print o

for o in m.search_pwm(t,0.5): # select only hits with score above 0.5
   print o


(contributed by bartek wilczynski)

Personal tools