zhanghao-njmu / SCP

An end-to-end Single-Cell Pipeline designed to facilitate comprehensive analysis and exploration of single-cell data.
https://zhanghao-njmu.github.io/SCP/
GNU General Public License v3.0
357 stars 81 forks source link

ValueError: Did not find PCA in `.obsm.keys() #144

Closed MinjieHu closed 1 year ago

MinjieHu commented 1 year ago

Hi there, Thanks for the great pipeline!

I encountered this error when I try to run RunSCVELO. Here is error message

Warning: sparse->dense coercion: allocating vector of size 1.1 GiBAssay 'integrated' is in the srt object but not converted.
Assay 'ambiguous' is in the srt object but not converted.
'misc' slot is not converted.
'tools' slot is not converted.
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
Filtered out 13400 genes that are detected 30 counts (shared).
Normalized count data: X, spliced, unspliced.
WARNING: Did not modify X as it looks preprocessed already.
computing neighbors
Error: ValueError: Did not find PCA in `.obsm.keys()`. You need to compute it first.

I have tried to re-run Standard_SCP or RunPCA, but neither works.

Thanks in advance for the help!

Minjie

MinjieHu commented 1 year ago

When I tried to run the example data, I run into an error "Error: AttributeError: can't set attribute"

Here is all the code I used

data("pancreas_sub")
pancreas_sub <- Standard_SCP(srt = pancreas_sub)
pancreas_sub <- RunSCVELO(
  srt = pancreas_sub, group_by = "SubCellType",
  linear_reduction = "PCA", nonlinear_reduction = "UMAP"
)
VelocityPlot(srt = pancreas_sub, reduction = "UMAP", group_by = "SubCellType")

And here are the outputs:

[2023-08-19 02:17:15.061111] Start Standard_SCP
[2023-08-19 02:17:15.062304] Checking srtList... ...
Data 1/1 of the srtList is raw_counts. Perform NormalizeData(LogNormalize) on the data ...
Perform FindVariableFeatures on the data 1/1 of the srtList...
Use the separate HVF from srtList...
Number of available HVF: 2000
[2023-08-19 02:17:16.890061] Finished checking.
[2023-08-19 02:17:16.890548] Perform ScaleData on the data...
[2023-08-19 02:17:17.026053] Perform linear dimension reduction (pca) on the data...
[2023-08-19 02:17:19.077435] Perform FindClusters (louvain) on the data...
[2023-08-19 02:17:19.212662] Reorder clusters...
[2023-08-19 02:17:19.599965] Perform nonlinear dimension reduction (umap) on the data...
Non-linear dimensionality reduction(umap) using Reduction(Standardpca, dims_range:1-50) as input
Non-linear dimensionality reduction(umap) using Reduction(Standardpca, dims_range:1-50) as input
[2023-08-19 02:17:27.935223] Standard_SCP done
Elapsed time: 12.87 secs 
'misc' slot is not converted.
'tools' slot is not converted.
Filtered out 12123 genes that are detected 30 counts (shared).
Normalized count data: X, spliced, unspliced.
Logarithmized X.
computing neighbors
    finished (0:00:00) --> added 
    'distances' and 'connectivities', weighted adjacency matrices (adata.obsp)
computing moments based on connectivities
    finished (0:00:00) --> added 
    'Ms' and 'Mu', moments of un/spliced abundances (adata.layers)
computing velocities
    finished (0:00:00) --> added 
    'stochastic', velocity vectors for each individual cell (adata.layers)
computing velocity graph (using 1/96 cores)
    finished (0:00:00) --> added 
    'stochastic_graph', sparse matrix with cosine correlations (adata.uns)
Renamed 'UMAP' to convention 'X_UMAP' (adata.obsm).
MinjieHu commented 1 year ago

I got the first issue solved. The name for PCA reduction in my object is “pca”. When using “PCA” indicated in the code doesn’t match with the reduction name in the object.

However, after getting it solved, I ran into the same error as the example data

zhanghao-njmu commented 1 year ago

The issue was caused by the "srt_to_adata" function. SCP has fixed this bug in version v0.5.1. You can try installing this version and running the tests again.

jjccco commented 5 months ago

I got the first issue solved. The name for PCA reduction in my object is “pca”. When using “PCA” indicated in the code doesn’t match with the reduction name in the object.

However, after getting it solved, I ran into the same error as the example data

I just solve this question by using lowercase, like "pca" and "umap".