1.11.4. Integrating data

Recipe metadata

identifier: FCB041 version: v1.0

Difficulty level

Reading Time

30 minutes

Recipe Type


Executable Code


Intended Audience

Data Manager

Data Scientist


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.

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

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

  1. 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")
  1. 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))
  1. 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")
  1. 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))

What do we see? The figure shows how consistant 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.

Bibliographic References

1. Magnard JL, Roccia A, Caissard JC, Vergne P, Sun P, Hecquet R, Dubois A, Hibrand-Saint Oyant L, Jullien F, Nicolè F, Raymond O, Huguet S, Baltenweck R, Meyer S, Claudel P, Jeauffre J, Rohmer M, Foucher F, Hugueney P, Bendahmane M, Baudino S. PLANT VOLATILES. Biosynthesis of monoterpene scent compounds in roses. Science. 2015 Jul 3;349(6243):81-3.

2. Raymond O, Gouzy J, Just J, Badouin H, Verdenaud M, Lemainque A, Vergne P, Moja S, Choisne N, Pont C, Carrère S, Caissard JC, Couloux A, Cottret L, Aury JM, Szécsi J, Latrasse D, Madoui MA, François L, Fu X, Yang SH, Dubois A, Piola F, Larrieu A, Perez M, Labadie K, Perrier L, Govetto B, Labrousse Y, Villand P, Bardoux C, Boltz V, Lopez-Roques C, Heitzler P, Vernoux T, Vandenbussche M, Quesneville H, Boualem A, Bendahmane A, Liu C, Le Bris M, Salse J, Baudino S, Benhamed M, Wincker P, Bendahmane M. The Rosa genome provides new insights into the domestication of modern roses. Nat Genet. 2018 Jun;50(6):772-777.