Create the PRECAST object with preprocessing step.

CreatePRECASTObject(seuList,  project = "PRECAST",  gene.number=2000, 
                    selectGenesMethod='SPARK-X',numCores_sparkx=1,  
                    customGenelist=NULL, premin.spots = 20,  
                    premin.features=20, postmin.spots=15, postmin.features=15,
                              rawData.preserve=FALSE,verbose=TRUE)

Arguments

seuList

a list consisting of Seurat objects, where each object is a SRT data batch. The default assay of each Seurat object will be used for data preprocessing and followed model fitting. The specified format about seuList argument can be referred to the details and example.

project

An optional string, name of the project, default as "PRECAST".

gene.number

an optional integer, the number of top spatially variable genes (SVGs) or highly variable genes (HVGs) to be chosen.

selectGenesMethod

an optional integer, the method to select genes for each sample. It supports 'SPARK-X' and 'HVGs' to select genes now. Users can provide self-selected genes using customGenelist argument.

numCores_sparkx

an optional integer, specify the number of CPU cores in SPARK package to use when selecting spatial genes.

customGenelist

an optional string vector, the list of user specified genes to be used for PRECAST model fitting. If this argument is given, SVGs/HVGs will not be selected.

premin.spots

An optional integer, the features (genes) are retained in raw data filtering step with at least premin.spots number of spots, default is 20.

premin.features

An optional integer, the locations are retained in raw data filtering step with at least premin.features number of nonzero-count features (genes), default is 20.

postmin.spots

An optional integer, the features (genes) are retained in filtering step after common genes selected among all data batches with at least postmin.spots number of spots, default is 15.

postmin.features

An optional integer, the locations are retained in filtering step after common genes selected among all data batches with at least postmin.features number of nonzero-count features (genes), default is 15.

rawData.preserve

An optional logical value, whether preserve the raw seuList data.

verbose

whether display the message in the creating process.

Details

seuList is a list with Seurat object as component, and each Seurat object includes the raw expression count matrix, spatial coordinates and meta data for each data batch, where the spatial coordinates information must be saved in the metadata of Seurat, named "row" and "col" for each data batch.

Value

Returns PRECAST object prepared for PRECAST model fitting. See PRECASTObj-class for more details.

Examples

  data(PRECASTObj)
  library(Seurat)
#> Warning: package 'Seurat' was built under R version 4.1.3
#> Attaching SeuratObject
#> Attaching sp
  seuList <- PRECASTObj@seulist
  ## Check the input of seuList for create PRECAST object.
  ## Check the default assay for each data batch
  lapply(seuList, DefaultAssay)
#> [[1]]
#> [1] "RNA"
#> 
#> [[2]]
#> [1] "RNA"
#> 
  ## Check the spatial coordinates in the meta data named "row" and "col".
  head(seuList[[1]]@meta.data)
#>         orig.ident nCount_RNA nFeature_RNA row col true_cluster
#> cell1_1      cell1      10004           55   1   1            2
#> cell1_2      cell1      12614           54   2   1            2
#> cell1_3      cell1      18233           57   3   1            2
#> cell1_4      cell1       1726           50   4   1            7
#> cell1_5      cell1       3451           53   5   1            7
#> cell1_6      cell1     134457           60   6   1            6
  ## Then create PRECAST object using this seuList.
  ## For convenience, we show the  user-specified genes' list for creating PRECAST object.
  ## Users can use SVGs from SPARK-X or HVGs.
  PRECASTObj2 <- CreatePRECASTObject(seuList, 
   customGenelist= row.names(seuList[[1]]), verbose=FALSE)
#>  
#>