Skip to contents

Get the cell IDs (termed spatial IDs to better reflect when not at the single-cell level) and feature IDs of a giotto object or subobject.

[giotto object specific] When applied on a giotto object, these functions pull from the cell_ID and feat_ID slots. The values within these slots are updated whenever the object is data is changed and, importantly, whenever the active spat_unit and feat_type is set (see activeSpatUnit() and activeFeatType()). New values for these slots are specific to the active spat_unit and feat_type and are detected from either the subcellular level (giottoPolygon and giottoPoints) or the aggregate level (expression matrix) data, with a preference for the latter if it exists. Be aware that with this current behavior, values returned byspatIDs() and featIDs() should be regarded as the minimal set of expected IDs within all giotto slots, and not always the exact set or ordering.

Usage

# S4 method for class 'giotto'
spatIDs(x, spat_unit = NULL, subset, negate = FALSE, quote = TRUE, ...)

# S4 method for class 'exprObj'
spatIDs(x, ...)

# S4 method for class 'spatLocsObj'
spatIDs(x, ...)

# S4 method for class 'cellMetaObj'
spatIDs(x, ...)

# S4 method for class 'spatialNetworkObj'
spatIDs(x, ...)

# S4 method for class 'dimObj'
spatIDs(x, ...)

# S4 method for class 'giottoPolygon'
spatIDs(x, use_cache = TRUE, uniques = TRUE, ...)

# S4 method for class 'spatEnrObj'
spatIDs(x, ...)

# S4 method for class 'nnNetObj'
spatIDs(x, ...)

# S4 method for class 'giotto'
featIDs(x, feat_type = NULL, subset, negate = FALSE, quote = TRUE, ...)

# S4 method for class 'exprObj'
featIDs(x, ...)

# S4 method for class 'featMetaObj'
featIDs(x, ...)

# S4 method for class 'giottoPoints'
featIDs(x, use_cache = TRUE, uniques = TRUE, ...)

# S4 method for class 'spatEnrObj'
featIDs(x, ...)

Arguments

x

an object

spat_unit

(optional) specify which spatial unit

subset

logical expression to find a subset of features.

negate

logical. if TRUE all IDs that are not in the subset are selected

quote

logical. If TRUE, the subset param will be quoted with substitute(). Set this to FALSE when calling from a function, although that may not be recommended since NSE output can be unexpected when not used interactively.

...

additional params to pass when used with the subset param. For spatID(), these pass to spatValues(). For featID(), these currently only pass to fDataDT().

use_cache

use cached IDs if available (gpoly and gpoints only)

uniques

return unique ID values only (currently gpoly and gpoints only)

feat_type

(optional) specify which feature type

Value

character vector of cell/spatial IDs or feature IDs

Examples

g <- GiottoData::loadGiottoMini("vis")
#> Error in match.arg(dataset, choices = c(names(mini_gobject_manifest))): 'arg' should be one of “visium”, “visium_multisample”, “vizgen”, “cosmx”, “seqfish”, “starmap”, “spatialgenomics”
spatIDs(g)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'spatIDs': object 'g' not found
spatIDs(g, subset = nr_feats <= 200)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'spatIDs': object 'g' not found
spatIDs(g, subset = Dim.1 > 25, dim_reduction_to_use = "umap")
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'spatIDs': object 'g' not found

featIDs(g)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'featIDs': object 'g' not found
featIDs(g, subset = nr_cells < 100)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'featIDs': object 'g' not found

gpoints <- GiottoData::loadSubObjectMini("giottoPoints")
featIDs(gpoints)
#>   [1] "Mlc1"      "Gprc5b"    "Gfap"      "Ednrb"     "Sox9"      "Aqp4"     
#>   [7] "Gjc3"      "Sox8"      "Ntsr2"     "Adcyap1r1" "Smo"       "Gpr161"   
#>  [13] "C1qb"      "Olig1"     "C1qa"      "Lmtk2"     "Pth1r"     "Ephb6"    
#>  [19] "Gpr26"     "Gabbr1"    "Adra2a"    "Gabbr2"    "Timp4"     "Abcc9"    
#>  [25] "Csf1r"     "Ntrk2"     "Adgrg1"    "Ntrk3"     "Ddr1"      "Erbb4"    
#>  [31] "Selplg"    "Cspg5"     "Dlk1"      "Gpr37l1"   "Fzd1"      "Fgfr3"    
#>  [37] "Slc25a18"  "Igf1r"     "Adgrl1"    "S1pr1"     "Ryk"       "Grm5"     
#>  [43] "Eomes"     "Axl"       "Efemp1"    "Adgrb3"    "Sstr4"     "Fn1"      
#>  [49] "Adora1"    "Erbb2"     "Gper1"     "Gramd3"    "Mertk"     "Slc32a1"  
#>  [55] "Adgra1"    "Adgrl2"    "Ptgfr"     "Fzd2"      "Aldh1l1"   "Adgrg6"   
#>  [61] "Egfr"      "Gpr162"    "Lpar4"     "Kit"       "Ptgdr"     "Gad1"     
#>  [67] "Lgr4"      "Tyro3"     "Atp13a5"   "Ddr2"      "Rspo3"     "Arhgap29" 
#>  [73] "Ackr3"     "Gpr146"    "Fzd7"      "Slc47a1"   "Insr"      "Ptger3"   
#>  [79] "Bdkrb1"    "Traf4"     "Celsr2"    "Fzd4"      "Fgfr2"     "Cx3cr1"   
#>  [85] "Anxa11"    "Adgrb1"    "Lpar1"     "Gpr17"     "Gpr173"    "Ror1"     
#>  [91] "Cxcl12"    "Kiss1r"    "Epha4"     "Gpr182"    "Man1a"     "Gpr4"     
#>  [97] "P2ry14"    "Hcar1"     "Ephb1"     "Adrb1"     "Grm3"      "P2ry1"    
#> [103] "Nrp2"      "Ptk7"      "Slco1a4"   "Tmem108"   "Hrh3"      "Insrr"    
#> [109] "Cmklr1"    "Opn3"      "Adra1b"    "Gpr62"     "Npy1r"     "Nrp1"     
#> [115] "Fzd6"      "S1pr5"     "Pdgfrb"    "Flt1"      "Chrm3"     "Agtr1a"   
#> [121] "Adgrl4"    "Ephb3"     "Lpar6"     "Epha6"     "Fzd5"      "Emcn"     
#> [127] "Cldn5"     "Sstr1"     "Fzd3"      "P2ry12"    "Adgrl3"    "Sema4d"   
#> [133] "Adgrf5"    "Gpr160"    "Mrgpre"    "Amigo2"    "Adgra3"    "P2yr13"   
#> [139] "Epha3"     "Adgre1"    "P2ry6"     "Cx3cl1"    "Epha10"    "Tacr1"    
#> [145] "Peg10"     "Ednra"     "Plxnb3"    "Flt4"      "Slc17a7"   "Drd2"     
#> [151] "Tjap1"     "Fzd8"      "Cd300c2"   "Htr4"      "Gpr52"     "Tek"      
#> [157] "S1pr2"     "Kdr"       "Ror2"      "Kcnj8"     "Hrh1"      "Celsr1"   
#> [163] "Gpr153"    "S1pr3"     "Adgra2"    "Fgfrl1"    "Tie1"      "Slc15a3"  
#> [169] "Ccr10"     "Pdgfra"    "Lhcgr"     "Mrgprf"    "Ascl1"     "Baiap2"   
#> [175] "Gpr85"     "Gpr22"     "Gcgr"      "Grm1"      "Ptafr"     "Calcrl"   
#> [181] "Gpr34"     "Cenpe"     "Adora2b"   "Adrb2"     "Ccr2"      "Alk"      
#> [187] "Tacr3"     "Chrm5"     "Erbb3"     "Ccr9"      "Gpr21"     "Epha7"    
#> [193] "Adra2b"    "Pcdh15"    "Blank-104" "Adora2a"   "Drd1"      "Blank-57" 
#> [199] "Grm7"      "Htr1b"     "Fzd9"      "Grm4"      "Blank-152" "Aplnr"    
#> [205] "Gpr176"    "F2r"       "Vmn1r43"   "Gpr156"    "Gpr55"     "Blank-155"
#> [211] "Bdkrb2"    "C5ar2"     "Gpbar1"    "Adgrv1"    "Gprc5c"    "Lmod1"    
#> [217] "Gpr135"    "Rxfp3"     "Tbxa2r"    "Fzd10"     "Ret"       "Blank-80" 
#> [223] "Epha8"     "Gpr75"     "Ackr1"     "Adgrg4"    "Chrm1"     "Epha1"    
#> [229] "Vmn2r1"    "Syt4"      "Tas2r135"  "Ccr1"      "Lpar2"     "Myh11"    
#> [235] "Gipr"      "Musk"      "Gpr183"    "Cnr1"      "C3ar1"     "S1pr4"    
#> [241] "Grm2"      "C5ar1"     "Ephb2"     "Fpr1"      "Rho"       "Gpr27"    
#> [247] "Adra1d"    "Gpr157"    "Adgrg2"    "Blank-45"  "Gpr20"     "Casr"     
#> [253] "Avpr2"     "Mc5r"      "Sctr"      "Epha5"     "Gpr158"    "Cxcr4"    
#> [259] "Vipr1"     "Gpr6"      "Blank-148" "Celsr3"    "Uts2r"     "Hrh2"     
#> [265] "Htr6"      "Slc17a6"   "Gpr1"      "Glp2r"     "Ppp1r3g"   "V1ra8"    
#> [271] "Trhr"      "Sstr3"     "Gpr63"     "Htr1a"     "F2rl3"     "Pln"      
#> [277] "Grin2b"    "Gpr37"     "Chrm4"     "Lgr6"      "Gpr61"     "Taar7e"   
#> [283] "Mas1"      "Npy2r"     "Ptger2"    "P2ry2"     "Oprm1"     "Prokr2"   
#> [289] "Adra1a"    "Gpr45"     "Mc4r"      "Blank-128" "Sstr2"     "Flt3"     
#> [295] "Htr5a"     "Ghsr"      "Galr1"     "Blank-95"  "Gpr83"     "Crhr1"    
#> [301] "Brs3"      "Drd5"      "Gpr139"    "Taar6"     "Htr5b"     "Vmn1r40"  
#> [307] "Rrh"       "Blank-83"  "Crhr2"     "Blank-161" "Vmn1r50"   "Tas1r3"   
#> [313] "Taar2"     "P2ry4"     "Mchr1"     "Tas1r1"    "Blank-69"  "Htr7"     
#> [319] "Hcrtr2"    "Htr2a"     "Cysltr2"   "Vmn1r46"   "Grpr"      "Adgrf2"   
#> [325] "Blank-127" "Opn5"      "Taar3"     "Oxtr"      "Cckbr"     "Nmbr"     
#> [331] "Ptger4"    "Blank-145" "Gpr101"    "Slc17a8"   "Adgrf4"    "Epha2"    
#> [337] "Blank-139"