Detect features that are spatially correlated
detectSpatialCorFeats(
gobject,
spat_unit = NULL,
feat_type = NULL,
spat_loc_name = "raw",
method = c("grid", "network"),
expression_values = c("normalized", "scaled", "custom"),
subset_feats = NULL,
spatial_network_name = "Delaunay_network",
network_smoothing = NULL,
spatial_grid_name = "spatial_grid",
min_cells_per_grid = 4,
cor_method = c("pearson", "kendall", "spearman")
)
giotto object
spatial unit
feature type
name for spatial locations
method to use for spatial averaging
gene expression values to use
subset of feats to use
name of spatial network to use
smoothing factor beteen 0 and 1 (default: automatic)
name of spatial grid to use
minimum number of cells to consider a grid
correlation method
returns a spatial correlation object: "spatCorObject"
For method = network, it expects a fully connected spatial network. You
can make sure to create a
fully connected network by setting minimal_k > 0 in the
createSpatialNetwork
function.
1. grid-averaging: average gene expression values within a predefined spatial grid
2. network-averaging: smoothens the gene expression matrix by averaging the expression within one cell by using the neighbours within the predefined spatial network. b is a smoothening factor that defaults to 1 - 1/k, where k is the median number of k-neighbors in the selected spatial network. Setting b = 0 means no smoothing and b = 1 means no contribution from its own expression.
The spatCorObject can be further explored with showSpatialCorFeats()
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
#> cell_spatInfo_spatVector.shp
#> cell
#>
#> 3.2 read Giotto spatial centroid information
#> cell
#>
#> 3.3 read Giotto spatial overlap information
#> No overlaps were found, overlap loading will be
#> skipped
#>
#> 4. read Giotto image information
#> a giotto python environment was found
#> Using python path:
#> "/Users/yuanlab/Library/r-miniconda/envs/giotto_env/bin/pythonw"
detectSpatialCorFeats(g, method = "network")
#> $cor_DT
#> feat_ID variable spat_cor expr_cor cordiff spatrank
#> <char> <fctr> <num> <num> <num> <int>
#> 1: 1110017D15Rik 1110017D15Rik 1.0000000 1.0000000 0.00000000 1
#> 2: 1110017D15Rik Dnali1 0.5152451 0.3690438 0.14620131 2
#> 3: 1110017D15Rik Spag8 0.5044653 0.3180572 0.18640810 3
#> 4: 1110017D15Rik 1700001C02Rik 0.4957575 0.4021766 0.09358091 4
#> 5: 1110017D15Rik Ccdc153 0.4947645 0.4050736 0.08969090 5
#> ---
#> 401952: Zmat4 Cabp7 -0.3106553 -0.2099353 -0.10072002 630
#> 401953: Zmat4 Sst -0.3310337 -0.1903481 -0.14068568 631
#> 401954: Zmat4 Hopx -0.3886083 -0.2587739 -0.12983435 632
#> 401955: Zmat4 Ttr -0.4280274 -0.3482754 -0.07975206 633
#> 401956: Zmat4 Gfap -0.4757224 -0.3562773 -0.11944508 634
#> exprrank rankdiff
#> <int> <int>
#> 1: 1 0
#> 2: 6 -4
#> 3: 10 -7
#> 4: 3 1
#> 5: 2 3
#> ---
#> 401952: 630 0
#> 401953: 627 4
#> 401954: 632 0
#> 401955: 633 0
#> 401956: 634 0
#>
#> $feat_order
#> [1] "Gna12" "Ccnd2" "Btbd17" "Sox9"
#> [5] "Sez6" "Serpinf1" "S100a6" "Col1a1"
#> [9] "Vwf" "Esam" "Npas1" "Tiam1"
#> [13] "Bcam" "Hmgn2" "Rab3b" "Inmt"
#> [17] "Ddr1" "Homer3" "Cp" "Calb2"
#> [21] "Man1a" "Efnb3" "Hlf" "Gstm7"
#> [25] "Cavin1" "Sst" "Hapln2" "Hspb1"
#> [29] "Ndrg1" "Nid1" "Kit" "Pvalb"
#> [33] "Tmbim1" "Crip1" "Tek" "Elovl1"
#> [37] "Cyba" "Itih3" "Cnp" "Hap1"
#> [41] "Clic1" "Stx1a" "Arpp19" "Dio2"
#> [45] "Id3" "Crlf1" "Ttc9b" "Carhsp1"
#> [49] "Cabp7" "Fam163b" "Rarres2" "Syn2"
#> [53] "Ick" "Prox1" "Adssl1" "Vipr2"
#> [57] "Gltp" "Amotl1" "Bcas1" "Aldh1a2"
#> [61] "Tppp3" "Sirt2" "Lpl" "Cers2"
#> [65] "Qdpr" "Stk32c" "Lbp" "Hsd11b1"
#> [69] "Vtn" "Stac2" "Plxdc1" "Igfbp4"
#> [73] "Dbndd2" "Pltp" "Slc12a4" "Cadps2"
#> [77] "Erbb3" "Pmp22" "Kcnab3" "Myh11"
#> [81] "Plod1" "Etnppl" "Arhgef25" "Rcn3"
#> [85] "Vip" "Utrn" "Grm1" "Reep3"
#> [89] "Fabp7" "Dcn" "Slc17a8" "Dusp6"
#> [93] "Kitl" "Ccn2" "Timp3" "Ascl1"
#> [97] "Unc5b" "Vsir" "Gamt" "Ptprb"
#> [101] "Csrp2" "Adarb1" "Rnf130" "Nefh"
#> [105] "Aebp1" "Sept4" "Gria1" "Sypl"
#> [109] "Arsg" "Cacng4" "Rab37" "Itgb4"
#> [113] "Aspa" "Cygb" "Rflnb" "Doc2b"
#> [117] "Gfap" "Npas3" "Serpina3n" "Clmn"
#> [121] "Prkch" "Fbln5" "Akr1c18" "Gng4"
#> [125] "Sema4d" "Cxcl14" "Hexb" "Iqgap2"
#> [129] "Crhbp" "Rab3c" "Thbs4" "Serinc5"
#> [133] "Erbin" "Prkcd" "Pdlim2" "Ednrb"
#> [137] "Cpne6" "Sema5a" "Matn2" "Nptxr"
#> [141] "Enpp2" "Efcab6" "Ppp1r1a" "Litaf"
#> [145] "Il1rap" "Apod" "Cpox" "Grik1"
#> [149] "Clic6" "Nr4a1" "Igfbp6" "Sncg"
#> [153] "Gzma" "Grm2" "Prph" "Rsph1"
#> [157] "Sox8" "Fam234a" "Lims2" "Aqp4"
#> [161] "Slc12a2" "Cd74" "Pdgfrb" "Csf1r"
#> [165] "Cbln2" "Frmd8" "Gldc" "Tcf7l2"
#> [169] "Bhlhe22" "Kcnip2" "Alas2" "Gdf11"
#> [173] "Baiap2" "Ifitm3" "Phkg1" "Nptx1"
#> [177] "Pde8a" "Itih5" "Homer2" "Fam20c"
#> [181] "Cplx2" "Myo5b" "Snca" "Col3a1"
#> [185] "Ecrg4" "Map4k4" "2010300C02Rik" "Ogfrl1"
#> [189] "Fn1" "Efhd1" "Ngef" "Bok"
#> [193] "Tmem163" "Lct" "Cfh" "Ptpn4"
#> [197] "Tnni1" "Csrp1" "Nfasc" "Syt2"
#> [201] "Atp2b4" "Rgs16" "Ncf2" "Cnih3"
#> [205] "Tmem63a" "Cfap126" "Meig1" "Ccdc3"
#> [209] "Rgs5" "Enkur" "Myoc" "Vim"
#> [213] "Prkcq" "Gad2" "Lcn2" "Nr4a2"
#> [217] "Ermn" "Fibcd1" "Gsn" "Grb14"
#> [221] "Notch1" "Ube2l6" "Gatm" "Cd82"
#> [225] "Mdk" "Lamp5" "Itpka" "Chgb"
#> [229] "Mal" "Pdyn" "Nkx2-2" "Edn3"
#> [233] "Car2" "Col9a3" "Chrna4" "Gss"
#> [237] "Slc7a11" "Tm4sf1" "Kcnab1" "Shox2"
#> [241] "Serpini1" "Tspan2" "S100a11" "Vcam1"
#> [245] "Lef1" "Npy2r" "F3" "Calb1"
#> [249] "Epha7" "Slc44a1" "1110017D15Rik" "Tpm2"
#> [253] "Slc6a9" "Laptm5" "Sema3c" "Hpca"
#> [257] "Padi2" "Slc4a2" "Gabrd" "Rgs12"
#> [261] "Slc30a3" "Emilin1" "1700001C02Rik" "Gabra4"
#> [265] "Pdgfra" "Epha5" "Tesc" "Pitpnm2"
#> [269] "Mmp17" "Cit" "Foxp2" "Arpc1b"
#> [273] "Col1a2" "Eln" "Pcolce" "Tsc22d4"
#> [277] "Cald1" "Ccdc136" "Npy" "Slc13a4"
#> [281] "Gkn3" "Slc6a13" "Mgp" "Lmo3"
#> [285] "Slco1c1" "Cpne9" "Itpr2" "Slc6a11"
#> [289] "Vamp1" "Cd9" "Pglyrp1" "Slc17a6"
#> [293] "Sipa1l3" "Sh3gl3" "Plekhb1" "Nupr1"
#> [297] "Dkk3" "Cox6a2" "Dkkl1" "Fgfr2"
#> [301] "Crym" "Slc38a5" "Flna" "Bgn"
#> [305] "Col4a1" "Plat" "Nr3c2" "Cbln1"
#> [309] "Gab1" "Pllp" "Necab2" "Dbndd1"
#> [313] "Agt" "Cryab" "Tagln" "Mcam"
#> [317] "Olfm2" "Icam5" "Anxa2" "Rora"
#> [321] "Calml4" "Htr3a" "Paqr5" "Rasgrf1"
#> [325] "Zic1" "Mobp" "Hhatl" "Trf"
#> [329] "Cpne4" "Cdhr4" "Cd59a" "Gng11"
#> [333] "Chrm1" "Prr5l" "Ugt8a" "Rims3"
#> [337] "Sgpp2" "Camkv" "Sox10" "Micall1"
#> [341] "Tie1" "Fa2h" "Ucp2" "Vav3"
#> [345] "Ccp110" "Gria2" "Rasl10a" "Foxj1"
#> [349] "Trim59" "Dynlrb2" "Gjc1" "Neurod1"
#> [353] "Ttyh2" "Cpne7" "Nrip3" "Tbr1"
#> [357] "Lcat" "Tmem98" "Myo1d" "Prdm8"
#> [361] "Tgfbi" "Kcnc2" "Thrsp" "Isg15"
#> [365] "Acta2" "H2-Q4" "Dock4" "Myrf"
#> [369] "Lmo1" "Igfbp7" "P2ry12" "Pcdh8"
#> [373] "Lgi4" "Fxyd1" "Fxyd7" "Mag"
#> [377] "Zcchc12" "Anln" "Wnt4" "C1ql2"
#> [381] "Unc93b1" "Tspan15" "Ppp1r14a" "Clic4"
#> [385] "Galnt6" "Ccn3" "Rims2" "Zmat4"
#> [389] "Cldn11" "Ccdc33" "Slc32a1" "Tgm2"
#> [393] "Vstm2l" "Neurod6" "Crygn" "Enpp6"
#> [397] "Neurod2" "Satb2" "Pcp4l1" "Txnip"
#> [401] "Egr1" "Otud7b" "Car14" "Rgs4"
#> [405] "Dock10" "Lpar1" "Trps1" "Ptpn3"
#> [409] "Lefty1" "Zfhx3" "St6galnac5" "Ak5"
#> [413] "Hrh3" "Nexn" "Adgrl4" "Rlbp1"
#> [417] "Igfbp2" "Wfs1" "Cplx3" "Orai2"
#> [421] "Olig2" "Gpr37" "Plcb4" "Nxph4"
#> [425] "Ndufa4l2" "Cacng5" "Plekhg1" "Cmtm5"
#> [429] "Gpr161" "Rfx3" "Igsf21" "Ramp3"
#> [433] "Arhgap12" "Nkx6-2" "Ninj2" "Cldn5"
#> [437] "Htr2c" "Hspb8" "Fmod" "Prelp"
#> [441] "Mpped1" "Rapgef5" "Vwa1" "Stab1"
#> [445] "Arl15" "Reln" "Mustn1" "Pbxip1"
#> [449] "Dnali1" "Id1" "Lrrtm3" "Tmem212"
#> [453] "Epop" "Gjc2" "1190005I06Rik" "Ctla2a"
#> [457] "Cnr1" "Gpr4" "Sowaha" "Tent5c"
#> [461] "Serpinb1a" "S1pr5" "Penk" "Cdc42ep2"
#> [465] "Slitrk6" "Hpcal4" "Olig1" "Rprml"
#> [469] "Stxbp6" "Hs3st2" "Rbp1" "Ppm1e"
#> [473] "Sox18" "Kctd4" "Nxph3" "Vat1l"
#> [477] "Cd24a" "Odf3b" "Gjb1" "Selplg"
#> [481] "Bcl11b" "Lhfp" "Ranbp3l" "Msx1"
#> [485] "Zdhhc22" "Phldb1" "Ctxn1" "Tprn"
#> [489] "Vstm2a" "Ndnf" "Pdp1" "Scn3b"
#> [493] "Cdc42ep1" "Gal3st1" "Rasd1" "Spink8"
#> [497] "Opalin" "Gja4" "Synpo2" "Pcdh20"
#> [501] "Adra1b" "Fam131a" "Tmem125" "Mb21d2"
#> [505] "Lingo3" "Ncald" "Siglech" "Rgs14"
#> [509] "Gm14964" "Gpr17" "Cx3cr1" "Ezr"
#> [513] "Adarb2" "Cpne8" "Plekhg3" "Lamb2"
#> [517] "Creb5" "Cntn2" "Aldh1a1" "Phgdh"
#> [521] "Tnfaip6" "Camk2d" "Shisa6" "Cthrc1"
#> [525] "Tmem119" "Hmgb2" "Tmem158" "Dsp"
#> [529] "Lrtm2" "Gabra5" "Tns1" "Nell1"
#> [533] "Slain1" "Prr18" "S100a8" "S100a9"
#> [537] "Col8a2" "Synpr" "Sertm1" "Adgrf5"
#> [541] "Capg" "Gjc3" "Fcer1g" "Pde1a"
#> [545] "Tafa1" "Ddn" "Hopx" "Ptk2b"
#> [549] "Rgs3" "Kcng2" "Ntng1" "H2-Q7"
#> [553] "Ifitm2" "Plaat3" "Plekhh1" "Myl4"
#> [557] "H2-K1" "Dpp6" "Tmem91" "Cyp2d22"
#> [561] "Ttr" "Suclg2" "Patj" "Btbd3"
#> [565] "Unc13c" "Syt9" "Shisal1" "Grm4"
#> [569] "Sox11" "Slc22a8" "Slc24a3" "Klk8"
#> [573] "Ipcef1" "Tnnt1" "Hhip" "Spag8"
#> [577] "Fxyd6" "Ppp1r3c" "Cbln4" "Nnat"
#> [581] "Myl9" "Vxn" "Lgals1" "Gpr88"
#> [585] "Ctxn3" "Lyz2" "Tmem100" "Wfdc17"
#> [589] "Ahnak" "Hba-a2" "Hba-a1" "Ccdc153"
#> [593] "Ccnd1" "Serpinh1" "Gad1" "Arhgef10"
#> [597] "2410004P03Rik" "Nt5dc2" "Cebpd" "Sod3"
#> [601] "H2-D1" "C4b" "Tmem88b" "Hbb-bt"
#> [605] "Rhog" "Rprm" "Ly6a" "Mog"
#> [609] "Trbc2" "Igkc" "Smim1" "Hs3st4"
#> [613] "Evi2a" "Prkcg" "Ly6c1" "Gbp4"
#> [617] "Wipf3" "BC039966" "Gm13889" "Plcxd2"
#> [621] "Mia" "Pou3f1" "Lrrc10b" "Apol11b"
#> [625] "Gpr62" "Shisa8" "Gm2115" "Kctd12"
#> [629] "1700047M11Rik" "Lhfpl3" "C030029H02Rik" "Gm19935"
#> [633] "9630013A20Rik" "2900040C04Rik"
#>
#> $cor_hclust
#> list()
#>
#> $cor_clusters
#> list()
#>
#> attr(,"class")
#> [1] "spatCorObject" "list"