Skip to content

Instantly share code, notes, and snippets.

@mikelove
Created June 1, 2021 07:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikelove/086b58809cb6806a03e20970367f7d34 to your computer and use it in GitHub Desktop.
Save mikelove/086b58809cb6806a03e20970367f7d34 to your computer and use it in GitHub Desktop.
load("invivo_invitro_overlap_mvalue.RDat")
rownames(DGE.lm.vivo) <- substr(rownames(DGE.lm.vivo),1,15)
all.equal(rownames(DGE.lm.vivo),rownames(DGE.lm.vitro))
idx <- DGE.lm.vivo$adj.P.Val < 0.01 & DGE.lm.vitro$adj.P.Val < 0.01 &
sign(DGE.lm.vivo$logFC) != sign(DGE.lm.vitro$logFC)
plot(sign(DGE.lm.vitro$logFC)*-log10(DGE.lm.vitro$adj.P.Val),
sign(DGE.lm.vivo$logFC)*-log10(DGE.lm.vivo$adj.P.Val),
col=idx+1,xlab="vitro",ylab="vivo",cex=.2)
abline(v=0,h=0,col="dodgerblue")
discordant <- rownames(DGE.lm.vivo)[idx]
table(discordant %in% neuroeGenes$gene)
table(discordant %in% proeGenes$gene)
round(prop.table(table(discordant %in% neuroeGenes$gene)) * 100)
round(prop.table(table(discordant %in% proeGenes$gene)) * 100)
sum(is.na(neuroeGenes$mval))
sum(is.na(proeGenes$mval))
library(fgsea)
eg <- proeGenes
eg <- eg[!is.na(eg$mval),]
discordant2 <- intersect(discordant, eg$gene)
nrow(eg)
length(discordant2)
eg <- eg[order(eg$mval),]
stats <- eg$mval
names(stats) <- eg$gene
res <- fgsea(list("discordant"=discordant2), stats, scoreType="pos")
res[,1:3]
library(ggplot2)
bars <- c(sum(eg$mval < .1),sum(eg$mval < .9))
plotEnrichment(discordant2, stats) + geom_vline(xintercept=bars)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment