Skip to content

plotColocal() not plotting right object names #2

@dimitrisokolowskei

Description

@dimitrisokolowskei

Hi,

First congratulations for such a useful package. I'm following the hoodscanR tutorial and I found this situation where colnames(hoods) from calcMetrics() function return me numbers rather than my seurat object cell type annotation labels. For instance:

spe <- calcMetrics(spe, pm_cols = colnames(hoods))

# Only running colnames
colnames(hoods)
 [1] "1"  "10" "11" "12" "13" "14" "2"  "3"  "4"  "5"  "6"  "7"  "8"  "9" 

Here goes my full code. I'm using Seurat v5.3.1.

seurat <- readRDS("seurat.rds")

# Add XY coordinates into metadata
seurat$coord_x <- seurat@images$fov@boundaries$centroids@coords[,1]
seurat$coord_y <- seurat@images$fov@boundaries$centroids@coords[,2]

# Convert Seurat into SingleCellExperiment format
data <- as.SingleCellExperiment(seurat)

# Run Neighbourhood analysis using hoodscanR
spe <- readHoodData(data, anno_col = "celltypes", pos_col = c("coord_x", "coord_y"))
colData(spe)

plotTissue(spe, color = cell_annotation, size = 1.5, alpha = 0.8)
fnc <- findNearCells(spe, k = 200)
pm <- scanHoods(fnc$distance)
hoods <- mergeByGroup(pm, fnc$cells)
spe <- mergeHoodSpe(spe, hoods)
spe <- calcMetrics(spe, pm_cols = colnames(hoods))
plotColocal(spe, pm_cols = colnames(hoods))

I would appreciate any help on this matter!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions