Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Genetic correlation between metabolites #2

Closed
rtabassu opened this issue Jun 4, 2020 · 3 comments
Closed

Genetic correlation between metabolites #2

rtabassu opened this issue Jun 4, 2020 · 3 comments

Comments

@rtabassu
Copy link

rtabassu commented Jun 4, 2020

Hi, you suggested that metabolites with high genetic correlation based on genetic instruments should be excluded. Could you suggest a method to calculate the genetic correlation based on a few selected variants? Thanks!

@verena-zuber
Copy link
Owner

Thanks rtabassu, the genetic correlation is simply the correlation between the genetic associations (or beta's) of the risk factors measured on the SNPs you use as instrumental variables. If your input matrix is betaX (dimension n (#SNPs) x p (#risk factors)) you can compute the correlation matrix (dimension pxp) using cor and plot using the library ggplot2 and reshape:

cor_beta = cor(betaX)
dim(cor_beta)
melted_cormat = melt(cor_beta)

print(
ggplot(data = melted_cormat, aes(Var2, Var1, fill = value))+
geom_tile(color = "white")+
scale_fill_gradient2(low = "blue", high = "red", mid = "white",
midpoint = 0, limit = c(-1,1), space = "Lab",
name="Correlation \n between betas") +
theme_minimal()+
theme(axis.text.x = element_text(angle = 45, vjust = 1, size = 12, hjust = 1))+
coord_fixed()+
theme(
axis.title.x = element_blank(),
axis.title.y = element_blank()
)
)

@rtabassu
Copy link
Author

rtabassu commented Jun 4, 2020 via email

@verena-zuber
Copy link
Owner

Dear Rubina, great happy to hear this, I am closing the issue now.
But please do get in touch if you have any other question or if you have any comments or feedback on the code. Hope to make this into a proper R-package soon.

Thanks for your interest, Verena

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants