View source: R/11_rtCorrection.R
correct_database_rt | R Documentation |
This function corrects the retention time (RT) information in a spectral database using a reference table of internal standards from an experiment and a corresponding table from the database. The correction can be performed using different methods such as polynomial fitting or loess smoothing.
correct_database_rt(
experiment.is.table,
database.is.table,
database,
method = c("polyline", "loess"),
poly = c(1, 2, 3, 4, 5),
degree = c(1, 2),
path = "."
)
experiment.is.table |
A data frame containing the internal standards (IS) information from the experiment. It should include columns for retention time (RT) and other relevant information. |
database.is.table |
A data frame containing the internal standards (IS) information from the database. It should include retention time (RT) values corresponding to the database spectra. |
database |
A 'databaseClass' object that contains the database to be corrected. |
method |
A character string specifying the method for RT correction. Options are '"polyline"' for polynomial fitting or '"loess"' for loess smoothing. Defaults to '"polyline"'. |
poly |
A numeric vector specifying the polynomial degrees to use for the correction when 'method = "polyline"'. Defaults to 'c(1, 2, 3, 4, 5)'. |
degree |
A numeric vector specifying the degree for loess smoothing when 'method = "loess"'. Defaults to 'c(1, 2)'. |
path |
A character string specifying the directory to save intermediate files. Defaults to the current directory ('"."'). |
The function first writes a table of features from the database to a CSV file, which is used in the 'correct_rt' function to perform the retention time correction based on the provided internal standards tables. The corrected RT values are then updated in the 'databaseClass' object.
The 'method' parameter allows the user to choose between polynomial fitting ('"polyline"') and loess smoothing ('"loess"') for the RT correction. The 'poly' and 'degree' parameters specify the details of the polynomial or loess fitting, respectively.
Intermediate files generated during the process are saved in the directory specified by 'path', but are removed after use.
A 'databaseClass' object with corrected RT values.
Xiaotao Shen xiaotao.shen@outlook.com
## Not run:
# Correct RT in a database using polynomial fitting
corrected_db <- correct_database_rt(
experiment.is.table = experiment_table,
database.is.table = database_table,
database = db_object,
method = "polyline",
poly = 1:3,
degree = 2,
path = "output_directory"
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.