Skip to content

Commit 274dc78

Browse files
committed
Convert to float for comparions since py2 doesn't also coerce types properly
1 parent 816cbc8 commit 274dc78

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

stringMLST.py

Lines changed: 4 additions & 4 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.5 (updated : January 5, 2018) """
18+
version = """ stringMLST v0.5.1 (updated : January 5, 2018) """
1919
"""
2020
2121
stringMLST free for academic users and requires permission before any commercial
@@ -515,7 +515,6 @@ def goodReads(read, k, non_overlapping_window):
515515
s = str(line[n:n+k])
516516
if s in kmerDict[k]:
517517
for probLoc in kmerDict[k][s]:
518-
# print(probLoc)
519518
if probLoc not in alleleCount:
520519
alleleCount[probLoc] = {}
521520
a = kmerDict[k][s][probLoc]
@@ -592,20 +591,21 @@ def getMaxCount(alleleCount, fileName):
592591
num_max2 = []
593592
compare = float(re.sub("\*$", "", str(max_n[loc])))
594593
for num in alleleCount[loc]:
595-
if alleleCount[loc][num] == compare:
594+
if float(re.sub("\*$", "", str(alleleCount[loc][num]))) == compare:
596595
if "\*" in str(max_n[loc]):
597596
insert = num + '*'
598597
num_max.append(insert)
599598
else:
600599
num_max.append(num)
601600
maxSupport[loc][num] = max_n[loc]
601+
602602
if alleleCount[loc][num] == secondMax[loc]:
603603
num_max2.append(num)
604604
secondSupport[loc][num] = secondMax[loc]
605605
try:
606606
finalProfileCount[loc] = num_max[0]
607607
except LookupError:
608-
finalProfileCount[loc] = '0'
608+
finalProfileCount[loc] = 'yes'
609609
msgs = "Max Support :" + fileName + " : " + str(maxSupport)
610610
logging.debug(msgs)
611611
msgs = "Second Max Support :" + fileName + " : " + str(secondSupport)

0 commit comments

Comments
 (0)