Skip to content

Commit

Permalink
Fix for weighted dictionaries when alleles are dash ('-') delimited i…
Browse files Browse the repository at this point in the history
…nstead of underscore ('_')
  • Loading branch information
ar0ch committed Feb 27, 2017
1 parent 26f8e63 commit 9b458b4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
setup(
name = 'stringMLST',
scripts = ['stringMLST.py'],
version = '0.3.6',
version = '0.3.6.1',
description = 'Fast k-mer based tool for alignment and assembly-free multi locus sequence typing (MLST) directly from genome sequencing reads.',
author = 'Jordan Lab',
author_email = '[email protected]',
Expand Down
9 changes: 6 additions & 3 deletions stringMLST.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
except ImportError:
from urllib import urlopen, urlretrieve
import argparse
version = """ stringMLST v0.3.6 (updated : February 16, 2017) """
version = """ stringMLST v0.3.6.1 (updated : February 27, 2017) """
"""
LICENSE TERMS FOR stringMLST
1. INTENT/PURPOSE:
Expand Down Expand Up @@ -519,8 +519,11 @@ def loadWeightDict(weightFile):
lines = weightTableFile.readlines()
for line in lines:
array = line.rstrip().rsplit('\t')
loc = array[0].rsplit('_')[0]
allele = array[0].rsplit('_')[1]
try:
(loc, allele) = array[0].replace('-','_').rsplit('_',1)
except ValueError:
print("Error : Allele name in locus file should be seperated by '_' or '-'")
exit(0)
if loc not in weightDict:
weightDict[loc] = {}
weightDict[loc][allele] = float(array[1])
Expand Down

0 comments on commit 9b458b4

Please sign in to comment.