Skip to content

Commit

Permalink
Correction of the construction of an Exception and correction of the …
Browse files Browse the repository at this point in the history
…creation

of a 0-order TFFM from a motif.
  • Loading branch information
amathelier committed Apr 18, 2013
1 parent 2632d69 commit 43c4e15
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 0 additions & 1 deletion exceptions_errors.py
Expand Up @@ -20,7 +20,6 @@ def __init__(self, value):
:type value: str
"""
Exception.__init__()
self.value = value

def __str__(self):
Expand Down
11 changes: 9 additions & 2 deletions tffm_module.py
Expand Up @@ -858,7 +858,12 @@ def create_0order_hmm(nb_seq, nb_residues, first_letters, motif):
# The first state is random
emissions = [[0.25, 0.25, 0.25, 0.25]]
# Complete the emissions with the actual motif frequencies
nb_hits = len(motif.instances)
if motif.instances:
# The motif.counts is computed directly when creating the motif from
# instances
nb_hits = len(motif.instances)
else:
nb_hits = nb_seq
for position in xrange(len(motif)):
frequencies = []
for letter in "ACGT":
Expand Down Expand Up @@ -1033,6 +1038,8 @@ def tffm_from_motif(motif, kind, name="TFFM", nb_res=None, first_letters=None):
nb_res = nb_seq * 100
if kind == TFFM_KIND.FIRST_ORDER:
hmm = create_1storder_hmm(nb_seq, nb_res, first_letters, motif)
else:
elif kind == TFFM_KIND.DETAILED:
hmm = create_detailed_hmm(nb_seq, nb_res, first_letters, motif)
else: # 0-order TFFM here
hmm = create_0order_hmm(nb_seq, nb_res, first_letters, motif)
return TFFM(hmm.emissionDomain, hmm.distribution, hmm.cmodel, kind, name)

0 comments on commit 43c4e15

Please sign in to comment.