MiDAR
is an R package to reproducibly manage,
post-process, visualize, apply quality control, and analyze
small-molecule mass spectrometry (MS) datasets, e.g. from targeted
lipidomics and metabolomics experiments.
MiDAR
is tailored to handle different analytical
designs, data types and data processing strategies. As such, this
package provides functions to import data files from from different
commercial and open-source tools. Data processing functions include,
internal standard and sample amount-based normalization, quantification,
as well as drift and batch corrections. Quality control (QC) functions
provide QC metrics and plots of raw and processed data, and QC-based
feature filtering.
Datasets and processing steps are tracked, and can be saved as
MiDAR
S4 class object (RDS) files, Excel, PowerPoint and
interactive HTML-based reports, enabling sharing and reporting of all
data, metadata and applied data processing steps.
Example Workflow
Below is example of a simple data processing workflow, starting with a MassHunter CSV file, metadata in an Excel template
library(midar)
#> Loading required package: ggplot2
#> Registered S3 method overwritten by 'ggpmisc':
#> method from
#> as.character.polynomial polynom
# Get paths of example files included with this package
masshunter_file <- system.file("extdata", "Example_MHQuant_1.csv", package = "midar", mustWork = TRUE)
metadata_file <- system.file("extdata", "Example_Metadata_1.xlsm", package = "midar", mustWork = TRUE)
# Create a MidarExperiment object (S4)
mexp <- MidarExperiment()
# Load data and metadata
mexp <- read_masshunter_csv(data = mexp, file_dir_names = masshunter_file)
#> Reading [Example_MHQuant_1.csv] ...
#> ✓ Imported 215 samples with 428 transitions.
mexp <- read_msorganizer_xlm(data = mexp, filename = metadata_file)
#> ✓ Metadata successfully associated with 215 samples and 428 features.
# Normalize and quantitate each feature by internal standards
mexp <- normalize_by_istd(mexp)
#> ✓ 428 features normalized with 15 ISTDs.
mexp <- quantitate_by_istd(mexp)
#> ✓ 428 features quantitated in 215 samples using 15 spiked-in ISTDs and sample amounts.
#> Concentration unit: [μmol/L].
# Get QC metrics for each feature
mexp <- calculate_qc_metrics(mexp)
# Filter features according to QC criteria
mexp <- apply_qc_filter(data = mexp,
CV_BQC_max = 30,
Intensity_BQC_min = 100,
SB_RATIO_min = 5,
R2_min = 0.8,
RQC_CURVE = 1)
#> ✓ QC filtering applied: 170 of 413 valid features passed QC criteria
#Plot the intensities (peak areas) of the internal standards
plot_runscatter(data = mexp,
y_var = "Intensity",
feature_filter = "ISTD",
show_driftcorrection = FALSE,
QC_TYPE_fit = "BQC",
show_batches = TRUE,
cap_values = TRUE, cols_page = 4, rows_page = 4,point_size = 1.5,
outputPDF = FALSE, filename = "RunScatter_Areas_ISTD.pdf", return_plot_list = FALSE)
#> [1] "Plotting 1 pages..."
#> [1] "page 1"
Contributor Code of Conduct
Please note that the midar project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.