R/update_seurat.R

Defines functions update_seurat

Documented in update_seurat

#' Update Seurat object
#'
#' Update a Seurat from V1 --> V3 or V2 --> V3.
#' @inheritParams converters
#' @export
#' @examples
#' obj <- example_obj("seurat")
#' obj2 <- update_seurat(obj)
update_seurat <- function(obj,
                          verbose=TRUE){

  #### Convert from v1 --> v2 ####
  ## v1 used the class "seurat" all lowercase,
  ## instead of "Seurat" which became the object class name
  ## from Seurat v2 onwards.
  if (methods::is(obj,"seurat")) {
    obj <- seurat1_to_list(obj = obj,
                           verbose = verbose) |>
      list_to_seurat(verbose = verbose)

  }
  obj <- SeuratObject::UpdateSeuratObject(obj)
  return(obj)
}
bschilder/scKirby documentation built on April 22, 2024, 12:13 a.m.