Evaluation of Bioinformatics Metrics with evaluomeR (original) (raw)
Contents
- 1 Introduction
- 2 Installation
- 3 Using evaluomeR
- 4 Selecting the optimal value of k
- 5 Metric analysis
- 6 Information
Introduction
The evaluomeR package permits to evaluate the reliability of bioinformatic metrics by analysing the stability and goodness of the classifications of such metrics. The method takes the measurements of the metrics for the dataset and evaluates the reliability of the metrics according to the following analyses: Correlations, Stability and Goodness of classifications.
- Correlations: Calculation of Pearson correlation coefficient between every pair of metrics available in order to quantify their interrelationship degree. The score is in the range [-1,1].
- Perfect correlations: -1 (inverse), and 1 (direct).
- Stability: This analysis permits to estimate whether the clustering is meaningfully affected by small variations in the sample(Milligan and Cheng 1996). First, a clustering using the k-means algorithm is carried out. The value of K can be provided by the user. Then, the stability index is the mean of the Jaccard coefficient (Jaccard 1901)values of a number of bootstrap replicates. The values are in the range [0,1], having the following meaning:
- Unstable: [0, 0.60[.
- Doubtful: [0.60, 0.75].
- Stable: ]0.75, 0.85].
- Highly Stable: ]0.85, 1].
- Goodness of classifications: The goodness of the classifications are assessed by validating the clusters generated. For this purpose, we use the Silhouette width as validity index. This index computes and compares the quality of the clustering outputs found by the different metrics, thus enabling to measure the goodness of the classification for both instances and metrics. More precisely, this goodness measurement provides an assessment of how similar an instance is to other instances from the same cluster and dissimilar to the rest of clusters. The average on all the instances quantifies how the instances appropriately are clustered. Kaufman and Rousseeuw (Kaufman and Rousseeuw 2009) suggested the interpretation of the global Silhouette width score as the effectiveness of the clustering structure. The values are in the range [0,1], having the following meaning:
- There is no substantial clustering structure: [-1, 0.25].
- The clustering structure is weak and could be artificial: ]0.25, 0.50].
- There is a reasonable clustering structure: ]0.50, 0.70].
- A strong clustering structure has been found: ]0.70, 1].
Installation
The installation of evaluomeR package is performed via Bioconductor:
if (!requireNamespace("BiocManager", quietly=TRUE))
install.packages("BiocManager")
BiocManager::install("evaluomeR")
Prerequisites
The package evaluomeR depends on the following CRAN packages for the calculus: cluster (Maechler et al. 2018), corrplot (Wei and Simko 2017). Moreover, this package also depends on grDevices,graphics, stats and utils from R Core (R Core Team 2018) for plotting and on the Bioconductor packages SummarizedExperiment (Morgan et al. 2018), MultiAssayExperiment (Ramos et al. 2017) for input/output data.
Using evaluomeR
Creating an input SummarizedExperiment
The input is a SummarizedExperiment
object. The assay contained inSummarizedExperiment
must follow a certain structure, see Table1: A valid header must be specified. The first column of the header is the ID or name of the instance of the dataset (e.g., ontology, pathway, etc.) on which the metrics are measured. The other columns of the header contains the names of the metrics. The rows contains the measurements of the metrics for each instance in the dataset.
Using input sample data from evaluomeR
In our package we provide three different sample input data:
- ontMetrics: Structural ontology metrics, 19 metrics measuring structural aspects of bio-ontologies have been analysed on two different corpora of ontologies: OBO Foundry and AgroPortal (Franco et al. 2019).
- rnaMetrics: RNA quality metrics for the assessment of gene expression differences, 2 quality metrics from 16 aliquots of a unique batch of RNA Samples. The metrics are Degradation Factor (DegFact) and RNA Integrity Number (RIN) (Imbeaud et al. 2005).
- bioMetrics: Metrics for biological pathways, 2 metrics that quantitative characterizations of the importance of regulation in biochemical pathway systems, including systems designed for applications in synthetic biology or metabolic engineering. The metrics are reachability and efficiency(Davis and Voit 2018).
The user shall run the data
built-in method to load evaluomeR sample input data. This requires to provide the descriptor of the desired dataset. The datasets availables can take the following values: “ontMetrics”, “rnaMetrics” or “bioMetrics”.
library(evaluomeR)
data("ontMetrics")
data("rnaMetrics")
data("bioMetrics")
Correlations
We provide the metricsCorrelations
function to evaluate the correlations among the metrics defined in the SummarizedExperiment
:
library(evaluomeR)
data("rnaMetrics")
correlationSE <- metricsCorrelations(rnaMetrics, margins = c(4,4,12,10))
##
## Data loaded.
## Number of rows: 16
## Number of columns: 3
# Access the correlation matrix via its first assay:
# assay(correlationSE,1)
Stability analysis
The calculation of the stability indices is performed by stability
andstabilityRange
functions.
Stability
The stability index analysis is performed by the stability
function. For instance, running a stability analysis for the metrics of rnaMetrics
with a number of 100
bootstrap replicates with a k-means cluster whose k
is 2 (note that k
must be inside [2,15] range):
stabilityData <- stability(rnaMetrics, k=2, bs = 100)
The stability
function returns the stabilityData
object, aExperimentList
that contains the several assays such as the stability mean or the mean, betweenss, totss, tot.swithinss and anova values from the kmeans
clustering:
stabilityData
## ExperimentList class object of length 9:
## [1] stability_mean: SummarizedExperiment with 2 rows and 2 columns
## [2] cluster_partition: SummarizedExperiment with 2 rows and 2 columns
## [3] cluster_mean: SummarizedExperiment with 2 rows and 2 columns
## [4] cluster_centers: SummarizedExperiment with 2 rows and 2 columns
## [5] cluster_size: SummarizedExperiment with 2 rows and 2 columns
## [6] cluster_betweenss: SummarizedExperiment with 2 rows and 2 columns
## [7] cluster_totss: SummarizedExperiment with 2 rows and 2 columns
## [8] cluster_tot.withinss: SummarizedExperiment with 2 rows and 2 columns
## [9] cluster_anova: SummarizedExperiment with 2 rows and 2 columns
The stability indices plots shown when getImages = TRUE
are generated with the values of the stability mean:
assay(stabilityData, "stability_mean")
The plot represents the stability mean from each metric for a given k
value. This mean is calculated by performing the average of every stability index from k
ranges [1,k] for each metric.
Stability range
The stabilityRange
function is an iterative method of stability
function. It performs a stability analysis for a range of k
values (k.range
).
For instance, analyzing the stability of rnaMetrics
in range [2,4], withbs=100
:
stabilityRangeData = stabilityRange(rnaMetrics, k.range=c(2,4), bs = 100)
Two kind of graphs are plotted in stabilityRange
function. The first type (titled as “St. Indices for k=X across metrics_”) shows, for every k
value, the stability indices across the metrics. The second kind (titled as_St. Indices for metric ‘X’ in range [x,y]), shows a plot of the behaviour of each metric across the k
range.
Goodness of classifications
There are two methods to calculate the goodness of classifications: quality
and qualityRange
.
Quality
This method plots how the metrics behave for the current k
value, according to the average silhouette width. Also, it will plot how the clusters are grouped for each metric (one plot per metric). For instance, running a quality analysis for the two metrics of rnaMetrics
dataset, being k=4
:
qualityData = quality(rnaMetrics, k = 4)
The data of the first plot titled as “_Qual. Indices for k=4 across metrics_” according to Silhouette avg. width, is stored in _Avg_Silhouette_Width_column from the first assay of the SummarizedExperiment
, qualityData
. The other three plots titled by their metric name display the input rows grouped by colours for each cluster, along with their Silhouette width scores.
The variable qualityData
contains information about the clusters of each metric: The average silhouette width per cluster, the overall average sihouette width (taking into account all the clusters) and the number of individuals per cluster:
assay(qualityData,1)
Quality range
The qualityRange
function is an iterative method that uses the same functionality of quality
for a range of values (k.range
), instead for one unique k
value. This methods allows to analyse the goodness of the classifications of the metric for different values of the range.
In the next example we will keep using the rnaMetrics
dataset, and ak.range
set to [4,6].
k.range = c(4,6)
qualityRangeData = qualityRange(rnaMetrics, k.range)
The qualityRange
function also returns two kind of plots, as seen inStability range section. One for each k
in thek.range
, showing the quality indices (goodness of the classification) across the metrics, and a second type of plot to show each metric with its respective quality index in each k
value.
The qualityRangeData
object returned by qualityRange
is a ExperimentList
fromMultiAssayExperiment
, which is a list of SummarizedExperiment
objects whose size is diff(k.range)+1
. In the example shown above, the size ofqualityRangeData
is 3, since the array length would contain the dataframes fromk=4
to k=6
.
diff(k.range)+1
## [1] 3
length(qualityRangeData)
## [1] 3
The user can access a specific dataframe for a given k
value in three different ways: by dollar notation, brackets notation or using our wrapper method getDataQualityRange
. For instance, if the user wishes to retrieve the dataframe which contains information of k=5
, being the k.range
[4,6]:
k5Data = qualityRangeData$k_5
k5Data = qualityRangeData[["k_5"]]
k5Data = getDataQualityRange(qualityRangeData, 5)
assay(k5Data, 1)
Once the user believes to have found a proper k
value, then the user can run the quality
function to see further silhouette information on the plots.
General functionality
In this section we describe a series of parameters that are shared among our analysis functions: metricsCorrelations
, stability
, stabilityRange
, quality
and qualityRange
.
Disabling plotting
The generation of the images can be disabled by setting to FALSE
the parameter getImages
:
stabilityData <- stability(rnaMetrics, k=5, bs = 50, getImages = FALSE)
This prevents from generating any graph, performing only the calculus. By default getImages
is set to TRUE
.
Selecting the optimal value of k
evaluomeR
analyzes the behavior of the metrics in terms of stability and goodness of the clusters for a range of values of \(k\). In case of wishing to select the optimal value for \(k\) for a metric in a given dataset we have implemented the getOptimalKValue
function, which returns a table stating which is the optimal value of k
for each metric.
The algorithm works as follows: The highest stability and the highest goodness are obtained for the same value of \(k\). In such case, that value would be the optimal one. On the other hand, the highest stability and the highest goodness are obtained for different values of \(k\). In this case, additional criteria are needed. does not currently aim at providing those criteria, but to provide the data that could permit the user to make decisions. In the use cases described in this paper, we will apply the following criteria for the latter case:
- If both values of \(k\) provide at least stable classifications (value >0.75), then we select the value of \(k\) that provides the largest Silhouette width. The same would happen if none provides stable classifications.
- If \(k_1\) provides stable classifications and \(k_2\) does not, we will select \(k_1\) if the width of the Silhouette is at least reasonable.
- If \(k_1\) provides stable classifications, \(k_2\) does not, and the width of the Silhouette of \(k_1\) is less than reasonable, then we will select the value of \(k\) with the largest Silhouette width.
stabilityData <- stabilityRange(data=ontMetrics, k.range=c(2,4),
bs=20, getImages = FALSE, seed=100)
qualityData <- qualityRange(data=ontMetrics, k.range=c(2,4),
getImages = FALSE, seed=100)
kOptTable <- getOptimalKValue(stabilityData, qualityData)
Additionally, you can select another subset of k.range
to delimit the range of the optimal k
.
kOptTable <- getOptimalKValue(stabilityData, qualityData, k.range=c(3,4))
## Processing metric: ANOnto
## Stability k '4' is stable but quality k '3' is not
## Using '4' since it provides higher stability
## Processing metric: AROnto
## Maximum stability and quality values matches the same K value: '4'
## Processing metric: CBOOnto
## Both Ks have a stable classification: '4', '3'
## Using '3' since it provides higher silhouette width
## Processing metric: CBOOnto2
## Both Ks have a stable classification: '4', '3'
## Using '3' since it provides higher silhouette width
## Processing metric: CROnto
## Both Ks have a stable classification: '4', '3'
## Using '3' since it provides higher silhouette width
## Processing metric: DITOnto
## Maximum stability and quality values matches the same K value: '4'
## Processing metric: INROnto
## Stability k '4' is stable but quality k '3' is not
## Using '4' since it provides higher stability
## Processing metric: LCOMOnto
## Maximum stability and quality values matches the same K value: '3'
## Processing metric: NACOnto
## Both Ks do not have a stable classification: '4', '3'
## Using '3' since it provides higher silhouette width
## Processing metric: NOCOnto
## Maximum stability and quality values matches the same K value: '3'
## Processing metric: NOMOnto
## Maximum stability and quality values matches the same K value: '3'
## Processing metric: POnto
## Stability k '4' is stable but quality k '3' is not
## Using '4' since it provides higher stability
## Processing metric: PROnto
## Maximum stability and quality values matches the same K value: '3'
## Processing metric: RFCOnto
## Maximum stability and quality values matches the same K value: '3'
## Processing metric: RROnto
## Maximum stability and quality values matches the same K value: '3'
## Processing metric: TMOnto
## Both Ks have a stable classification: '4', '3'
## Using '3' since it provides higher silhouette width
## Processing metric: TMOnto2
## Both Ks have a stable classification: '3', '4'
## Using '4' since it provides higher silhouette width
## Processing metric: WMCOnto
## Both Ks have a stable classification: '4', '3'
## Using '3' since it provides higher silhouette width
## Processing metric: WMCOnto2
## Both Ks have a stable classification: '4', '3'
## Using '3' since it provides higher silhouette width
Metric analysis
We provide a series of methods for a further analysis on the metrics. These methods are: plotMetricsMinMax
, plotMetricsBoxplot
, plotMetricsCluster
and plotMetricsViolin
.
The plotMetricsMinMax
function plots the minimum, maximum and standard deviation of min/max points of the values of each metric:
plotMetricsMinMax(ontMetrics)
## Warning: Use of `dataStats.df.t$Min` is discouraged.
## ℹ Use `Min` instead.
## Warning: Use of `dataStats.df.t$Max` is discouraged.
## ℹ Use `Max` instead.
## Warning: Use of `dataStats.df.t$Metric` is discouraged.
## ℹ Use `Metric` instead.
## Warning: Use of `dataStats.df.t$Min` is discouraged.
## ℹ Use `Min` instead.
## Warning: Use of `dataStats.df.t$Metric` is discouraged.
## ℹ Use `Metric` instead.
## Warning: Use of `dataStats.df.t$Max` is discouraged.
## ℹ Use `Max` instead.
## Warning: Use of `dataStats.df.t$Metric` is discouraged.
## ℹ Use `Metric` instead.
## Warning: Use of `dataStats.df.t$Max` is discouraged.
## ℹ Use `Max` instead.
## Warning: Use of `dataStats.df.t$Sd` is discouraged.
## ℹ Use `Sd` instead.
## Warning: Use of `dataStats.df.t$Max` is discouraged.
## ℹ Use `Max` instead.
## Warning: Use of `dataStats.df.t$Sd` is discouraged.
## ℹ Use `Sd` instead.
## Warning: Use of `dataStats.df.t$Metric` is discouraged.
## ℹ Use `Metric` instead.
## Warning: Use of `dataStats.df.t$Min` is discouraged.
## ℹ Use `Min` instead.
## Warning: Use of `dataStats.df.t$Sd` is discouraged.
## ℹ Use `Sd` instead.
## Warning: Use of `dataStats.df.t$Min` is discouraged.
## ℹ Use `Min` instead.
## Warning: Use of `dataStats.df.t$Sd` is discouraged.
## ℹ Use `Sd` instead.
## Warning: Use of `dataStats.df.t$Metric` is discouraged.
## ℹ Use `Metric` instead.
The plotMetricsBoxplot
method boxplots the value of each metric:
plotMetricsBoxplot(rnaMetrics)
## Warning: Use of `data.melt$variable` is discouraged.
## ℹ Use `variable` instead.
## Warning: Use of `data.melt$value` is discouraged.
## ℹ Use `value` instead.
Next, the plotMetricsCluster
function clusters the values of the metrics by using the euclidean distance and the method ward.D2
from hclust
:
plotMetricsCluster(ontMetrics)
And finally the plotMetricsViolin
function:
plotMetricsViolin(rnaMetrics)
## Warning: Use of `data.melt$variable` is discouraged.
## ℹ Use `variable` instead.
## Warning: Use of `data.melt$value` is discouraged.
## ℹ Use `value` instead.
## Warning: Use of `data.melt$variable` is discouraged.
## ℹ Use `variable` instead.
## Warning: Use of `data.melt$value` is discouraged.
## ℹ Use `value` instead.
Information
License
The package ‘evaluomeR’ is licensed under GPL-3.
How to cite
Currently there is no literature for evaluomeR. Please cite the R package, the github or the website. This package will be updated as soon as a citation is available.
Session information
sessionInfo()
## R version 4.5.0 RC (2025-04-04 r88126)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 24.04.2 LTS
##
## Matrix products: default
## BLAS: /home/biocbuild/bbs-3.21-bioc/R/lib/libRblas.so
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.12.0 LAPACK version 3.12.0
##
## locale:
## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=en_GB LC_COLLATE=C
## [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
## [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
## [9] LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
##
## time zone: America/New_York
## tzcode source: system (glibc)
##
## attached base packages:
## [1] stats4 stats graphics grDevices utils datasets methods
## [8] base
##
## other attached packages:
## [1] evaluomeR_1.24.0 sparcl_1.0.4
## [3] RSKC_2.4.2 flexclust_1.5.0
## [5] flexmix_2.3-20 lattice_0.22-7
## [7] randomForest_4.7-1.2 fpc_2.2-13
## [9] cluster_2.1.8.1 MultiAssayExperiment_1.34.0
## [11] SummarizedExperiment_1.38.0 Biobase_2.68.0
## [13] GenomicRanges_1.60.0 GenomeInfoDb_1.44.0
## [15] IRanges_2.42.0 S4Vectors_0.46.0
## [17] BiocGenerics_0.54.0 generics_0.1.3
## [19] MatrixGenerics_1.20.0 matrixStats_1.5.0
## [21] magrittr_2.0.3 kableExtra_1.4.0
## [23] BiocStyle_2.36.0
##
## loaded via a namespace (and not attached):
## [1] tidyselect_1.2.1 viridisLite_0.4.2 farver_2.1.2
## [4] dplyr_1.1.4 fastmap_1.2.0 digest_0.6.37
## [7] lifecycle_1.0.4 kernlab_0.9-33 compiler_4.5.0
## [10] rlang_1.1.6 sass_0.4.10 tools_4.5.0
## [13] plotrix_3.8-4 yaml_2.3.10 corrplot_0.95
## [16] knitr_1.50 labeling_0.4.3 S4Arrays_1.8.0
## [19] mclust_6.1.1 DelayedArray_0.34.0 plyr_1.8.9
## [22] xml2_1.3.8 abind_1.4-8 withr_3.0.2
## [25] nnet_7.3-20 grid_4.5.0 colorspace_2.1-1
## [28] ggplot2_3.5.2 scales_1.3.0 MASS_7.3-65
## [31] prabclus_2.3-4 tinytex_0.57 cli_3.6.4
## [34] rmarkdown_2.29 crayon_1.5.3 rstudioapi_0.17.1
## [37] robustbase_0.99-4-1 reshape2_1.4.4 httr_1.4.7
## [40] BiocBaseUtils_1.10.0 cachem_1.1.0 stringr_1.5.1
## [43] modeltools_0.2-23 parallel_4.5.0 BiocManager_1.30.25
## [46] XVector_0.48.0 vctrs_0.6.5 Matrix_1.7-3
## [49] jsonlite_2.0.0 bookdown_0.43 magick_2.8.6
## [52] systemfonts_1.2.2 diptest_0.77-1 jquerylib_0.1.4
## [55] ggdendro_0.2.0 glue_1.8.0 DEoptimR_1.1-3-1
## [58] stringi_1.8.7 gtable_0.3.6 UCSC.utils_1.4.0
## [61] munsell_0.5.1 tibble_3.2.1 pillar_1.10.2
## [64] htmltools_0.5.8.1 GenomeInfoDbData_1.2.14 R6_2.6.1
## [67] Rdpack_2.6.4 evaluate_1.0.3 rbibutils_2.3
## [70] bslib_0.9.0 class_7.3-23 Rcpp_1.0.14
## [73] svglite_2.1.3 SparseArray_1.8.0 xfun_0.52
## [76] pkgconfig_2.0.3
Bibliography
Franco, Manuel, Juana María Vivo, Manuel Quesada-Martínez, Astrid Duque-Ramos, and Jesualdo Tomás Fernández-Breis. 2019. “Evaluation of ontology structural metrics based on public repository data.” Bioinformatics, February. https://doi.org/10.1093/bib/bbz009.
Imbeaud, Sandrine, Esther Graudens, Virginie Boulanger, Xavier Barlet, Patrick Zaborski, Eric Eveno, Odilo Mueller, Andreas Schroeder, and Charles Auffray. 2005. “Towards Standardization of Rna Quality Assessment Using User-Independent Classifiers of Microcapillary Electrophoresis Traces.” Nucleic Acids Research 33 (6): e56–e56.
Jaccard, Paul. 1901. “Distribution de La Flore Alpine Dans Le Bassin Des Dranses et Dans Quelques Regions Voisines.” Bull Soc Vaudoise Sci Nat 37: 241–72.
Kaufman, Leonard, and Peter J Rousseeuw. 2009. Finding Groups in Data: An Introduction to Cluster Analysis. Vol. 344. John Wiley & Sons.
Maechler, Martin, Peter Rousseeuw, Anja Struyf, Mia Hubert, Kurt Hornik, Matthias Studer, Pierre Roudier, Juan Gonzalez, and Kamil Kozlowski. 2018. R Package "Cluster": "Finding Groups in Data": Cluster Analysis Extended Rousseeuw et Al". https://cran.r-project.org/package=cluster.
Milligan, Glenn W, and Richard Cheng. 1996. “Measuring the Influence of Individual Data Points in a Cluster Analysis.” Journal of Classification 13 (2): 315–35.
Morgan, Martin, Valerie Obenchain, Jim Hester, and Hervé Pagès. 2018. SummarizedExperiment: SummarizedExperiment Container.
Ramos, Marcel, Lucas Schiffer, Angela Re, Rimsha Azhar, Azfar Basunia, Carmen Rodriguez Cabrera, Tiffany Chan, et al. 2017. “Software for the Integration of Multi-Omics Experiments in Bioconductor.” Cancer Research 77(21); e39-42.
R Core Team. 2018. R: A Language and Environment for Statistical Computing. Vienna, Austria: R Foundation for Statistical Computing. https://www.R-project.org/.