This function formats data describing mass spectrometry (MS) peak areas from samples collected as part of in vitro measurements of chemical fraction unbound in plasma using rapid equilibrium dialysis waters2008validationinvitroTKstats. The input data frame is organized into a standard set of columns and written to a tab-separated text file.
format_fup_red(
FILENAME = "MYDATA",
data.in,
sample.col = "Lab.Sample.Name",
date = NULL,
date.col = "Date",
compound.col = "Compound.Name",
dtxsid.col = "DTXSID",
lab.compound.col = "Lab.Compound.Name",
type.col = "Sample.Type",
cal = NULL,
cal.col = "Cal",
dilution = NULL,
dilution.col = "Dilution.Factor",
time = NULL,
time.col = "Time",
istd.col = "ISTD.Area",
istd.name = NULL,
istd.name.col = "ISTD.Name",
istd.conc = NULL,
istd.conc.col = "ISTD.Conc",
test.nominal.conc = NULL,
test.nominal.conc.col = "Test.Target.Conc",
plasma.percent = NULL,
plasma.percent.col = "Plasma.Percent",
test.conc = NULL,
test.conc.col = "Test.Compound.Conc",
area.col = "Area",
biological.replicates = NULL,
biological.replicates.col = "Biological.Replicates",
technical.replicates = NULL,
technical.replicates.col = "Technical.Replicates",
analysis.method = NULL,
analysis.method.col = "Analysis.Method",
analysis.instrument = NULL,
analysis.instrument.col = "Analysis.Instrument",
analysis.parameters = NULL,
analysis.parameters.col = "Analysis.Parameters",
note.col = "Note",
level0.file = NULL,
level0.file.col = "Level0.File",
level0.sheet = NULL,
level0.sheet.col = "Level0.Sheet",
output.res = FALSE,
save.bad.types = FALSE,
sig.figs = 5,
INPUT.DIR = NULL,
OUTPUT.DIR = NULL,
verbose = TRUE
)A level-1 data frame with a standardized format containing a standardized set of columns and column names with plasma protein binding (PPB) data from an rapid equilibrium dialysis (RED) assay.
(Character) A string used to identify the output level-1 file. "<FILENAME>-fup-RED-Level1.tsv", and/or used to identify the input level-0 file, "<FILENAME>-fup-RED-Level0.tsv" if importing from a .tsv file. (Defaults to "MYDATA".)
(Data Frame) A level-0 data frame containing mass-spectrometry peak areas, indication of chemical identity, and measurement type. The data frame should contain columns with names specified by the following arguments:
(Character) Column name of data.in containing the unique mass
spectrometry (MS) sample name used by the laboratory. (Defaults to
"Lab.Sample.Name".)
(Character) The laboratory measurement date, format "MMDDYY" where
"MM" = 2 digit month, "DD" = 2 digit day, and "YY" = 2 digit year. (Defaults to NULL.)
(Note: Single entry only, use only if all data were collected on the same date.)
(Character) Column name containing date information.
(Defaults to "Date".) (Note: data.in does not
necessarily have this field. If this field is missing, it can be auto-filled with the value
specified in date.)
(Character) Column name of data.in containing the test compound.
(Defaults to "Compound.Name".)
(Character) Column name of data.in containing EPA's DSSTox Structure
ID (http://comptox.epa.gov/dashboard). (Defaults to "DTXSID".)
(Character) Column name of data.in containing the test compound
name used by the laboratory. (Defaults to "Lab.Compound.Name".)
(Character) Column name of data.in containing the sample type (see table
under Details). (Defaults to "Sample.Type".)
(Character) MS calibration the samples were based on. Typically, this uses
indices or dates to represent if the analyses were done on different machines on
the same day or on different days with the same MS analyzer. (Defaults to NULL.)
(Note: Single entry only,
use only if all data were collected based on the same calibration.)
(Character) Column name containing cal
information. (Defaults to "Cal".) (Note: data.in does not
necessarily have this field. If this field is missing, it can be auto-filled with the value
specified in cal.)
(Numeric) Number of times the sample was diluted before MS
analysis. (Defaults to NULL.) (Note: Single entry only, use only if all
samples underwent the same number of dilutions.)
(Character) Column name containing dilution
information. (Defaults to "Dilution.Factor".) (Note: data.in does not
necessarily have this field. If this field is missing, it can be auto-filled with the value
specified in dilution.)
(Numeric) Incubation time (in hours) - from the start of incubation to
when the sample measurements were taken. (Defaults to NULL.) (Note: Single entry only, use only if all
samples were taken after the same amount of incubation time.)
(Character) Column name containing time information.
(Defaults to "Time".) (Note: data.in does not
necessarily have this field. If this field is missing, it can be auto-filled with the value
specified in time.)
(Character) Column name of data.in containing the
MS peak area for the internal standard. (Defaults to "ISTD.Area".)
(Character) The identity of the internal standard. (Defaults to NULL.)
(Note: Single entry only, use only if all tested compounds use the same internal standard.)
(Character) Column name containing istd.name information.
(Defaults to "ISTD.Name".) (Note: data.in does not
necessarily have this field. If this field is missing, it can be auto-filled with the value
specified in istd.name.)
(Numeric) The concentration for the internal standard. (Defaults to NULL.)
(Note: Single entry only, use only if all tested compounds have the same
internal standard concentration.)
(Character) Column name containing istd.conc information.
(Defaults to "ISTD.Conc".) (Note: data.in does not
necessarily have this field. If this field is missing, it can be auto-filled with the value
specified in istd.conc.)
(Numeric) The nominal concentration added to the RED assay
at time 0. (Defaults to NULL.) (Note: Single entry only, use only
if all tested compounds used the same concentration at time 0.)
(Character) Column name containing test.nominal.conc
information. (Defaults to "Test.Target.Conc".) (Note: data.in does not
necessarily have this field. If this field is missing, it can be auto-filled with the value
specified in test.nominal.conc.)
(Numeric) The percent of the physiological plasma concentration
used in RED assay. (Defaults to NULL.) (Note: Single entry only, use only
if all compounds were tested with the same plasma percent.)
(Character) Column name containing plasma.percent
information. (Defaults to "Plasma.Percent".) (Note: data.in does not
necessarily have this field. If this field is missing, it can be auto-filled with the value
specified in plasma.percent.)
(Numeric) The standard test chemical concentration for
the fup RED assay. (Defaults to NULL.) (Note: Single entry only,
use only if the same standard concentration was used for all tested compounds.)
(Character) Column name containing test.conc
information. (Defaults to "Test.Compound.Conc".) (Note: data.in does not
necessarily have this field. If this field is missing, it can be auto-filled with the value
specified in test.conc.)
(Character) Column name of data.in containing the target analyte (that
is, the test compound) MS peak area. (Defaults to "Area".)
(Character) Replicates with the same analyte. Typically, this uses
numbers or letters to index. (Defaults to NULL.) (Note: Single entry only,
use only if none of the test compounds have replicates.)
(Character) Column name of data.in containing the number or
the indices of replicates with the same analyte. (Defaults to "Biological.Replicates".)
(Note: data.in does not necessarily have this field. If this field is missing, it can be auto-filled with the value
specified in biological.replicates.)
(Character) Repeated measurements from one sample. Typically, this uses
numbers or letters to index. (Defaults to NULL.) (Note: Single entry only,
use only if none of the test compounds have replicates.)
(Character) Column name of data.in containing the number or
the indices of replicates taken from the one sample. (Defaults to "Technical.Replicates".)
(Note: data.in does not necessarily have this field. If this field is missing, it can be auto-filled with the value
specified in technical.replicates.)
(Character) The analytical chemistry analysis method,
typically "LCMS" or "GCMS", liquid chromatography or gas chromatography–mass spectrometry, respectively.
(Defaults to NULL.) (Note: Single entry only,
use only if the same method was used for all tested compounds.)
(Character) Column name containing analysis.method
information. (Defaults to "Analysis.Method".) (Note: data.in does not
necessarily have this field. If this field is missing, it can be auto-filled with the value
specified in analysis.method.)
(Character) The instrument used for chemical analysis,
for example "Waters ACQUITY I-Class UHPLC - Xevo TQ-S uTQMS". (Defaults to NULL.)
(Note: Single entry only, use only if the same instrument was used for all tested compounds.)
(Character) Column name containing analysis.instrument
information. (Defaults to "Analysis.Instrument".) (Note: data.in does not
necessarily have this field. If this field is missing, it can be auto-filled with the value
specified in analysis.instrument.)
(Character) The parameters used to identify the
compound on the chemical analysis instrument. (Defaults to NULL.)
(Note: Single entry only, use only if the same parameters were used for all tested compounds.)
(Character) Column name containing analysis.parameters
information. (Defaults to "Analysis.Parameters".) (Note: data.in does not
necessarily have this field. If this field is missing, it can be auto-filled with the value
specified in analysis.parameters.)
(Character) Column name of data.in containing additional notes on
test compounds. (Defaults to "Note".)
(Character) The level-0 file from which the data.in were obtained.
(Defaults to NULL.) (Note: Single entry only, use only if all rows in data.in
were obtained from the same level-0 file.)
(Character) Column name containing level0.file information.
(Defaults to "Level0.File".) (Note: data.in does not
necessarily have this field. If this field is missing, it can be auto-filled with the value
specified in level0.file.)
(Character) The specific sheet name of level-0 file from which the
data.in is obtained from, if the level-0 file is an Excel workbook.
(Defaults to NULL.) (Note: Single entry only, use only if all rows in data.in
were obtained from the same sheet in the same level-0 file.)
(Character) Column name containing level0.sheet information.
(Defaults to "Level0.Sheet".) (Note: data.in does not
necessarily have this field. If this field is missing, it can be auto-filled with the value
specified in level0.sheet.)
(Logical) When set to TRUE, the result
table (level-1) will be exported to the user's per-session temporary directory
or OUTPUT.DIR (if specified) as a .tsv file.
(Defaults to FALSE.)
(Logical) When set to TRUE, export data removed
due to inappropriate sample types. See the Detail section for the required sample types.
(Defaults to FALSE.)
(Numeric) The number of significant figures to round the exported result table (level-1).
(Defaults to 5.)
(Character) Path to the directory where the input level-0 file exists.
If NULL, looking for the input level-0 file in the current working
directory. (Defaults to NULL.)
(Character) Path to the directory to save the output file.
If NULL, the output file will be saved to the user's per-session temporary
directory or INPUT.DIR if specified. (Defaults to NULL.)
(logical) Indicate whether printed statements should be shown. (Default is TRUE.)
John Wambaugh
The data frame of observations should be annotated according to these types:
| No Plasma Blank (no chemical, no plasma) | NoPlasma.Blank | Plasma Blank (no chemical, just plasma) | Plasma.Blank | Plasma well concentration |
| Plasma | Phosphate-buffered well concentration | PBS | Time zero plasma concentration | T0 |
| Plasma stability sample | Stability | Acceptor compartment of the equilibrium evaluation | EC_acceptor | Donor compartment of the equilibrium evaluation (chemical spiked side) |
Chemical concentration is calculated qualitatively as a response and returned as a column in the output data frame:
Response <- AREA / ISTD.AREA * ISTD.CONC
If the output level-1 result table is chosen to be exported and an output
directory is not specified, it will be exported to the user's R session
temporary directory. This temporary directory is a per-session directory
whose path can be found with the following code: tempdir(). For more
details, see https://www.collinberke.com/blog/posts/2023-10-24-til-temp-directories/.
As a best practice, INPUT.DIR and/or OUTPUT.DIR should be
specified to simplify the process of importing and exporting files. This
practice ensures that the exported files can easily be found and will not be
exported to a temporary directory.
waters2008validationinvitroTKstats
## Load the example level-0 data
level0 <- invitroTKstats::fup_red_L0
## Run it through level-1 processing function
## This example shows the use of the data.in argument which allows users to pass
## in a data frame from the R session.
## If the input level-0 data exists in an external file such as a .tsv file,
## users may import it using FILENAME and INPUT.DIR to specify the file name
## and its directory path, respectively.
level1 <- format_fup_red(data.in = level0,
sample.col ="Sample",
date.col="Date",
compound.col="Compound",
lab.compound.col="Lab.Compound.ID",
type.col="Sample.Type",
dilution.col="Dilution.Factor",
technical.replicates.col ="Replicate",
biological.replicates = 1,
cal=1,
area.col = "Peak.Area",
istd.conc = 10/1000,
istd.col= "ISTD.Peak.Area",
test.conc.col = "Compound.Conc",
test.nominal.conc = 10,
plasma.percent = 100,
time.col = "Time",
analysis.method = "LCMS",
analysis.instrument = "Waters ACQUITY I-Class UHPLC - Xevo TQ-S uTQMS",
analysis.parameters = "RT",
note.col=NULL,
output.res = FALSE
)
Run the code above in your browser using DataLab