Skip to content

Commit

Permalink
Start cluster numbers from 1 rather than 0
Browse files Browse the repository at this point in the history
Will automatically work with old schemes as long as a _clusters.csv is provided
Closes #26
  • Loading branch information
johnlees committed Aug 7, 2018
1 parent 7ee405f commit 30346a9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions PopPUNK/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def printClusters(G, outPrefix, oldClusterFile = None, printRef = True):

if oldClusterFile != None:
oldClusters = readClusters(oldClusterFile)
new_id = len(oldClusters)
new_id = len(oldClusters) + 1 # 1-indexed
while new_id in oldClusters:
new_id += 1 # in case clusters have been merged

Expand Down Expand Up @@ -333,9 +333,9 @@ def printClusters(G, outPrefix, oldClusterFile = None, printRef = True):
cls_id = oldClusterName
break

# Otherwise just number sequentially
# Otherwise just number sequentially starting from 1
else:
cls_id = newClsIdx
cls_id = newClsIdx + 1

for cluster_member in newCluster:
clustering[cluster_member] = cls_id
Expand Down

0 comments on commit 30346a9

Please sign in to comment.