MarcElosua/SPOTlight

HELP! imgData is not equal to the spatialcoords

Opened this issue · 0 comments

スクリーンショット 2024-04-15 020641

Dear authors:
I have little idea of the workflow. Just writing to ask you a favor.
Here's my codes,if there is any mistake?

`xyz <- read.csv('./spatial/tissue_positions_list.csv', header = FALSE,
col.names = c(
"barcode", "in_tissue", "array_row", "array_col",
"pxl_row_in_fullres", "pxl_col_in_fullres"))
exp<-DropletUtils::read10xCounts('GSM6433593_094C_filtered_feature_bc_matrix.h5',type = 'HDF5',row.names = 'symbol')
rd <- S4Vectors::DataFrame(
symbol = rowData(exp)$Symbol)
xz<-xyz[!xyz$in_tissue=='0',]
st <- SpatialExperiment(
assays = list(counts = assay(exp)),
rowData = rd,
colData = DataFrame(xz),
spatialCoordsNames = c("pxl_col_in_fullres", "pxl_row_in_fullres"),
imgData = img,
sample_id = "sample01")

res <- SPOTlight(
x = sce,
y = st,
groups = as.character(sce$celltype_minor), # 也可以是cluster
mgs = mgs_df,
hvg = hvg,
weight_id = "mean.AUC",
group_id = "cluster",
gene_id = "gene")

head(mat <- res$mat)[, seq_len(length(unique(sce$celltype_minor)))]
mod <- res$NMF

p3 <- plotSpatialScatterpie(
x = st,
y = mat,
cell_types = colnames(mat),
img = T, #以tiff为背景
scatterpie_alpha = 1,
pie_scale = 0.4,

Rotate the image 90 degrees counterclockwise

degrees = -90,

Pivot the image on its x axis

axis = "h") +
scale_fill_manual(
values = pal,
breaks = names(pal))`