Skip to content
Snippets Groups Projects
Commit d8874b22 authored by Brandon Chen's avatar Brandon Chen
Browse files

added log option to avgExp

parent 21bc03c7
Branches
Tags
No related merge requests found
......@@ -354,7 +354,7 @@ getPercentExpressions=function(seuratObject,geneDescriptions,features=NULL) {
}
####################
####################
getAvgExp=function(seuratObject,cells,colID,geneDescriptions,features) {
getAvgExp=function(seuratObject,cells,colID,geneDescriptions,features,log) {
if (is.null(colID)) {
colID='Altogether'
cells$Altogether='all'
......@@ -371,6 +371,9 @@ getAvgExp=function(seuratObject,cells,colID,geneDescriptions,features) {
expressions=AverageExpression(seuratObject,assays='RNA',features=features) #By default this uses non-scaled values. #This function doesn't preserve column names of expressions. a 'g' can be added as prefix.
if (length(features)==1)
rownames(expressions[['RNA']])=features
if (log==T){
expressions[['RNA']]=log2(expressions[['RNA']]+1) #Added by BC
}
expressions[['RNA']]=data.frame(expressions[['RNA']][,mixedsort(colnames(expressions[['RNA']])),drop=F],check.names=F)
colnames(expressions[['RNA']])=paste0(rownames(stats),'(n=',stats$n,')')
if (!is.null(geneDescriptions))
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment