I used FindMarkers to find the DEGs between two clusters in my dataset using Seurat. I am trying to visualize the outcome using a heatmap but I failed to write the command in R.
dput(cluster4_3.markers)
p_val avg_logFC pct.1 pct.2 p_val_adj
Vim 1.803527e-44 -1.1689785 0.996 0.999 3.458985e-40
Lgals7 1.479278e-38 1.7615232 0.993 0.552 2.837108e-34
Anxa2 1.797016e-37 -1.3971764 0.629 0.991 3.446497e-33
Tmsb10 6.936830e-31 0.7937881 1.000 1.000 1.330415e-26
Ptma 7.518439e-27 0.5622808 1.000 1.000 1.441961e-22
Jund 2.044576e-25 -0.9881766 0.993 0.999 3.921293e-21
When I tried:
DoHeatmap(cluster4_3.markers, features = NULL) +
scale_fill_gradientn(colors = rev(RColorBrewer::brewer.pal(n = 7, name = "RdYlBu")))
Error in UseMethod(generic = "DefaultAssay", object = object) :
no applicable method for 'DefaultAssay' applied to an object of class "data.frame"
It didn't work. I was trying to replicate this command:
top10 <- pbmc.markers %>% group_by(cluster) %>% top_n(n = 10, wt = avg_logFC)
DoHeatmap(pbmc, features = top10$gene) + NoLegend() +
scale_fill_gradientn(colors = rev(RColorBrewer::brewer.pal(n = 7, name = "RdYlBu")))
I tried to extract some info from the csv file but I couldn't determine which parameter is important (p_val avg_logFC pct.1 pct.2 p_val_adj). Also, I didn't know which parameter to use to use the group_by function. That's one of my attempts:
clus4vs3 <- cluster4_3.markers$p_val %>%
group_by(pct.1) %>%
top_n(n = 10, wt = avg_logFC)
Error in UseMethod("group_by_") :
no applicable method for 'group_by_' applied to an object of class "c('double', 'numeric')"
Now that I understand 'group_by' only accepts a categorical variable, how can I write a command that displays the top20 differentially expressed genes between cluster 4 and 3 in a heatmap ?
dput(cluster4_3.markers)
b) tell us what didn't work because it's not 'obvious' to us since we can't see your data. Include details of all error messages. We can't help you otherwise. $\endgroup$