This is a test version of Biostars. For the public version, visit https://www.biostars.org.
find top expressed genes under one specific object

Hello everyone,

I hope you guys could help me with a code I am trying to write. I have a single cell dataset, and my data from both healthy and diseased patients. I performed a find cluster analysis, and I found 6 t-cell clusters. I want to know the top 10 t-cell markers in each t-cell cluster in different patient condition. I wonder how could I find my top 10 t-cell markers.

Thank you Andy

seurat r

1 answer

If you're using R and the Seurat pipeline, one way to get top lists of markers following a call to FindAllMarkers() is to use some of the dplyr functions from the tidyverse on the marker matrix:

 top10 <- markergenes %>% group_by(cluster) %>% top_n(-10, p_val_adj)
# split dataframe into list if you find that convenient
 top10.cids <- split(top10$gene, top10$cluster)

This would try to select the top 10 by P-value. You'll have to know which cluster numbers are your t-cells. And you can get back more than 10 if genes in the top set have the same p-value.

I appreciate your help.

However, the code did not run successfully. Since I want to split my data by Seurat objects. I run your code with top10$study, and r said first argument has to be a vector.

Log in to answer this question.