Learn R Programming

rmzqc

An R package for reading, validating, and writing mzQC files.

Installation

You can grab rmzqc from either CRAN or GitHub. GitHub installation will give you the latest package; the CRAN version might be a little older, but is faster to install.

## CRAN
install.packages("rmzqc")

or

## GitHub
if (!require(devtools, quietly = TRUE)) install.packages("devtools")
library("devtools")

install_github("MS-Quality-hub/rmzqc", build_vignettes = TRUE, dependencies = TRUE)

To get started, see the help and/or vignettes:

help(package="rmzqc")
browseVignettes(package = 'rmzqc')

Please feel free to report bugs (see below), or issue pull requests!

Latest changes / ChangeLog

Check the version history in NEWS.md.

Usage

The package vignettes provide examples on how to use rmzqc. After the package is installed (see below), you can browse the vignettes using either of these commands within R:

help(package="rmzqc")
browseVignettes(package = 'rmzqc')

If you do not want to wait that long, you can look at the latest online vignette at CRAN

Currently, there are vignettes on:

  • Creating and storing a basic mzQC document using rmzqc

(more to come)

Bug reporting / Feature requests

If you encounter a bug, please use the GitHub issue tracker and file a report.

You should include

  • stage you encounter the bug, e.g. during installation, importing, exporting, etc
  • version of rmzqc, e.g. call help(package="rmzqc") within R
  • error message (very important!). Either copy it or provide a screen shot.

Please be as precise as possible when providing the bug report: just imagine what kind of information you would like to have in order to track down the issue. In certain situations, the input/output file you are trying to read/write is helpful.

Contributing - Get Involved!

We welcome input from our user base! rmzqc has a very permissive MIT License (see DESCRIPTION file), so feel free to fork, patch and contribute!

There are many ways to get involved, you do not need to be a developer!

  • suggest a new metric (and why you think it's useful) by opening a new ticket here on GitHub.
  • suggest changes to functions (improvements or bugfixes), see above.
  • suggest improvements to our documentation
  • write code (in R) and submit a Pull Request (PR).

Building the package locally

Use roxygen2 to build the vignettes and documentation:

roxygen2::roxygenize('.', roclets = c('rd', 'collate', 'namespace'))

Use pkgdown to build the html documentation in ./docs/:

pkgdown::buildsite()

Links

See https://github.com/HUPO-PSI/mzQC/ for the specification details of the mzQC format.

Copy Link

Version

Install

install.packages('rmzqc')

Monthly Downloads

404

Version

0.7.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Chris Bielow

Last Published

July 16th, 2025

Functions in rmzqc (0.7.0)

NULL_to_charNA

Converts a NULL to NA_character_; or returns the argument unchanged otherwise
MzQCsetQuality

A setQuality object. Use it for metrics which are specific to sets, i.e. only for values which only make sense in the set context and cannot be stored as runQuality (see mzQC spec doc).
checkUnexpectedFields

Check for unexpected fields in data and warn if any are found
MzQCqualityMetric

The central class to store QC information
MzQCrunQuality

A runQuality object. Use to report metrics for individual runs which are independent of other runs.
MzQCanalysisSoftware

Details of the software used to create the QC metrics
NULL_to_NA

Converts a NULL to NA; or returns the argument unchanged otherwise
fromDatatoMzQCobj

Allow conversion of a plain R object (obtained from jSON) to an mzQC object
getCVDictionary

Fetch and parse the 'psi-ms.obo' and some metadata from the usual sources to use as ontology.
getOptionalValue

Get an optional value from data, using a default if not present
getQualityMetricTemplate

Fills a MzQCqualityMetric object with id(accession) and name. The value (if any) and unit (if any) need to be set afterwards.
getCVInfo

Returns an MzQCcontrolledVocabulary for the currently used CV (see getCVSingleton) using getCVSingleton()$getData()$URI and $version.
getCVSingleton

Returns the CV singleton. See CV_.
removeIfExists

Remove a file, if it exists (useful for temporary files which may or may not have been created)
removeFileSuffix

Removes the last suffix (including the last dot) from a filename. If no dot exists, the full string is returned.
check_type

Checks the value's class type, which should match at least of the types given in any_expected_class_types.
getCVTemplate

Fills a MzQCcvParameter object with id(accession) and name. The value (if any) needs to be set afterwards.
check_field_exists

Check if a field exists in data and warn if it doesn't, then return the field value
getDefaultCV

Returns an MzQCcontrolledVocabulary for the currently used CV (see getCVSingleton)
readMZQC

Read a JSON file in mzQC format into an MzQCmzQC root object
readMZQCFromJSON

Read a JSON object in mzQC format into an MzQCmzQC root object
rmzqc-package

rmzqc: Creation, Reading and Validation of 'mzqc' Files
localFileToURI

Convert a local filename, e.g. "./myData/test.mzML" to a proper URI (e.g. "file:///user/bielow/myData/test.mzML")
parseOBO

Get the information of each CV term from an obo file.
toAnalysisSoftware

From an ID, e.g. "MS:1003162" (for PTX-QC), and some additional information, create an 'analysisSoftware' node for mzQC
getSyntaxValidator

Get a syntax validator for mzQC
hasFileSuffix

Checks if filepath ends in suffix (ignoring lower/upper case differences). If suffix does not start with a '.' it is prepended automatically.
writeMZQC

Writes a full mzQC object to disk.
toQCMetric

Create an 'MzQCqualityMetric' object from two inputs (id and value).
validateFromFile

Syntactically validates an mzQC document which is present as a file.
getLatest_PSICV_URL

Get the latest PSI-MS CV release URL
isUndefined

Tell if a variable's value is undefined (NA or NULL); If yes, and it is required by the mzQC standard, we can raise an error.
filenameToCV

For a given filename (e.g. "test.mzML"), check the suffix and translate it to an PSI-MS CV term, e.g. 'MS:1000584'
getLocal_CV_Version

Obtains the 'data-version' from a local (i.e. non-url) PSI-MS-CV
fromDatatoMzQC

Allow conversion of plain named lists of R objects (from jSON) to mzQC objects
isValidMzQC

Checks validity (= completeness) of mzQC objects - or lists (JSON arrays) thereof
validateFromObj

Syntactically validates an mzQC document which is already in memory as mzQC root object, as obtained by, e.g. readMZQC().
validateFromString

Syntactically validates an mzQC document which is already in memory as JSON string. e.g. the string "{ mzQC : {}}"
CV_

CV_
MzQCcvParameter

A controlled vocabulary parameter, as detailed in the OBO file
MzQCinputFile

An inputfile within metadata for a run/setQuality
MzQCDateTime

An mzQC-formatted date+time in ISO8601 format, as required by the mzQC spec doc.
MzQCmetadata

The metadata for a run/setQuality
MzQCbaseQuality

Base class of runQuality/setQuality
MzQCbaseQuality_getMetric

Extract a certain metric from a runQuality's list of MzQCqualityMetric
MzQCcontrolledVocabulary

A controlled vocabulary document, usually pointing to an .obo file
MzQCmzQC

Root element of an mzQC document