drieslab / Giotto

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

error running trendSceek #149

Open rvanguri opened 2 years ago

rvanguri commented 2 years ago

I am unable to run trendSceek in a fresh conda environment.

using 'trendsceek' for spatial gene/pattern detection. If used in published research, please cite:
  Edsgard, Daniel, Per Johnsson, and Rickard Sandberg. 'Identification of Spatial Expression Trends in Single-Cell Gene Expression Data.'
          Nature Methods 15, no. 5 (May 2018): 339-42. https://doi.org/10.1038/nmeth.4634.
Error: 'ppp' is not an exported object from 'namespace:spatstat'

Here is the script I am using:

library(Giotto)
data_path = '/path/to/visiumdata/'
workdir="/path/to/workdir"
expr_data_path=fs::path(data_path, "raw_feature_bc_matrix")
raw_matrix=get10Xmatrix(path_to_data=expr_data_path, gene_column_index=2)
spatial_locations=data.table::fread(fs::path(data_path, "spatial", "tissue_positions_list.csv"))
spatial_locations = spatial_locations[match(colnames(raw_matrix), V1)]
colnames(spatial_locations) = c('barcode', 'in_tissue', 'array_row', 'array_col', 'col_pxl', 'row_pxl')
myinst=createGiottoInstructions(save_plot=T, show_plot=F, save_dir=workdir, python_path="/workdir/miniconda3/envs/giottoenv/bin/python")

visium <- createGiottoObject(raw_exprs = raw_matrix, spatial_locs = spatial_locations[,.(row_pxl,-col_pxl)], instructions = myinst, cell_metadata = spatial_locations[,.(in_tissue, array_row, array_col)])

visium <- normalizeGiotto(gobject = visium, scalefactor = 6000, verbose = T)
tsres <- trendSceek(visium, expression_values="normalized")

Any advice would be appreciated!

ndelrossi7 commented 2 years ago

Hi @rvanguri! Could you please try updating your version of sf? I think this is an error specific to spatstat and this is the info I found for it online: https://github.com/spatstat/spatstat/issues/152. Thanks!

rvanguri commented 2 years ago

Hi @ndelrossi7, thanks for the reply! My sf is at the latest version in CRAN (1.0.3) and I am still getting the same error.

sistia01 commented 2 years ago

Hi! Thanks for using Giotto!

The trendSceek() function is a wrapper function for the trendsceek package. Unfortunately, this package has not been updated in several years while its dependencies have. Therefore, users have had trouble using the function. One of the issues that users have run into is the following error code.

Error: 'ppp' is not an exported object from 'namespace:spatstat' See this link for further information.

We believe that this error likely comes from the updated spatstat function (which trendsecek depends on) which is causing the outdated trendsceek package to be nonfunctional. Due to the high rate of user errors we have decided to deprecate the trendsceek() function within Giotto.

Giotto does provide other options to determine genes with a spatially coherent expression pattern, including binSpect(), SpatialDE() and spark() and all work well on both simulated and real datasets. For more information, please see the documentation section of our website for more information.