Demonstration of the functionnalities of the R ODAM package


Description


Load the R ODAM package

library(Rodam)
## Loading required package: RCurl
## Loading required package: bitops


Initialize the ODAM object

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

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


Get the Data Tree

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

show(dh)
##                        levelName SetID Identifier WSEntry                             Description Count
## 1  plants                            1    PlantID   plant                          Plant features   552
## 2   °--samples                       2   SampleID  sample                         Sample features  1288
## 3       ¦--aliquots                  3  AliquotID aliquot                       Aliquots features   530
## 4       ¦   ¦--cellwall_metabo       4  AliquotID aliquot      Cell wall Compound quantifications    75
## 5       ¦   ¦--cellwall_metaboFW     5  AliquotID aliquot Cell Wall Compound quantifications (FW)    75
## 6       ¦   ¦--activome              6  AliquotID aliquot                       Activome Features   266
## 7       ¦   ¦--plato_hexosesP       10  AliquotID aliquot                       Hexoses Phosphate   266
## 8       ¦   ¦--lipids_AG            11  AliquotID aliquot                               Lipids AG    57
## 9       ¦   °--AminoAcid            12  AliquotID aliquot                             Amino Acids    69
## 10      °--pools                     7     PoolID    pool                Pools of remaining pools   195
## 11          ¦--qMS_metabo            8     PoolID    pool            MS Components quantification    25
## 12          °--qNMR_metabo           9     PoolID    pool                Pools of remaining pools    65


Get all WebService entries

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

dh$getWSEntryByName("samples")
##    Subset Attribute   WSEntry
## 1  plants   PlantID     plant
## 2  plants      Rank       row
## 3  plants  PlantNum  plantnum
## 4  plants Treatment treatment
## 5 samples  SampleID    sample
## 6 samples     Truss     truss
## 7 samples  DevStage     stage
## 8 samples  FruitAge       age

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
##   PlantID Rank PlantNum Treatment SampleID Truss DevStage FruitAge HarvestDate HarvestHour FruitPosition FruitDiameter FruitHeight FruitFW
## 1     E35    E      311   Control      365    T6    FR.02    47DPA       40423         0.5             5         55.46       48.98   83.32
## 2     A17    A       17   Control      365    T6    FR.02    47DPA       40423         0.5             3         56.59       47.77   82.02
## 3      A8    A        8   Control      365    T6    FR.02    47DPA       40423         0.5             5         55.11       44.90   71.82
## 4      D3    D      210   Control      365    T6    FR.02    47DPA       40423         0.5             5         49.28       44.35   58.28
## 5     H11    H      356   Control      365    T6    FR.02    47DPA       40423         0.5             6         46.68       38.69   49.25

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, ]
##     PlantID Rank PlantNum Treatment SampleID Truss DevStage FruitAge HarvestDate HarvestHour FruitPosition FruitDiameter FruitHeight FruitFW
## 22       A8    A        8   Control      365    T6    FR.02    47DPA       40423         0.5             5         55.11       44.90   71.82
## 41      A17    A       17   Control      365    T6    FR.02    47DPA       40423         0.5             3         56.59       47.77   82.02
## 402      D3    D      210   Control      365    T6    FR.02    47DPA       40423         0.5             5         49.28       44.35   58.28
## 590     E35    E      311   Control      365    T6    FR.02    47DPA       40423         0.5             5         55.46       48.98   83.32
## 662     H11    H      356   Control      365    T6    FR.02    47DPA       40423         0.5             6         46.68       38.69   49.25


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, ]
##     PlantID Rank PlantNum Treatment SampleID Truss DevStage FruitAge HarvestDate HarvestHour FruitPosition FruitDiameter FruitHeight FruitFW
## 22       A8    A        8   Control      365    T6    FR.02    47DPA  2010-09-02        12h0             5         55.11       44.90   71.82
## 41      A17    A       17   Control      365    T6    FR.02    47DPA  2010-09-02        12h0             3         56.59       47.77   82.02
## 402      D3    D      210   Control      365    T6    FR.02    47DPA  2010-09-02        12h0             5         49.28       44.35   58.28
## 590     E35    E      311   Control      365    T6    FR.02    47DPA  2010-09-02        12h0             5         55.46       48.98   83.32
## 662     H11    H      356   Control      365    T6    FR.02    47DPA  2010-09-02        12h0             6         46.68       38.69   49.25





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
## [1] "AliquotID"
ds$facnames  # Show all factors defined in the data subset
## [1] "Treatment" "DevStage"  "FruitAge"
ds$varnames  # Show all quantitative variables defined in the data subset
##  [1] "PGM"           "F16BP_Cyt"     "PyrK"          "CitS"          "PPI"           "AcoS"          "PFK"           "FruS"          "F16BP_Stroma" 
## [10] "GluS"          "ISODH_NAD"     "EnoS"          "ISODH_NADP"    "PEPC"          "FBPA"          "SucCoALig"     "MALDH"         "AlaS"         
## [19] "FumS"          "AspS"          "GLUDH_NADP"    "GAPDH_NAD"     "GAPDH_NADP"    "GLUDH_NAD"     "TPI"           "PhoS"          "NI"           
## [28] "AciS"          "G6PDH"         "UGPS"          "SucS"          "MAL_NAD"       "ShiS"          "MAL_NADP"      "PGI_tot"       "SolStarchS"   
## [37] "AGPS"          "SucPhosphateS"
ds$qualnames # Show all qualitative variables defined in the data subset
## [1] "Rank"  "Truss"
ds$WSEntry   # Show all WS entries defined in the data subset
##      Subset Attribute   WSEntry
## 1    plants   PlantID     plant
## 2    plants      Rank       row
## 3    plants  PlantNum  plantnum
## 4    plants Treatment treatment
## 5   samples  SampleID    sample
## 6   samples     Truss     truss
## 7   samples  DevStage     stage
## 8   samples  FruitAge       age
## 9  aliquots  SampleID    sample
## 10 aliquots AliquotID   aliquot
## 11 activome AliquotID   aliquot


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.5)

plot of chunk plot1



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 ]
##             activome qNMR_metabo cellwall_metabo
## samples          254         191              70
## activome           0         191              70
## qNMR_metabo        0           0              24





R Session Information

options(width=128)
sessionInfo()
## R version 3.3.1 (2016-06-21)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 7 x64 (build 7601) Service Pack 1
## 
## locale:
## [1] LC_COLLATE=C                   LC_CTYPE=French_France.1252    LC_MONETARY=French_France.1252 LC_NUMERIC=C                  
## [5] LC_TIME=French_France.1252    
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
## [1] Rodam_0.1.2    RCurl_1.95-4.8 bitops_1.0-6  
## 
## loaded via a namespace (and not attached):
##  [1] Rcpp_0.12.7      visNetwork_1.0.1 digest_0.6.10    R6_2.1.3         plyr_1.8.4       jsonlite_1.0     formatR_1.4     
##  [8] magrittr_1.5     evaluate_0.9     scales_0.4.0     stringi_1.1.1    rstudioapi_0.6   DiagrammeR_0.8.4 data.tree_0.4.0 
## [15] tools_3.3.1      stringr_1.1.0    htmlwidgets_0.7  igraph_1.0.1     munsell_0.4.3    influenceR_0.1.0 colorspace_1.2-6
## [22] htmltools_0.3.5  knitr_1.14