R/check_varm.R

Defines functions check_varm

check_varm <- function(varm,
                       X){
  if(!is.null(varm)){
    varm <- lapply(varm,function(x){
      #### Transpose ####
      x <- Matrix::t(x)
      #### anndata requires the dims to match ####
      if(ncol(x)!=ncol(X)){
        return(NULL)
      } else {
        return(x)
      }
    })
    varm[sapply(varm, is.null)] <- NULL
  } else {
    varm <- NULL
  }
  return(varm)
}
bschilder/scKirby documentation built on Oct. 2, 2024, 10:16 p.m.