Skip to content

Instantly share code, notes, and snippets.

@explodecomputer
Last active April 15, 2016 11:42
Show Gist options
  • Save explodecomputer/488f1d4966b10d684ab0dec6bdb75168 to your computer and use it in GitHub Desktop.
Save explodecomputer/488f1d4966b10d684ab0dec6bdb75168 to your computer and use it in GitHub Desktop.
arachidonic acid mr
library(TwoSampleMR)
ao <- available_outcome()
i <- grep("arachid", ao$trait)
b <- extract_instruments(ao$id[i[1]])
o <- extract_outcome_data(b$SNP[1], ao$id)
dat <- harmonise_data(b[1,], o)
m <- mr(dat)
ivw <- subset(m, method=="Fixed effects meta analysis (delta method)" & pval < 0.05)
ivw <- subset(ivw, !duplicated(outcome))
ivw <- ivw[order(ivw$b), ]
ivw$outcome <- factor(ivw$outcome, levels=ivw$outcome)
ggplot(ivw, aes(x=outcome, y=b)) +
geom_point() +
geom_errorbar(aes(ymin=b - se*1.96, ymax=b+se*1.96), width=0) +
geom_hline(yintercept=0) +
coord_flip()
ggsave(file="~/Desktop/arachidonate.pdf", width=10, height=25)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment