Background:

Human studies of the metabolic basis of prostate cancer (PCa) have yet to determine which metabolic changes associated with prostate cancer are a cause or a consequence of tumor development and progression.

Methods:

To address this, I performed a nested case-control study of metabolites and PCa incidence, stage and grade in a cross-sectional sample of 5,041 localized PCa cases (2335) and controls (2706) in the UK-based ProtecT study (adjusting for age, study center, and family history). Then, using the summary data for the association of between SNPs associated with metabolites and PCa incidence in the PRACTICAL consortium (44,825 PCa cases 27,904 controls) and extracting SNPs associated with PCa from the publicly-available GWAS Catalog and the summary data for the association of these SNPs with 123 metabolites, I performed bi-directional, 2-sample Mendelian randomization (MR), interrogating the causality of the metabolome on PCa incidence (PRACTICAL) and the causality of PCa on the metabolome (GWAS Catalog).

Results:

A list of the ProtecT findings with p-values less than the PCA-derived multiple-testing correction threshold (0.0014) is below, as are the findings for the MR of metabolites on PCa and the MR of PCa incidence on metabolites. In the MR of metabolites on PCa incidence, creatinine had a p-value <0.0014, though creatinine was not associated observationally with PCa. Interestingly, the ProtecT associations between PCa incidence and glycerol and PCa incidence and albumin appear to be the consequence of tumor development and not its cause. The observational findings for stage (<3 and >=3) and grade (<7 and >=7; <8 and>=8) are provided. We are awaiting the stage and grade equivalent outcome data from PRACTICAL.


List of ProtecT findings for the association of metabolites on prostate cancer incidence

# Complete list of results is viewable as an interactive shiny app. Open R, and type the following two-line code, which will access the project files (ui.R, server.R, and protect.csv) I stored in my "protect" repository:
library(shiny) 
runGitHub( "protect", "CharleenAdams")
Metabolite OR P-value LCI UCI Description
Glol 0.6553527 2.664802e-11 0.5780110 0.7412617 glycerol
M_VLDL_PL_. 0.8732285 7.323548e-06 0.8228883 0.9264453 phospholipids to total lipids ratio in medium VLDL
S_HDL_C 0.8732623 1.125733e-05 0.8217311 0.9274349 total cholesterol in small HDL
S_HDL_CE 0.8774507 2.112785e-05 0.8259049 0.9317173 cholesterol esters to total lipids ratio in small HDL
Tyr 1.1376343 2.454522e-05 1.0716897 1.2081405 tyrosine
Ile 1.1345019 4.146335e-05 1.0682633 1.2053172 isoleucine
Leu 1.1318246 6.118838e-05 1.0656001 1.2028308 leucine
SFA.FA 1.1274312 8.459010e-05 1.0621770 1.1971785 ratio of saturated fatty acids
Alb 0.8957930 3.175461e-04 0.8435500 0.9509507 albumin
XS_VLDL_PL_. 0.8966989 4.138705e-04 0.8436937 0.9523114 phospholipids to total lipids
Val 1.1101809 6.384085e-04 1.0456760 1.1790166 valine
IDL_FC 0.9014798 6.439810e-04 0.8492479 0.9567330 free cholesterol to total lipids ratio in IDL
M_HDL_FC_. 0.8998385 6.531297e-04 0.8464827 0.9557802 free cholesterol to total lipids ratio in medium HDL
S_VLDL_TG_. 1.1088164 6.551682e-04 1.0449512 1.1768208 triglycerides to total lipids
L_LDL_FC 0.9022708 7.261058e-04 0.8499374 0.9576444 free cholesterol in large LDL
M_VLDL_TG_. 1.1068419 7.645546e-04 1.0433930 1.1743955 triglycerides to total lipids ratio in medium VLDL
M_HDL_FC 0.9044687 9.626556e-04 0.8520305 0.9599479 free cholesterol in medium HDL
S_VLDL_C_. 0.9050544 1.001738e-03 0.8527355 0.9603868 total cholesterol to total lipids ratio in small VLDL
FAw6.FA 0.9051374 1.026871e-03 0.8527105 0.9605002 ratio of omega-6 fatty acids to total fatty acids
VLDL_D 1.1039821 1.055388e-03 1.0406156 1.1714342 mean diameter for VLDL particles
IDL_PL 0.9055591 1.117105e-03 0.8530232 0.9611483 phospholipids to total lipids ratio in IDL
S_VLDL_CE_. 0.9060277 1.144429e-03 0.8536167 0.9614573 cholesterol esters to total lipids ratio in small VLDL
S_HDL_L 0.9043873 1.227302e-03 0.8503707 0.9606276 total lipids in small HDL
M_LDL_PL_. 1.1064544 1.238442e-03 1.0409811 1.1770598 phospholipids to total lipids ratio in medium LDL

List of ProtecT findings for the association of metabolites on stage (<3 and >=3)

Metabolite OR P-value LCI UCI Description
S_HDL_PL_. 1.3284078 0.0001159095 1.1483494 1.5335032 phospholipids to total lipds ratio in small HDL
S_LDL_PL_. 1.2762402 0.0003202600 1.1141019 1.4544262 phospholipids to total lipids ratio in small LDL
M_LDL_C_. 0.7860330 0.0003507433 0.6905401 0.9001361 total cholesterol to total lipids ratio in medium LDL
M_LDL_PL_. 1.2736280 0.0003508704 1.1115246 1.4507506 phospholipids to total lipids ratio in medium LDL
S_HDL_CE_. 0.7731154 0.0003920311 0.6715387 0.8930492 cholesterol esters to total lipids ratio in small HDL
S_HDL_C_. 0.7736563 0.0003924222 0.6722889 0.8933916 total cholesterol to total lipids ratio in small HDL
S_LDL_C_. 0.7881754 0.0004068676 0.6923828 0.9023682 total cholesterol to total lipids ratio in small LDL
S_LDL_CE_. 0.7879145 0.0004398147 0.6914414 0.9027815 cholesterol esters to total lipids ratio in small LDL
M_LDL_CE_. 0.7906808 0.0005693380 0.6935472 0.9068247 cholesterol esters to total lipids ratio in medium LDL
PUFA.FA 0.7815378 0.0007005327 0.6783451 0.9023850 ratio of polyunsaturated fatty acids to total fatty acids
XS_VLDL_FC_. 0.7890715 0.0008364721 0.6879315 0.9093618 phospholipids to total lipids ratio in very small VLDL
M_LDL_PL_. 1.1064544 1.238442e-03 1.0409811 1.1770598 phospholipids to total lipids ratio in medium LDL

List of ProtecT findings for the association of metabolites on grade (<7 and >=7)

Metabolite OR P-value LCI UCI Description
M_LDL_TG_. 1.175836 0.001097428 1.066641 1.296052 triglycerides to total lipids ratio in medium LDL

List of ProtecT findings for the association of metabolites on grade (<8 and >=8)

Metabolite OR P-value LCI UCI Description
S_HDL_C_. 0.7201618 0.0002377088 0.6066479 0.8619930 total cholesterol to total lipids ratio in small HDL
S_HDL_CE_. 0.7199488 0.0002463473 0.6060987 0.8621997 cholesterol esters to total lipids ratio in small HDL
S_HDL_PL_. 1.3776690 0.0005781698 1.1435806 1.6483907 phospholipids to total lipds ratio in small HDL
XS_VLDL_FC_. 0.7440629 0.0006145425 0.6313257 0.8872124 phospholipids to total lipids ratio in very small VLDL
S_HDL_CE 0.7349189 0.0007917589 0.6161985 0.8837708 phospholipids to total lipids ratio in very small VLDL
XS_VLDL_PL_. 0.7474369 0.0008556690 0.6333012 0.8931350 phospholipids to total lipids ratio in very small VLDL
IDL_FC_. 0.7617759 0.0008787680 0.6517801 0.9008792 phospholipids to total lipids ratio in very small VLDL
S_LDL_C_. 0.7644256 0.0012497011 0.6532419 0.9068541 total cholesterol to total lipids ratio in small LDL
M_LDL_PL_. 1.1064544 1.238442e-03 1.0409811 1.1770598 phospholipids to total lipids ratio in medium LDL

MR results exploring the causality of metabolites on prostate cancer incidence

Metabolite Methods P-value OR Description
Crea Maximum likelihood 3.046832e-05 1.4108683 creatinine
Gp Maximum likelihood 6.414927e-03 1.1673271 glycoprotein acetyls
Pyr Inverse variance weighted 2.415705e-02 1.2926272 pyruvate
Pyr Maximum likelihood 2.754147e-02 1.2927579 pyruvate
Lac Inverse variance weighted 2.842687e-02 1.3790633 lactate
Ala Inverse variance weighted 2.936834e-02 1.1967192 alanine
Ala Maximum likelihood 3.072430e-02 1.1984432 alanine
Lac Maximum likelihood 3.453195e-02 1.3791564 lactate
FAw79S Maximum likelihood 3.712253e-02 1.1191078 ?
FAw79S Inverse variance weighted 3.770544e-02 1.1173267 ?

# Complete list of results is viewable as an interactive shiny app. Open R, and type the following two-line code, which will access the project files (ui.R, server.R, and practical.csv) I stored in my "practical" repository:
library(shiny) 
runGitHub( "practical", "CharleenAdams")

MR results exploring the causality of prostate cancer incidence on metabolites

Metabolite Methods P-value Beta Description
Alb Maximum likelihood 0.00332458 0.9149797 albumin *
Cit Maximum likelihood 0.00332458 0.9149797 citrate
Cit Inverse variance weighted 0.01489222 1.0200445 citrate
totCholMDHL Inverse variance weighted 0.01914970 0.9364396 total cholesterol in medium HDL
totCholMDHL Maximum likelihood 0.02173529 0.9363811 total cholesterol in medium HDL
Glol Inverse variance weighted 0.02304488 1.0199923 glycerol *
Glol Maximum likelihood 0.02449946 1.0200524 glycerol *
Glu Maximum likelihood 0.02547133 1.0757333 glucose
meanLDL Inverse variance weighted 0.02984548 0.9394014 mean diameter for LDL particles
meanLDL Maximum likelihood 0.03208265 0.9394521 mean diameter for LDL particles
docacid Inverse variance weighted 0.03461089 0.9410828 docosahexaenoic acid
cholMedHDL Inverse variance weighted 0.03461089 0.9410828 cholesterol esters in medium HDL
cholMedHDL Maximum likelihood 0.03817747 0.9409950 cholesterol esters in medium HDL
docacid Maximum likelihood 0.04147820 1.0401230 docosahexaenoic acid

Data setup

library('MRInstruments')
library('TwoSampleMR')
## Welcome to TwoSampleMR.
## [>] Check for updates: https://github.com/MRCIEU/TwoSampleMR
## [>] Full documentation: https://mrcieu.github.io/TwoSampleMR
setwd("C:/Users/ca16591/Dropbox/Bristol")

# Read in the exposure data

data(gwas_catalog) 

# Read in outcome data (the 123 Kettunen metabolite associations) and create sublists of the metabolite IDs to use in the function looping through the outcomes by metabolite study ID. Note: the sublists are necessary because, while the function works on the complete list, R times out from the computational load. R can handle the task in smaller bits.

ao <- available_outcomes()
list <- subset(ao, select=c(author, trait, id))
list2 <- subset(list, author=="Kettunen")
Outcome.vec2 <-c(list2[,3])
unlist(Outcome.vec2)
##   [1] 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854
##  [18] 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871
##  [35] 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888
##  [52] 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905
##  [69] 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922
##  [86] 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939
## [103] 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956
## [120] 957 958 959 960
Outcome.vec2 <- as.data.frame(Outcome.vec2)
Outcome.subset1 <- Outcome.vec2[c(seq(1,10,1)),]
Outcome.subset2 <- Outcome.vec2[c(seq(11,20,1)),]
Outcome.subset3 <- Outcome.vec2[c(seq(21,30,1)),]
Outcome.subset4 <- Outcome.vec2[c(seq(31,40,1)),]
Outcome.subset5 <- Outcome.vec2[c(seq(41,50,1)),]
Outcome.subset6 <- Outcome.vec2[c(seq(51,60,1)),]
Outcome.subset7 <- Outcome.vec2[c(seq(61,70,1)),]
Outcome.subset8 <- Outcome.vec2[c(seq(71,80,1)),]
Outcome.subset9 <- Outcome.vec2[c(seq(81,90,1)),]
Outcome.subset10 <- Outcome.vec2[c(seq(91,100,1)),]
Outcome.subset11 <- Outcome.vec2[c(seq(101,110,1)),]
Outcome.subset12 <- Outcome.vec2[c(seq(111,120,1)),]
Outcome.subset13 <- Outcome.vec2[c(seq(121,123,1)),]

Function to loop through all the metabolite outcomes

Funk.1 <-function(OUT)  
{exposure_dat <- format_data(subset(gwas_catalog, Phenotype_simple=="Prostate cancer"))
head(exposure_dat)

  #Extracting outcome data for Creatinine 
  out_dat <- extract_outcome_data(snps = exposure_dat$SNP, outcomes=OUT, proxies=FALSE)
  head(out_dat)
  
  #harmonization
  dat <- harmonise_data(exposure_dat, out_dat, action=2)
  
  #mr analysis
  res <-  mr(dat, method_list=c("mr_two_sample_ml", "mr_ivw"))
  
  #head(res)
  
  #sensitivity analyses
  het.dat<-mr_heterogeneity(dat)
  
  p1 <- mr_scatter_plot(res, dat)
  
  return(list(res,het.dat,p1))
  
}

Run the function for each of the outcome lists and save the outputs

outcome.test1<- mapply(Funk.1, Outcome.subset1)
write.csv(outcome.test1, "outcome.test1")
outcome.test2<- mapply(Funk.1, Outcome.subset2)
write.csv(outcome.test2, "outcome.test2")
outcome.test3<- mapply(Funk.1, Outcome.subset3)
write.csv(outcome.test3, "outcome.test3")
outcome.test4<- mapply(Funk.1, Outcome.subset4)
write.csv(outcome.test4, "outcome.test4")
outcome.test5<- mapply(Funk.1, Outcome.subset5)
write.csv(outcome.test5, "outcome.test5")
outcome.test6<- mapply(Funk.1, Outcome.subset6)
write.csv(outcome.test6, "outcome.test6")
outcome.test7<- mapply(Funk.1, Outcome.subset7)
write.csv(outcome.test7, "outcome.test7")
outcome.test8<- mapply(Funk.1, Outcome.subset8)
write.csv(outcome.test8, "outcome.test8")
outcome.test9<- mapply(Funk.1, Outcome.subset9)
write.csv(outcome.test9, "outcome.test9")
outcome.test10<- mapply(Funk.1, Outcome.subset10)
write.csv(outcome.test10, "outcome.test10")
outcome.test11<- mapply(Funk.1, Outcome.subset11)
write.csv(outcome.test11, "outcome.test11")
outcome.test12<- mapply(Funk.1, Outcome.subset12)
write.csv(outcome.test12, "outcome.test12")
outcome.test13<- mapply(Funk.1, Outcome.subset13)
write.csv(outcome.test13, "outcome.test13")

Extract the results from each of the lists and dataframe them by metabolite name

#### outcome.test1

OT1 <- outcome.test1[,1]
OT1 <- OT1[[1]]
OT1 <- as.data.frame(OT1)
OT1$Name <- 0
OT1$Name <- ifelse(OT1$Name==0,"Acetoacetate",OT1$Name)
OT1$Metabolite<- 0
OT1$Metabolite<- ifelse(OT1$Metabolite==0,"AcAce",OT1$Metabolite)
Acetoacetate<- OT1[order(OT1$pval), ]
Acetoacetate
write.csv(Acetoacetate, "Acetoacetate.csv")

OT2 <- outcome.test1[,2]
OT2 <- OT2[[1]]
OT2 <- as.data.frame(OT2)
OT2
OT2$Name <- 0
OT2$Name <- ifelse(OT2$Name==0,"Acetate",OT2$Name)
OT2$Metabolite<- 0
OT2$Metabolite<- ifelse(OT2$Metabolite==0,"Ace",OT2$Metabolite)
Acetate <- OT2[order(OT2$pval), ]
Acetate
write.csv(Acetate, "Acetate.csv")

OT3 <- outcome.test1[,3]
OT3 <- OT3[[1]]
OT3 <- as.data.frame(OT3)
OT3
OT3$Name <- 0
OT3$Name <- ifelse(OT3$Name==0,"Alanine",OT3$Name)
OT3$Metabolite<- 0
OT3$Metabolite<- ifelse(OT3$Metabolite==0,"Ala",OT3$Metabolite)
Alanine <- OT3[order(OT3$pval), ]
Alanine
write.csv(Alanine, "Alanine.csv")

OT4 <- outcome.test1[,4]
OT4 <- OT4[[1]]
OT4 <- as.data.frame(OT4)
OT4
OT4$Name <- 0
OT4$Name <- ifelse(OT4$Name==0,"Albumin",OT4$Name)
OT4$Metabolite<- 0
OT4$Metabolite<- ifelse(OT4$Metabolite==0,"Alb",OT4$Metabolite)
Albumin <- OT4[order(OT4$pval), ]
Albumin ###Got one! But in Japanese population; 3 snps; pval=0.003; ML method
write.csv(Albumin, "Albumin.csv")

OT5 <- outcome.test1[,5]
OT5 <- OT5[[1]]
OT5 <- as.data.frame(OT5)
OT5
OT5$Name <- 0
OT5$Name <- ifelse(OT5$Name==0,"Apolipoprotein.a1 ",OT5$Name)
OT5$Metabolite<- 0
OT5$Metabolite<- ifelse(OT5$Metabolite==0,"ApoA1",OT5$Metabolite)
Apolipoprotein.a1 <- OT5[order(OT5$pval), ]
Apolipoprotein.a1 #doublecheck
write.csv(Apolipoprotein.a1, "Apolipoprotein.a1.csv")

OT6 <- outcome.test1[,6]
OT6 <- OT6[[1]]
OT6 <- as.data.frame(OT6)
OT6
OT6$Name <- 0
OT6$Name <- ifelse(OT6$Name==0,"Apolipoprotein.B ",OT6$Name)
OT6$Metabolite<- 0
OT6$Metabolite<- ifelse(OT6$Metabolite==0,"ApoB",OT6$Metabolite)
Apolipoprotein.B <- OT6[order(OT6$pval), ]
Apolipoprotein.B# doublecheck
write.csv(Apolipoprotein.B, "Apolipoprotein.B.csv")

OT7 <- outcome.test1[,7]
OT7 <- OT7[[1]]
OT7 <- as.data.frame(OT7)
OT7
OT7$Name <- 0
OT7$Name <- ifelse(OT7$Name==0,"UNK.Ratio.of.bisallylic.groups.to.double.bonds",OT7$Name)
OT7$Metabolite<- 0
OT7$Metabolite<- ifelse(OT7$Metabolite==0,"Ratio.of.bisallylic.groups.to.double.bonds",OT7$Metabolite)
Ratio.of.bisallylic.groups.to.double.bonds <- OT7[order(OT7$pval), ]
Ratio.of.bisallylic.groups.to.double.bonds
write.csv(Ratio.of.bisallylic.groups.to.double.bonds, "Ratio.of.bisallylic.groups.to.double.bonds.csv")

OT8 <- outcome.test1[,8]
OT8 <- OT8[[1]]
OT8 <- as.data.frame(OT8)
OT8
OT8$Name <- 0
OT8$Name <- ifelse(OT8$Name==0,"UNK.Ratio.of.bisallylic.groups.to.fatty.acids",OT8$Name)
OT8$Metabolite<- 0
OT8$Metabolite<- ifelse(OT8$Metabolite==0,"Ratio.of.bisallylic.groups.to.fatty.acids",OT8$Metabolite)
Ratio.of.bisallylic.groups.to.fatty.acids <- OT8[order(OT8$pval), ]
Ratio.of.bisallylic.groups.to.fatty.acids
write.csv(Ratio.of.bisallylic.groups.to.fatty.acids, "Ratio.of.bisallylic.groups.to.fatty.acids.csv")

OT9 <- outcome.test1[,9]
OT9 <- OT9[[1]]
OT9 <- as.data.frame(OT9)
OT9
OT9$Name <- 0
OT9$Name <- ifelse(OT9$Name==0,"three.hydroxybutyrate",OT9$Name)
OT9$Metabolite<- 0
OT9$Metabolite<- ifelse(OT9$Metabolite==0,"bOHBut",OT9$Metabolite)
three.hydroxybutyrate <- OT9[order(OT9$pval), ]
write.csv(three.hydroxybutyrate, "three.hydroxybutyrate.csv")

OT10 <- outcome.test1[,10]
OT10 <- OT10[[1]]
OT10 <- as.data.frame(OT10)
OT10
OT10$Name <- 0
OT10$Name <- ifelse(OT10$Name==0,"Average.number.of.methylene.groups.per.double.bond",OT10$Name)
OT10$Metabolite <- 0
OT10$Metabolite <- ifelse(OT10$Metabolite==0,"UNK.Average.number.of.methylene.groups.per.double.bond",OT10$Metabolite)
Average.number.of.methylene.groups.per.double.bond <- OT10[order(OT10$pval), ]
Average.number.of.methylene.groups.per.double.bond
write.csv(Average.number.of.methylene.groups.per.double.bond, "Average.number.of.methylene.groups.per.double.bond.csv")

#### outcome.test2

OT1 <- outcome.test2[,1]
OT1 <- OT1[[1]]
OT1 <- as.data.frame(OT1)
OT1
OT1$Name <- 0
OT1$Name <- ifelse(OT1$Name==0,"Average.number.of.methylene.groups.in.a.fatty.acid.chain",OT1$Name)
OT1$Metabolite <- 0
OT1$Metabolite <- ifelse(OT1$Metabolite==0,"UNK.Average.number.of.methylene.groups.in.a.fatty.acid.chain",OT1$Metabolite)
Average.number.of.methylene.groups.in.a.fatty.acid.chain <- OT1[order(OT1$pval), ]
Average.number.of.methylene.groups.in.a.fatty.acid.chain
write.csv(Average.number.of.methylene.groups.in.a.fatty.acid.chain, "Average.number.of.methylene.groups.in.a.fatty.acid.chain.csv")

OT2 <- outcome.test2[,2]
OT2 <- OT2[[1]]
OT2 <- as.data.frame(OT2)
OT2
OT2$Name <- 0
OT2$Name <- ifelse(OT2$Name==0,"Citrate",OT2$Name)
OT2$Metabolite <- 0
OT2$Metabolite <- ifelse(OT2$Metabolite==0,"Cit",OT2$Metabolite)
Citrate <- OT2[order(OT2$pval), ]
Citrate ###Got one! But 86 SNPs 0.05/86=0.0006 and p-value is 0.02 ML & IVW
write.csv(Citrate, "Citrate.csv")

OT3 <- outcome.test2[,3]
OT3 <- OT3[[1]]
OT3 <- as.data.frame(OT3)
OT3
OT3$Name <- 0
OT3$Name <- ifelse(OT3$Name==0,"Creatinine",OT3$Name)
OT3$Metabolite <- 0
OT3$Metabolite <- ifelse(OT3$Metabolite==0,"Crea",OT3$Metabolite)
Creatinine <- OT3[order(OT3$pval), ]
Creatinine
write.csv(Creatinine, "Creatinine.csv")

OT4 <- outcome.test2[,4]
OT4 <- OT4[[1]]
OT4 <- as.data.frame(OT4)
OT4
OT4$Name <- 0
OT4$Name <- ifelse(OT4$Name==0,"Average.number.of.double.bonds.in.a.fatty.acid.chain",OT4$Name)
OT4$Metabolite <- 0
OT4$Metabolite <- ifelse(OT4$Metabolite==0,"UNK.Average.number.of.double.bonds.in.a.fatty.acid.chain",OT4$Metabolite)
Average.number.of.double.bonds.in.a.fatty.acid.chain <- OT4[order(OT4$pval), ]
Average.number.of.double.bonds.in.a.fatty.acid.chain
write.csv(Average.number.of.double.bonds.in.a.fatty.acid.chain, "Average.number.of.double.bonds.in.a.fatty.acid.chain.csv")

OT5 <- outcome.test2[,5]
OT5 <- OT5[[1]]
OT5 <- as.data.frame(OT5)
OT5
OT5$Name <- 0
OT5$Name <- ifelse(OT5$Name==0,"docosahexaenoic.acid",OT5$Name)
OT5$Metabolite <- 0
OT5$Metabolite <- ifelse(OT5$Metabolite==0,"DHA",OT5$Metabolite)
docosahexaenoic.acid <- OT5[order(OT5$pval), ]
docosahexaenoic.acid ### Got one! But in Japanese population. p-value=0.0342866 (IVW); 4 snps
write.csv(docosahexaenoic.acid, "DHA.csv")

OT6 <- outcome.test2[,6]
OT6 <- OT6[[1]]
OT6 <- as.data.frame(OT6)
OT6
OT6$Name <- 0
OT6$Name <- ifelse(OT6$Name==0,"Free.cholesterol.to.esterified.cholesterol.ratio",OT6$Name)
OT6$Metabolite <- 0
OT6$Metabolite <- ifelse(OT6$Metabolite==0,"UNK.Free.cholesterol.to.esterified.cholesterol.ratio",OT6$Metabolite)
Free.cholesterol.to.esterified.cholesterol.ratio <- OT6[order(OT6$pval), ]
Free.cholesterol.to.esterified.cholesterol.ratio
write.csv(Free.cholesterol.to.esterified.cholesterol.ratio, "Free.cholesterol.to.esterified.cholesterol.ratio.csv")

OT7 <- outcome.test2[,7]
OT7 <- OT7[[1]]
OT7 <- as.data.frame(OT7)
OT7
OT7$Name <- 0
OT7$Name <- ifelse(OT7$Name==0,"Description.of.average.fatty.acid.chain.length.not.actual.carbon.number",OT7$Name)
OT7$Metabolite <- 0
OT7$Metabolite <- ifelse(OT7$Metabolite==0,"UNK.Description.of.average.fatty.acid.chain.length.not.actual.carbon.number",OT7$Metabolite)
Description.of.average.fatty.acid.chain.length.not.actual.carbon.number <- OT7[order(OT7$pval), ]
Description.of.average.fatty.acid.chain.length.not.actual.carbon.number
write.csv(Description.of.average.fatty.acid.chain.length.not.actual.carbon.number, "Description.of.average.fatty.acid.chain.length.not.actual.carbon.number.csv")

OT8 <- outcome.test2[,8]
OT8 <- OT8[[1]]
OT8 <- as.data.frame(OT8)
OT8
OT8$Name <- 0
OT8$Name <- ifelse(OT8$Name==0,"Omega3.fatty.acids",OT8$Name)
OT8$Metabolite <- 0
OT8$Metabolite <- ifelse(OT8$Metabolite==0,"FAw3",OT8$Metabolite)
Omega3.fatty.acids <- OT8[order(OT8$pval), ]
Omega3.fatty.acids
write.csv(Omega3.fatty.acids, "Omega3.fatty.acids.csv")

OT9 <- outcome.test2[,9]
OT9 <- OT9[[1]]
OT9 <- as.data.frame(OT9)
OT9
OT9$Name <- 0
OT9$Name <- ifelse(OT9$Name==0,"Omega6.fatty.acids",OT9$Name)
OT9$Metabolite <- 0
OT9$Metabolite <- ifelse(OT9$Metabolite==0,"FAw6",OT9$Metabolite)
Omega6.fatty.acids <- OT9[order(OT9$pval), ]
Omega6.fatty.acids
write.csv(Omega6.fatty.acids, "Omega6.fatty.acids.csv")

OT10 <- outcome.test2[,10]
OT10 <- OT10[[1]]
OT10 <- as.data.frame(OT10)
OT10
OT10$Name <- 0
OT10$Name <- ifelse(OT10$Name==0,"Omega.9.and.saturated.fatty.acids",OT10$Name)
OT10$Metabolite <- 0
OT10$Metabolite <- ifelse(OT10$Metabolite==0,"UNK.Omega.9.and.saturated.fatty.acids,OT10$Metabolite")
Omega.9.and.saturated.fatty.acids <- OT10[order(OT10$pval), ]
Omega.9.and.saturated.fatty.acids
write.csv(Omega.9.and.saturated.fatty.acids, "Omega.9.and.saturated.fatty.acids.csv")

#### outcome.test3

OT1 <- outcome.test3[,1]
OT1 <- OT1[[1]]
OT1 <- as.data.frame(OT1)
OT1
OT1$Name <- 0
OT1$Name <- ifelse(OT1$Name==0,"Free.cholesterol",OT1$Name)
OT1$Metabolite <- 0
OT1$Metabolite <- ifelse(OT1$Metabolite==0,"FreeC")
Free.cholesterol <- OT1[order(OT1$pval), ]
Free.cholesterol 
write.csv(Free.cholesterol, "Free.cholesterol.csv")

OT2 <- outcome.test3[,2]
OT2 <- OT2[[1]]
OT2 <- as.data.frame(OT2)
OT2
OT2$Name <- 0
OT2$Name <- ifelse(OT2$Name==0,"Glucose",OT2$Name)
OT2$Metabolite <- 0
OT2$Metabolite <- ifelse(OT2$Metabolite==0,"Glc")
Glucose  <- OT2[order(OT2$pval), ]
Glucose  ###Got one! But 14 SNPs 0.05/14= 0.0034 and p-value is 0.03 ML 
write.csv(Glucose, "Glucose.csv")

OT3 <- outcome.test3[,3]
OT3 <- OT3[[1]]
OT3 <- as.data.frame(OT3)
OT3
OT3$Name <- 0
OT3$Name <- ifelse(OT3$Name==0,"Gln",OT3$Name)
OT3$Metabolite <- 0
OT3$Metabolite <- ifelse(OT3$Metabolite==0,"Glu")
Glutamine <- OT3[order(OT3$pval), ]
Glutamine
write.csv(Glutamine, "Glutamine")

OT4 <- outcome.test3[,4]
OT4 <- OT4[[1]]
OT4 <- as.data.frame(OT4)
OT4
OT4$Name <- 0
OT4$Name <- ifelse(OT4$Name==0,"Glycerol",OT4$Name)
OT4$Metabolite <- 0
OT4$Metabolite <- ifelse(OT4$Metabolite==0,"Glol")
Glycerol <- OT4[order(OT4$pval), ]
Glycerol ###Got one! But 86 SNPs 0.05/86= 0.00058 and p-value is 0.023 IVw & 0.24 ML 
write.csv(Glycerol, "Glycerol.csv")

OT5 <- outcome.test3[,5]
OT5 <- OT5[[1]]
OT5 <- as.data.frame(OT5)
OT5
OT5$Name <- 0
OT5$Name <- ifelse(OT5$Name==0,"Glycoproteins",OT5$Name)
OT5$Metabolite <- 0
OT5$Metabolite <- ifelse(OT5$Metabolite==0,"Gp?")
Glycoproteins <- OT5[order(OT5$pval), ]
Glycoproteins
write.csv(Glycoproteins, "Glycoproteins.csv")

OT6 <- outcome.test3[,6]
OT6 <- OT6[[1]]
OT6 <- as.data.frame(OT6)
OT6
OT6$Name <- 0
OT6$Name <- ifelse(OT6$Name==0,"Glycoprotein.acetyls",OT6$Name)
OT6$Metabolite <- 0
OT6$Metabolite <- ifelse(OT6$Metabolite==0,"Gp")
Glycoprotein.acetyls <- OT6[order(OT6$pval), ]
Glycoprotein.acetyls
write.csv(Glycoprotein.acetyls, "Glycoprotein.acetyls.csv")

OT7 <- outcome.test3[,7]
OT7 <- OT7[[1]]
OT7 <- as.data.frame(OT7)
OT7
OT7$Name <- 0
OT7$Name <- ifelse(OT7$Name==0,"Total.cholesterol.in.HDL",OT7$Name)
OT7$Metabolite <- 0
OT7$Metabolite <- ifelse(OT7$Metabolite==0,"L.HDL.C")
Total.cholesterol.in.HDL <- OT7[order(OT7$pval), ]
Total.cholesterol.in.HDL
write.csv(Total.cholesterol.in.HDL, "Total.cholesterol.in.HDL.csv")

OT8 <- outcome.test3[,8]
OT8 <- OT8[[1]]
OT8 <- as.data.frame(OT8)
OT8
OT8$Name <- 0
OT8$Name <- ifelse(OT8$Name==0,"Mean.diameter.for.HDL.particles",OT8$Name)
OT8$Metabolite <- 0
OT8$Metabolite <- ifelse(OT8$Metabolite==0,"HDL.D")
Mean.diameter.for.HDL.particles <- OT8[order(OT8$pval), ]
Mean.diameter.for.HDL.particles
write.csv(Mean.diameter.for.HDL.particles, "Mean.diameter.for.HDL.particles.csv")

OT9 <- outcome.test3[,9]
OT9 <- OT9[[1]]
OT9 <- as.data.frame(OT9)
OT9
OT9$Name <- 0
OT9$Name <- ifelse(OT9$Name==0,"Histidine",OT9$Name)
OT9$Metabolite <- 0
OT9$Metabolite <- ifelse(OT9$Metabolite==0,"His")
Histidine <- OT9[order(OT9$pval), ]
Histidine
write.csv(Histidine, "Histidine.csv")

OT10 <- outcome.test3[,10]
OT10 <- OT10[[1]]
OT10 <- as.data.frame(OT10)
OT10
OT10$Name <- 0
OT10$Name <- ifelse(OT10$Name==0,"Total.cholesterol.in.IDL",OT10$Name)
OT10$Metabolite <- 0
OT10$Metabolite <- ifelse(OT10$Metabolite==0,"IDL.C")
Total.cholesterol.in.IDL <- OT10[order(OT10$pval), ]
Total.cholesterol.in.IDL
write.csv(Total.cholesterol.in.IDL, "Total.cholesterol.in.IDL.csv")

#### outcome.test4

OT1 <- outcome.test4[,1]
OT1 <- OT1[[1]]
OT1 <- as.data.frame(OT1)
OT1
OT1$Name <- 0
OT1$Name <- ifelse(OT1$Name==0,"Free.cholesterol.in.IDL",OT1$Name)
OT1$Metabolite <- 0
OT1$Metabolite <- ifelse(OT1$Metabolite==0,"IDL.FC")
Free.cholesterol.in.IDL <- OT1[order(OT1$pval), ]
Free.cholesterol.in.IDL 
write.csv(Free.cholesterol.in.IDL, "Free.cholesterol.in.IDL.csv")

OT2 <- outcome.test4[,2]
OT2 <- OT2[[1]]
OT2 <- as.data.frame(OT2)
OT2
OT2$Name <- 0
OT2$Name <- ifelse(OT2$Name==0,"Total.lipids.in.IDL ",OT2$Name)
OT2$Metabolite <- 0
OT2$Metabolite <- ifelse(OT2$Metabolite==0,"IDL.L")
Total.lipids.in.IDL  <- OT2[order(OT2$pval), ]
Total.lipids.in.IDL 
write.csv(Total.lipids.in.IDL, "Total.lipids.in.IDL.csv")

OT3 <- outcome.test4[,3]
OT3 <- OT3[[1]]
OT3 <- as.data.frame(OT3)
OT3
OT3$Name <- 0
OT3$Name <- ifelse(OT3$Name==0,"Concentration.of.IDL.particles",OT3$Name)
OT3$Metabolite <- 0
OT3$Metabolite <- ifelse(OT3$Metabolite==0,"IDL.P")
Concentration.of.IDL.particles <- OT3[order(OT3$pval), ]
Concentration.of.IDL.particles
write.csv(Concentration.of.IDL.particles,"Concentration.of.IDL.particles.csv")

OT4 <- outcome.test4[,4]
OT4 <- OT4[[1]]
OT4 <- as.data.frame(OT4)
OT4
OT4$Name <- 0
OT4$Name <- ifelse(OT4$Name==0,"Phospholipids.in.IDL",OT4$Name)
OT4$Metabolite <- 0
OT4$Metabolite <- ifelse(OT4$Metabolite==0,"IDL.PL")
Phospholipids.in.IDL <- OT4[order(OT4$pval), ]
Phospholipids.in.IDL 
write.csv(Phospholipids.in.IDL, "Phospholipids.in.IDL.csv")

OT5 <- outcome.test4[,5]
OT5 <- OT5[[1]]
OT5 <- as.data.frame(OT5)
OT5
OT5$Name <- 0
OT5$Name <- ifelse(OT5$Name==0,"Triglycerides.in.IDL",OT5$Name)
OT5$Metabolite <- 0
OT5$Metabolite <- ifelse(OT5$Metabolite==0,"IDL.TG")
Triglycerides.in.IDL <- OT5[order(OT5$pval), ]
Triglycerides.in.IDL
write.csv(Triglycerides.in.IDL,"Triglycerides.in.IDL.csv")

OT6 <- outcome.test4[,6]
OT6 <- OT6[[1]]
OT6 <- as.data.frame(OT6)
OT6
OT6$Name <- 0
OT6$Name <- ifelse(OT6$Name==0,"Isoleucine",OT6$Name)
OT6$Metabolite <- 0
OT6$Metabolite <- ifelse(OT6$Metabolite==0,"Ile")
Isoleucine <- OT6[order(OT6$pval), ]
Isoleucine
write.csv(Isoleucine, "Isoleucine.csv")

OT7 <- outcome.test4[,7]
OT7 <- OT7[[1]]
OT7 <- as.data.frame(OT7)
OT7
OT7$Name <- 0
OT7$Name <- ifelse(OT7$Name==0,"Total.cholesterol.in.large.HDL",OT7$Name)
OT7$Metabolite <- 0
OT7$Metabolite <- ifelse(OT7$Metabolite==0,"L.HDL.C")
Total.cholesterol.in.large.HDL <- OT7[order(OT7$pval), ]
Total.cholesterol.in.large.HDL
write.csv(Total.cholesterol.in.large.HDL, "Total.cholesterol.in.large.HDL.csv")

OT8 <- outcome.test4[,8]
OT8 <- OT8[[1]]
OT8 <- as.data.frame(OT8)
OT8
OT8$Name <- 0
OT8$Name <- ifelse(OT8$Name==0,"Cholesterol.esters.in.large.HDL",OT8$Name)
OT8$Metabolite <- 0
OT8$Metabolite <- ifelse(OT8$Metabolite==0,"L.HDL.CE")
Cholesterol.esters.in.large.HDL <- OT8[order(OT8$pval), ]
Cholesterol.esters.in.large.HDL
write.csv(Cholesterol.esters.in.large.HDL, "Cholesterol.esters.in.large.HDL.csv")

OT9 <- outcome.test4[,9]
OT9 <- OT9[[1]]
OT9 <- as.data.frame(OT9)
OT9
OT9$Name <- 0
OT9$Name <- ifelse(OT9$Name==0,"Free.cholesterol.in.large.HDL",OT9$Name)
OT9$Metabolite <- 0
OT9$Metabolite <- ifelse(OT9$Metabolite==0,"L.HDL.FC")
Free.cholesterol.in.large.HDL <- OT9[order(OT9$pval), ]
Free.cholesterol.in.large.HDL
write(Free.cholesterol.in.large.HDL, "Free.cholesterol.in.large.HDL.csv")

OT10 <- outcome.test4[,10]
OT10 <- OT10[[1]]
OT10 <- as.data.frame(OT10)
OT10
OT10$Name <- 0
OT10$Name <- ifelse(OT10$Name==0,"Total.lipids.in.large.HDL",OT10$Name)
OT10$Metabolite <- 0
OT10$Metabolite <- ifelse(OT10$Metabolite==0,"L.HDL.L")
Total.lipids.in.large.HDL <- OT10[order(OT10$pval), ]
Total.lipids.in.large.HDL
write.csv(Total.lipids.in.large.HDL, "Total.lipids.in.large.HDL.csv")

#### outcome.test5

OT1 <- outcome.test5[,1]
OT1 <- OT1[[1]]
OT1 <- as.data.frame(OT1)
OT1
OT1$Name <- 0
OT1$Name <- ifelse(OT1$Name==0,"Concentration.of.large.HDL.particles",OT1$Name)
OT1$Metabolite <- 0
OT1$Metabolite <- ifelse(OT1$Metabolite==0,"L.HDL.P")
Concentration.of.large.HDL.particles <- OT1[order(OT1$pval), ]
Concentration.of.large.HDL.particles 
write.csv(Concentration.of.large.HDL.particles, "Concentration.of.large.HDL.particles.csv")

OT2 <- outcome.test5[,2]
OT2 <- OT2[[1]]
OT2 <- as.data.frame(OT2)
OT2
OT2$Name <- 0
OT2$Name <- ifelse(OT2$Name==0,"Phospholipids.in.large.HDL",OT2$Name)
OT2$Metabolite <- 0
OT2$Metabolite <- ifelse(OT2$Metabolite==0,"L.HDL.PL")
Phospholipids.in.large.HDL  <- OT2[order(OT2$pval), ]
Phospholipids.in.large.HDL
write.csv(Phospholipids.in.large.HDL, "Phospholipids.in.large.HDL.csv")

OT3 <- outcome.test5[,3]
OT3 <- OT3[[1]]
OT3 <- as.data.frame(OT3)
OT3
OT3$Name <- 0
OT3$Name <- ifelse(OT3$Name==0,"Total.cholesterol.in.large.LDL",OT3$Name)
OT3$Metabolite <- 0
OT3$Metabolite <- ifelse(OT3$Metabolite==0,"L.LDL.C")
Total.cholesterol.in.large.LDL <- OT3[order(OT3$pval), ]
Total.cholesterol.in.large.LDL
write.csv(Total.cholesterol.in.large.LDL, "Total.cholesterol.in.large.LDL.csv")

OT4 <- outcome.test5[,4]
OT4 <- OT4[[1]]
OT4 <- as.data.frame(OT4)
OT4
OT4$Name <- 0
OT4$Name <- ifelse(OT4$Name==0,"Cholesterol.esters.in.large.VLDL",OT4$Name)
OT4$Metabolite <- 0
OT4$Metabolite <- ifelse(OT4$Metabolite==0,"XL.VLDL.CE")
Cholesterol.esters.in.large.VLDL <- OT4[order(OT4$pval), ]
Cholesterol.esters.in.large.VLDL
write.csv(Cholesterol.esters.in.large.VLDL, "Cholesterol.esters.in.large.VLDL.csv")

OT5 <- outcome.test5[,5]
OT5 <- OT5[[1]]
OT5 <- as.data.frame(OT5)
OT5
OT5$Name <- 0
OT5$Name <- ifelse(OT5$Name==0,"Free.cholesterol.in.large.LDL",OT5$Name)
OT5$Metabolite <- 0
OT5$Metabolite <- ifelse(OT5$Metabolite==0,"L.LDL.FC")
Free.cholesterol.in.large.LDL <- OT5[order(OT5$pval), ]
Free.cholesterol.in.large.LDL
write.csv(Free.cholesterol.in.large.LDL, "Free.cholesterol.in.large.LDL.csv")

OT6 <- outcome.test5[,6]
OT6 <- OT6[[1]]
OT6 <- as.data.frame(OT6)
OT6
OT6$Name <- 0
OT6$Name <- ifelse(OT6$Name==0,"Total.lipids.in.large.LDL",OT6$Name)
OT6$Metabolite <- 0
OT6$Metabolite <- ifelse(OT6$Metabolite==0,"L.LDL.L", "L.LDL.L")
Total.lipids.in.large.LDL <- OT6[order(OT6$pval), ]
Total.lipids.in.large.LDL
write.csv(Total.lipids.in.large.LDL, "Total.lipids.in.large.LDL.csv")

OT7 <- outcome.test5[,7]
OT7 <- OT7[[1]]
OT7 <- as.data.frame(OT7)
OT7
OT7$Name <- 0
OT7$Name <- ifelse(OT7$Name==0,"Concentration.of.large.LDL.particles",OT7$Name)
OT7$Metabolite <- 0
OT7$Metabolite <- ifelse(OT7$Metabolite==0,"L.LDL.P")
Concentration.of.large.LDL.particles <- OT7[order(OT7$pval), ]
Concentration.of.large.LDL.particles
write.csv(Concentration.of.large.LDL.particles, "Concentration.of.large.LDL.particles.csv")

OT8 <- outcome.test5[,8]
OT8 <- OT8[[1]]
OT8 <- as.data.frame(OT8)
OT8
OT8$Name <- 0
OT8$Name <- ifelse(OT8$Name==0,"Phospholipids.in.large.LDL",OT8$Name)
OT8$Metabolite <- 0
OT8$Metabolite <- ifelse(OT8$Metabolite==0,"L.LDL.PL")
Phospholipids.in.large.LDL <- OT8[order(OT8$pval), ]
Phospholipids.in.large.LDL
write.csv(Phospholipids.in.large.LDL, "Phospholipids.in.large.LDL.csv")

OT9 <- outcome.test5[,9]
OT9 <- OT9[[1]]
OT9 <- as.data.frame(OT9)
OT9
OT9$Name <- 0
OT9$Name <- ifelse(OT9$Name==0,"Total.cholesterol.in.large.VLDL",OT9$Name)
OT9$Metabolite <- 0
OT9$Metabolite <- ifelse(OT9$Metabolite==0,"L.VLDL.C")
Total.cholesterol.in.large.VLDL <- OT9[order(OT9$pval), ]
Total.cholesterol.in.large.VLDL
write.csv(Total.cholesterol.in.large.VLDL, "Total.cholesterol.in.large.VLDL.csv")

OT10 <- outcome.test5[,10]
OT10 <- OT10[[1]]
OT10 <- as.data.frame(OT10)
OT10
OT10$Name <- 0
OT10$Name <- ifelse(OT10$Name==0,"Cholesterol.esters.in.large.VLDL",OT10$Name)
OT10$Metabolite <- 0
OT10$Metabolite <- ifelse(OT10$Metabolite==0,"L.VLDL.CE")
Cholesterol.esters.in.large.VLDL <- OT10[order(OT10$pval), ]
write.csv(Cholesterol.esters.in.large.VLDL, "Cholesterol.esters.in.large.VLDL.csv")
Cholesterol.esters.in.large.VLDL
write.csv(Cholesterol.esters.in.large.VLDL, "Cholesterol.esters.in.large.VLDL.csv")

#### outcome.test6

OT1 <- outcome.test6[,1]
OT1 <- OT1[[1]]
OT1 <- as.data.frame(OT1)
OT1
OT1$Name <- 0
OT1$Name <- ifelse(OT1$Name==0,"Free.cholesterol.in.large.VLDL",OT1$Name)
OT1$Metabolite <- 0
OT1$Metabolite <- ifelse(OT1$Metabolite==0,"L.VLDL.FC")
Free.cholesterol.in.large.VLDL  <- OT1[order(OT1$pval), ]
Free.cholesterol.in.large.VLDL
write.csv(Free.cholesterol.in.large.VLDL, "Free.cholesterol.in.large.VLDL.csv")

OT2 <- outcome.test6[,2]
OT2 <- OT2[[1]]
OT2 <- as.data.frame(OT2)
OT2
OT2$Name <- 0
OT2$Name <- ifelse(OT3$Name==0,"Total.lipids.in.large.VLDL",OT2$Name)
OT2$Metabolite <- 0
OT2$Metabolite <- ifelse(OT2$Metabolite==0,"XL.VLDL.L")
Total.lipids.in.large.VLDL  <- OT2[order(OT2$pval), ]
Total.lipids.in.large.VLDL
write.csv(Total.lipids.in.large.VLDL, "Total.lipids.in.large.VLDL.csv")

OT3 <- outcome.test6[,3]
OT3 <- OT3[[1]]
OT3 <- as.data.frame(OT3)
OT3
OT3$Name <- 0
OT3$Name <- ifelse(OT3$Name==0,"Concentration.of.large.VLDL.particles",OT3$Name)
OT3$Metabolite <- 0
OT3$Metabolite <- ifelse(OT3$Metabolite==0,"L.VLDL.P")
Concentration.of.large.VLDL.particles <- OT3[order(OT3$pval), ]
Concentration.of.large.VLDL.particles
write.csv(Concentration.of.large.VLDL.particles,"Concentration.of.large.VLDL.particles.csv")

OT4 <- outcome.test6[,4]
OT4 <- OT4[[1]]
OT4 <- as.data.frame(OT4)
OT4
OT4$Name <- 0
OT4$Name <- ifelse(OT4$Name==0,"Phospholipids.in.large.VLDL",OT4$Name)
OT4$Metabolite <- 0
OT4$Metabolite <- ifelse(OT4$Metabolite==0,"L.VLDL.PL")
Phospholipids.in.large.VLDL <- OT4[order(OT4$pval), ]
Phospholipids.in.large.VLDL
write.csv(Phospholipids.in.large.VLDL, "Phospholipids.in.large.VLDL.csv")

OT5 <- outcome.test6[,5]
OT5 <- OT5[[1]]
OT5 <- as.data.frame(OT5)
OT5
OT5$Name <- 0
OT5$Name <- ifelse(OT5$Name==0,"Triglycerides.in.large.VLDL",OT5$Name)
OT5$Metabolite <- 0
OT5$Metabolite <- ifelse(OT5$Metabolite==0,"L.VLDL.TG")
Triglycerides.in.large.VLDL <- OT5[order(OT5$pval), ]
Triglycerides.in.large.VLDL
write.csv(Triglycerides.in.large.VLDL, "Triglycerides.in.large.VLDL.csv")

OT6 <- outcome.test6[,6]
OT6 <- OT6[[1]]
OT6 <- as.data.frame(OT6)
OT6
OT6$Name <- 0
OT6$Name <- ifelse(OT6$Name==0,"linoleic.acid",OT6$Name)
OT6$Metabolite <- 0
OT6$Metabolite <- ifelse(OT6$Metabolite==0,"LA")
linoleic.acid <- OT6[order(OT6$pval), ]
linoleic.acid
write.csv(linoleic.acid, "linoleic.acid.csv")

OT7 <- outcome.test6[,7]
OT7 <- OT7[[1]]
OT7 <- as.data.frame(OT7)
OT7
OT7$Name <- 0
OT7$Name <- ifelse(OT7$Name==0,"Lactate",OT7$Name)
OT7$Metabolite <- 0
OT7$Metabolite <- ifelse(OT7$Metabolite==0,"Lac")
Lactate <- OT7[order(OT7$pval), ]
Lactate
write.csv(Lactate, "Lactate.csv")

OT8 <- outcome.test6[,8]
OT8 <- OT8[[1]]
OT8 <- as.data.frame(OT8)
OT8
OT8$Name <- 0
OT8$Name <- ifelse(OT8$Name==0,"Total.cholesterol.in.LDL",OT8$Name)
OT8$Metabolite <- 0
OT8$Metabolite <- ifelse(OT8$Metabolite==0,"LDL.C")
Total.cholesterol.in.LDL <- OT8[order(OT8$pval), ]
Total.cholesterol.in.LDL
write.csv(Total.cholesterol.in.LDL, "Total.cholesterol.in.LDL.csv")

OT9 <- outcome.test6[,9]
OT9 <- OT9[[1]]
OT9 <- as.data.frame(OT9)
OT9
OT9$Name <- 0
OT9$Name <- ifelse(OT9$Name==0,"Mean.diameter.for.LDL.particles",OT9$Name)
OT9$Metabolite <- 0
OT9$Metabolite <- ifelse(OT9$Metabolite==0,"LDL.D")
Mean.diameter.for.LDL.particles <- OT9[order(OT9$pval), ]
Mean.diameter.for.LDL.particles
write.csv(Mean.diameter.for.LDL.particles, "Mean.diameter.for.LDL.particles.csv")

OT10 <- outcome.test6[,10]
OT10 <- OT10[[1]]
OT10 <- as.data.frame(OT10)
OT10
OT10$Name <- 0
OT10$Name <- ifelse(OT10$Name==0,"Leucine",OT10$Name)
OT10$Metabolite <- 0
OT10$Metabolite <- ifelse(OT10$Metabolite==0,"Leu")
Leucine <- OT10[order(OT10$pval), ]
Leucine 
write.csv(Leucine, "Leucine.csv")

#### outcome.test7

OT1 <- outcome.test7[,1]
OT1 <- OT1[[1]]
OT1 <- as.data.frame(OT1)
OT1
OT1$Name <- 0
OT1$Name <- ifelse(OT1$Name==0,"Total.cholesterol.in.medium.HDL",OT1$Name)
OT1$Metabolite <- 0
OT1$Metabolite <- ifelse(OT1$Metabolite==0,"M.HDL.C")
Total.cholesterol.in.medium.HDL  <- OT1[order(OT1$pval), ]
Total.cholesterol.in.medium.HDL #### Got one! But in Japanese & Latin American population: 3 snps: IVW =0.019/ML=0.02
write.csv(Total.cholesterol.in.medium.HDL,"Total.cholesterol.in.medium.HDL.csv")

OT2 <- outcome.test7[,2]
OT2 <- OT2[[1]]
OT2 <- as.data.frame(OT2)
OT2
OT2$Name <- 0
OT2$Name <- ifelse(OT2$Name==0,"Cholesterol.esters.in.medium.HDL",OT2$Name)
OT2$Metabolite <- 0
OT2$Metabolite <- ifelse(OT2$Metabolite==0,"M.HDL.CE")
Cholesterol.esters.in.medium.HDL  <- OT2[order(OT2$pval), ]
Cholesterol.esters.in.medium.HDL #### Got one! But in Japanese & Latin American population: 3 snps: IVW =0.03/ML=0.04
write.csv(Cholesterol.esters.in.medium.HDL, "Cholesterol.esters.in.medium.HDL.csv")

OT3 <- outcome.test7[,3]
OT3 <- OT3[[1]]
OT3 <- as.data.frame(OT3)
OT3
OT3$Name <- 0
OT3$Name <- ifelse(OT3$Name==0,"Free.cholesterol.in.medium.HD",OT3$Name)
OT3$Metabolite <- 0
OT3$Metabolite <- ifelse(OT3$Metabolite==0,"M.HDL.FC")
Free.cholesterol.in.medium.HDL <- OT3[order(OT3$pval), ]
Free.cholesterol.in.medium.HDL
write.csv(Free.cholesterol.in.medium.HDL, "Free.cholesterol.in.medium.HDL.csv")

OT4 <- outcome.test7[,4]
OT4 <- OT4[[1]]
OT4 <- as.data.frame(OT4)
OT4
OT4$Name <- 0
OT4$Name <- ifelse(OT4$Name==0,"Total.lipids.in.medium.HDL",OT4$Name)
OT4$Metabolite <- 0
OT4$Metabolite <- ifelse(OT4$Metabolite==0,"M.HDL.L")
Total.lipids.in.medium.HDL <- OT4[order(OT4$pval), ]
Total.lipids.in.medium.HDL
write.csv(Total.lipids.in.medium.HDL, "Total.lipids.in.medium.HDL.csv")

OT5 <- outcome.test7[,5]
OT5 <- OT5[[1]]
OT5 <- as.data.frame(OT5)
OT5
OT5$Name <- 0
OT5$Name <- ifelse(OT5$Name==0,"Concentration.of.medium.HDL.particles",OT5$Name)
OT5$Metabolite <- 0
OT5$Metabolite <- ifelse(OT5$Metabolite==0,"M.HDL.P")
Concentration.of.medium.HDL.particles <- OT5[order(OT5$pval), ]
Concentration.of.medium.HDL.particles
write.csv(Concentration.of.medium.HDL.particles, "Concentration.of.medium.HDL.particles.csv")

OT6 <- outcome.test7[,6]
OT6 <- OT6[[1]]
OT6 <- as.data.frame(OT6)
OT6
OT6$Name <- 0
OT6$Name <- ifelse(OT6$Name==0,"Phospholipids.in.medium.HDL",OT6$Name)
OT6$Metabolite <- 0
OT6$Metabolite <- ifelse(OT6$Metabolite==0,"M.HDL.PL")
Phospholipids.in.medium.HDL <- OT6[order(OT6$pval), ]
Phospholipids.in.medium.HDL
write.csv(Phospholipids.in.medium.HDL, "Phospholipids.in.medium.HDL.csv")

OT7 <- outcome.test7[,7]
OT7 <- OT7[[1]]
OT7 <- as.data.frame(OT7)
OT7
OT7$Name <- 0
OT7$Name <- ifelse(OT7$Name==0,"Total.cholesterol.in.medium.LDL",OT7$Name)
OT7$Metabolite <- 0
OT7$Metabolite <- ifelse(OT7$Metabolite==0,"M.LDL.C")
Total.cholesterol.in.medium.LDL <- OT7[order(OT7$pval), ]
Total.cholesterol.in.medium.LDL
write.csv(Total.cholesterol.in.medium.LDL,"Total.cholesterol.in.medium.LDL.csv")

OT8 <- outcome.test7[,8]
OT8 <- OT8[[1]]
OT8 <- as.data.frame(OT8)
OT8
OT8$Name <- 0
OT8$Name <- ifelse(OT8$Name==0,"Cholesterol.esters.in.medium.LDL",OT8$Name)
OT8$Metabolite <- 0
OT8$Metabolite <- ifelse(OT8$Metabolite==0,"M.LDL.CE")
Cholesterol.esters.in.medium.LDL <- OT8[order(OT8$pval), ]
Cholesterol.esters.in.medium.LDL
write.csv(Cholesterol.esters.in.medium.LDL, "Cholesterol.esters.in.medium.LDL.csv")

OT9 <- outcome.test7[,9]
OT9 <- OT9[[1]]
OT9 <- as.data.frame(OT9)
OT9
OT9$Name <- 0
OT9$Name <- ifelse(OT9$Name==0,"Total.lipids.in.medium.LDL",OT9$Name)
OT9$Metabolite <- 0
OT9$Metabolite <- ifelse(OT9$Metabolite==0,"M.LDL.L")
Total.lipids.in.medium.LDL <- OT9[order(OT9$pval), ]
Total.lipids.in.medium.LDL
write.csv(Total.lipids.in.medium.LDL, "Total.lipids.in.medium.LDL.csv")

OT10 <- outcome.test7[,10]
OT10 <- OT10[[1]]
OT10 <- as.data.frame(OT10)
OT10
OT10$Name <- 0
OT10$Name <- ifelse(OT10$Name==0,"Concentration.of.medium.LDL.particles",OT10$Name)
OT10$Metabolite <- 0
OT10$Metabolite <- ifelse(OT10$Metabolite==0,"M.LDL.P")
Concentration.of.medium.LDL.particles <- OT10[order(OT10$pval), ]
Concentration.of.medium.LDL.particles
write.csv(Concentration.of.medium.LDL.particles, "Concentration.of.medium.LDL.particles.csv") 

#### outcome.test8

OT1 <- outcome.test8[,1]
OT1 <- OT1[[1]]
OT1 <- as.data.frame(OT1)
OT1
OT1$Name <- 0
OT1$Name <- ifelse(OT1$Name==0,"Phospholipids.in.medium.LDL",OT1$Name)
OT1$Metabolite <- 0
OT1$Metabolite <- ifelse(OT1$Metabolite==0,"M.LDL.PL")
Phospholipids.in.medium.LDL  <- OT1[order(OT1$pval), ]
Phospholipids.in.medium.LDL 
write.csv(Phospholipids.in.medium.LDL, "Phospholipids.in.medium.LDL.csv")

OT2 <- outcome.test8[,2]
OT2 <- OT2[[1]]
OT2 <- as.data.frame(OT2)
OT2
OT2$Name <- 0
OT2$Name <- ifelse(OT2$Name==0,"Total.cholesterol.in.medium.VLDL",OT2$Name)
OT2$Metabolite <- 0
OT2$Metabolite <- ifelse(OT2$Metabolite==0,"M.VLDL.C")
Total.cholesterol.in.medium.VLDL  <- OT2[order(OT2$pval), ]
Total.cholesterol.in.medium.VLDL  
write.csv(Total.cholesterol.in.medium.VLDL, "Total.cholesterol.in.medium.VLDL.csv")

OT3 <- outcome.test8[,3]
OT3 <- OT3[[1]]
OT3 <- as.data.frame(OT3)
OT3
OT3$Name <- 0
OT3$Name <- ifelse(OT3$Name==0,"Cholesterol.esters.in.medium.VLDL",OT3$Name)
OT3$Metabolite <- 0
OT3$Metabolite <- ifelse(OT3$Metabolite==0,"M.VLDL.CE")
Cholesterol.esters.in.medium.VLDL <- OT3[order(OT3$pval), ]
Cholesterol.esters.in.medium.VLDL
write.csv(Cholesterol.esters.in.medium.VLDL,"Cholesterol.esters.in.medium.VLDL.csv")

OT4 <- outcome.test8[,4]
OT4 <- OT4[[1]]
OT4 <- as.data.frame(OT4)
OT4
OT4$Name <- 0
OT4$Name <- ifelse(OT4$Name==0,"Free.cholesterol.in.medium.VLDL",OT4$Name)
OT4$Metabolite <- 0
OT4$Metabolite <- ifelse(OT4$Metabolite==0,"M.VLDL.FC")
Free.cholesterol.in.medium.VLDL <- OT4[order(OT4$pval), ]
Free.cholesterol.in.medium.VLDL
write.csv(Free.cholesterol.in.medium.VLDL,"Free.cholesterol.in.medium.VLDL.csv")

OT5 <- outcome.test8[,5]
OT5 <- OT5[[1]]
OT5 <- as.data.frame(OT5)
OT5
OT5$Name <- 0
OT5$Name <- ifelse(OT5$Name==0,"Total.lipids.in.medium.VLDL",OT5$Name)
OT5$Metabolite <- 0
OT5$Metabolite <- ifelse(OT5$Metabolite==0,"M.VLDL.L")
Total.lipids.in.medium.VLDL <- OT5[order(OT5$pval), ]
Total.lipids.in.medium.VLDL
write.csv(Total.lipids.in.medium.VLDL, "Total.lipids.in.medium.VLDL.csv")

OT6 <- outcome.test8[,6]
OT6 <- OT6[[1]]
OT6 <- as.data.frame(OT6)
OT6
OT6$Name <- 0
OT6$Name <- ifelse(OT6$Name==0,"Concentration.of.medium.VLDL.particle",OT6$Name)
OT6$Metabolite <- 0
OT6$Metabolite <- ifelse(OT6$Metabolite==0,"M.VLDL.P")
Concentration.of.medium.VLDL.particle <- OT6[order(OT6$pval), ]
Concentration.of.medium.VLDL.particle
write.csv(Concentration.of.medium.VLDL.particle, "Concentration.of.medium.VLDL.particle.csv")

OT7 <- outcome.test8[,7]
OT7 <- OT7[[1]]
OT7 <- as.data.frame(OT7)
OT7
OT7$Name <- 0
OT7$Name <- ifelse(OT7$Name==0,"Phospholipids.in.medium.VLDL",OT7$Name)
OT7$Metabolite <- 0
OT7$Metabolite <- ifelse(OT7$Metabolite==0,"M.VLDL.PL")
Phospholipids.in.medium.VLDL <- OT7[order(OT7$pval), ]
Phospholipids.in.medium.VLDL
write.csv(Phospholipids.in.medium.VLDL, "Phospholipids.in.medium.VLDL.csv")

OT8 <- outcome.test8[,8]
OT8 <- OT8[[1]]
OT8 <- as.data.frame(OT8)
OT8
OT8$Name <- 0
OT8$Name <- ifelse(OT8$Name==0,"Triglycerides.in.medium.VLDL",OT8$Name)
OT8$Metabolite <- 0
OT8$Metabolite <- ifelse(OT8$Metabolite==0,"M.VLDL.TG")
Triglycerides.in.medium.VLDL <- OT8[order(OT8$pval), ]
Triglycerides.in.medium.VLDL
write.csv(Triglycerides.in.medium.VLDL, "Triglycerides.in.medium.VLDL.csv")

OT9 <- outcome.test8[,9]
OT9 <- OT9[[1]]
OT9 <- as.data.frame(OT9)
OT9
OT9$Name <- 0
OT9$Name <- ifelse(OT9$Name==0,"Mono.unsaturated.fatty.acids",OT9$Name)
OT9$Metabolite <- 0
OT9$Metabolite <- ifelse(OT9$Metabolite==0,"MUFA")
Mono.unsaturated.fatty.acids <- OT9[order(OT9$pval), ]
Mono.unsaturated.fatty.acids
write.csv(Mono.unsaturated.fatty.acids, "Mono.unsaturated.fatty.acids.csv")

OT10 <- outcome.test8[,10]
OT10 <- OT10[[1]]
OT10 <- as.data.frame(OT10)
OT10
OT10$Name <- 0
OT10$Name <- ifelse(OT10$Name==0,"Other.polyunsaturated.fatty.acids.than.18.2",OT10$Name)
OT10$Metabolite <- 0
OT10$Metabolite <- ifelse(OT10$Metabolite==0,"UNK.Other.polyunsaturated.fatty.acids.than.18.2")
Other.polyunsaturated.fatty.acids.than.18.2 <- OT10[order(OT10$pval), ]
Other.polyunsaturated.fatty.acids.than.18.2
write.csv(Other.polyunsaturated.fatty.acids.than.18.2, "Other.polyunsaturated.fatty.acids.than.18.2.csv")

#### outcome.test9

OT1 <- outcome.test9[,1]
OT1 <- OT1[[1]]
OT1 <- as.data.frame(OT1)
OT1
OT1$Name <- 0
OT1$Name <- ifelse(OT1$Name==0,"Phosphatidylcholine.and.other.cholines",OT1$Name)
OT1$Metabolite <- 0
OT1$Metabolite <- ifelse(OT1$Metabolite==0,"PC")
Phosphatidylcholine.and.other.cholines <- OT1[order(OT1$pval), ]
Phosphatidylcholine.and.other.cholines
write.csv(Phosphatidylcholine.and.other.cholines, "Phosphatidylcholine.and.other.cholines.csv")

OT2 <- outcome.test9[,2]
OT2 <- OT2[[1]]
OT2 <- as.data.frame(OT2)
OT2
OT2$Name <- 0
OT2$Name <- ifelse(OT2$Name==0,"Phenylalanine",OT2$Name)
OT2$Metabolite <- 0
OT2$Metabolite <- ifelse(OT2$Metabolite==0,"Phe")
Phenylalanine  <- OT2[order(OT2$pval), ]
Phenylalanine 
write.csv(Phenylalanine, "Phenylalanine.csv")

OT3 <- outcome.test9[,3]
OT3 <- OT3[[1]]
OT3 <- as.data.frame(OT3)
OT3
OT3$Name <- 0
OT3$Name <- ifelse(OT3$Name==0,"Pyruvate",OT3$Name)
OT3$Metabolite <- 0
OT3$Metabolite <- ifelse(OT3$Metabolite==0,"Pyr")
Pyruvate <- OT3[order(OT3$pval), ]
Pyruvate
write.csv(Pyruvate, "Pyruvate.csv")

OT4 <- outcome.test9[,4]
OT4 <- OT4[[1]]
OT4 <- as.data.frame(OT4)
OT4
OT4$Name <- 0
OT4$Name <- ifelse(OT4$Name==0,"Total.lipids.in.small.HDL",OT4$Name)
OT4$Metabolite <- 0
OT4$Metabolite <- ifelse(OT4$Metabolite==0,"S.HDL.L")
Total.lipids.in.small.HDL <- OT4[order(OT4$pval), ]
Total.lipids.in.small.HDL
write.csv(Total.lipids.in.small.HDL, "Total.lipids.in.small.HDL.csv")

OT5 <- outcome.test9[,5]
OT5 <- OT5[[1]]
OT5 <- as.data.frame(OT5)
OT5
OT5$Name <- 0
OT5$Name <- ifelse(OT5$Name==0,"Concentration.of.small.HDL.particles",OT5$Name)
OT5$Metabolite <- 0
OT5$Metabolite <- ifelse(OT5$Metabolite==0,"S.HDL.P")
Concentration.of.small.HDL.particles <- OT5[order(OT5$pval), ]
Concentration.of.small.HDL.particles
write.csv(Concentration.of.small.HDL.particles, "Concentration.of.small.HDL.particles.csv")

OT6 <- outcome.test9[,6]
OT6 <- OT6[[1]]
OT6 <- as.data.frame(OT6)
OT6
OT6$Name <- 0
OT6$Name <- ifelse(OT6$Name==0,"Triglycerides.in.small.HDL",OT6$Name)
OT6$Metabolite <- 0
OT6$Metabolite <- ifelse(OT6$Metabolite==0,"S.HDL.TG")
Triglycerides.in.small.HDL <- OT6[order(OT6$pval), ]
Triglycerides.in.small.HDL

OT7 <- outcome.test9[,7]
OT7 <- OT7[[1]]
OT7 <- as.data.frame(OT7)
OT7
OT7$Name <- 0
OT7$Name <- ifelse(OT7$Name==0,"Total.cholesterol.in.small.LDL",OT7$Name)
OT7$Metabolite <- 0
OT7$Metabolite <- ifelse(OT7$Metabolite==0,"S.LDL.C")
Total.cholesterol.in.small.LDL <- OT7[order(OT7$pval), ]
Total.cholesterol.in.small.LDL
write.csv(Total.cholesterol.in.small.LDL, "Total.cholesterol.in.small.LDL.csv")


OT8 <- outcome.test9[,8]
OT8 <- OT8[[1]]
OT8 <- as.data.frame(OT8)
OT8
OT8$Name <- 0
OT8$Name <- ifelse(OT8$Name==0,"Total.lipids.in.small.LDL",OT8$Name)
OT8$Metabolite <- 0
OT8$Metabolite <- ifelse(OT8$Metabolite==0,"S.LDL.L")
Total.lipids.in.small.LDL <- OT8[order(OT8$pval), ]
Total.lipids.in.small.LDL
write.csv(Total.lipids.in.small.LDL, "Total.lipids.in.small.LDL.csv")

OT9 <- outcome.test9[,9]
OT9 <- OT9[[1]]
OT9 <- as.data.frame(OT9)
OT9
OT9$Name <- 0
OT9$Name <- ifelse(OT9$Name==0,"Concentration.of.small.LDL.particles",OT9$Name)
OT9$Metabolite <- 0
OT9$Metabolite <- ifelse(OT9$Metabolite==0,"S.LDL.P")
Concentration.of.small.LDL.particles <- OT9[order(OT9$pval), ]
Concentration.of.small.LDL.particles
write.csv(Concentration.of.small.LDL.particles, "Concentration.of.small.LDL.particles.csv")

OT10 <- outcome.test9[,10]
OT10 <- OT10[[1]]
OT10 <- as.data.frame(OT10)
OT10
OT10$Name <- 0
OT10$Name <- ifelse(OT10$Name==0,"Total.cholesterol.in.small.VLDL",OT10$Name)
OT10$Metabolite <- 0
OT10$Metabolite <- ifelse(OT10$Metabolite==0,"S.VLDL.C")
Total.cholesterol.in.small.VLDL <- OT10[order(OT10$pval), ]
Total.cholesterol.in.small.VLDL
write.csv(Total.cholesterol.in.small.VLDL, "Total.cholesterol.in.small.VLDL.csv")

#### outcome.test10

OT1 <- outcome.test10[,1]
OT1 <- OT1[[1]]
OT1 <- as.data.frame(OT1)
OT1
OT1$Name <- 0
OT1$Name <- ifelse(OT1$Name==0,"Free.cholesterol.in.small.VLDL",OT1$Name)
OT1$Metabolite <- 0
OT1$Metabolite <- ifelse(OT1$Metabolite==0,"S.VLDL.FC")
Free.cholesterol.in.small.VLDL <- OT1[order(OT1$pval), ]
Free.cholesterol.in.small.VLDL
write.csv(Free.cholesterol.in.small.VLDL, "Free.cholesterol.in.small.VLDL.csv")

OT2 <- outcome.test10[,2]
OT2 <- OT2[[1]]
OT2 <- as.data.frame(OT2)
OT2
OT2$Name <- 0
OT2$Name <- ifelse(OT2$Name==0,"Total.lipids.in.small.VLDL",OT2$Name)
OT2$Metabolite <- 0
OT2$Metabolite <- ifelse(OT2$Metabolite==0,"S.VLDL.L")
Total.lipids.in.small.VLDL  <- OT2[order(OT2$pval), ]
Total.lipids.in.small.VLDL
write.csv(Total.lipids.in.small.VLDL, "Total.lipids.in.small.VLDL.csv")

OT3 <- outcome.test10[,3]
OT3 <- OT3[[1]]
OT3 <- as.data.frame(OT3)
OT3
OT3$Name <- 0
OT3$Name <- ifelse(OT3$Name==0,"Concentration.of.small.VLDL.particles",OT3$Name)
OT3$Metabolite <- 0
OT3$Metabolite <- ifelse(OT3$Metabolite==0,"S.VLDL.P")
Total.lipids.in.small.VLDL  <- OT3[order(OT3$pval), ]
Concentration.of.small.VLDL.particles <- OT3[order(OT3$pval), ]
Concentration.of.small.VLDL.particles
write.csv(Concentration.of.small.VLDL.particles, "Concentration.of.small.VLDL.particles.csv")

OT4 <- outcome.test10[,4]
OT4 <- OT4[[1]]
OT4 <- as.data.frame(OT4)
OT4
OT4$Name <- 0
OT4$Name <- ifelse(OT4$Name==0,"Concentration.of.small.VLDL.particles",OT4$Name)
OT4$Metabolite <- 0
OT4$Metabolite <- ifelse(OT4$Metabolite==0,"S.VLDL.PL")
Total.lipids.in.small.VLDL  <- OT4[order(OT4$pval), ]
Concentration.of.small.VLDL.particles <- OT4[order(OT4$pval), ]
Phospholipids.in.small.VLDL  <- OT4[order(OT4$pval), ]
Phospholipids.in.small.VLDL
write.csv(Phospholipids.in.small.VLDL, "Phospholipids.in.small.VLDL.csv")

OT5 <- outcome.test10[,5]
OT5 <- OT5[[1]]
OT5 <- as.data.frame(OT5)
OT5
OT5$Name <- 0 
OT5$Name <- ifelse(OT5$Name==0,"Triglycerides.in.small.VLDL",OT5$Name)
OT5$Metabolite <- 0
OT5$Metabolite <- ifelse(OT5$Metabolite==0,"S.VLDL.TG")
Triglycerides.in.small.VLDL <- OT5[order(OT5$pval), ]
Triglycerides.in.small.VLDL
write.csv(Triglycerides.in.small.VLDL, "Triglycerides.in.small.VLDL.csv")

OT6 <- outcome.test10[,6]
OT6 <- OT6[[1]]
OT6 <- as.data.frame(OT6)
OT6
OT6$Name <- 0
OT6$Name <- ifelse(OT6$Name==0,"Serum.total.cholesterol",OT6$Name)
OT6$Metabolite <- 0
OT6$Metabolite <- ifelse(OT6$Metabolite==0,"Serum.C")
Triglycerides.in.small.VLDL <- OT6[order(OT6$pval), ]
Serum.total.cholesterol <- OT6[order(OT6$pval), ]
Serum.total.cholesterol
write.csv(Serum.total.cholesterol, "Serum.total.cholesterol.csv")

OT7 <- outcome.test10[,7]
OT7 <- OT7[[1]]
OT7 <- as.data.frame(OT7)
OT7
OT7$Name <- 0
OT7$Name <- ifelse(OT7$Name==0,"Serum.total.triglycerides",OT7$Name)
OT7$Metabolite <- 0
OT7$Metabolite <- ifelse(OT7$Metabolite==0,"Serum.TG")
Triglycerides.in.small.VLDL <- OT7[order(OT7$pval), ]
Serum.total.cholesterol <- OT7[order(OT7$pval), ]
Serum.total.triglycerides <- OT7[order(OT7$pval), ]
Serum.total.triglycerides
write.csv(Serum.total.triglycerides, "Serum.total.triglycerides.csv")

OT8 <- outcome.test10[,8]
OT8 <- OT8[[1]]
OT8 <- as.data.frame(OT8)
OT8
OT8$Name <- 0
OT8$Name <- ifelse(OT8$Name==0,"Sphingomyelins",OT8$Name)
OT8$Metabolite <- 0
OT8$Metabolite <- ifelse(OT8$Metabolite==0,"SM")
Triglycerides.in.small.VLDL <- OT8[order(OT8$pval), ]
Sphingomyelins <- OT8[order(OT8$pval), ]
Sphingomyelins
write.csv(Sphingomyelins, "Sphingomyelins.csv")

OT9 <- outcome.test10[,9]
OT9 <- OT9[[1]]
OT9 <- as.data.frame(OT9)
OT9
OT9$Name <- 0
OT9$Name <- ifelse(OT9$Name==0,"Total.fatty.acids",OT9$Name)
OT9$Metabolite <- 0
OT9$Metabolite <- ifelse(OT9$Metabolite==0,"TotFA")
Total.fatty.acids <- OT9[order(OT9$pval), ]
Total.fatty.acids <- OT9[order(OT9$pval), ]
Total.fatty.acids
write.csv(Total.fatty.acids, "Total.fatty.acids.csv")

OT10 <- outcome.test10[,10]
OT10 <- OT10[[1]]
OT10 <- as.data.frame(OT10)
OT10
OT10$Name <- 0 
OT10$Name <- ifelse(OT10$Name==0,"phosphoglycerides", "phosphoglycerides")
OT10$Metabolite <- 0
OT10$Metabolite <- ifelse(OT10$Metabolite==0,"TG.PG")
phosphoglycerides <- OT10[order(OT10$pval), ]
phosphoglycerides
write.csv(phosphoglycerides, "phosphoglycerides.csv")

#### outcome.test11

OT1 <- outcome.test11[,1]
OT1 <- OT1[[1]]
OT1 <- as.data.frame(OT1)
OT1
OT1$Name <-0
OT1$Name <- ifelse(OT1$Name==0,"Tyrosine",OT1$Name)
OT1$Metabolite <- 0
OT1$Metabolite <- ifelse(OT1$Metabolite==0,"Tyr")
Tyrosine <- OT1[order(OT1$pval), ]
Tyrosine
write.csv(Tyrosine, "Tyrosine.csv")

OT2 <- outcome.test11[,2]
OT2 <- OT2[[1]]
OT2 <- as.data.frame(OT2)
OT2
OT2$Name <- 0
OT2$Name <- ifelse(OT2$Name==0,"Urea",OT2$Name)
OT2$Metabolite <- 0
OT2$Metabolite <- ifelse(OT2$Metabolite==0,"UNK.Urea")
Urea <- OT2[order(OT2$pval), ]
Urea
write.csv(Urea, "Urea.csv")


OT3 <- outcome.test11[,3]
OT3 <- OT3[[1]]
OT3 <- as.data.frame(OT3)
OT3
OT3$Name <-0 
OT3$Name <- ifelse(OT3$Name==0,"Valine",OT3$Name)
OT3$Metabolite <- 0
OT3$Metabolite <- ifelse(OT3$Metabolite==0,"Val")
Valine <- OT3[order(OT3$pval), ]
Valine
write.csv(Valine, "Valine.csv")

OT4 <- outcome.test11[,4]
OT4 <- OT4[[1]]
OT4 <- as.data.frame(OT4)
OT4
OT4$Name <- 0
OT4$Name <- ifelse(OT4$Name==0,"Mean.diameter.for.VLDL.particles ",OT4$Name)
OT4$Metabolite <- 0
OT4$Metabolite <- ifelse(OT4$Metabolite==0,"VLDL.D")
Mean.diameter.for.VLDL.particles  <- OT4[order(OT4$pval), ]
Mean.diameter.for.VLDL.particles 
write.csv(Mean.diameter.for.VLDL.particles, "Mean.diameter.for.VLDL.particles.csv")

OT5 <- outcome.test11[,5]
OT5 <- OT5[[1]]
OT5 <- as.data.frame(OT5)
OT5
OT5$Name <-0
OT5$Name <- ifelse(OT5$Name==0,"Total.cholesterol.in.very.large.HDL",OT5$Name)
OT5$Metabolite <- 0
OT5$Metabolite <- ifelse(OT5$Metabolite==0,"XL.HDL.C")
Mean.diameter.for.VLDL.particles  <- OT5[order(OT5$pval), ]
Total.cholesterol.in.very.large.HDL <- OT5[order(OT5$pval), ]
Total.cholesterol.in.very.large.HDL
write.csv(Total.cholesterol.in.very.large.HDL, "Total.cholesterol.in.very.large.HDL.csv")

OT6 <- outcome.test11[,6]
OT6 <- OT6[[1]]
OT6 <- as.data.frame(OT6)
OT6
OT6$Name <-0
OT6$Name <- ifelse(OT6$Name==0,"Cholesterol.esters.in.very.large.HDLL",OT6$Name)
OT6$Metabolite <- 0
OT6$Metabolite <- ifelse(OT6$Metabolite==0,"XL.HDL.CE")
Cholesterol.esters.in.very.large.HDL <- OT6[order(OT6$pval), ]
Cholesterol.esters.in.very.large.HDL
write.csv(Cholesterol.esters.in.very.large.HDL, "Cholesterol.esters.in.very.large.HDL.csv")

OT7 <- outcome.test11[,7]
OT7 <- OT7[[1]]
OT7 <- as.data.frame(OT7)
OT7 
OT7$Name <-0
OT7$Name <- ifelse(OT7$Name==0,"Total.cholesterol.in.very.large.HDL",OT7$Name)
OT7$Metabolite <- 0
OT7$Metabolite <- ifelse(OT7$Metabolite==0,"XL.HDL.FC")
Free.cholesterol.in.very.large.HDL <- OT7[order(OT7$pval), ]
Free.cholesterol.in.very.large.HDL
write.csv(Free.cholesterol.in.very.large.HDL, "Free.cholesterol.in.very.large.HDL.csv")

OT8 <- outcome.test11[,8]
OT8 <- OT8[[1]]
OT8 <- as.data.frame(OT8)
OT8
OT8$Name <-0
OT8$Name <- ifelse(OT8$Name==0,"Total.cholesterol.in.very.large.HDL",OT8$Name)
OT8$Metabolite <- 0
OT8$Metabolite <- ifelse(OT8$Metabolite==0,"XL.HDL.L")
Total.lipids.in.very.large.HDL <- OT8[order(OT8$pval), ]
Total.lipids.in.very.large.HDL
write.csv(Total.lipids.in.very.large.HDL, "Total.lipids.in.very.large.HDL.csv")

OT9 <- outcome.test11[,9]
OT9 <- OT9[[1]]
OT9 <- as.data.frame(OT9)
OT9
OT9$Name <- 0
OT9$Name <- ifelse(OT9$Name==0,"Concentration.of.very.large.HDL.particles",OT9$Name)
OT9$Metabolite <- 0
OT9$Metabolite <- ifelse(OT9$Metabolite==0,"XL.HDL.PL")
Concentration.of.very.large.HDL.particles <- OT9[order(OT9$pval), ]
Concentration.of.very.large.HDL.particles
write.csv(Concentration.of.very.large.HDL.particles, "Concentration.of.very.large.HDL.particles.csv")

OT10 <- outcome.test11[,10]
OT10 <- OT10[[1]]
OT10 <- as.data.frame(OT10)
OT10
OT10$Name <- 0
OT10$Name <- ifelse(OT10$Name==0,"Phospholipids.in.very.large.HDL",OT10$Name)
OT10$Metabolite <- 0
OT10$Metabolite <- ifelse(OT10$Metabolite==0,"XL.HDL.PL")
Concentration.of.very.large.HDL.particles <- OT10[order(OT10$pval), ]
Phospholipids.in.very.large.HDL <- OT10[order(OT10$pval), ]
Phospholipids.in.very.large.HDL
write.csv(Phospholipids.in.very.large.HDL, "Phospholipids.in.very.large.HDL.csv")

#### outcome.test12

OT1 <- outcome.test12[,1]
OT1 <- OT1[[1]]
OT1 <- as.data.frame(OT1)
OT1
OT1$Name <- 0
OT1$Name <- ifelse(OT1$Name==0,"Triglycerides.in.very.large.HDL",OT1$Name)
OT1$Metabolite <- 0
OT1$Metabolite <- ifelse(OT1$Metabolite==0,"XL.VLDL.TG")
Triglycerides.in.very.large.HDL <- OT1[order(OT1$pval), ]
write.csv(Triglycerides.in.very.large.HDL, "Triglycerides.in.very.large.HDL.csv")

OT2 <- outcome.test12[,2]
OT2 <- OT2[[1]]
OT2 <- as.data.frame(OT2)
OT2
OT2$Name <- 0
OT2$Name <- ifelse(OT2$Name==0,"Total.lipids.in.very.large.VLDL",OT2$Name)
OT2$Metabolite <- 0
OT2$Metabolite <- ifelse(OT2$Metabolite==0,"XL.VLDL.L")
Total.lipids.in.very.large.VLDL <- OT2[order(OT2$pval), ]
Total.lipids.in.very.large.VLDL 
write.csv(Total.lipids.in.very.large.VLDL, "Total.lipids.in.very.large.VLDL.csv") 

OT3 <- outcome.test12[,3]
OT3 <- OT3[[1]]
OT3 <- as.data.frame(OT3)
OT3
OT3$Name <- 0
OT3$Name <- ifelse(OT3$Name==0,"Concentration.of.very.large.VLDL.particles",OT3$Name)
OT3$Metabolite <- 0
OT3$Metabolite <- ifelse(OT3$Metabolite==0,"XL.VLDL.P")
Concentration.of.very.large.VLDL.particles  <- OT3[order(OT3$pval), ]
Concentration.of.very.large.VLDL.particles 
write.csv(Concentration.of.very.large.VLDL.particles, "Concentration.of.very.large.VLDL.particles.csv")

OT4 <- outcome.test12[,4]
OT4 <- OT4[[1]]
OT4 <- as.data.frame(OT4)
OT4
OT4$Name <- 0
OT4$Name <- ifelse(OT4$Name==0,"Phospholipids.in.very.large.VLDL",OT4$Name)
OT4$Metabolite <- 0
OT4$Metabolite <- ifelse(OT4$Metabolite==0,"XL.VLDL.PL")
Phospholipids.in.very.large.VLDL  <- OT4[order(OT4$pval), ]
Phospholipids.in.very.large.VLDL
write.csv(Phospholipids.in.very.large.VLDL, "Phospholipids.in.very.large.VLDL.csv")

OT5 <- outcome.test12[,5]
OT5 <- OT5[[1]]
OT5 <- as.data.frame(OT5)
OT5
OT5$Name <- 0
OT5$Name <- ifelse(OT5$Name==0,"Triglycerides.in.very.large.VLDL",OT5$Name)
OT5$Metabolite <- 0
OT5$Metabolite <- ifelse(OT5$Metabolite==0,"XL.VLDL.TG")
Phospholipids.in.very.large.VLDL  <- OT5[order(OT5$pval), ]
Triglycerides.in.very.large.VLDL <- OT5[order(OT5$pval), ]
Triglycerides.in.very.large.VLDL
write.csv(Triglycerides.in.very.large.VLDL, "Triglycerides.in.very.large.VLDL.csv")

OT6 <- outcome.test12[,6]
OT6 <- OT6[[1]]
OT6 <- as.data.frame(OT6)
OT6
OT6$Name <- 0
OT6$Name <- ifelse(OT6$Name==0,"Total.lipids.in.very.small.VLDL")
OT6$Metabolite <- 0
OT6$Metabolite <- ifelse(OT6$Metabolite==0,"XS.VLDL.L")
Total.lipids.in.very.small.VLDL <- OT6[order(OT6$pval), ]
Total.lipids.in.very.small.VLDL
write.csv(Total.lipids.in.very.small.VLDL, "Total.lipids.in.very.small.VLDL.csv")

OT7 <- outcome.test12[,7]
OT7 <- OT7[[1]]
OT7 <- as.data.frame(OT7)
OT7
OT7$Name <- 0
OT7$Name <- ifelse(OT7$Name==0,"Concentration.of.very.small.VLDL.particles",OT7$Name)
OT7$Metabolite <- 0
OT7$Metabolite <- ifelse(OT7$Metabolite==0,"XS.VLDL.P")
Total.lipids.in.very.small.VLDL <- OT7[order(OT7$pval), ]
Concentration.of.very.small.VLDL.particles <- OT7[order(OT7$pval), ]
Concentration.of.very.small.VLDL.particles
write.csv(Concentration.of.very.small.VLDL.particles, "Concentration.of.very.small.VLDL.particles.csv")

OT8 <- outcome.test12[,8]
OT8 <- OT8[[1]]
OT8 <- as.data.frame(OT8)
OT8
OT8$Name <- 0
OT8$Name <- ifelse(OT8$Name==0,"Phospholipids.in.very.small.VLDL",OT8$Name)
OT8$Metabolite <- 0
OT8$Metabolite <- ifelse(OT8$Metabolite==0,"XS.VLDL.PL")
Phospholipids.in.very.small.VLDL <- OT8[order(OT8$pval), ]
Phospholipids.in.very.small.VLDL

OT9 <- outcome.test12[,9]
OT9 <- OT9[[1]]
OT9 <- as.data.frame(OT9)
OT9
OT9$Name <- 0
OT9$Name <- ifelse(OT9$Name==0,"Triglycerides.in.very.small.VLDL",OT9$Name)
OT9$Metabolite <- 0
OT9$Metabolite <- ifelse(OT9$Metabolite==0,"XS.VLDL.TG", OT9$Name)
Triglycerides.in.very.small.VLDL <- OT9[order(OT9$pval), ]
Triglycerides.in.very.small.VLDL
write.csv(Triglycerides.in.very.small.VLDL, "Triglycerides.in.very.small.VLDL.csv")

OT10 <- outcome.test12[,10]
OT10 <- OT10[[1]]
OT10 <- as.data.frame(OT10)
OT10
OT10$Name <- 0
OT10$Name <- ifelse(OT10$Name==0,"Total.lipids.in.chylomicrons.and.largest.VLDL.particles",OT10$Name)
OT10$Metabolite <- 0
OT10$Metabolite <- ifelse(OT10$Metabolite==0,"XXL.VLDL.L", OT10$Name)
Total.lipids.in.chylomicrons.and.largest.VLDL.particles <- OT10[order(OT10$pval), ]
Total.lipids.in.chylomicrons.and.largest.VLDL.particles
write.csv(Total.lipids.in.chylomicrons.and.largest.VLDL.particles, "Total.lipids.in.chylomicrons.and.largest.VLDL.particles.csv")

#### outcome.test13

OT1 <- outcome.test13[,1]
OT1 <- OT1[[1]]
OT1 <- as.data.frame(OT1)
OT1
OT1$Name <- 0
OT1$Name <- ifelse(OT1$Name==0,"Concentration.of.chylomicrons.and.largest.VLDL.particles")
OT1$Metabolite <- 0
OT1$Metabolite <- ifelse(OT1$Metabolite==0,"XXL.VLDL.P")
Concentration.of.chylomicrons.and.largest.VLDL.particles <- OT1[order(OT1$pval), ]
Concentration.of.chylomicrons.and.largest.VLDL.particles
write.csv(Concentration.of.chylomicrons.and.largest.VLDL.particles, "Concentration.of.chylomicrons.and.largest.VLDL.particles.csv")

OT2 <- outcome.test13[,2]
OT2 <- OT2[[1]]
OT2 <- as.data.frame(OT2)
OT2
OT2$Name <- 0
OT2$Name <- ifelse(OT2$Name==0,"Total.lipids.in.chylomicrons.and.largest.VLDL.particles")
OT2$Metabolite <- 0
OT2$Metabolite <- ifelse(OT2$Metabolite==0,"XXL.VLDL.P")
Phospholipids.in.chylomicrons.and.largest.VLDL.particles <- OT2[order(OT2$pval), ]
Phospholipids.in.chylomicrons.and.largest.VLDL.particles
write.csv(Phospholipids.in.chylomicrons.and.largest.VLDL.particles, "Phospholipids.in.chylomicrons.and.largest.VLDL.particles.csv")

OT3 <- outcome.test13[,3]
OT3 <- OT3[[1]]
OT3 <- as.data.frame(OT3)
OT3
OT3$Name <- 0
OT3$Name <- ifelse(OT3$Name==0,"Triglycerides.in.chylomicrons.and.largest.VLDL.particles")
OT3$Metabolite <- 0
OT3$Metabolite <- ifelse(OT3$Metabolite==0,"XXL.VLDL.TG")
Triglycerides.in.chylomicrons.and.largest.VLDL.particles <- OT3[order(OT3$pval), ]
Triglycerides.in.chylomicrons.and.largest.VLDL.particles
write.csv(Triglycerides.in.chylomicrons.and.largest.VLDL.particles, "Triglycerides.in.chylomicrons.and.largest.VLDL.particles.csv")

rbind using the names of the metabolites to create a master file of MR findings

library(data.table)

MASTER_results=rbindlist(list(Acetoacetate, 
Acetate, 
Alanine, 
Albumin, 
Apolipoprotein.a1, 
Apolipoprotein.B, 
Ratio.of.bisallylic.groups.to.double.bonds, 
Ratio.of.bisallylic.groups.to.fatty.acids, 
three.hydroxybutyrate, 
Average.number.of.methylene.groups.per.double.bond,
Average.number.of.methylene.groups.in.a.fatty.acid.chain, 
Citrate,
Creatinine, 
Average.number.of.double.bonds.in.a.fatty.acid.chain, 
docosahexaenoic.acid, 
Free.cholesterol.to.esterified.cholesterol.ratio, 
Description.of.average.fatty.acid.chain.length.not.actual.carbon.number, 
Omega3.fatty.acids, 
Omega6.fatty.acids, 
Omega.9.and.saturated.fatty.acids,
Free.cholesterol, 
Glucose, 
Glutamine, 
Glycerol, 
Glycoproteins, 
Glycoprotein.acetyls, 
Total.cholesterol.in.HDL, 
Mean.diameter.for.HDL.particles, 
Histidine, 
Total.cholesterol.in.IDL,
Free.cholesterol.in.IDL, 
Total.lipids.in.IDL, 
Concentration.of.IDL.particles,
Phospholipids.in.IDL, 
Triglycerides.in.IDL,
Isoleucine,
Total.cholesterol.in.large.HDL,
Cholesterol.esters.in.large.HDL,
Free.cholesterol.in.large.HDL,
Total.lipids.in.large.HDL,
Concentration.of.large.HDL.particles, 
Phospholipids.in.large.HDL,
Total.cholesterol.in.large.LDL,
Cholesterol.esters.in.large.VLDL,
Free.cholesterol.in.large.LDL,
Total.lipids.in.large.LDL,
Concentration.of.large.LDL.particles,
Phospholipids.in.large.LDL,
Total.cholesterol.in.large.VLDL,
Cholesterol.esters.in.large.VLDL,
Free.cholesterol.in.large.VLDL,
Total.lipids.in.large.VLDL,
Concentration.of.large.VLDL.particles,
Phospholipids.in.large.VLDL,
Triglycerides.in.large.VLDL,
linoleic.acid,
Lactate,
Total.cholesterol.in.LDL,
Mean.diameter.for.LDL.particles,
Leucine, 
Total.cholesterol.in.medium.HDL,
Cholesterol.esters.in.medium.HDL,
Free.cholesterol.in.medium.HDL,
Total.lipids.in.medium.HDL,
Concentration.of.medium.HDL.particles,
Phospholipids.in.medium.HDL,
Total.cholesterol.in.medium.LDL,
Cholesterol.esters.in.medium.LDL,
Total.lipids.in.medium.LDL,
Concentration.of.medium.LDL.particles, 
Phospholipids.in.medium.LDL, 
Total.cholesterol.in.medium.VLDL,  
Cholesterol.esters.in.medium.VLDL,
Free.cholesterol.in.medium.VLDL,
Total.lipids.in.medium.VLDL,
Concentration.of.medium.VLDL.particle,
Phospholipids.in.medium.VLDL,
Triglycerides.in.medium.VLDL,
Mono.unsaturated.fatty.acids, 
Other.polyunsaturated.fatty.acids.than.18.2,
Phosphatidylcholine.and.other.cholines,
Phenylalanine, 
Pyruvate,
Total.lipids.in.small.HDL,
Concentration.of.small.HDL.particles,
Triglycerides.in.small.HDL,
Total.cholesterol.in.small.LDL,
Total.lipids.in.small.LDL,
Concentration.of.small.LDL.particles,
Total.cholesterol.in.small.VLDL,
Free.cholesterol.in.small.VLDL,
Total.lipids.in.small.VLDL,
Concentration.of.small.VLDL.particles,
Phospholipids.in.small.VLDL,
Triglycerides.in.small.VLDL,
Serum.total.cholesterol,
Serum.total.triglycerides,
Sphingomyelins,
Total.fatty.acids,
phosphoglycerides, 
Tyrosine, 
Urea, 
Valine, 
Mean.diameter.for.VLDL.particles, 
Total.cholesterol.in.very.large.HDL, 
Cholesterol.esters.in.very.large.HDL, 
Free.cholesterol.in.very.large.HDL, 
Total.lipids.in.very.large.HDL, 
Concentration.of.very.large.HDL.particles, 
Phospholipids.in.very.large.HDL, 
Triglycerides.in.very.large.HDL, 
Total.lipids.in.very.large.VLDL, 
Concentration.of.very.large.VLDL.particles, 
Phospholipids.in.very.large.VLDL, 
Triglycerides.in.very.large.VLDL, 
Total.lipids.in.very.small.VLDL, 
Concentration.of.very.small.VLDL.particles, 
Phospholipids.in.very.small.VLDL, 
Triglycerides.in.very.small.VLDL, 
Total.lipids.in.chylomicrons.and.largest.VLDL.particles, 
Concentration.of.chylomicrons.and.largest.VLDL.particles, 
Phospholipids.in.chylomicrons.and.largest.VLDL.particles, 
Triglycerides.in.chylomicrons.and.largest.VLDL.particles), fill=T)

write.csv(MASTER_results, "MASTER.MR2_results.csv")

head(MASTER_results)

Sort the MASTER_results dataset by ‘pval’ and display those with p-values <0.05

MASTER_results <- read.csv("C:/Users/ca16591/Dropbox/Bristol/MASTER.MR2_results.csv")
#head(MASTER_results)
sorted_MASTER_results= MASTER_results[order(MASTER_results$'pval'),]
#head(sorted_MASTER_results)
sorted_MASTER_results$Beta <- sorted_MASTER_results$b
sorted_MASTER_results$OR<- exp(sorted_MASTER_results$b)
sorted_MASTER_results$Method<- sorted_MASTER_results$method
sorted_MASTER_results$Pval<- sorted_MASTER_results$pval
#dat=sorted_MASTER_results$outcome
#sorted_MASTER_results <- gsub("\\|.*","",dat)# removes the extra "|| NA 2016" characters from "outcome" variable
myvars <- c("Metabolite", "Method", "nsnp", "Beta", "Pval")
sorted_MASTER_results <- sorted_MASTER_results[myvars]
head(sorted_MASTER_results, n=14)
##     Metabolite                    Method nsnp        Beta       Pval
## 31         Alb        Maximum likelihood    3 -0.08885345 0.00332458
## 111        Cit        Maximum likelihood   86  0.02001923 0.01213075
## 112        Cit Inverse variance weighted   86  0.01984630 0.01489222
## 601    M.HDL.C Inverse variance weighted    3 -0.06567023 0.01914970
## 602    M.HDL.C        Maximum likelihood    3 -0.06573274 0.02173529
## 231       Glol Inverse variance weighted   86  0.01979506 0.02304488
## 232       Glol        Maximum likelihood   86  0.01985399 0.02449946
## 211        Glc        Maximum likelihood   14  0.07300253 0.02547133
## 581      LDL.D Inverse variance weighted    3 -0.06251239 0.02984548
## 582      LDL.D        Maximum likelihood    3 -0.06245849 0.03208265
## 141        DHA Inverse variance weighted    4  0.03883914 0.03428660
## 611   M.HDL.CE Inverse variance weighted    3 -0.06072416 0.03461089
## 612   M.HDL.CE        Maximum likelihood    3 -0.06081743 0.03817747
## 142        DHA        Maximum likelihood    4  0.03933898 0.04147820
#top <- sum(sorted_MASTER_results$'pval'<0.05)
#head(top, n=14)

#' Before I saved the MASTER_results file as a .csv, it was a large data table. In order to select the variables I wanted, I used the "with=FALSE" syntax for data tables:  

#sorted_MASTER_results <- sorted_MASTER_results[, c("Metabolite", "Method", "nsnp", "OR", "Pval"), with=FALSE]