R/dm_estimateMeanExpression.R

Defines functions dm_estimateMeanExpression

dm_estimateMeanExpression <- function(counts, verbose = FALSE){
  
  # Calculate mean expression of genes 
  time_start <- Sys.time()
  if(verbose) message("* Calculating mean gene expression.. \n")
  
  inds <- 1:length(counts)
  
  mean_expression <- unlist(lapply(inds, function(g){ 
    mean(colSums(counts[[g]]), na.rm = TRUE)
  }))
  
  names(mean_expression) <- names(counts)
  
  time_end <- Sys.time()
  if(verbose) message("Took ", round(time_end - time_start, 4), " seconds.\n")
  
  return(mean_expression)
  
}

Try the DRIMSeq package in your browser

Any scripts or data that you put into this service are public.

DRIMSeq documentation built on Nov. 8, 2020, 8:25 p.m.