Skip to content

Commit

Permalink
Merge pull request #298 from samhorsfield96/poppunk_assign_fix
Browse files Browse the repository at this point in the history
Poppunk assign fix
  • Loading branch information
samhorsfield96 authored Dec 15, 2023
2 parents efb47b0 + b28fd91 commit 6cae83c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion PopPUNK/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

'''PopPUNK (POPulation Partitioning Using Nucleotide Kmers)'''

__version__ = '2.6.3'
__version__ = '2.6.4'

# Minimum sketchlib version
SKETCHLIB_MAJOR = 2
Expand Down
7 changes: 5 additions & 2 deletions PopPUNK/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -1468,8 +1468,11 @@ def printClusters(G, rlist, outPrefix=None, oldClusterFile=None,
if oldClusterFile != None:
oldAllClusters = readIsolateTypeFromCsv(oldClusterFile, mode = 'external', return_dict = False)
oldClusters = oldAllClusters[list(oldAllClusters.keys())[0]]
new_id = len(oldClusters.keys()) + 1 # 1-indexed
while new_id in oldClusters:
# parse all previously used clusters, including those that are merged
parsed_oldClusters = set([int(item) for sublist in (x.split('_') for x in oldClusters) for item in sublist])

new_id = max(parsed_oldClusters) + 1 # 1-indexed
while new_id in parsed_oldClusters:
new_id += 1 # in case clusters have been merged

# Samples in previous clustering
Expand Down

0 comments on commit 6cae83c

Please sign in to comment.