Skip to content

Commit 9b458b4

Browse files
committed
Fix for weighted dictionaries when alleles are dash ('-') delimited instead of underscore ('_')
1 parent 26f8e63 commit 9b458b4

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
setup(
99
name = 'stringMLST',
1010
scripts = ['stringMLST.py'],
11-
version = '0.3.6',
11+
version = '0.3.6.1',
1212
description = 'Fast k-mer based tool for alignment and assembly-free multi locus sequence typing (MLST) directly from genome sequencing reads.',
1313
author = 'Jordan Lab',
1414
author_email = 'pypi@atc.io',

stringMLST.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
except ImportError:
1616
from urllib import urlopen, urlretrieve
1717
import argparse
18-
version = """ stringMLST v0.3.6 (updated : February 16, 2017) """
18+
version = """ stringMLST v0.3.6.1 (updated : February 27, 2017) """
1919
"""
2020
LICENSE TERMS FOR stringMLST
2121
1. INTENT/PURPOSE:
@@ -519,8 +519,11 @@ def loadWeightDict(weightFile):
519519
lines = weightTableFile.readlines()
520520
for line in lines:
521521
array = line.rstrip().rsplit('\t')
522-
loc = array[0].rsplit('_')[0]
523-
allele = array[0].rsplit('_')[1]
522+
try:
523+
(loc, allele) = array[0].replace('-','_').rsplit('_',1)
524+
except ValueError:
525+
print("Error : Allele name in locus file should be seperated by '_' or '-'")
526+
exit(0)
524527
if loc not in weightDict:
525528
weightDict[loc] = {}
526529
weightDict[loc][allele] = float(array[1])

0 commit comments

Comments
 (0)