shangll123 / SpatialPCA

Spatially aware dimension reduction for spatial transcriptomics.
40 stars 9 forks source link

unable to reproduce example the website #11

Closed william-denault closed 6 months ago

william-denault commented 7 months ago

Hello

I am trying to reproduce the example from this page https://lulushang.org/SpatialPCA_Tutorial/DLPFC.html I downloaded the data here https://drive.google.com/drive/folders/1mkXV3kQKqwxk42SW4Rb263FgFj2K8HhT?usp=sharing (as you indicated).

Please find below the error message I got

Please let me know what I need to modify.

best regards, William


> library(SpatialPCA)
> library(ggplot2)
>
>
> sample_names=c("151507", "151508", "151509", "151510", "151669", "151670", "151671" ,"151672","151673", "151674" ,"151675" ,> i=9 # Here we take the 9th sample as example, in total there are 12 samples (numbered as 1-12), the user can test on other s> clusterNum=c(7,7,7,7,5,5,5,5,7,7,7,7) # each sample has different ground truth cluster number
>
>
> load( paste0("/home/wdenault/spatial_RNA_seq/data_spatial_PCA/DLPFC/LIBD_sample",i,".RData"))
> print(dim(count_sub)) # The count matrix
[1] 33538  3639
> print(dim(xy_coords)) # The x and y coordinates. We flipped the y axis for visualization.
[1] 3639    2
>
>
>
>
> # location matrix: n x 2, count matrix: g x n.
> # here n is spot number, g is gene number.
> xy_coords = as.matrix(xy_coords)
> rownames(xy_coords) = colnames(count_sub) # the rownames of location should match with the colnames of count matrix
> LIBD = CreateSpatialPCAObject(counts=count_sub,
+                               location=xy_coords,
+                               project = "SpatialPCA",
+                               gene.type="spatial",
+                               sparkversion="spark",
+                               numCores_spark=5,
+                               gene.number=3000,
+                               customGenelist=NULL,
+                               min.loctions = 20,
+                               min.features=20)
## Use SCTransform function in Seurat to normalize data.
Running SCTransform on assay: RNA
Running SCTransform on layer: counts
vst.flavor='v2' set. Using model with fixed slope and excluding poisson genes.
Variance stabilizing transformation of count matrix of size 15124 by 3639
Model formula is y ~ log_umi
Get Negative Binomial regression parameters per gene
Using 2000 genes, 3639 cells
Error: useNames = NA is defunct. Instead, specify either useNames = TRUE or useNames = FALSE.
shangll123 commented 7 months ago

Hi William,

Thank you for your interest in our package! But I couldn't repeat your error message, I guess there might be some package version issues? Please refer to https://github.com/shangll123/SpatialPCA/issues/10, where I provided the versions of packages that I used on our HPC server. Please feel free to let me know if it still doesn't work.

Best, Lulu