Skip to contents

Imports .csv files exported from Agilent MassHunter Quantitative Analysis software, containing peak integration results. The input files must have anlyses (samples) in rows, features/compounds in columns, and either peak areas, peak heights, or response as the values. Additional columns, such as retention time (RT), full-width at half-maximum (FWHM), precursor m/z (PrecursorMZ), and collision energy (CE), will also be imported and made available in the MidarExperiment object for downstream analyses.

When a directory path is provided, all matching .csv files in that directory will be imported and merged into a single dataset. This is useful when importing datasets that were pre-processed in blocks, resulting in multiple files. Each unique combination of feature and raw data file must only occur once across all source data files. Duplicate combinations will result in an error.

Usage

import_data_masshunter(
  data = NULL,
  path,
  import_metadata,
  expand_qualifier_names = TRUE,
  silent = FALSE
)

Arguments

data

MidarExperiment object

path

One or more file paths, or a directory path (in which case all matching files will be imported)

import_metadata

Logical, whether to extract and add metadata from the analysis result file

expand_qualifier_names

Logical, whether to add the quantifier name in front of the qualifier name (the latter only has the m/z transition values)

silent

Logical, whether to suppress most notifications

Value

MidarExperiment object with the imported data

Examples

mexp <- MidarExperiment()
file_path = system.file("extdata", "MHQuant_demo.csv", package = "midar")

mexp <- import_data_masshunter(
  data = mexp,
  path = file_path,
  import_metadata = TRUE,
  expand_qualifier_names = TRUE)
#>  Imported 38 analyses with 31 features
#>  `feature_area` selected as default feature intensity. Modify with `set_intensity_var()`.
#>  Analysis metadata associated with 38 analyses.
#>  Feature metadata associated with 31 features.

print(mexp)
#> 
#> ── MidarExperiment ─────────────────────────────────────────────────────────────
#> Title:
#> 
#> Processing status: Annotated raw AREA values
#> 
#> ── Annotated Raw Data ──
#> 
#> • Analyses: 38
#> • Features: 31
#> • Raw signal used for processing: `feature_area`
#> 
#> ── Metadata ──
#> 
#> • Analyses/samples: 
#> • Features/analytes: 
#> • Internal standards: 
#> • Response curves: 
#> • Calibrants/QC concentrations: 
#> • Study samples: 
#> 
#> ── Processing Status ──
#> 
#> • Isotope corrected: 
#> • ISTD normalized: 
#> • ISTD quantitated: 
#> • Drift corrected variables: 
#> • Batch corrected variables: 
#> • Feature filtering applied: 
#> 
#> ── Exclusion of Analyses and Features ──
#> 
#> • Analyses manually excluded (`analysis_id`): NA