4. Integrating data




Recipe Overview
Reading Time
30 minutes
Executable Code
Yes
Difficulty
Integrating data
FAIRPlus logo
Recipe Type
Hands-on
Maturity Level & Indicator
DSM-1-C0DSM-1-C1
hover me Tooltip text

4.1. Background:

Experimental results such as metabolite profiling data published in [1,2] can be straightfowardly reported using OKFN Data Packages. Such components can be easily parsed into R and exploited with rich graphical libraries, such as the well know ggplot2 (https://ggplot2.tidyverse.org/). A few lines of code allow to query datasets and rapidly explore the information. Most importantly, this rapid exploration is possible because of independent variables and because their levels have been clearly and unambiguously declared in the Tabular Data Package itself.

4.1.1. .

4.1.1.1. 1. Let’s begin by installing the R packages allowing easy access and use of data formatted as JSON Data Package

install.packages("ggplot2")
install.packages("readr")
install.packages("devtools")
library(ggplot2) 
library(readr)
library(devtools)

4.1.1.2. 2. Here, we install an additional library, providing some additional customization of graphs and plots

install_github("kassambara/easyGgplot2") 
library(easyGgplot2) 

4.1.1.3. 3. Reading the data

We now simply read in the comma-separated-file associated with the tabular data package (a “long” table)

# rose arome nature genetics data from 2018 and plotting for the different treatment groups:
# rosedata <- read_csv("../data/processed/rose-data/rose-aroma-naturegenetics2018-treatment-group-mean-sem-report-table-example.csv")
rosedata <- read_csv("https://zenodo.org/api/files/ba3fbc84-14af-4858-a9ed-e6cfe8d4efd2/rose-aroma-naturegenetics2018-treatment-group-mean-sem-report-table-example.csv")

4.1.1.4. 4. Plotting the data: We then generate a barplot using the ggplot2 library

ggplot2.barplot(data=rosedata, xName="chemical_name", yName="sample_mean", faceting=TRUE, facetingVarNames="treatment", facetingDirection="vertical",facetingScales="free", groupName="treatment", groupColors=c('#999999','#E69F00','pink','coral','grey','lightblue','aquamarine3','orange'), xtitle="chemical name",ytitle="mean concentration", xtitleFont=c(10,"plain","darkblue"),ytitleFont=c(10,"plain","darkblue"), xTickLabelFont=c(8,"italic", "black"), yTickLabelFont=c(8,"italic","black"), legendPosition="right",legendTitle="Treatment", legendTitleFont=c(10, "bold", "black"), legendTextFont=c(9, "plain", "black"), legendBackground=c("white", 0.5, "solid", "black" )) + theme(axis.text.x=element_text(angle=90, hjust=1),strip.text.y = element_text(angle=0, colour="black",face="plain",size=8))

4.1.1.5. 5. Let’s now compare the dataset generated in 2015 and the dataset generated in 2018

Both datasets have been generated by the same team, on the same genotype (Rosa Chinensis ‘Old Blush’) and organism part (‘sepals’). Both datasets are held in a Tabular Data Package with the same structure. To perform the comparison, we have simply created another tabular data package, which retains the exact same structure and that simply holds the measurements for the relevant conditions extracted from each dataset (the function to create such file is omitted).

# rose arome nature genetics data from 2018 and plotting for the different treatment groups:
# ng2018sc2015 <- read_csv("../data/processed/rose-data/rose_aroma_compound_science2015_vs_NG2018_data_integration.csv")
ng2018sc2015 <- read_csv("https://zenodo.org/api/files/268f29fc-8ead-4049-bb86-181b72073682/rose_aroma_compound_science2015_vs_NG2018_data_integration.csv")

4.1.1.6. 6. We generate another barplot, which shows the concentration of the chemicals targeted by the GC-MS profiling assay

ggplot2.barplot(data=ng2018sc2015, xName="chemical_name", yName="normalized_to_total_sum_concentration", faceting=TRUE, facetingVarNames="publication_year", facetingDirection="vertical",facetingScales="free", groupName="publication_year", groupColors=c('aquamarine3','orange'), xtitle="chemical name",ytitle="normalizated to total sum concentration", xtitleFont=c(10,"plain","darkblue"),ytitleFont=c(10,"plain","darkblue"), xTickLabelFont=c(8,"italic", "black"), yTickLabelFont=c(8,"italic","black"),  legendPosition="right", legendTitle="Treatment", legendTitleFont=c(10, "bold", "black"),           legendTextFont=c(9, "plain", "black"), legendBackground=c("white", 0.5, "solid", "black" ))  + theme(axis.text.x=element_text(angle=90, hjust=1),strip.text.y = element_text(angle=0, colour="black",face="plain",size=8))

4.1.2. Conclusion

What do we see? The figure shows how consistent the chemical profile of the scent between the 2 studies is and which prevalent compounds such as X, Y, and Z show roughly similar relative amount within and across studies.

4.3. Authors