I'm working with PTX samples (human and mouse), they're aligned to both transcriptomes and so gene names contain hg38- and mm10- at the beginning of each gene. I have eliminated teh prefixes because I want to integrate this dataset with a dataset that does not contain prefixes. I have annotated each cell type accordingly and have subsetted out the mouse cells.
human <- grep(pattern = "^hg38-", x = rownames(x = scData), value = TRUE)
mouse <- grep(pattern = "^mm10-", x = rownames(x = scData), value = TRUE)
mouse_1 <- substring(mouse,6)
human_1 <- substring(human,6)
human_only <- subset(PTX_no_prefix, features = human_1)
mouse_only <- subset(PTX_no_prefix, features = mouse_1)
Idents(mouse_only) <- "cell_ann"
TME_PTX <- subset(mouse_only, idents = c("Fibroblast_mouse", "Myeloid_mouse", "Endothelial_mouse", "Pericytes_mouse", "Neutrophil_mouse"))
I'm now trying to merge two datasets together but receive an error.
combined_het <- merge(TME_het_PTX, y = skin_only_ann)
scData <- combined_het
# remove cells with <200 RNA molecules, or >6000 molecules, or >30% mito
scData <- subset(scData, subset = nFeature_RNA > 200 & nFeature_RNA < 6000 & percent.mt_mouse < 30)
#scData <- NormalizeData(scData, normalization.method = "LogNormalize", scale.factor = 10000)
#scData <- FindVariableFeatures(scData, selection.method = "vst", nfeatures = 2000)
all.genes <- rownames(scData)
GLOBALS_MAXSIZE <- 4000
options(future.globals.maxSize = GLOBALS_MAXSIZE * 1024^2)
scData <- SCTransform(scData, vars.to.regress = "nCount_RNA", verbose = FALSE)
#scData <- ScaleData(scData, features = VariableFeatures(object = scData), vars.to.regress = c("nCount_RNA"))
scData <- RunPCA(scData, features = VariableFeatures(object = scData))
combined_het <- merge(TME_PTX, y = skin_only_ann)
Error in intI(i, n = x@Dim[1], dn[[1]], give.dn = FALSE) :
invalid character indexing
I checked the gene names from each dataset to make sure they're in the same format and they are.
head(rownames(skin_only_ann))
[1] "Xkr4" "Gm37180" "Gm37363" "Gm37686" "Gm1992" "Gm37329"
head(rownames(TME_PTX))
[1] "Xkr4" "Gm37180" "Gm37363" "Gm37686" "Gm38148" "Gm19938"