Permalink
Browse files

Avoid using add_instance in Bio.Motif.AlignAce

  • Loading branch information...
1 parent 69492c2 commit 3d6d18039d9ffa7b998641514fd1ca7d0a121628 Michiel de Hoon committed Nov 23, 2012
Showing with 12 additions and 6 deletions.
  1. +12 −6 Bio/Motif/AlignAce.py
View
@@ -41,16 +41,22 @@ def read(handle):
elif line[:5]=="Input":
record.sequences=[]
elif line[:5]=="Motif":
- current_motif = Motif()
- current_motif.alphabet=IUPAC.unambiguous_dna
- record.motifs.append(current_motif)
+ words = line.split()
+ assert words[0]=="Motif"
+ number = int(words[1])
+ instances = []
elif line[:3]=="MAP":
- current_motif.score = float(line.split()[-1])
+ motif = Motif(instances)
+ motif.alphabet = IUPAC.unambiguous_dna
+ motif.score = float(line.split()[-1])
+ motif.number = number
+ motif.set_mask(mask)
+ record.motifs.append(motif)
elif len(line.split("\t"))==4:
seq = Seq(line.split("\t")[0],IUPAC.unambiguous_dna)
- current_motif.add_instance(seq)
+ instances.append(seq)
elif "*" in line:
- current_motif.set_mask(line.strip("\n\c"))
+ mask = line.strip("\r\n")
else:
raise ValueError(line)
return record

0 comments on commit 3d6d180

Please sign in to comment.