@@ -6,6 +6,7 @@ library(dplyr)
6
6
library(readr )
7
7
library(ggplot2 )
8
8
9
+ source(' /Users/ellad/UniversityEdinburgh/PhD/CodePhD/Metabolomics/functions_metabolite.R' )
9
10
# scale function for the x axis
10
11
scaleFUN <- function (x ) {
11
12
tmp <- x / 1000000
@@ -45,28 +46,28 @@ locus_plot <- function(sumstats, LD_file, lowerlim, upperlim, colocalised_SNP, f
45
46
46
47
# #LA to TFA plot ##
47
48
48
- la_sumstats_chr11 <- read.table(' Metabolomics/chr11_signif_metabolites/f.23456.0.0chr_11.tsv' , sep = ' \t ' , header = T )
49
- rs174578_ld <- read.table(' Metabolomics/SNP_ld/rs174578.ld' , header = T )
49
+ la_sumstats_chr11 <- read.table(' /Users/ellad/UniversityEdinburgh/PhD/Data/UKB/ Metabolomics/chr11_signif_metabolites/f.23456.0.0chr_11.tsv' , sep = ' \t ' , header = T )
50
+ rs174578_ld <- read.table(' /Users/ellad/UniversityEdinburgh/PhD/Data/UKB/ Metabolomics/SNP_ld/rs174578.ld' , header = T )
50
51
51
52
LA_TFA_locus_plot <- locus_plot(la_sumstats_chr11 , rs174578_ld , 61450000 , 61800000 , ' rs174578' , ' f.23456.0.0' )
52
53
# # DHA plot ##
53
54
54
- DHA_sumstats_chr11 <- read.table(' Metabolomics/chr11_signif_metabolites/f.23450.0.0chr_11.tsv' , sep = ' \t ' , header = T )
55
- rs2727271_ld <- read.table(' Metabolomics/SNP_ld/rs2727271.ld' , header = T )
55
+ DHA_sumstats_chr11 <- read.table(' /Users/ellad/UniversityEdinburgh/PhD/Data/UKB/ Metabolomics/chr11_signif_metabolites/f.23450.0.0chr_11.tsv' , sep = ' \t ' , header = T )
56
+ rs2727271_ld <- read.table(' /Users/ellad/UniversityEdinburgh/PhD/Data/UKB/ Metabolomics/SNP_ld/rs2727271.ld' , header = T )
56
57
57
58
DHA_locus_plot <- locus_plot(DHA_sumstats_chr11 , rs2727271_ld , 61450000 , 61800000 , ' rs2727271' , ' f.23450.0.0' )
58
59
DHA_locus_plot_sameLD <- locus_plot(DHA_sumstats_chr11 , rs174578_ld , 61450000 , 61800000 , ' rs174578' , ' f.23450.0.0' )
59
60
60
61
# #DHA to Total Fatty Acids ##
61
62
62
- DHA_TFA_sumstats_chr11 <- read.table(' Metabolomics/chr11_signif_metabolites/f.23457.0.0chr_11.tsv' , sep = ' \t ' , header = T )
63
- rs174575_ld <- read.table(' Metabolomics/SNP_ld/rs174575.ld' , header = T )
63
+ DHA_TFA_sumstats_chr11 <- read.table(' /Users/ellad/UniversityEdinburgh/PhD/Data/UKB/ Metabolomics/chr11_signif_metabolites/f.23457.0.0chr_11.tsv' , sep = ' \t ' , header = T )
64
+ rs174575_ld <- read.table(' /Users/ellad/UniversityEdinburgh/PhD/Data/UKB/ Metabolomics/SNP_ld/rs174575.ld' , header = T )
64
65
65
66
DHA_TFA_locus_plot <- locus_plot(DHA_TFA_sumstats_chr11 , rs174575_ld , 61450000 , 61800000 , ' rs174575' , ' f.23457.0.0' )
66
67
67
68
# # MDD locus plot - slightly different scales etc ##
68
69
69
- mdd_chr11 <- read.table(' Metabolomics/mdd_sumstats_chr11_noUKB_withNandBETA.tsv' , sep = ' \t ' , header = T )
70
+ mdd_chr11 <- read.table(' /Users/ellad/UniversityEdinburgh/PhD/Data/UKB/ Metabolomics/mdd_sumstats_chr11_noUKB_withNandBETA.tsv' , sep = ' \t ' , header = T )
70
71
subset_mdd_chr11 <- mdd_chr11 [which(mdd_chr11 $ BP > = 61450000 ),]
71
72
subset_mdd_chr11 <- subset_mdd_chr11 [which(subset_mdd_chr11 $ BP < = 61800000 ),]
72
73
mdd_snps_in_LD_matrix_df <- merge(subset_mdd_chr11 , rs174578_ld [,c(' SNP_B' , ' R2' )], by.x = ' SNP' , by.y = ' SNP_B' )
@@ -81,7 +82,7 @@ mdd_locus_plot <- ggplot(mdd_snps_in_LD_matrix_df, aes(x = BP, y = -log10(P))) +
81
82
# # the gene tracks of the region ##
82
83
83
84
# ### not sure what the above is , but doing it with ggplot ####
84
- more_UCSC_genes <- read.table(' Metabolomics/6145-618_UCSC_genes' , sep = ' \t ' , header = F )
85
+ more_UCSC_genes <- read.table(' /Users/ellad/UniversityEdinburgh/PhD/Data/UKB/ Metabolomics/6145-618_UCSC_genes' , sep = ' \t ' , header = F )
85
86
colnames(more_UCSC_genes ) <- c(' Chrom' , ' Start' , ' End' , ' Gene' , ' Description' )
86
87
87
88
more_UCSC_genes $ Colour <- ' black' # change this depending on the genes which we tested
@@ -106,10 +107,10 @@ gene_track_plot <- ggplot(more_UCSC_genes, aes(x = BP, y = Y)) + geom_segment(ae
106
107
gene_track_plot <- gene_track_plot + guides(color = " none" )
107
108
108
109
all_plots <- ggarrange(LA_TFA_locus_plot ,DHA_locus_plot , DHA_TFA_locus_plot , mdd_locus_plot , gene_track_plot , common.legend = T , nrow = 5 , ncol = 1 )
109
- ggsave(' Metabolomics/plots/locus_zoom_plots.tiff' , device = ' tiff' , all_plots , scale = 1 , width = 184 , height = 285 , units = " mm" )
110
+ ggsave(' /Users/ellad/UniversityEdinburgh/PhD/Data/UKB/ Metabolomics/plots/locus_zoom_plots.tiff' , device = ' tiff' , all_plots , scale = 1 , width = 184 , height = 285 , units = " mm" )
110
111
111
112
# DHA_plots <- ggarrange(DHA_locus_plot, DHA_TFA_locus_plot, mdd_locus_plot, gene_track_plot, common.legend = T, labels = c('A', 'B', 'C', 'D'), nrow = 4, ncol =1)
112
113
# ggsave('Metabolomics/plots/DHA_all_locus_zoom.tiff', device = 'tiff', DHA_plots, scale = 1, width = 190, height = 243.2, units ="mm", bg = "white")
113
- DHA_plot_single <- ggarrange(DHA_locus_plot , mdd_locus_plot , gene_track_plot , common.legend = T , labels = c(' A' , ' B' , ' C' ), nrow = 3 , ncol = 1 )
114
+ DHA_plot_single <- ggarrange(mdd_locus_plot , DHA_locus_plot , gene_track_plot , common.legend = T , labels = c(' A' , ' B' , ' C' ), nrow = 3 , ncol = 1 )
114
115
# la_tfa_plots <- ggarrange(LA_TFA_locus_plot, mdd_locus_plot, gene_track_plot, common.legend = T, labels = c('A', 'B', 'C'), nrow = 3, ncol = 1)
115
- ggsave(' Figure_3.tiff' , device = ' tiff' , DHA_plot_single , scale = 1 , width = 190 , height = 243.2 , units = " mm" , bg = " white" )
116
+ ggsave(' /Users/ellad/UniversityEdinburgh/PhD/Year_1/Metabolomics_Submission/Acceptance/Proofd/ Figure_3.tiff' , device = ' tiff' , DHA_plot_single , scale = 1 , width = 190 , height = 243.2 , units = " mm" , bg = " white" )
0 commit comments