Skip to content

Instantly share code, notes, and snippets.

@oganm
Last active December 3, 2024 17:45
Show Gist options
  • Save oganm/7e6eae47c8610d9f6da76deb1c30a294 to your computer and use it in GitHub Desktop.
Save oganm/7e6eae47c8610d9f6da76deb1c30a294 to your computer and use it in GitHub Desktop.
Gemma wide differential expression
library(gemma.R)
library(ggplot2)
library(magrittr)
library(dplyr)
# mouse Eno2 datasets that are annotated with the term for brain
brain_eno2 = get_gene_differential_expression_values(13807 , uris = "http://purl.obolibrary.org/obo/UBERON_0000955")
# mouse Eno2 datasets that are annotated with the term for blood
blood_eno2 = get_gene_differential_expression_values(13807 , uris = "http://purl.obolibrary.org/obo/UBERON_0000178")
brain_frame = data.frame(tissue = 'brain',
`log2(Fold Change)` = abs(brain_eno2$factor.logfc),
`-log10(p)` = -log10(brain_eno2$factor.pvalue),check.names = FALSE)
blood_frame = data.frame(tissue = 'blood',
`log2(Fold Change)` = abs(blood_eno2$factor.logfc),
`-log10(p)` = -log10(blood_eno2$factor.pvalue), check.names = FALSE)
frame = rbind(brain_frame,blood_frame)
# this removes results with extreme differential expression values
frame %<>% dplyr::filter(`log2(Fold Change)` <10)
# set 0 Ps to the smallest non 0 value.
frame$`-log10(p)`[frame$`-log10(p)` == Inf] = max(frame$`-log10(p)`[frame$`-log10(p)` != Inf],na.rm = TRUE)
frame %>%
ggplot(aes(x = `log2(Fold Change)`, y = `-log10(p)`, color = tissue)) + geom_point(alpha = 0.5) + cowplot::theme_cowplot()
# what other datasets CACNA1G DE in?
cacna1g_dif_exp = get_gene_differential_expression_values(8913)
cacna1g_dif_exp %>% filter(correctedPValue < 0.05) %$% experiment.ID %>% unique
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment