Title: | RT-QuIC Data Formatting and Analysis |
---|---|
Description: | Designed for the curation and analysis of data generated from real-time quaking-induced conversion (RT-QuIC) assays first described by Atarashi et al. (2011) <doi:10.1038/nm.2294>. 'quicR' calculates useful metrics such as maxpoint ratio: Rowden et al. (2023) <doi:10.1099/vir.0.069906-0>; time-to-threshold: Shi et al. (2013) <doi:10.1186/2051-5960-1-44>; and maximum slope. Integration with the output from plate readers allows for seamless input of raw data into the R environment. |
Authors: | Gage Rowden [aut, cre] |
Maintainer: | Gage Rowden <[email protected]> |
License: | GPL-3 |
Version: | 2.1.0 |
Built: | 2025-02-12 17:24:37 UTC |
Source: | https://github.com/gage1145/quicr |
Adds replicate information to the sample IDs. Well IDs should be formatted like so: A4, B9, H11, J24
add_reps(df, sep = "_")
add_reps(df, sep = "_")
df |
A dataframe containing two columns for well IDs and Sample IDs |
sep |
a character string to separate the terms. |
A dataframe with replicate numbers pasted to the Sample IDs
BMG_format accepts a plate layout .CSV file and formats the Sample IDs into a format which can be easily imported into the BMG control software.
BMG_format( file, save_path = "", save_name = "formatted.txt", write_file = FALSE )
BMG_format( file, save_path = "", save_name = "formatted.txt", write_file = FALSE )
file |
A .CSV file containing the plate layout of Sample IDs. |
save_path |
The path to the directory that you want the file saved. |
save_name |
The name of the output file. Should have the ".txt" extension. |
write_file |
Logical. If true, function will write a .txt file; otherwise it will return a character vector. |
A text file containing information for import into the BMG control software.
layout_file <- system.file( "extdata/BMG_formatting", file = "plate_layout.csv", package = "quicR" ) BMG_format(layout_file)
layout_file <- system.file( "extdata/BMG_formatting", file = "plate_layout.csv", package = "quicR" ) BMG_format(layout_file)
Uses functions from the "calculate" family of quicR functions to generate an analyzed dataframe.
calculate_metrics( data, meta, metrics = c("MPR", "MS", "TtT", "RAF"), transpose = FALSE, normalize = FALSE, start_col = 3L, MS_window = 3L, threshold = 2 )
calculate_metrics( data, meta, metrics = c("MPR", "MS", "TtT", "RAF"), transpose = FALSE, normalize = FALSE, start_col = 3L, MS_window = 3L, threshold = 2 )
data |
A dataframe containing the raw RT-QuIC data. |
meta |
A dataframe containing sample metadata. Should include at least the "Sample IDs" column. |
metrics |
An array containing the metrics which should be calculated. |
transpose |
Logical; should the raw data be transposed before performing the calculations? |
normalize |
Logical; should the raw data be normalized before performing the calculations? |
start_col |
Integer; column number denoting where the numeric data begins. |
MS_window |
Integer; width of the window applied in the calculation of max slope. |
threshold |
Float; the threshold applied to the calculation of time-to-threshold. |
A dataframe of calculated metrics.
file <- system.file( "extdata/input_files", file = "test4.xlsx", package = "quicR" ) data <- quicR::get_real(file)[[1]] |> quicR::normalize_RFU() meta <- quicR::organize_tables(file) |> quicR::convert_tables() calculate_metrics(data, meta)
file <- system.file( "extdata/input_files", file = "test4.xlsx", package = "quicR" ) data <- quicR::get_real(file)[[1]] |> quicR::normalize_RFU() meta <- quicR::organize_tables(file) |> quicR::convert_tables() calculate_metrics(data, meta)
Maxpoint ratio is defined as the maximum relative fluorescence divided by the background fluorescence.
calculate_MPR(data, start_col = 3, data_is_norm = TRUE)
calculate_MPR(data, start_col = 3, data_is_norm = TRUE)
data |
A dataframe containing the real-time fluorescence data. |
start_col |
Integer, the column at which the background fluorescence should be read. |
data_is_norm |
Logical, if the data has not been normalized, will make a call to normalize_RFU. |
A vector containing MPR values.
# This test takes >5 sec file <- system.file( "extdata/input_files", file = "test.xlsx", package = "quicR" ) df_ <- quicR::get_real(file)[[1]] print(calculate_MPR(df_))
# This test takes >5 sec file <- system.file( "extdata/input_files", file = "test.xlsx", package = "quicR" ) df_ <- quicR::get_real(file)[[1]] print(calculate_MPR(df_))
Uses a sliding window to calculate the slope of real-time reads.
calculate_MS(data, window = 3, data_is_norm = TRUE)
calculate_MS(data, window = 3, data_is_norm = TRUE)
data |
A dataframe containing real-time reads. It is recommended to use a dataframe made from normalize_RFU. |
window |
Integer designating how wide you want the sliding window to be for calculating the moving average slope. |
data_is_norm |
Logical; if FALSE, will make a call to normalize_RFU. |
A dataframe containing the real-time slope values as ΔRFU/sec.
# This test takes >5 sec file <- system.file( "extdata/input_files", file = "rt_data.csv", package = "quicR" ) df_ <- read.csv(file, check.names = FALSE) calculate_MS(df_)
# This test takes >5 sec file <- system.file( "extdata/input_files", file = "rt_data.csv", package = "quicR" ) df_ <- read.csv(file, check.names = FALSE) calculate_MS(df_)
Calculates a threshold for determining time-to-threshold and rate of amyloid formation.
calculate_threshold( data, background_cycle = 2, method = list("stdev", "none"), multiplier = 1 )
calculate_threshold( data, background_cycle = 2, method = list("stdev", "none"), multiplier = 1 )
data |
A dataframe output from get_real. |
background_cycle |
Integer; the cycle used for background fluorescence. |
method |
Method for determining threshold; default is "stdev". |
multiplier |
For some methods, will add a multiplier for more conservative thresholds. |
A float value.
file <- system.file( "extdata/input_files", file = "test2.xlsx", package = "quicR" ) threshold <- get_real(file)[[1]] |> calculate_threshold(multiplier = 10)
file <- system.file( "extdata/input_files", file = "test2.xlsx", package = "quicR" ) threshold <- get_real(file)[[1]] |> calculate_threshold(multiplier = 10)
Calculates the time required to reach a defined threshold.
calculate_TtT(data, threshold, start_col = 3)
calculate_TtT(data, threshold, start_col = 3)
data |
A dataframe containing real-time RT-QuIC data. |
threshold |
A numeric value defining the threshold. |
start_col |
The column containing the starting position of the real-time data. |
A vector containing the times to threshold
# This test takes >5 sec file <- system.file( "extdata/input_files", file = "test2.xlsx", package = "quicR" ) df_ <- get_real(file)[[1]] |> quicR::transpose_real() |> quicR::normalize_RFU(transposed = TRUE) calculate_TtT(df_, threshold = 2)
# This test takes >5 sec file <- system.file( "extdata/input_files", file = "test2.xlsx", package = "quicR" ) df_ <- get_real(file)[[1]] |> quicR::transpose_real() |> quicR::normalize_RFU(transposed = TRUE) calculate_TtT(df_, threshold = 2)
Accepts a table or matrix or a list of tables and matrices and converts them into dataframe columns.
convert_tables(tab, na_omit = TRUE)
convert_tables(tab, na_omit = TRUE)
tab |
A table/matrix or a list of tables/matrices. |
na_omit |
Logical; if true, will remove rows with NA. |
A dataframe column.
file <- system.file( "extdata/input_files", file = "test.xlsx", package = "quicR" ) tabs <- organize_tables(file) convert_tables(tabs)
file <- system.file( "extdata/input_files", file = "test.xlsx", package = "quicR" ) tabs <- organize_tables(file) convert_tables(tabs)
Takes the Excel file exported from MARS and compiles the metadata in the header.
get_meta(file)
get_meta(file)
file |
The Excel file exported from MARS. |
A dataframe containing the Meta_ID and Meta_info
file <- system.file( "extdata/input_files", file = "test.xlsx", package = "quicR" ) get_meta(file)
file <- system.file( "extdata/input_files", file = "test.xlsx", package = "quicR" ) get_meta(file)
Accepts an Excel file or a dataframe of real-time RT-QuIC data.
get_real(data, ordered = FALSE)
get_real(data, ordered = FALSE)
data |
Either an Excel file or a dataframe. |
ordered |
Logical, if true, will organize the columns by sample ID rather than by well. |
A list of dataframes containing the formatted real-time data.
file <- system.file( "extdata/input_files", file = "test.xlsx", package = "quicR" ) get_real(file)
file <- system.file( "extdata/input_files", file = "test.xlsx", package = "quicR" ) get_real(file)
Returns a dataframe with the sample IDs and well IDs used in the plate.
get_sample_locations( file, tab_name = "Sample IDs", dilution_bool = FALSE, dilution_fun = function(x) 1 * x, sep = "\n", plate = 96 )
get_sample_locations( file, tab_name = "Sample IDs", dilution_bool = FALSE, dilution_fun = function(x) 1 * x, sep = "\n", plate = 96 )
file |
Excel file exported from MARS |
tab_name |
Table name containing the sample IDs. |
dilution_bool |
Logical; is there a table containing dilution factors? If so, will add a newline and the log of the dilution factor to the ID column. |
dilution_fun |
A function for transforming the dilution factor. |
sep |
A string used to separate the sample ID and dilution factor. |
plate |
Integer; either 96 or 384 to denote microplate type. |
A vector containing well IDs.
file <- system.file( "extdata/input_files", file = "test.xlsx", package = "quicR" ) get_sample_locations(file)
file <- system.file( "extdata/input_files", file = "test.xlsx", package = "quicR" ) get_sample_locations(file)
Returns the well IDs used in the plate.
get_wells(file)
get_wells(file)
file |
Excel file exported from MARS |
A vector containing well IDs.
file <- system.file( "extdata/input_files", file = "test.xlsx", package = "quicR" ) get_wells(file)
file <- system.file( "extdata/input_files", file = "test.xlsx", package = "quicR" ) get_wells(file)
Normalizes the real-time RT-QuIC data against the background fluorescence of a defined cycle. All cycles are divided by the fluorescent value of the defined cycle.
normalize_RFU(data, bg_cycle = 4, transposed = FALSE)
normalize_RFU(data, bg_cycle = 4, transposed = FALSE)
data |
A dataframe generated from get_real. |
bg_cycle |
The cycle used for background fluorescence |
transposed |
Logical, TRUE if cycle values are shown as column names. |
A dataframe containing real-time normalized fluorescence values.
# This test takes >5 sec file <- system.file( "extdata/input_files", file = "test2.xlsx", package = "quicR" ) df_ <- get_real(file)[[1]] # Export the tables in the first sheet of the file. dic <- quicR::organize_tables(file) # Normalize the raw data against the background reading. normalize_RFU(df_)
# This test takes >5 sec file <- system.file( "extdata/input_files", file = "test2.xlsx", package = "quicR" ) df_ <- get_real(file)[[1]] # Export the tables in the first sheet of the file. dic <- quicR::organize_tables(file) # Normalize the raw data against the background reading. normalize_RFU(df_)
Extracts the tables from the microplate view sheet in the MARS Excel file and adds each table to a list.
organize_tables(file, plate = 96)
organize_tables(file, plate = 96)
file |
An Excel file exported from MARS. |
plate |
Integer either 96 or 384 to denote microplate type. |
A list containing tibbles.
file <- system.file( "extdata/input_files", file = "test.xlsx", package = "quicR" ) organize_tables(file)
file <- system.file( "extdata/input_files", file = "test.xlsx", package = "quicR" ) organize_tables(file)
Converts the real-time data into a ggplot figure. The layout is either 8x12 or 16x24 for 96- and 384-well plates, respectively.
plate_view(df, meta, plate = 96)
plate_view(df, meta, plate = 96)
df |
Real-time dataframe |
meta |
Dataframe containing well IDs and Sample IDs to title each facet. |
plate |
Integer either 96 or 384 to denote microplate type. |
A ggplot object
# This test takes >5 sec file <- system.file( "extdata/input_files", file = "test2.xlsx", package = "quicR" ) # Get the real-time data. df_ <- get_real(file, ordered = FALSE)[[1]] |> as.data.frame() sample_locations <- get_sample_locations( file, dilution_bool = TRUE, dilution_fun = function(x) -log10(x) ) plate_view(df_, sample_locations)
# This test takes >5 sec file <- system.file( "extdata/input_files", file = "test2.xlsx", package = "quicR" ) # Get the real-time data. df_ <- get_real(file, ordered = FALSE)[[1]] |> as.data.frame() sample_locations <- get_sample_locations( file, dilution_bool = TRUE, dilution_fun = function(x) -log10(x) ) plate_view(df_, sample_locations)
Generates a faceted figure of boxplots.
plot_metrics( data, sample_col = "Sample IDs", fill = "Dilutions", dilution_bool = TRUE, nrow = 2, ncol = 2 )
plot_metrics( data, sample_col = "Sample IDs", fill = "Dilutions", dilution_bool = TRUE, nrow = 2, ncol = 2 )
data |
A dataframe containing the calculated metrics from the "calculate" family of quicR functions. |
sample_col |
The name of the column containing the sample IDs. |
fill |
The column containing the fill aesthetic. Usually the dilutions column. |
dilution_bool |
Logical; should dilution factors be included in the plot? |
nrow |
Integer; number of rows to output in the plot. |
ncol |
Integer; number of columns to output in the plot. |
A ggplot object
file <- system.file( "extdata/input_files", file = "test4.xlsx", package = "quicR" ) data <- quicR::get_real(file)[[1]] |> quicR::normalize_RFU() meta <- quicR::organize_tables(file) |> quicR::convert_tables() calculate_metrics(data, meta) |> plot_metrics()
file <- system.file( "extdata/input_files", file = "test4.xlsx", package = "quicR" ) data <- quicR::get_real(file)[[1]] |> quicR::normalize_RFU() meta <- quicR::organize_tables(file) |> quicR::convert_tables() calculate_metrics(data, meta) |> plot_metrics()
If multiple real-time reads were exported from MARS, separate_raw will parse them out and separate them. It will also export to an Excel file with each real-time data having its own sheet.
separate_raw(file, num_rows, export_name)
separate_raw(file, num_rows, export_name)
file |
An Excel file exported from MARS. |
num_rows |
Number of rows in the header to ignore. |
export_name |
The name of the original file or an orignal name. |
An Excel file with separated raw real-time data.
Transposes the real-time data table exported by the BMG software. Accepts output from the function, "get_real".
transpose_real(data)
transpose_real(data)
data |
A dataframe generated from get_real. |
A transposed dataframe containing real-time normalized fluorescence values.