Skip to content

Commit

Permalink
Bug fixed when maxClusterNumber is applied
Browse files Browse the repository at this point in the history
  • Loading branch information
juexinwang committed Apr 16, 2021
1 parent 0f75b36 commit a4524ac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion scGNN.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,11 @@ def train(epoch, train_loader=train_loader, EMFlag=False, taskType='celltype', s
for i in range(len(set(listResult))):
clusterIndexList.append([])
for i in range(len(listResult)):
clusterIndexList[listResult[i]].append(i)
assignee = listResult[i]
# Avoid bugs for maxClusterNumber
if assignee == args.maxClusterNumber:
assignee = args.maxClusterNumber-1
clusterIndexList[assignee].append(i)

reconNew = np.zeros(
(scData.features.shape[0], scData.features.shape[1]))
Expand Down
2 changes: 1 addition & 1 deletion util_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ def trimClustering(listResult, minMemberinCluster=5, maxClusterNumber=30):
size = len(set(listResult))
changeDict = {}
for item in range(size):
if numDict[item] < minMemberinCluster and item >= maxClusterNumber:
if numDict[item] < minMemberinCluster or item >= maxClusterNumber:
changeDict[item] = ''

count = 0
Expand Down

0 comments on commit a4524ac

Please sign in to comment.