drieslab / Giotto

Spatial omics analysis toolbox
https://drieslab.github.io/Giotto_website/
Other
258 stars 98 forks source link

PCA reduction="genes" #100

Closed GiovanniCS closed 3 years ago

GiovanniCS commented 3 years ago

Hello, when i try the snippet below, i get "Error in dimnames(x) <- dn : length of 'dimnames' [1] not equal to array extent". I'm quite confident I'm not doing something wrong..

//bash code wget https://cf.10xgenomics.com/samples/spatial-exp/1.1.0/V1_Mouse_Kidney/V1_Mouse_Kidney_spatial.tar.gz wget https://cf.10xgenomics.com/samples/spatial-exp/1.1.0/V1_Mouse_Kidney/V1_Mouse_Kidney_filtered_feature_bc_matrix.h5 tar -xzf V1_Mouse_Kidney_spatial.tar.gz mkdir filtered_feature_bc_matrix && cp -r spatial filtered_feature_bc_matrix cp V1_Mouse_Kidney_filtered_feature_bc_matrix.h5 filtered_feature_bc_matrix cd filtered_feature_bc_matrix && R

//R code library(Giotto) pcaDimensions=10

my_giotto_object = createGiottoVisiumObject(visium_dir="./", expr_data="filter", h5_visium_path="filtered_feature_bc_matrix.h5",h5_tissue_positions_path="./spatial/tissue_positions_list.csv") my_giotto_object <- normalizeGiotto(gobject = my_giotto_object) my_giotto_object <- runPCA(gobject = my_giotto_object,ncp=pcaDimensions,reduction="genes")

RubD commented 3 years ago

Hi, The reduction="genes" is currently not implemented yet. We kept this open as a possible future addition, but we're not sure if anyone wants to do this. The default reduction="cells" should work and that will create PC dimensions for your cells. This is what most people want to do. Is there a reason you want to describe the genes in a reduced dimension?

GiovanniCS commented 3 years ago

Hi, thank you for answering my issue. It's my fault, I thought my_giotto_object@dimension_reduction$cells$pca$pca$misc$loadings were the pca values (that are genes x pcaDimensions). I was trying "genes" because I wanted spots x pcaDimensions. Since pca values are in my_giotto_object@dimension_reduction$cells$pca$pca$coordinates my problem is solved.

Thank you again.