Closed tanasa closed 3 years ago
Hi,
Not member of dev team but hopefully can be helpful. Please refer to the manual entry for AverageExpression
. You just need to specify your groups to the group.by
parameter.
Best, Sam
Thank you Sam. yes, both the commands below work fine :
cluster.averages.CLUSTER.SEURAT <- AverageExpression(samples.combined.list.combined, slot = "data", group.by = "seurat_clusters" , return.seurat = TRUE)
head(cluster.averages.CLUSTER.SEURAT@assays$RNA@counts)
or
cluster.averages.CLUSTER <- AverageExpression(samples.combined.list.combined, slot = "data", group.by = "seurat_clusters" , return.seurat = FALSE)
head(cluster.averages.CLUSTER$RNA)
and provide the same results. I was wondering if there is a fast way to compute the average expression based on 2 criteria; in other words, is the command below syntactically correct ? just to double check :
AverageExpression(samples.combined.list.combined, slot = "data", group.by = c("seurat_clusters", "celltype.stim") , return.seurat = FALSE)
Hi,
Yes, as the manual says:
group.by: Categories for grouping (e.g, ident, replicate, celltype); 'ident' by default
You easily see this by passing the return of AverageExpression
to a data.frame:
avg_test <- data.frame(AverageExpression(object = obj, group.by = c("ident", "Treatment")))
In my case this groups by both ident (i.e. Astrocyte 1 and Astrocyte 2) and Treatment (INHIB and NO_INHIB).
Best, Sam
thank you Sam ! interesting - are you working on A1 and A2 astrocytes in the context of neurodegeneration ? We have a project on A1 and A2 astrocytes in the context of optical nerve crush, although we can possibly talk more offline about these.
and thank you for your suggestions :) !
Hi,
Not specifically no. The astrocyte 1 and 2 here are just two different homeostatic clusters of astrocytes in one of my datasets.
Best, Sam
Dear all, i would appreciate having your answer please to a simple question : is there a way to write the R code for AverageExpression() in such a way that we obtain the AverageExpression per CLUSTER per EXPERIMENT ? We do have 54 clusters in our data and 10 experimental conditions. Thanks a lot,
-- bogdan