drieslab / Giotto

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

Is it possible to use createGiottoObject with scRNAseq data? #116

Closed smk5g5 closed 3 years ago

smk5g5 commented 3 years ago

Since I can't use my seurat objects averaged cell type matrix directly (for deconvolution) since I keep getting the quadprog solve error

Error in quadprog::solve.QP(D/sc, d/sc, A, bzero) :
  NA/NaN/Inf in foreign function call (arg 1)

I thought I should convert the seurat object into anndata object then I will import the scrnaseq data into giotto but after unsuccessfully struggling to use anndataToGiotto I tried to follow the tutorials here

https://github.com/bernard2012/spatial_dataset_tutorial/blob/dae24d5c676712d40042941d928425c7fe38f900/slideseq.part1/README.md

sc <- reticulate::import("scanpy") pd <- reticulate::import("pandas") adata <- sc$read(anndata_path) exprs <- t(adata$layers[['counts']]) colnames(exprs) <- adata$obs_names$to_list() rownames(exprs) <- adata$var_names$to_list() my_cell_metadata <- as.data.frame(adata$obs) workdir = "B185/giotto" myinst=createGiottoInstructions(save_plot=T, show_plot=F, save_dir=workdir) B185_giotto_scrnaseq <- createGiottoObject(raw_exprs = as.matrix(exprs), instructions=myinst,cell_metadata=my_cell_metadata)

But now I am stuck at this error :

 Giotto does not automatically install all these packages as they are not absolutely required and this reduces the number of dependencies
List of 1
 $ raw: num [1:19969, 1:24409] 0 0 0 0 0 0 0 0 0 0 ...
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : chr [1:19969] "AL627309.5" "AP006222.2" "LINC01409" "FAM87B" ...
  .. ..$ : chr [1:24409] "B185_1_B185_1_count_cellranger5_AAACCTGAGAAGGACA-1" "B185_1_B185_1_count_cellranger5_AAACCTGAGACAAGCC-1" "B185_1_B185_1_count_cellranger5_AAACCTGCAAGCGTAG-1" "B185_1_B185_1_count_cellranger5_AAACCTGCATGTCGAT-1" ...
NULL
Depth of provided expression list is 1, working with one type of molecular feature

Error in extract_spatial_locations_list(gobject, spat_loc_list = spatial_locs,  :

 the raw / real / physical coordinates must be provided with name 'raw'
In addition: Warning message:
In createGiottoObject(raw_exprs = as.matrix(exprs), spatial_locs = 0,  :
  raw_exprs argument is deprecated, use expression argument in the future

I was wondering if there is anyway possible to create a single cell RNAseq giotto object without giving spatial_locs variable? Or should I give it a dummy dataframe for the same?

Thanks!

RubD commented 3 years ago

I've updated Giotto (suite) and you can now use Giotto without spatial locations.

joe-jhou2 commented 2 years ago

I've updated Giotto (suite) and you can now use Giotto without spatial locations.

Could you please give more details of how to use this? Try help this function but cannot find it. try seuratToGiotto(se.object) return error "object test not found"