SCCAF / sccaf

Single-Cell Clustering Assessment Framework
MIT License
85 stars 18 forks source link

Errors when using low_res parameter to constrain optimization #33

Open s2hui opened 4 years ago

s2hui commented 4 years ago

Hello,

Thanks for developing this useful tool!

We currently use Seurat to preprocess our single cell data and I wanted to try using your tool and took the following steps.

1) wrote my seurat object to a loom file 2) read the loom file into python:

adata = sc.read_loom(FILE)

3) loaded the over-clustering assignments @ res=1.2 (computed previously in R/Seurat) into the anndata object:

adata.obs['L1_Round0'] = adata.obs['SCT_snn_res_1.2']

4) updated X_pca to contain the Seurat computed PCA embeddings

adata.obsm['X_pca'] = adata.obsm['pca_cell_embeddings']

5) executed the following (added a lower constraint res = 0.3):

SCCAF_optimize_all(ad=adata, plot=False, min_acc=0.9, prefix ='L1', low_res='SCT_snn_res_0.3', use='pca',n_iter=150)

I get the errors below and I am not sure what is wrong. When I run the above without the low_res parameter it completes 10-12 rounds successfully (however it seems to prefer under clustering, hence wanting to try running it with low_res set).

OUTPUT:

R1norm_cutoff: 0.500000 R2norm_cutoff: 0.050000 Accuracy: 0.000000

Round1 ... Mean CV accuracy: 0.8799 Accuracy on the training set: 0.9441 Accuracy on the hold-out set: 0.8487 Accuracy on the training set: 0.9506 Accuracy on the hold-out set: 0.8477 Accuracy on the training set: 0.9435 Accuracy on the hold-out set: 0.8421 Max R1mat: 0.652632 Max R2mat: 0.006597 min_acc: 0.842117 Traceback (most recent call last): File "", line 1, in File "/usr/local/bin/miniconda2/envs/myPythonEnv/lib/python3.7/site-packages/SCCAF/init.py", line 654, in SCCAF_optimize_all *args, **kwargs) File "/usr/local/bin/miniconda2/envs/myPythonEnv/lib/python3.7/site-packages/SCCAF/init.py", line 861, in SCCAF_optimize zmat = np.minimum.reduce([(R1mat > R1norm_cutoff), conn_mat.values]) ValueError: operands could not be broadcast together with shapes (50,50) (93,93)

Thanks for your help, shui

jtuddenham commented 3 years ago

Hello,

I am running into similar issues as well. I am wondering if there is any update on this. Alternatively @s2hui did you find a fix for this?

Thanks, John