File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 22import numpy as np
33from scvi .external import cytovi
44from sklearn .cluster import KMeans
5+ from threadpoolctl import threadpool_limits
56
67## VIASH START
78par = {
3738
3839print ("Clustering using k-means with k =" , par ["n_clusters" ], flush = True )
3940# cluster data using Kmeans
40- adata_to_correct .obs ["clusters" ] = (
41- KMeans (n_clusters = par ["n_clusters" ], random_state = 0 )
42- .fit_predict (adata_to_correct .layers ["scaled" ])
43- .astype (str )
44- )
41+ with threadpool_limits (limits = 1 ):
42+ adata_to_correct .obs ["clusters" ] = (
43+ KMeans (n_clusters = par ["n_clusters" ], random_state = 0 )
44+ .fit_predict (adata_to_correct .layers ["scaled" ])
45+ .astype (str )
46+ )
4547# concatenate obs so we can use it for subsampling
4648adata_to_correct .obs ["sample_cluster" ] = (
4749 adata_to_correct .obs ["sample" ].astype (str ) + "_" + adata_to_correct .obs ["clusters" ]
You can’t perform that action at this time.
0 commit comments