Skip to content

Commit f97e19d

Browse files
authored
Merge pull request #2237 from GreenleafLab/ia/fix-seurat-object-creation
fix issues with creating Seuratv5 obj
2 parents 0b776ca + 59fee90 commit f97e19d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

R/RNAIntegration.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,10 @@ addGeneIntegrationMatrix <- function(
472472
o <- suppressWarnings(file.remove(unlist(getImputeWeights(subProj)[[1]]))) #Clean Up Space
473473
.logThis(mat, paste0("GeneScoreMat-Block-Impute-",i), logFile=logFile)
474474
}
475-
475+
# Seurat v5 requires character type row/colnames
476+
# sparse matrices occasionally convert names to array type, so convert back to create seurat obj
477+
rownames(mat) <- as.character(rownames(mat))
478+
colnames(mat) <- as.character(colnames(mat))
476479
#Log-Normalize
477480
mat <- log(mat + 1) #use natural log
478481
seuratATAC <- supressWarninggs(Seurat::CreateSeuratObject(counts = as.matrix(mat[head(seq_len(nrow(mat)), 5), , drop = FALSE])))

0 commit comments

Comments
 (0)