Rodam package"

knitr::opts_chunk$set(echo = TRUE, warning=FALSE, fig.align=TRUE)

Demonstration of the functionnalities of the R ODAM package

Description


Load the R ODAM package

library(Rodam)


Initialize the ODAM object

Initialize the 'ODAM' object with the wanted dataset along with its corresponding URL of webservice

dh <- new('odamws', wsURL='https://pmb-bordeaux.fr/getdata/', dsname='frim1')


Get the Data Tree

options(width=256)
options(warn=-1)
options(stringsAsFactors=FALSE)

show(dh)


Get all WebService entries

Get all WebService entries defined in the data subset 'samples'

dh$getWSEntryByName("samples")

NOTE:

a 'WSEntry' is an alias name associated with an attribute that allows user to query the data subset by putting a filter condition (i.e. a selection constraint) on the corresponding attribute. Not all attributes have a WSEntry but only few ones, especially the attributes within the identifier and factor categories. For instance, the WSEntry of the 'SampleID' attribute is 'sample'. Thus, if you want to select only samples with their ID equal to 365, you have to specify the filter condition as 'sample/365'.



Get data from 'samples' subset with a constraint

data <- dh$getDataByName('samples','sample/365')
data


But if this WSEntry concept is not clear for you, you can retrieve the full data subset, then performe a local selection as shown below :

data <- dh$getDataByName('samples') 
data[data$SampleID==365, ]


Convert all numeric values of date and time in a human-readable format

data$HarvestDate <- dh$dateToStr(data$HarvestDate)
data$HarvestHour <- dh$timeToStr(data$HarvestHour)
data[data$SampleID==365, ]



Get 'activome' data subset

Get 'activome' data subset along with its metadata

ds <- dh$getSubsetByName('activome')
ds$samples   # Show the identifier defined in the data subset
ds$facnames  # Show all factors defined in the data subset
options(width=150)
ds$varnames  # Show all quantitative variables defined in the data subset
ds$qualnames # Show all qualitative variables defined in the data subset
ds$WSEntry   # Show all WS entries defined in the data subset


Boxplot of all variables defined in ds$varnames

Rank <- simplify2array(lapply(ds$varnames, function(x) { round(mean(log10(ds$data[ , x]), na.rm=T)) }))
cols <- c('red', 'orange', 'darkgreen', 'blue', 'purple')
boxplot(log10(ds$data[, ds$varnames]), outline=F, horizontal=T, border=cols[Rank], las=2, cex.axis=0.8)


Find how many IDs in common there are between the subsets

Based on the subset network, the common ID to be considered is the "SampleID" identifier

 refID <- "SampleID"
 subsetList <- c( "samples", "activome", "qNMR_metabo", "cellwall_metabo" )
 n <- length(subsetList)
 Mintersubsets <- matrix(data=0, nrow=n, ncol=n)
 for (i in 1:(n-1))
     for (j in (i+1):n)
          Mintersubsets[i,j] <- length(dh$getCommonID(refID,subsetList[i],subsetList[j]))

 rownames(Mintersubsets) <- subsetList
 colnames(Mintersubsets) <- subsetList
 Mintersubsets[ -n, -1 ]


Get the merged data of two data subsets based on their common identifiers

setNameList <- c("activome", "qNMR_metabo" )
dsMerged <- dh$getSubsetByName(setNameList)

Boxplot of all variables defined in ds$varnames

cols <- c( rep('red', length(dsMerged$varsBySubset[[setNameList[1]]])), 
           rep('darkgreen', length(dsMerged$varsBySubset[[setNameList[2]]])) )
boxplot(log10(dsMerged$data[, dsMerged$varnames]), outline=F, horizontal=T, border=cols, las=2, cex.axis=0.8)





R Session Information

options(width=128)
sessionInfo()


Try the Rodam package in your browser

Any scripts or data that you put into this service are public.

Rodam documentation built on March 18, 2022, 6:16 p.m.