Identifying common DEGs among multiple datasets
Hello everyone,
I desperately need help here. I have microarray and RNA-seq datasets on which I performed, individually, DEGs analysis using GEO2R. Now I need to find the common DEGs between all these datasets using R.
I am very lost and confused about the next steps, as the internet is overwhelmingly full of tutorials and most of them are for comparing only two datasets (not multiple)
I am a beginner and I really need help in this as my time is running out
Any guidance is highly appreciated
Thank you!
• 1,784 views
•
link
1 answer
Return a vector of common DEGs
dataset1 <- read.csv("dataset1.csv", header=T)
dataset2 <- read.csv("dataset2.csv", header=T)
head(dataset1)
Gene logFC AveExpr t P.Value adj.P.Val B
1 MAOA -6.679361 6.726295 -32.72261 4.120941e-15 3.56476e-11 24.50716
2 PRKD1 -5.554521 6.771339 -31.54545 6.999959e-15 3.56476e-11 24.26388
3 KLK3 -4.327225 8.363903 -30.63718 1.067627e-14 3.56476e-11 24.10586
common_genes <- Reduce(intersect, list(dataset1$Gene, dataset2$Gene))
You might be interested in capturing DEGs that exhibit the same fold change direction across your experiments and averaging their logFC values
library(dplyr)
dataset1$experiment = "experiment1"
dataset2$experiment = "experiment2"
intersection = rbind(dataset1, dataset2)
# Adjust >=2 to the number of datasets you are merging
intersection = intersection %>% group_by(Gene) %>% filter(length(unique(experiment))>=2) %>% ungroup()
intersection = intersection %>% group_by(Gene) %>% filter(all(logFC>0) | all(logFC<0)) %>% ungroup()
intersection = intersection %>% group_by(Gene) %>% summarise(average_LFC = mean(logFC))
• 0 views
•
link
Log in to answer this question.
If you already have DE results, you can merge your different DE results using
mergefunction and find common DE genes-