filter Giotto object based on expression threshold

filterGiotto(
  gobject,
  spat_unit = NULL,
  feat_type = NULL,
  expression_values = c("raw", "normalized", "scaled", "custom"),
  expression_threshold = 1,
  feat_det_in_min_cells = 100,
  min_det_feats_per_cell = 100,
  spat_unit_fsub = ":all:",
  feat_type_ssub = ":all:",
  all_spat_units = NULL,
  all_feat_types = NULL,
  poly_info = NULL,
  tag_cells = FALSE,
  tag_cell_name = "tag",
  tag_feats = FALSE,
  tag_feats_name = "tag",
  verbose = TRUE
)

Arguments

gobject

giotto object

spat_unit

character. spatial unit. If more than one is provided then the first will be filtered, the filtering results will be applied across the other spat_units provided

feat_type

character. feature type. If more than one is provided then the first will be filtered, the filtering results will be applied across the other feat_types provided.

expression_values

expression values to use

expression_threshold

threshold to consider a gene expressed

feat_det_in_min_cells

minimum # of cells that need to express a feature

min_det_feats_per_cell

minimum # of features that need to be detected in a cell

spat_unit_fsub

character vector. (default = ':all:') limit features to remove results to selected spat_units

feat_type_ssub

character vector. (default = ':all:') limit cells to remove results to selected feat_types

all_spat_units

deprecated. Use spat_unit_fsub = ":all:"

all_feat_types

deprecated. Use feat_type_ssub = ":all:"

poly_info

polygon information to use

tag_cells

tag filtered cells in metadata vs. remove cells

tag_cell_name

column name for tagged cells in metadata

tag_feats

tag features in metadata vs. remove features

tag_feats_name

column name for tagged features in metadata

verbose

verbose

Value

giotto object

Details

The function filterCombinations can be used to explore the effect of different parameter values. Please note that this function filters data in a predefined order, features, then cells. After filtering in this order, certain features may be left over in the metadata with a corresponding number of cells which is less than that of the threshold value of cells, feat_det_in_min_cells. This behavior is explained in detail here: https://github.com/drieslab/Giotto/issues/500#issuecomment-1396083446

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
#> python already initialized in this session
#>  active environment : '/usr/bin/python3'
#>  python version : 3.10
#> checking default envname 'giotto_env'
#> a system default python environment was found
#> Using python path:
#>  "/usr/bin/python3"

filterGiotto(g)
#> completed 1: preparation
#> completed 2: subset expression data
#> completed 3: subset spatial locations
#> completed 4: subset cell metadata
#> completed 5: subset feature metadata
#> completed 6: subset spatial network(s)
#> completed 7: subsetted dimension reductions
#> completed 8: subsetted nearest network(s)
#> completed 9: subsetted spatial enrichment results
#> for cell
#> --> cell found back in polygon layer: cell
#> completed 10: subsetted spatial information data
#> 
#> Feature type:  rna 
#> Number of cells removed:  2  out of  624 
#> Number of feats removed:  93  out of  634 
#> An object of class giotto 
#> >Active spat_unit:  cell 
#> >Active feat_type:  rna 
#> dimensions    : 541, 622 (features, cells)
#> [SUBCELLULAR INFO]
#> polygons      : cell 
#> [AGGREGATE INFO]
#> expression -----------------------
#>   [cell][rna] raw normalized scaled
#> spatial locations ----------------
#>   [cell] raw
#> spatial networks -----------------
#>   [cell] Delaunay_network spatial_network
#> spatial enrichments --------------
#>   [cell][rna] cluster_metagene DWLS
#> dim reduction --------------------
#>   [cell][rna] pca custom_pca umap custom_umap tsne
#> nearest neighbor networks --------
#>   [cell][rna] sNN.pca custom_NN
#> attached images ------------------
#> images      : alignment image 
#> 
#> 
#> Use objHistory() to see steps and params used