R/ArchR_SplitbyStage.R

Defines functions ArchR_SplitbyStage

Documented in ArchR_SplitbyStage

#' ArchR function: Split by stage
#'
#' This function splits ArchR object by stage
#'
#' @param ArchR ArchR object
#' @return list of ArchR objects, split by stage
#' @export
ArchR_SplitbyStage <- function(ArchR){
  split_names <- unique(ArchR$stage)
  split_ArchR <- c()
  for (i in split_names){
    idxSample <- BiocGenerics::which(ArchR$stage %in% i)
    cellsSample <- ArchR$cellNames[idxSample]
    split_ArchR <- c(split_ArchR, ArchR[cellsSample, ])
  }
  return(split_ArchR)
}
alexthiery/scHelper documentation built on Aug. 26, 2023, 3:42 p.m.