Objective: To map the cellular composition, gene expression patterns, and spatial organization of the breast cancer tumor microenvironment at high resolution, using spatial transcriptomics and integrated single-cell data. This study aims to uncover cellular heterogeneity, molecular interactions, and spatial dynamics within tumor tissues, contributing to a deeper understanding of tumor progression and potential therapeutic targets.

xenium_obj <- LoadXenium(
  "C:/Users/iyand/Downloads/Xenium_FFPE_Human_Breast_Cancer_Rep1_outs/outs", 
  fov = "fov",  # Ensure this matches a valid field of view in your dataset
  assay = "Xenium"  # Ensure this is the correct assay name
)
## 10X data contains more than one type and is being returned as a list containing matrices of each type.
## Warning: Feature names cannot have underscores ('_'), replacing with dashes
## ('-')
## Warning: Feature names cannot have underscores ('_'), replacing with dashes
## ('-')
## Warning: Feature names cannot have underscores ('_'), replacing with dashes
## ('-')
## Warning: Feature names cannot have underscores ('_'), replacing with dashes
## ('-')
## Warning: Feature names cannot have underscores ('_'), replacing with dashes
## ('-')
## Warning: Feature names cannot have underscores ('_'), replacing with dashes
## ('-')
####remove cells with 0 counts (quality control)
xenium_obj <- subset(xenium_obj, subset =  nCount_Xenium > 0)
## Warning: Not validating FOV objects
## Warning: Not validating Centroids objects
## Not validating Centroids objects
## Warning: Not validating FOV objects
## Warning: Not validating Centroids objects
## Warning: Not validating FOV objects
## Not validating FOV objects
## Not validating FOV objects
## Warning: Not validating Seurat objects
##Genes/cell and Transcript count/cell
VlnPlot(xenium_obj, features = c ("nFeature_Xenium", "nCount_Xenium"), ncol = 2, pt.size = 0)
## Warning: Default search for "data" layer in "Xenium" assay yielded no results;
## utilizing "counts" layer instead.
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`

xenium_obj <- subset(
  xenium_obj, subset = nFeature_Xenium > 5 & nFeature_Xenium < 200 & nCount_Xenium >10 & nCount_Xenium < 1000
)
## Warning: Not validating FOV objects
## Warning: Not validating Centroids objects
## Not validating Centroids objects
## Warning: Not validating FOV objects
## Warning: Not validating Centroids objects
## Warning: Not validating FOV objects
## Not validating FOV objects
## Not validating FOV objects
## Warning: Not validating Seurat objects
print(xenium_obj)
## An object of class Seurat 
## 541 features across 163779 samples within 4 assays 
## Active assay: Xenium (313 features, 0 variable features)
##  1 layer present: counts
##  3 other assays present: BlankCodeword, ControlCodeword, ControlProbe
##  1 spatial field of view present: fov

Normalization and Seurate Workflow

xenium_obj <- SCTransform(xenium_obj, assay = "Xenium")
## Running SCTransform on assay: Xenium
## Running SCTransform on layer: counts
## vst.flavor='v2' set. Using model with fixed slope and excluding poisson genes.
## `vst.flavor` is set to 'v2' but could not find glmGamPoi installed.
## Please install the glmGamPoi package for much faster estimation.
## --------------------------------------------
## install.packages('BiocManager')
## BiocManager::install('glmGamPoi')
## --------------------------------------------
## Falling back to native (slower) implementation.
## Variance stabilizing transformation of count matrix of size 313 by 163779
## Model formula is y ~ log_umi
## Get Negative Binomial regression parameters per gene
## Using 313 genes, 5000 cells
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Found 3 outliers - those will be ignored in fitting/regularization step
## Second step: Get residuals using fitted parameters for 313 genes
## Computing corrected count matrix for 313 genes
## Calculating gene attributes
## Wall clock passed: Time difference of 1.177924 mins
## Determine variable features
## Centering data matrix
## Getting residuals for block 1(of 33) for counts dataset
## Getting residuals for block 2(of 33) for counts dataset
## Getting residuals for block 3(of 33) for counts dataset
## Getting residuals for block 4(of 33) for counts dataset
## Getting residuals for block 5(of 33) for counts dataset
## Getting residuals for block 6(of 33) for counts dataset
## Getting residuals for block 7(of 33) for counts dataset
## Getting residuals for block 8(of 33) for counts dataset
## Getting residuals for block 9(of 33) for counts dataset
## Getting residuals for block 10(of 33) for counts dataset
## Getting residuals for block 11(of 33) for counts dataset
## Getting residuals for block 12(of 33) for counts dataset
## Getting residuals for block 13(of 33) for counts dataset
## Getting residuals for block 14(of 33) for counts dataset
## Getting residuals for block 15(of 33) for counts dataset
## Getting residuals for block 16(of 33) for counts dataset
## Getting residuals for block 17(of 33) for counts dataset
## Getting residuals for block 18(of 33) for counts dataset
## Getting residuals for block 19(of 33) for counts dataset
## Getting residuals for block 20(of 33) for counts dataset
## Getting residuals for block 21(of 33) for counts dataset
## Getting residuals for block 22(of 33) for counts dataset
## Getting residuals for block 23(of 33) for counts dataset
## Getting residuals for block 24(of 33) for counts dataset
## Getting residuals for block 25(of 33) for counts dataset
## Getting residuals for block 26(of 33) for counts dataset
## Getting residuals for block 27(of 33) for counts dataset
## Getting residuals for block 28(of 33) for counts dataset
## Getting residuals for block 29(of 33) for counts dataset
## Getting residuals for block 30(of 33) for counts dataset
## Getting residuals for block 31(of 33) for counts dataset
## Getting residuals for block 32(of 33) for counts dataset
## Getting residuals for block 33(of 33) for counts dataset
## Centering data matrix
## Finished calculating residuals for counts
## Set default assay to SCT
xenium_obj <- RunPCA(xenium_obj, npcs = 50, features = rownames(xenium_obj))
## PC_ 1 
## Positive:  KRT7, ERBB2, SCD, EPCAM, TACSTD2, GATA3, FOXA1, KRT8, FASN, ANKRD30A 
##     MLPH, CEACAM6, CCND1, CDH1, CD9, S100A14, ABCC11, SERHL2, DSP, MYO5B 
##     SERPINA3, TCIM, TPD52, LYPD3, CTTN, ELF3, NARS, AR, CCDC6, FLNB 
## Negative:  LUM, POSTN, CXCL12, CCDC80, IL7R, PTPRC, LYZ, CXCR4, MMP2, SFRP4 
##     ZEB2, TRAC, PTGDS, CD3E, CD4, PDGFRB, PDK4, FBLN1, PDGFRA, S100A4 
##     FGL2, FCER1G, CD68, CYTIP, IGF1, CD8A, AQP1, PECAM1, CCL5, LDHB 
## PC_ 2 
## Positive:  IL7R, PTPRC, CXCR4, CD3E, TRAC, CD8A, CYTIP, CCL5, IL2RG, KLRB1 
##     LYZ, GZMA, CD4, GPR183, CD69, CD3D, CD3G, CD247, S100A4, SELL 
##     CCR7, SMAP2, FAM107B, SLAMF1, ERN1, LPXN, CTLA4, LTB, TCF7, PRDM1 
## Negative:  POSTN, LUM, CCDC80, CXCL12, MMP2, PDGFRB, AQP1, SFRP4, ACTA2, PDGFRA 
##     FBLN1, CAV1, VWF, MYLK, CRISPLD2, IGF1, ADH1B, SFRP1, CD93, CLEC14A 
##     PECAM1, TCF4, RAMP2, DST, SVIL, KDR, RUNX1, GJB2, LRRC15, ZEB1 
## PC_ 3 
## Positive:  AQP1, VWF, PECAM1, CD93, CLEC14A, RAMP2, CAV1, MMRN2, KDR, BTNL9 
##     MYLK, NOSTRIN, HOXD9, ACTA2, IL3RA, CAVIN2, EDN1, ESM1, SOX17, EGFL7 
##     ANGPT2, ANKRD29, TCF4, MYH11, FLNB, PPARG, RAPGEF3, HOXD8, DST, EDNRB 
## Negative:  LUM, POSTN, CCDC80, SFRP4, MMP2, FBLN1, PDGFRA, ERBB2, CXCL12, IGF1 
##     SCD, BASP1, ANKRD30A, EPCAM, CRISPLD2, FOXA1, GATA3, PTGDS, DPT, LRRC15 
##     ADH1B, FASN, KRT7, MLPH, RUNX1, CEACAM6, PDGFRB, GJB2, KRT8, CDH1 
## PC_ 4 
## Positive:  LYZ, FCER1G, FGL2, CD68, CD163, MRC1, PDK4, CD4, ITGAX, AIF1 
##     CD14, C1QC, IGSF6, HAVCR2, APOC1, MNDA, ZEB2, C1QA, FCGR3A, CD86 
##     FCER1A, ITGAM, CD1C, CXCL16, TYROBP, CX3CR1, MMP12, MAP3K8, CD83, GLIPR1 
## Negative:  IL7R, CD3E, TRAC, CD8A, LUM, POSTN, CCL5, GZMA, KLRB1, CD69 
##     CXCR4, CD3G, CD3D, CD247, CCDC80, CYTIP, ACTA2, AQP1, PDGFRB, CD8B 
##     KLRD1, MYLK, IL2RG, SLAMF1, TCF7, MMP2, ERN1, PRDM1, SFRP4, CTLA4 
## PC_ 5 
## Positive:  SCD, VWF, FASN, FOXA1, PECAM1, ERBB2, ANKRD30A, CXCL12, EPCAM, ABCC11 
##     TCIM, CLEC14A, AQP1, MLPH, TENT5C, CD93, SERHL2, RAMP2, LUM, GATA3 
##     CCDC80, KDR, MMP2, BTNL9, MDM2, POSTN, MMRN2, BASP1, PTGDS, AR 
## Negative:  KRT14, MYLK, KRT5, SERPINA3, KRT15, KRT6B, SFRP1, PTN, MYH11, KRT23 
##     ACTA2, TACSTD2, KRT16, DST, CEACAM6, ACTG2, DSC2, DSP, KIT, RUNX1 
##     EGFR, C5orf46, OPRPN, ALDH1A3, KRT7, FOXC2, GLIPR1, PIGR, SVIL, SLC25A37
xenium_obj <- RunUMAP(xenium_obj, dims = 1: 30)
## Warning: The default method for RunUMAP has changed from calling Python UMAP via reticulate to the R-native UWOT using the cosine metric
## To use Python UMAP via reticulate, set umap.method to 'umap-learn' and metric to 'correlation'
## This message will be shown once per session
## 19:49:17 UMAP embedding parameters a = 0.9922 b = 1.112
## 19:49:17 Read 163779 rows and found 30 numeric columns
## 19:49:17 Using Annoy for neighbor search, n_neighbors = 30
## 19:49:17 Building Annoy index with metric = cosine, n_trees = 50
## 0%   10   20   30   40   50   60   70   80   90   100%
## [----|----|----|----|----|----|----|----|----|----|
## **************************************************|
## 19:49:37 Writing NN index file to temp file C:\Users\iyand\AppData\Local\Temp\Rtmp0czLLe\file7efc3aec2337
## 19:49:37 Searching Annoy index using 1 thread, search_k = 3000
## 19:50:31 Annoy recall = 100%
## 19:50:32 Commencing smooth kNN distance calibration using 1 thread with target n_neighbors = 30
## 19:50:41 Initializing from normalized Laplacian + noise (using RSpectra)
## 19:50:46 Commencing optimization for 200 epochs, with 7704852 positive edges
## 19:52:58 Optimization finished
xenium_obj <- FindNeighbors(xenium_obj, reduction = "pca", dims = 1:30)
## Computing nearest neighbor graph
## Computing SNN
xenium_obj <- FindClusters(xenium_obj, resolution =  0.2)
## Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
## 
## Number of nodes: 163779
## Number of edges: 5298734
## 
## Running Louvain algorithm...
## Maximum modularity in 10 random starts: 0.9485
## Number of communities: 12
## Elapsed time: 114 seconds
DimPlot(xenium_obj, group.by = "seurat_clusters", label = T)
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`

Cell Anotation

AllMaarker <- FindAllMarkers(xenium_obj)
## Calculating cluster 0
## For a (much!) faster implementation of the Wilcoxon Rank Sum Test,
## (default method for FindMarkers) please install the presto package
## --------------------------------------------
## install.packages('devtools')
## devtools::install_github('immunogenomics/presto')
## --------------------------------------------
## After installation of presto, Seurat will automatically use the more 
## efficient implementation (no further action necessary).
## This message will be shown once per session
## Calculating cluster 1
## Calculating cluster 2
## Calculating cluster 3
## Calculating cluster 4
## Calculating cluster 5
## Calculating cluster 6
## Calculating cluster 7
## Calculating cluster 8
## Calculating cluster 9
## Calculating cluster 10
## Calculating cluster 11
rownames(xenium_obj)
##   [1] "ABCC11"   "ACTA2"    "ACTG2"    "ADAM9"    "ADGRE5"   "ADH1B"   
##   [7] "ADIPOQ"   "AGR3"     "AHSP"     "AIF1"     "AKR1C1"   "AKR1C3"  
##  [13] "ALDH1A3"  "ANGPT2"   "ANKRD28"  "ANKRD29"  "ANKRD30A" "APOBEC3A"
##  [19] "APOBEC3B" "APOC1"    "AQP1"     "AQP3"     "AR"       "AVPR1A"  
##  [25] "BACE2"    "BANK1"    "BASP1"    "BTNL9"    "C15orf48" "C1QA"    
##  [31] "C1QC"     "C2orf42"  "C5orf46"  "C6orf132" "CAV1"     "CAVIN2"  
##  [37] "CCDC6"    "CCDC80"   "CCL20"    "CCL5"     "CCL8"     "CCND1"   
##  [43] "CCPG1"    "CCR7"     "CD14"     "CD163"    "CD19"     "CD1C"    
##  [49] "CD247"    "CD27"     "CD274"    "CD3D"     "CD3E"     "CD3G"    
##  [55] "CD4"      "CD68"     "CD69"     "CD79A"    "CD79B"    "CD80"    
##  [61] "CD83"     "CD86"     "CD8A"     "CD8B"     "CD9"      "CD93"    
##  [67] "CDC42EP1" "CDH1"     "CEACAM6"  "CEACAM8"  "CENPF"    "CLCA2"   
##  [73] "CLDN4"    "CLDN5"    "CLEC14A"  "CLEC9A"   "CLECL1"   "CLIC6"   
##  [79] "CPA3"     "CRHBP"    "CRISPLD2" "CSF3"     "CTH"      "CTLA4"   
##  [85] "CTSG"     "CTTN"     "CX3CR1"   "CXCL12"   "CXCL16"   "CXCL5"   
##  [91] "CXCR4"    "CYP1A1"   "CYTIP"    "DAPK3"    "DERL3"    "DMKN"    
##  [97] "DNAAF1"   "DNTTIP1"  "DPT"      "DSC2"     "DSP"      "DST"     
## [103] "DUSP2"    "DUSP5"    "EDN1"     "EDNRB"    "EGFL7"    "EGFR"    
## [109] "EIF4EBP1" "ELF3"     "ELF5"     "ENAH"     "EPCAM"    "ERBB2"   
## [115] "ERN1"     "ESM1"     "ESR1"     "FAM107B"  "FAM49A"   "FASN"    
## [121] "FBLIM1"   "FBLN1"    "FCER1A"   "FCER1G"   "FCGR3A"   "FGL2"    
## [127] "FLNB"     "FOXA1"    "FOXC2"    "FOXP3"    "FSTL3"    "GATA3"   
## [133] "GJB2"     "GLIPR1"   "GNLY"     "GPR183"   "GZMA"     "GZMB"    
## [139] "GZMK"     "HAVCR2"   "HDC"      "HMGA1"    "HOOK2"    "HOXD8"   
## [145] "HOXD9"    "HPX"      "IGF1"     "IGSF6"    "IL2RA"    "IL2RG"   
## [151] "IL3RA"    "IL7R"     "ITGAM"    "ITGAX"    "ITM2C"    "JUP"     
## [157] "KARS"     "KDR"      "KIT"      "KLF5"     "KLRB1"    "KLRC1"   
## [163] "KLRD1"    "KLRF1"    "KRT14"    "KRT15"    "KRT16"    "KRT23"   
## [169] "KRT5"     "KRT6B"    "KRT7"     "KRT8"     "LAG3"     "LARS"    
## [175] "LDHB"     "LEP"      "LGALSL"   "LIF"      "LILRA4"   "LPL"     
## [181] "LPXN"     "LRRC15"   "LTB"      "LUM"      "LY86"     "LYPD3"   
## [187] "LYZ"      "MAP3K8"   "MDM2"     "MEDAG"    "MKI67"    "MLPH"    
## [193] "MMP1"     "MMP12"    "MMP2"     "MMRN2"    "MNDA"     "MPO"     
## [199] "MRC1"     "MS4A1"    "MUC6"     "MYBPC1"   "MYH11"    "MYLK"    
## [205] "MYO5B"    "MZB1"     "NARS"     "NCAM1"    "NDUFA4L2" "NKG7"    
## [211] "NOSTRIN"  "NPM3"     "OCIAD2"   "OPRPN"    "OXTR"     "PCLAF"   
## [217] "PCOLCE"   "PDCD1"    "PDCD1LG2" "PDE4A"    "PDGFRA"   "PDGFRB"  
## [223] "PDK4"     "PECAM1"   "PELI1"    "PGR"      "PIGR"     "PIM1"    
## [229] "PLD4"     "POLR2J3"  "POSTN"    "PPARG"    "PRDM1"    "PRF1"    
## [235] "PTGDS"    "PTN"      "PTPRC"    "PTRHD1"   "QARS"     "RAB30"   
## [241] "RAMP2"    "RAPGEF3"  "REXO4"    "RHOH"     "RORC"     "RTKN2"   
## [247] "RUNX1"    "S100A14"  "S100A4"   "S100A8"   "SCD"      "SCGB2A1" 
## [253] "SDC4"     "SEC11C"   "SEC24A"   "SELL"     "SERHL2"   "SERPINA3"
## [259] "SERPINB9" "SFRP1"    "SFRP4"    "SH3YL1"   "SLAMF1"   "SLAMF7"  
## [265] "SLC25A37" "SLC4A1"   "SLC5A6"   "SMAP2"    "SMS"      "SNAI1"   
## [271] "SOX17"    "SOX18"    "SPIB"     "SQLE"     "SRPK1"    "SSTR2"   
## [277] "STC1"     "SVIL"     "TAC1"     "TACSTD2"  "TCEAL7"   "TCF15"   
## [283] "TCF4"     "TCF7"     "TCIM"     "TCL1A"    "TENT5C"   "TFAP2A"  
## [289] "THAP2"    "TIFA"     "TIGIT"    "TIMP4"    "TMEM147"  "TNFRSF17"
## [295] "TOMM7"    "TOP2A"    "TPD52"    "TPSAB1"   "TRAC"     "TRAF4"   
## [301] "TRAPPC3"  "TRIB1"    "TUBA4A"   "TUBB2B"   "TYROBP"   "UCP1"    
## [307] "USP53"    "VOPP1"    "VWF"      "WARS"     "ZEB1"     "ZEB2"    
## [313] "ZNF562"
#### B Cells Markers: MS4A1, CD79A, CD19
FeaturePlot(object = xenium_obj, features = c("MS4A1", "CD79A", "CD19"))
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`

#### T Cells Markers: CD3D, CD4, CD8A
FeaturePlot(object = xenium_obj, features = c("CD3D", "CD4", "CD8A"))
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`

#### Macrophages/Monocytes Markers: CD14, CD163, ITGAX, CD68
FeaturePlot(object = xenium_obj, features = c("CD14", "CD163", "ITGAX", "CD68"))
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`

#### Dendritic Cells Markers: CD1C, FCER1A, CLEC9A
FeaturePlot(object = xenium_obj, features = c("CD1C", "FCER1A", "CLEC9A"))
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`

#### Natural Killer (NK) Cells Markers: NCAM1, KLRD1, NKG7
FeaturePlot(object = xenium_obj, features = c("NCAM1", "KLRD1", "NKG7"))
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`

#### Regulatory T Cells (Tregs) Markers: FOXP3, IL2RA
FeaturePlot(object = xenium_obj, features = c("FOXP3", "IL2RA"))
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`

#### Fibroblasts Markers: PDGFRA, PDGFRB
FeaturePlot(object = xenium_obj, features = c("PDGFRA", "PDGFRB"))
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`

#### Endothelial Cells Markers: PECAM1, VWF, KDR
FeaturePlot(object = xenium_obj, features = c("PECAM1", "VWF", "KDR"))
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`

#### Epithelial Cells Markers: EPCAM, KRT8, KRT14
FeaturePlot(object = xenium_obj, features = c("EPCAM", "KRT8", "KRT14"))
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`

#### Mast Cells Markers: TPSAB1, KIT
FeaturePlot(object = xenium_obj, features = c("TPSAB1", "KIT"))
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`

#### Plasma Cells Markers: MZB1, CD38
FeaturePlot(object = xenium_obj, features = c("MZB1", "CD38"))
## Warning: No layers found matching search pattern provided
## Warning: The following requested variables were not found: CD38
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`

#### Tumor Cells Markers: ERBB2, MUC1, EPCAM
FeaturePlot(object = xenium_obj, features = c("ERBB2", "MUC1", "EPCAM"))
## Warning: No layers found matching search pattern provided
## Warning: The following requested variables were not found: MUC1
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`

#############

# Check if the renaming worked
xenium_obj$cell_type <- Idents(xenium_obj)

# Visualize the results
DimPlot(xenium_obj, group.by = "cell_type", size = 0.9)
## Rasterizing points since number of points exceeds 100,000.
## To disable this behavior set `raster=FALSE`

Spatial Coordinate

ImageDimPlot(xenium_obj, group.by = "cell_type", size = 0.9)
## Warning: No FOV associated with assay 'SCT', using global default FOV

ImageDimPlot(xenium_obj, group.by = "seurat_clusters", size = 0.9)
## Warning: No FOV associated with assay 'SCT', using global default FOV

Visualizing gene of interest spatial location

ImageFeaturePlot(xenium_obj, features = "FASN", cols = c("white", "red"))
## Warning: No FOV associated with assay 'SCT', using global default FOV

#####
ImageDimPlot(xenium_obj, fov ="fov", nmols = 20000, axes = T, molecules = c("CEACAM6", "FASN"))
## Warning in brewer.pal(n = length(x = levels(x = molecules$molecule)), name = "Set1"): minimal value for n is 3, returning requested palette with 3 different levels