Skip to content

Commit

Permalink
Rename variable to be more consistent with seurat
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronwolen committed May 19, 2022
1 parent 8079be2 commit ca1ac08
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions R/SCDataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ SCDataset <- R6::R6Class(
from_seurat = function(object) {
stopifnot(inherits(object, "Seurat"))

identities <- SeuratObject::Idents(object)
if (nlevels(identities) > 1L) {
idents <- SeuratObject::Idents(object)
if (nlevels(idents) > 1L) {
object <- SeuratObject::AddMetaData(
object = object,
metadata = as.character(identities),
metadata = as.character(idents),
col.name = "active_ident"
)
}
Expand Down Expand Up @@ -155,7 +155,7 @@ SCDataset <- R6::R6Class(
obs_df <- self$scgroups[[1]]$obs$to_dataframe()

# retain cell identities before restoring cell-level metadata
identities <- setNames(obs_df$active_ident, rownames(obs_df))
idents <- setNames(obs_df$active_ident, rownames(obs_df))
obs_df$active_ident <- NULL

object <- SeuratObject::CreateSeuratObject(
Expand All @@ -164,8 +164,8 @@ SCDataset <- R6::R6Class(
meta.data = obs_df
)

if (!is.null(identities)) {
SeuratObject::Idents(object) <- identities[SeuratObject::Cells(object)]
if (!is.null(idents)) {
SeuratObject::Idents(object) <- idents[SeuratObject::Cells(object)]
}

if (nassays > 1) {
Expand Down

0 comments on commit ca1ac08

Please sign in to comment.