R/input.R

Defines functions AddMetaDataMatrix

Documented in AddMetaDataMatrix

# Input -------------------------------------------


#' Add cell wise data to seurat object
#'
#' Takes in a matrix containing information about each cell in a single cell
#' seurat object and and adds the data to the matrix. This method allows
#' metadata to be added to the object in bulk.
#'
#' @param seurat_object A seurat object
#' @param data_matrix A factor x cell matrix with cell wise data
#'
#' @import Seurat
#' @return A seurat object with all the data from data_matrix added
#' @export
AddMetaDataMatrix <- function(seurat_object, data_matrix) {
  for (i in 1:nrow(data_matrix)) {
    seurat_object[[rownames(data_matrix)[i]]] <- data_matrix[i,]
  }
  return(seurat_object)
}
sbrn3/disscat documentation built on Dec. 12, 2019, 7:54 a.m.