Skip to content

Commit

Permalink
add checking for fa length
Browse files Browse the repository at this point in the history
  • Loading branch information
kepbod committed Mar 2, 2017
1 parent 1f50b47 commit a935846
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions maxentpy/maxent.py
Expand Up @@ -8,6 +8,7 @@
2004, 11:377-94.
'''

import sys
import math
from collections import defaultdict
try:
Expand Down Expand Up @@ -45,6 +46,9 @@ def score5(fa, matrix=None):
>>> round(score5('cagGTAAGT', matrix=matrix), 2)
10.86
'''
# check length of fa
if len(fa) != 9:
sys.exit('Wrong length of fa!')
# check matrix
if not matrix:
matrix = load_matrix5()
Expand Down Expand Up @@ -83,6 +87,9 @@ def score3(fa, matrix=None):
>>> round(score3('ttccaaacgaacttttgtAGgga', matrix=matrix), 2)
2.89
'''
# check length of fa
if len(fa) != 23:
sys.exit('Wrong length of fa!')
# check matrix
if not matrix:
matrix = load_matrix3()
Expand Down

0 comments on commit a935846

Please sign in to comment.