Compute spatial variable genes with spatialDE method

spatialDE(
  gobject = NULL,
  feat_type = NULL,
  spat_unit = NULL,
  spat_loc_name = "raw",
  expression_values = c("raw", "normalized", "scaled", "custom"),
  size = c(4, 2, 1),
  color = c("blue", "green", "red"),
  sig_alpha = 0.5,
  unsig_alpha = 0.5,
  python_path = NULL,
  show_plot = NULL,
  return_plot = NULL,
  save_plot = NULL,
  save_param = list(),
  default_save_name = "SpatialDE"
)

Arguments

gobject

Giotto object

feat_type

feature type

spat_unit

spatial unit

spat_loc_name

name for spatial locations

expression_values

gene expression values to use

size

size of plot

color

low/medium/high color scheme for plot

sig_alpha

alpha value for significance

unsig_alpha

alpha value for unsignificance

python_path

specify specific path to python if required

show_plot

show plot

return_plot

return ggplot object

save_plot

directly save the plot [boolean]

save_param

list of saving parameters, see showSaveParameters

default_save_name

default save name for saving, don't change, change save_name in save_param

Value

a list of data.frames with results and plot (optional)

Details

This function is a wrapper for the SpatialDE method originally implemented in python. See publication doi:10.1038/nmeth.4636

Examples

g <- GiottoData::loadGiottoMini("visium")
#> 1. read Giotto object
#> 2. read Giotto feature information
#> 3. read Giotto spatial information
#> 3.1 read Giotto spatial shape information
#> 3.2 read Giotto spatial centroid information
#> 3.3 read Giotto spatial overlap information
#> 4. read Giotto image information
#> 
#> checking default envname 'giotto_env'
#> a system default python environment was found
#> Using python path:
#>  "/usr/bin/python3"

spatialDE(g)
#> Warning: SpatialDE python module is not installed:
#>             install in the right environment or python path with:
#> 
#>             'pip install spatialde'
#> 
#>             or from within R in the Giotto environment with:
#> 
#>             conda_path = reticulate::miniconda_path()
#>             conda_full_path = paste0(conda_path,'/','bin/conda')
#>             full_envname = paste0(conda_path,'/envs/giotto_env')
#>             reticulate::py_install(packages = c('NaiveDE', 'patsy', 'SpatialDE'),
#>                                    envname = full_envname,
#>                                    method = 'conda',
#>                                    conda = conda_full_path,
#>                                    pip = TRUE,
#>                                    python_version = '3.6')
#> using 'SpatialDE' for spatial gene/pattern detection. If used in
#>     published research, please cite:
#>     Svensson, Valentine, Sarah A. Teichmann, and Oliver Stegle.
#>     'SpatialDE: Identification of Spatially Variable Genes.'
#>     Nature Methods 15, no. 5 (May 2018): 343-46.
#>     https://doi.org/10.1038/nmeth.4636.
#> Error in py_run_file_impl(file, local, convert): ModuleNotFoundError: No module named 'pandas'
#> Run `reticulate::py_last_error()` for details.