cole-trapnell-lab / monocle-release

276 stars 116 forks source link

summary statistics #42

Open ghost opened 7 years ago

ghost commented 7 years ago

in your documents about differential expression you mention "We could also simply compute summary statistics such as mean or median expression level on a per-CellType basis"...

This would be really useful for my objectives, would you mind sharing a way to do this.

Thanks for your time.

Andrew

dpcook commented 6 years ago

Hey timmo,

Late reply, but in case you're still interested, you can simply use rowMeans()/rowMedians() on the expression matrix, subsetting its columns by cells of a given cell type/cluster. Something like:

cds$clust1.mean <- rowMeans(cds[,which(cds$cluster == "1")])

This will then be stored in pData(cds) for you. You could also use this approach for a bunch of other summary statistics: rowMedians(), rowVars(), rowMins(), rowMaxs(), etc.