Hi I am using FindTransferAnchors to label transfer from an scRNA obj to a Spatial-derived obj. But I get an error which I do not know the reason for it.
Here is my code:
DefaultAssay(scrna) <- "RNA";
DefaultAssay(seu) <- "Spatial";
seu <- NormalizeData(seu, normalization.method = "LogNormalize");
# find 2k hvg
seu <- FindVariableFeatures(seu, selection.method = "vst", nfeatures = 2000)
# scale the data based on all genes, not just the hvg
all.genes <- rownames(seu);
seu <- ScaleData(seu, features = all.genes);
seu <- RunPCA(seu, verbose = T, seed.use = seed, npcs = 30);
features1 <- VariableFeatures(object = scrna);
features <- intersect(features1, rownames(seu));
cat("\n ", length(features1), "\t", length(features)); ### The output of this line is: 2000 1522
#find anchors for label transfer
anchors <- FindTransferAnchors(
reference = scrna, query = seu, normalization.method = "LogNormalize",
reference.assay = "RNA", query.assay = "Spatial", reduction = "pcaproject",
features = features, k.filter = NA
);
The error is:
Error in `[<-.data.frame`(`*tmp*`, i[index], value = list(c(`AAACATGCAACACCTA-1` = 2993, :
replacement element 1 has 3922 rows, need 6723
Hi I am using FindTransferAnchors to label transfer from an scRNA obj to a Spatial-derived obj. But I get an error which I do not know the reason for it. Here is my code:
The error is:
Here is the dimension of each obj:
I don't understand where does number 6723 come from in " replacement element 1 has 3922 rows, need 6723" error!
Here is the session info: