Title: | Systematic Quantification of AgNPs to Unleash their Potential for Applicability |
---|---|
Description: | There is variation across AgNPs due to differences in characterization techniques and testing metrics employed in studies. To address this problem, we have developed a systematic evaluation framework called 'sysAgNPs'. Within this framework, Distribution Entropy (DE) is utilized to measure the uncertainty of feature categories of AgNPs, Proclivity Entropy (PE) assesses the preference of these categories, and Combination Entropy (CE) quantifies the uncertainty of feature combinations of AgNPs. Additionally, a Markov chain model is employed to examine the relationships among the sub-features of AgNPs and to determine a Transition Score (TS) scoring standard that is based on steady-state probabilities. The 'sysAgNPs' framework provides metrics for evaluating AgNPs, which helps to unravel their complexity and facilitates effective comparisons among different AgNPs, thereby advancing the scientific research and application of these AgNPs. |
Authors: | Xiting Wang [aut, cre] |
Maintainer: | Xiting Wang <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.0.0 |
Built: | 2025-03-01 13:32:14 UTC |
Source: | https://github.com/xitingwang-ida/sysagnps |
A binary dataframe of datasets used to establish evaluation criteria.
data(binary_dataset)
data(binary_dataset)
A dataframe with 600 rows and 50 variables.
Subfeature of nano silver.
Nanosilver data set.
data(dataset)
data(dataset)
A dataframe with 600 rows and 15 variables.
Features of nano silver.
Calculate Axis Path. This function is derived from the 'ggradar' package.https://github.com/ricardo-bion/ggradar/. Calculates x-y coordinates for a set of radial axes (one per variable being plotted in radar plot)
sys_CalculateAxisPath(var.names, min, max)
sys_CalculateAxisPath(var.names, min, max)
var.names |
list of variables to be plotted on radar plot |
min |
MININUM value required for the plotted axes (same value will be applied to all axes) |
max |
MAXIMUM value required for the plotted axes (same value will be applied to all axes) |
a dataframe of the calculated axis paths
Calculate Group Path. This function is derived from the 'ggradar' package.https://github.com/ricardo-bion/ggradar/. Converts variable values into a set of radial x-y coordinates
sys_CalculateGroupPath(df)
sys_CalculateGroupPath(df)
df |
a dataframe with Col 1 is group ('unique' cluster / group ID of entity) and Col 2-n are v1.value to vn.value - values (e.g. group/cluser mean or median) of variables v1 to v.n |
a dataframe of the calculated axis paths
Code adapted from a solution posted by Tony M to https://stackoverflow.com/questions/9614433/creating-radar-chart-a-k-a-star-plot-spider-plot-using-ggplot2-in-r/.
Calculate the average value of the probability of surprising level of the presence and absence of a particular category within the specific category to measure the average uncertainty of feature categories.
sys_CE(data, dataset)
sys_CE(data, dataset)
data |
A dataframe that contains experimental data. |
dataset |
The dataset used to to calculate the ratio of the number of reporting a certain feature in the AgNPs dataset to the total number of samples. |
A dataframe including: 1. the ratio of the number of reporting a certain feature in the AgNPs dataset to the total number of samples; 2. pc:the probability of the feature combination occurring; 3. Hi:the probability of surprising level of the presence and absence of feature combinations to measure the uncertainty of feature combination.
data(dataset) users_data <- dataset CE <- sys_CE(users_data, dataset)
data(dataset) users_data <- dataset CE <- sys_CE(users_data, dataset)
Measure the distribution variability of the presence and absence of feature categories.
sys_DE(data)
sys_DE(data)
data |
A dataframe that contains experimental data. |
A dataframe including 1. the number of feature in a certain category; 2. the total number of features in the sample; 3. the average value to measure the average uncertainty of feature categories
data(dataset) users_data <- dataset DE = sys_DE(users_data)
data(dataset) users_data <- dataset DE = sys_DE(users_data)
Convert categorical variables into discrete variables
sys_discretize(dataset, vars_to_discretize = NULL)
sys_discretize(dataset, vars_to_discretize = NULL)
dataset |
A dataframe of dataset. Datasets used to establish evaluation criteria. |
vars_to_discretize |
Variables or columns to be discretized. Default is NULL. |
A binary dataframe.
data(dataset) dis_data <- sys_discretize(dataset, c("Shape", "pH"))
data(dataset) dis_data <- sys_discretize(dataset, c("Shape", "pH"))
This function evaluates the criteria for a binary dataset by calculating the transfer probability matrix and iterating to obtain the transfer probability vector.
sys_eval_cri(binary_dataset, n_iter, vars_to_discretize = NULL)
sys_eval_cri(binary_dataset, n_iter, vars_to_discretize = NULL)
binary_dataset |
A binary dataframe of datasets used to establish evaluation criteria. |
n_iter |
The number of iterations to reach the steady state. |
vars_to_discretize |
Variables or columns to be discretized. Default is NULL. |
A dataframe containing the scores of nanomaterial features.
data(dataset) binary_dataset <- dataset var_dis <- c("Synthesis methods", "pH", "Temperature (℃)", "Zeta potential (mV)","Size (nm)", "Shape", "Applications") criteria <- sys_eval_cri(binary_dataset, 6, var_dis)
data(dataset) binary_dataset <- dataset var_dis <- c("Synthesis methods", "pH", "Temperature (℃)", "Zeta potential (mV)","Size (nm)", "Shape", "Applications") criteria <- sys_eval_cri(binary_dataset, 6, var_dis)
Generate circle coordinates. This function is derived from the 'ggradar' package.https://github.com/ricardo-bion/ggradar/. Generate coordinates to draw a circle.
sys_funcCircleCoords(center = c(0, 0), r = 1, npoints = 100)
sys_funcCircleCoords(center = c(0, 0), r = 1, npoints = 100)
center |
coordinate for centroid |
r |
radius |
npoints |
number of coordinates to generate |
a dataframe
Adapted from Joran's response to https://stackoverflow.com/questions/6862742/draw-a-circle-with-ggplot2/.
Generate Dynamic Color Values. This function is derived from the 'ggradar' package.https://github.com/ricardo-bion/ggradar/. This function dynamically generates a vector of color values based on the number of groups. It uses RColorBrewer for smaller sets of groups and generates a gradient for larger sets.
sys_generate_color_values(num_groups)
sys_generate_color_values(num_groups)
num_groups |
The number of groups for which to generate color values. |
A character vector of color values.
sys_generate_color_values(5) sys_generate_color_values(20)
sys_generate_color_values(5) sys_generate_color_values(20)
This function is derived from the 'ggradar' package.https://github.com/ricardo-bion/ggradar/.
sys_ggradar( plot.data, base.size = 15, font.radar = "sans", values.radar = c("0%", "50%", "100%"), axis.labels = colnames(plot.data)[-1], grid.min = 0, grid.mid = 0.5, grid.max = 1, centre.y = grid.min - ((1/9) * (grid.max - grid.min)), plot.extent.x.sf = 1, plot.extent.y.sf = 1.2, x.centre.range = 0.02 * (grid.max - centre.y), label.centre.y = FALSE, grid.line.width = 0.5, gridline.min.linetype = "longdash", gridline.mid.linetype = "longdash", gridline.max.linetype = "longdash", gridline.min.colour = "grey", gridline.mid.colour = "#007A87", gridline.max.colour = "grey", grid.label.size = 6, gridline.label.offset = -0.1 * (grid.max - centre.y), label.gridline.min = TRUE, label.gridline.mid = TRUE, label.gridline.max = TRUE, axis.label.offset = 1.15, axis.label.size = 5, axis.line.colour = "grey", group.line.width = 1.5, group.point.size = 6, group.colours = NULL, background.circle.colour = "#D7D6D1", background.circle.transparency = 0.2, plot.legend = if (nrow(plot.data) > 1) TRUE else FALSE, legend.title = "", plot.title = "", legend.text.size = 14, legend.position = "left", fill = FALSE, fill.alpha = 0.5, draw.points = TRUE, point.alpha = 1, line.alpha = 1 )
sys_ggradar( plot.data, base.size = 15, font.radar = "sans", values.radar = c("0%", "50%", "100%"), axis.labels = colnames(plot.data)[-1], grid.min = 0, grid.mid = 0.5, grid.max = 1, centre.y = grid.min - ((1/9) * (grid.max - grid.min)), plot.extent.x.sf = 1, plot.extent.y.sf = 1.2, x.centre.range = 0.02 * (grid.max - centre.y), label.centre.y = FALSE, grid.line.width = 0.5, gridline.min.linetype = "longdash", gridline.mid.linetype = "longdash", gridline.max.linetype = "longdash", gridline.min.colour = "grey", gridline.mid.colour = "#007A87", gridline.max.colour = "grey", grid.label.size = 6, gridline.label.offset = -0.1 * (grid.max - centre.y), label.gridline.min = TRUE, label.gridline.mid = TRUE, label.gridline.max = TRUE, axis.label.offset = 1.15, axis.label.size = 5, axis.line.colour = "grey", group.line.width = 1.5, group.point.size = 6, group.colours = NULL, background.circle.colour = "#D7D6D1", background.circle.transparency = 0.2, plot.legend = if (nrow(plot.data) > 1) TRUE else FALSE, legend.title = "", plot.title = "", legend.text.size = 14, legend.position = "left", fill = FALSE, fill.alpha = 0.5, draw.points = TRUE, point.alpha = 1, line.alpha = 1 )
plot.data |
dataframe comprising one row per group |
base.size |
text size |
font.radar |
text font family |
values.radar |
values to print at minimum, 'average', and maximum gridlines |
axis.labels |
names of axis labels if other than column names supplied via plot.data |
grid.min |
value at which mininum grid line is plotted |
grid.mid |
value at which 'average' grid line is plotted |
grid.max |
value at which maximum grid line is plotted |
centre.y |
value of y at centre of plot |
plot.extent.x.sf |
controls relative size of plot horizontally |
plot.extent.y.sf |
controls relative size of plot vertically |
x.centre.range |
controls axis label alignment |
label.centre.y |
whether value of y at centre of plot should be labelled |
grid.line.width |
width of gridline |
gridline.min.linetype |
line type of minimum gridline |
gridline.mid.linetype |
line type of 'average' gridline |
gridline.max.linetype |
line type of maximum gridline |
gridline.min.colour |
colour of minimum gridline |
gridline.mid.colour |
colour of 'average' gridline |
gridline.max.colour |
colour of maximum gridline |
grid.label.size |
text size of gridline label |
gridline.label.offset |
displacement to left/right of central vertical axis |
label.gridline.min |
whether or not to label the mininum gridline |
label.gridline.mid |
whether or not to label the 'mininum'average' gridline |
label.gridline.max |
whether or not to label the maximum gridline |
axis.label.offset |
vertical displacement of axis labels from maximum grid line, measured relative to circle diameter |
axis.label.size |
text size of axis label |
axis.line.colour |
colour of axis line |
group.line.width |
line width of group |
group.point.size |
point size of group |
group.colours |
colour of group |
background.circle.colour |
colour of background circle/radar |
background.circle.transparency |
transparency of background circle/radar |
plot.legend |
whether to include a plot legend |
legend.title |
title of legend |
plot.title |
title of radar plot |
legend.text.size |
text size in legend |
legend.position |
position of legend, valid values are "top", "right", "bottom", "left" |
fill |
whether to fill polygons |
fill.alpha |
if filling polygons, transparency values |
draw.points |
whether to draw points |
point.alpha |
alpha for points, can be a single value or vector |
line.alpha |
alpha for lines, can be a single value or vector |
a ggplot object
Most of the code is from http://rstudio-pubs-static.s3.amazonaws.com/5795_e6e6411731bb4f1b9cc7eb49499c2082.html.
Loop "n_iter" times to obtain the transition probability of each iteration.
sys_iter(binary_dataset, n_iter, vars_to_discretize = NULL)
sys_iter(binary_dataset, n_iter, vars_to_discretize = NULL)
binary_dataset |
A binary dataframe of datasets used to establish evaluation criteria. |
n_iter |
The number of iterations to reach the steady state. |
vars_to_discretize |
Variables or columns to be discretized. Default id NULL. |
A dataframe containing the number of iterations and the transition probability of each iteration.
data(dataset) iter_prob <- sys_iter(dataset, 6, c("Shape", "pH"))
data(dataset) iter_prob <- sys_iter(dataset, 6, c("Shape", "pH"))
Line and Radar Plot of sysAgNPs score
sys_line_radar(sysAgNPs_score, num_plots)
sys_line_radar(sysAgNPs_score, num_plots)
sysAgNPs_score |
A dataframe containing four columns of numeric data. |
num_plots |
The range of the graph to be output and saved can be a vector or a single value. |
A ggplot
object.
Measure the preference of feature categories.
sys_PE(data)
sys_PE(data)
data |
A dataframe that contains experimental data. |
A dataframe including 1. the number of feature in a certain category; 2. the total number of features in the sample; 3. the expected value to measure the average description level across different feature categories.
data(dataset) users_data <- dataset PE = sys_PE(users_data)
data(dataset) users_data <- dataset PE = sys_PE(users_data)
Change the values of the constraints step by step and record the number of iterations to reach the steady state.
sys_steady( binary_dataset, tran_matrix, tol_vec = c(0.01, 0.001, 1e-04, 1e-05, 1e-06, 1e-07) )
sys_steady( binary_dataset, tran_matrix, tol_vec = c(0.01, 0.001, 1e-04, 1e-05, 1e-06, 1e-07) )
binary_dataset |
A binary dataframe of datasets used to establish evaluation criteria. |
tran_matrix |
A transfer probability matrix. |
tol_vec |
A smaller constants used as constraints. |
A data frame containing the constraints and the number of iterations to reach the steady state.
data(binary_dataset) data(tran_matrix) tol_iter <- sys_steady(binary_dataset, tran_matrix, 1e-5)
data(binary_dataset) data(tran_matrix) tol_iter <- sys_steady(binary_dataset, tran_matrix, 1e-5)
Calculate transition probability matrix
sys_tran(binary_dataset)
sys_tran(binary_dataset)
binary_dataset |
A binary dataframe of datasets used to establish Transition Scores criteria. |
A transfer probability matrix.
data(binary_dataset) tran_matrix <- sys_tran(binary_dataset)
data(binary_dataset) tran_matrix <- sys_tran(binary_dataset)
Calculate the Transition Scores
sys_TS(data, dataset, n_iter, vars_to_discretize)
sys_TS(data, dataset, n_iter, vars_to_discretize)
data |
A dataframe that contains experimental data. |
dataset |
A binary dataframe. Datasets used to establish evaluation criteria. |
n_iter |
The number of iterations to reach the steady state. |
vars_to_discretize |
Variables or columns to be discretized. Default is NULL. |
A dataframe that contains sysAgNPs scores.
sysAgNPs package application results in four evaluation scores.
data(sysAgNPs_score)
data(sysAgNPs_score)
A dataframe with 600 rows and 4 variables.
Four evaluation scores.
A transfer probability matrix.
data(tran_matrix)
data(tran_matrix)
A matrix with 50 rows and 50 columns.
Subfeature of nano silver.