R/preprocessCountMatrix.R

# function to normalize the countMatrix depending on the input
# single cell data will be processed using seurat
# bulk data will be processed using edgeR
# countMatrix IDs should be entrezIDs

library(Seurat)
library(edgeR)

# single cell data
preprocessCountMatrix <- function(countMatrix, scData){
  if(scData=="TRUE"){
    nbt.data <- log(data.matrix(countMatrix)+1)
    nbt <- CreateSeuratObject(nbt.data)
    seqwell <- NormalizeData(object = nbt)
    seqwell <- ScaleData(object = seqwell)
    seqwell <- FindVariableGenes(object = seqwell, do.plot = FALSE)
  }
  else{
    
  }
  return(seqwell)
}
richabatra/FunRNA documentation built on May 4, 2019, 7:43 p.m.