Title: | IN-vivo reSPonsE Classification of Tumours |
---|---|
Description: | This is a shiny app used for the statistical classifying and analysing pre-clinical tumour responses. |
Authors: | Bairu Zhang [cre, aut], Olga Muraeva [aut], Natasha Karp [aut] |
Maintainer: | Bairu Zhang <[email protected]> |
License: | Apache License (== 2) |
Version: | 0.1.0 |
Built: | 2025-02-13 04:15:19 UTC |
Source: | https://github.com/cran/INSPECTumours |
create a table with aggregated data: each row contains information about control and treatments of a single study
aggregate_study_info(df)
aggregate_study_info(df)
df |
data.frame |
data.frame
Generate table representing number of animals in classification groups
animal_info_classification(data)
animal_info_classification(data)
data |
final classification data |
data frame
Credible interval (or say “Bayesian confidence interval”) of the mean difference between two groups (treatment and reference) is used to assess the efficacy. If 0 falls outside the interval, the drug was considered significantly effective
assess_efficacy(data, reference = "Control")
assess_efficacy(data, reference = "Control")
data |
prediction results |
reference |
name of the reference treatment |
dataframe with information about drug efficacy
makes df with data to be excluded
below_min_points(df, min_points)
below_min_points(df, min_points)
df |
initial data frame |
min_points |
minimum number of data points for one animal_id per study |
df
Function to return rate of growth (e.g. the slope after a log transformation of the tumour data against time)
calc_gr(df, log_tv = "log_tv", day = "day")
calc_gr(df, log_tv = "log_tv", day = "day")
df |
subset, one animal_id |
log_tv |
name of the column, tumour volume |
day |
name of the column, days |
tibble with GR and GR_SE
Calculate probability of categories
calc_probability(data)
calc_probability(data)
data |
data frame with predictions |
data frame
Calculate percentage of survived animals
calc_survived(df)
calc_survived(df)
df |
data frame |
data frame
Get an array with change_time for studies from the population-level effects, multiple studies
change_time_multi(model)
change_time_multi(model)
model |
an object of class brmsfit |
data frame
Get a change time from the population-level effects, single study
change_time_single(model)
change_time_single(model)
model |
an object of class brmsfit |
a numeric vector of length one
Classify individual data points as Responders or Non-responders
classify_data_point(df_newstudy, pred_newstudy)
classify_data_point(df_newstudy, pred_newstudy)
df_newstudy |
data from new study |
pred_newstudy |
data frame with predictions |
data frame with "Responder"/"Non-responder" for individual data points
Make predictions for subcategories
classify_subcategories(data, model)
classify_subcategories(data, model)
data |
data frame with classification results |
model |
object of class brmsfit |
data frame
Classify tumour based on the growth rate and the p_value for a two-sided T test Tumour will be considered as "Non-responder", "Modest responder", "Stable responder" or "Regressing responder"
classify_type_responder(df)
classify_type_responder(df)
df |
data frame |
data frame with a new column classify_tumour
function to remove hyphens, underscores, spaces and transform to lowercase
clean_string(string)
clean_string(string)
string |
to modify |
modified string
Function to plot a control growth profile
control_growth_plot(df, model_type, col_palette)
control_growth_plot(df, model_type, col_palette)
df |
data frame |
model_type |
string |
col_palette |
character palette |
ggplot object
A dataset containing the repeatedly measurements of tumour volume data over time for individual animals.
example_data
example_data
A data frame with 1462 rows and 6 variables:
study identifier
group identifier
treatment type
animal identifier
day after implant
volume in mm3
Filter rows to exclude from the analysis
exclude_data(df, study_id_ex, animal_id_ex, day_ex, reason)
exclude_data(df, study_id_ex, animal_id_ex, day_ex, reason)
df |
initial df |
study_id_ex |
string: study id |
animal_id_ex |
string: animal id |
day_ex |
string: day |
reason |
string: why it should be excluded |
dataframe with rows that meets exclusion criteria
Function to expand a vector of colors if needed
expand_palette(col_palette, n)
expand_palette(col_palette, n)
col_palette |
character palette to color the treatments |
n |
how many colors are needed |
a character vector of colors
Calculate coefficients for a nonlinear model
f_start(df, x, y, r_change)
f_start(df, x, y, r_change)
df |
data frame with x as a predictor and y is an outcome |
x |
predictor string |
y |
outcome string |
r_change |
numeric |
list of coefficients
Classify tumour based on response status of individuals
get_responder(x, n)
get_responder(x, n)
x |
character vector with response statuses of one animal |
n |
consecutive measurements for classification |
"Responder" or "Non-responder"
function to search for the possible critical columns in a data.frame
guess_match(colnames_df, crit_cols)
guess_match(colnames_df, crit_cols)
colnames_df |
a character vector with names |
crit_cols |
a character vector |
list: possible match to each critical column
Function to hide outliers in boxplots with jitterdodge as suggested
hide_outliers(x)
hide_outliers(x)
x |
plotly object |
plotly object without boxplot outliers
function to read data from users (.csv or .xlsx files)
load_data(path, name)
load_data(path, name)
path |
path to a temp file |
name |
filename provided by the web browser |
data frame
Create a character vector with the names of terms from model, for which predictions should be displayed Specific values are specified in square brackets
make_terms(days, studies = NULL)
make_terms(days, studies = NULL)
days |
vector with days with which to predict |
studies |
vector with studies with which to predict |
vector with values for predictions
Build model and make predictions
model_control(df_control, df_newstudy, method, end_day)
model_control(df_control, df_newstudy, method, end_day)
df_control |
data frame with control data (including historical control, if provided) |
df_newstudy |
data frame, data from new study |
method |
"Two-stage non-linear model" or "Linear model" |
end_day |
period of time used for the statistical modelling of the control data |
list: two data frames with prediction results (for new study and for control data)
Display a popup message and reset fileInput
notify_error_and_reset_input(message_text)
notify_error_and_reset_input(message_text)
message_text |
the modal's text |
Fit model (Bayesian ordered logistic regression)
ordered_regression(df, formula, n_cores)
ordered_regression(df, formula, n_cores)
df |
data frame with classification results. Tumour classification is converted into ordinal data |
formula |
string |
n_cores |
number of cores to use |
object of class brmsfit
Plot representing number of animals in classification groups
plot_animal_info(data, col_palette)
plot_animal_info(data, col_palette)
data |
final classification data |
col_palette |
character palette |
ggplot object
Function to plot classification over growth rate
plot_class_gr(df, col_palette)
plot_class_gr(df, col_palette)
df |
data frame |
col_palette |
character palette |
ggplot object
Function to plot classification over tumour volume
plot_class_tv(df, col_palette, title_name)
plot_class_tv(df, col_palette, title_name)
df |
data frame |
col_palette |
named vector |
title_name |
character |
ggplot object
Plot estimated proportions
plot_proportions(data, col_palette)
plot_proportions(data, col_palette)
data |
table of the category prediction |
col_palette |
character palette |
Function to plot waterfall
plot_waterfall(df, col_palette, study_name)
plot_waterfall(df, col_palette, study_name)
df |
data frame |
col_palette |
character palette |
study_name |
string: to show on title |
ggplot object
Create volume plot for one-batch data
plotly_volume( df, col_palette = NULL, faceting_var, y_name, y_var, p_title, ... )
plotly_volume( df, col_palette = NULL, faceting_var, y_name, y_var, p_title, ... )
df |
data.frame, single-batch long format |
col_palette |
character palette to color the treatments |
faceting_var |
string |
y_name |
string |
y_var |
string: column name for y axis |
p_title |
plot title |
... |
arguments passed to plot_ly |
plotly object
Make predictions, linear model
predict_lm(model, newdata, single)
predict_lm(model, newdata, single)
model |
a model object |
newdata |
data frame in which to look for variables with which to predict |
single |
logical: TRUE if single study experiment |
data frame with predictions
Make predictions based on non-linear model, multiple studies
predict_nlm_multi(model, newdata, change_time)
predict_nlm_multi(model, newdata, change_time)
model |
an object of class brmsfit |
newdata |
data frame in which to look for variables with which to predict |
change_time |
data frame |
data frame with predictions
Make predictions based on non-linear model, single study
predict_nlm_single(model, newdata, change_time)
predict_nlm_single(model, newdata, change_time)
model |
an object of class brmsfit |
newdata |
data frame in which to look for variables with which to predict |
change_time |
numeric |
data frame with predictions
Make predictions
predict_regr_model(model, df)
predict_regr_model(model, df)
model |
object of class brmsfit |
df |
data frame with classification results |
data frame
Run the Shiny Application
run_app(...)
run_app(...)
... |
additional options passed to shinyApp() |
No return value, called for the shiny app interface
Fit nonlinear model - continuous hinge function
run_nl_model(start, df_mod, formula, n_cores)
run_nl_model(start, df_mod, formula, n_cores)
start |
df with coefficients |
df_mod |
data of all variables used in the model |
formula |
an object of class brmsformula |
n_cores |
number of cores to use |
object of class brmsfit
Set up a waiting screen
set_waiter(header)
set_waiter(header)
header |
text to display on loading screen |
object of a class waiter