Title: | Creation, Reading and Validation of 'mzqc' Files |
---|---|
Description: | Reads, writes and validates 'mzQC' files. The 'mzQC' format is a standardized file format for the exchange, transmission, and archiving of quality metrics derived from biological mass spectrometry data, as defined by the HUPO-PSI (Human Proteome Organisation - Proteomics Standards Initiative) Quality Control working group. See <https://hupo-psi.github.io/mzQC/> for details. |
Authors: | Chris Bielow [aut, cre] , David Jimenez-Morales [rev, ctb] |
Maintainer: | Chris Bielow <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.5.4 |
Built: | 2024-11-12 03:40:38 UTC |
Source: | https://github.com/ms-quality-hub/rmzqc |
Checks the value's class type, which should match at least of the types given in any_expected_class_types.
check_type(value, any_expected_class_types, expected_length = 0)
check_type(value, any_expected_class_types, expected_length = 0)
value |
A certain value (e.g. a single value, data.frame etc) |
any_expected_class_types |
A vector of valid class types, any of which the @p value should have |
expected_length |
The expected length of value (usually to check if its a single value); 0 (default) indicates that length can be ignored |
check_type(1, "numeric", 1) # TRUE check_type("1", "numeric", 1) # FALSE check_type(1, "numeric", 2) # FALSE check_type("ABC", "character", 1) # TRUE check_type("ABC", "character") # TRUE check_type("ABC", "character", 2) # FALSE check_type(c("ABC", "DEF"), "character", 2) # TRUE check_type(1.1, c("numeric", "double")) # TRUE check_type(1.1, c("numeric", "double"), 1) # TRUE check_type(matrix(1:9, nrow=3), "matrix") # TRUE check_type(data.frame(a=1:3, b=4:6), c("something", "data.frame")) # TRUE
check_type(1, "numeric", 1) # TRUE check_type("1", "numeric", 1) # FALSE check_type(1, "numeric", 2) # FALSE check_type("ABC", "character", 1) # TRUE check_type("ABC", "character") # TRUE check_type("ABC", "character", 2) # FALSE check_type(c("ABC", "DEF"), "character", 2) # TRUE check_type(1.1, c("numeric", "double")) # TRUE check_type(1.1, c("numeric", "double"), 1) # TRUE check_type(matrix(1:9, nrow=3), "matrix") # TRUE check_type(data.frame(a=1:3, b=4:6), c("something", "data.frame")) # TRUE
Define a Singleton class which can hold a CV dictionary (so we do not have to load the .obo files over and over again)
Get the full data by calling the 'getData()' function (which returns a list containing a 'CV', 'URI' and 'version'),
or 'getCV()' which is a shorthand for 'getData()$CV'.
You can set your own custom CV by calling 'setData()'. By default, the latest release of the PSI-MS-CV (see getCVDictionary
).
Wherever you need this data, simply re-grab the singleton using 'CV_$new()' (or use the convenience function getCVSingleton() from outside the package)
R6P::Singleton
-> CV_
ensureHasData()
Make sure that the CV data is loaded
CV_$ensureHasData()
byID()
A function to retrieve a CV entry using its ID
CV_$byID(id)
id
A CV accession, e.g. 'MS:1000560'
setData()
Set a user-defined object (= a list of 'CV', 'URI' and 'version'), as obtained from getCVDictionary
CV_$setData(cv_data)
cv_data
The result of a call to getCVDictionary
getData()
Gets the underlying data (CV, URI and version)
CV_$getData()
getCV()
A shorthand for 'getData()$CV', i.e. the CV data.frame.
CV_$getCV()
clone()
The objects of this class are cloneable with this method.
CV_$clone(deep = FALSE)
deep
Whether to make a deep clone.
## Not run: cv_dict = CV_$new() ## uses 'getCVDictionary()' to populate the singleton cv_2 = CV_$new() ## uses the same data without parsing again cv_2$setData(getCVDictionary("custom", "https://my.com/custom.obo")) ## End(Not run)
## Not run: cv_dict = CV_$new() ## uses 'getCVDictionary()' to populate the singleton cv_2 = CV_$new() ## uses the same data without parsing again cv_2$setData(getCVDictionary("custom", "https://my.com/custom.obo")) ## End(Not run)
The following mapping is currently known: .raw : MS:1000563 ! Thermo RAW format .mzML : MS:1000584 ! mzML format .mzData : MS:1000564 ! PSI mzData format .wiff : MS:1000562 ! ABI WIFF format .pkl : MS:1000565 ! Micromass PKL format .mzXML : MS:1000566 ! ISB mzXML format .yep : MS:1000567 ! Bruker/Agilent YEP format .dta : MS:1000613 ! Sequest DTA format .mzMLb : MS:1002838 ! mzMLb format
filenameToCV(filepath)
filenameToCV(filepath)
filepath |
A filename (with optional path) |
Falls back to 'MS:1000560 ! mass spectrometer file format' if no match could be found.
Upper/lowercase is ignored, i.e. "mzML == mzml".
A CV term accession as string, e.g. 'MS:1000584'
filenameToCV("test.mZmL") # MS:1000584 filenameToCV("test.raw") # MS:1000563 filenameToCV(c("test.raw", "bla.mzML"))
filenameToCV("test.mZmL") # MS:1000584 filenameToCV("test.raw") # MS:1000563 filenameToCV(c("test.raw", "bla.mzML"))
Allow conversion of plain named lists of R objects (from jSON) to mzQC objects
fromDatatoMzQC(mzqc_class, data)
fromDatatoMzQC(mzqc_class, data)
mzqc_class |
Prototype of the class to convert 'data' into |
data |
A list of: A datastructure of R lists/arrays as obtained by 'jsonlite::fromJSON()' |
data = rmzqc::MzQCcvParameter$new("acc", "myName", "value") data_recovered = rmzqc::fromDatatoMzQC(rmzqc::MzQCcvParameter, list(jsonlite::fromJSON(jsonlite::toJSON(data))))
data = rmzqc::MzQCcvParameter$new("acc", "myName", "value") data_recovered = rmzqc::fromDatatoMzQC(rmzqc::MzQCcvParameter, list(jsonlite::fromJSON(jsonlite::toJSON(data))))
If you have a list of elements, call fromDatatoMzQC.
fromDatatoMzQCobj(mzqc_class, data)
fromDatatoMzQCobj(mzqc_class, data)
mzqc_class |
Prototype of the class to convert 'data' into |
data |
A datastructure of R lists/arrays as obtained by 'jsonlite::fromJSON()' |
data = MzQCcvParameter$new("acc", "myName", "value") data_recovered = fromDatatoMzQCobj(MzQCcvParameter, jsonlite::fromJSON(jsonlite::toJSON(data))) data_recovered
data = MzQCcvParameter$new("acc", "myName", "value") data_recovered = fromDatatoMzQCobj(MzQCcvParameter, jsonlite::fromJSON(jsonlite::toJSON(data))) data_recovered
If use_local_fallback
is TRUE, this function will never fail. Otherwise, it may fail if the internet connection
is flawed or internal URLs related to GitHubs API become stale.
getCVDictionary( source = c("latest", "local", "custom"), custom_uri = NULL, use_local_fallback = TRUE )
getCVDictionary( source = c("latest", "local", "custom"), custom_uri = NULL, use_local_fallback = TRUE )
source |
Where to get the PSI-MS CV from: - 'latest' will download 'psi-ms.obo' from https://api.github.com/repos/HUPO-PSI/psi-ms-CV/releases/latest - 'local' will use rmzqc/cv/psi-ms.obo' (which might be outdated, if you need the latest terms) - 'custom' uses a user-defined URI in 'custom_uri' |
custom_uri |
Used when 'source' is set to 'custom'. The URI can be local or remote, e.g. 'c:/obo/my.obo' or 'https://www.abc.com/my.obo' |
use_local_fallback |
When downloading a file from a URI fails, should we fall back to the local psi-ms.obo shipped with rmzqc? |
A 'pato.obo', and 'uo.obo' from the 'rmzqc/cv/' folder are automatically merged into the result.
See CV_ class to use this function efficiently.
A list with 'CV', 'URI' and 'version', where 'CV' is a data.frame with columns 'id', 'name', 'def', 'parents', 'children' (and many more) which contains the CV entries
MzQCcontrolledVocabulary
for the currently used CV (see getCVSingleton
)
using getCVSingleton()$getData()$URI
and $version
.Returns an MzQCcontrolledVocabulary
for the currently used CV (see getCVSingleton
)
using getCVSingleton()$getData()$URI
and $version
.
getCVInfo()
getCVInfo()
CV_
.Returns the CV singleton. See CV_
.
getCVSingleton()
getCVSingleton()
Fills a MzQCcvParameter object with id(accession) and name. The value (if any) needs to be set afterwards.
getCVTemplate(accession, CV = getCVSingleton())
getCVTemplate(accession, CV = getCVSingleton())
accession |
The ID (=accession) of the term in the CV |
CV |
A CV dictionary, as obtained by getCVDictionary(); defaults to the global singleton, which is populated automatically |
An instance of MzQCcvParameter
getCVSingleton
)Returns an MzQCcontrolledVocabulary for the currently used CV (see getCVSingleton
)
getDefaultCV()
getDefaultCV()
This function will be deprecated soon. Use getCVInfo
instead.
This may fail (e.g. if no internet connection is available, or URLs became invalid) then 'NULL' will be returned instead of an URL. A warning may be emitted, if the URL is out of date (i.e. the GitHub API changed).
getLatest_PSICV_URL()
getLatest_PSICV_URL()
Obtains the 'data-version' from a local (i.e. non-url) PSI-MS-CV
getLocal_CV_Version(local_PSIMS_obo_file)
getLocal_CV_Version(local_PSIMS_obo_file)
local_PSIMS_obo_file |
A path to a local file, e.g. 'c:/temp/my.obo' |
getLocal_CV_Version(system.file("./cv/psi-ms.obo", package="rmzqc")) # "4.1.95"
getLocal_CV_Version(system.file("./cv/psi-ms.obo", package="rmzqc")) # "4.1.95"
Fills a MzQCqualityMetric object with id(accession) and name. The value (if any) and unit (if any) need to be set afterwards.
getQualityMetricTemplate(accession, CV = getCVSingleton())
getQualityMetricTemplate(accession, CV = getCVSingleton())
accession |
The ID (=accession) of the term in the CV |
CV |
A CV dictionary, as obtained by getCVDictionary(); defaults to the global singleton, which is populated automatically |
An instance of MzQCqualityMetric
Get a syntax validator for mzQC
getSyntaxValidator()
getSyntaxValidator()
Checks if filepath ends in suffix (ignoring lower/upper case differences). If suffix does not start with a '.' it is prepended automatically.
hasFileSuffix(filepath, suffix)
hasFileSuffix(filepath, suffix)
filepath |
A relative or absolute path to a file, whose suffix is checked |
suffix |
This is the suffix we expect (the '.' is prepended internally if missing) |
TRUE if yes, FALSE otherwise
hasFileSuffix("bla.txt", "txt") # TRUE hasFileSuffix("bla.txt", ".txt") # TRUE hasFileSuffix("bla.txt", ".TXT") # TRUE hasFileSuffix("foo", "") # TRUE hasFileSuffix("", "") # TRUE hasFileSuffix("bla.txt", "doc") # FALSE hasFileSuffix("bla.txt", ".doc") # FALSE hasFileSuffix("fo", ".doc") # FALSE hasFileSuffix("", ".doc") # FALSE
hasFileSuffix("bla.txt", "txt") # TRUE hasFileSuffix("bla.txt", ".txt") # TRUE hasFileSuffix("bla.txt", ".TXT") # TRUE hasFileSuffix("foo", "") # TRUE hasFileSuffix("", "") # TRUE hasFileSuffix("bla.txt", "doc") # FALSE hasFileSuffix("bla.txt", ".doc") # FALSE hasFileSuffix("fo", ".doc") # FALSE hasFileSuffix("", ".doc") # FALSE
You can pass multiple strings, which are all checked. If any of them is undefined, the function returns TRUE
isUndefined(s, ..., verbose = TRUE)
isUndefined(s, ..., verbose = TRUE)
s |
A string to be checked for NA/NULL |
... |
More strings to be checked |
verbose |
If TRUE and 's' is NULL/NA, will print the name of the variable which was passed in |
isUndefined(NA) ## TRUE isUndefined(NULL) ## TRUE isUndefined(NA, NULL) ## TRUE isUndefined("") ## FALSE isUndefined("", NA) ## TRUE isUndefined(NA, "") ## TRUE isUndefined(1) ## FALSE myVar = NA isUndefined(myVar) ## TRUE, with warning "Variable 'myVar' is NA/NULL!"
isUndefined(NA) ## TRUE isUndefined(NULL) ## TRUE isUndefined(NA, NULL) ## TRUE isUndefined("") ## FALSE isUndefined("", NA) ## TRUE isUndefined(NA, "") ## TRUE isUndefined(1) ## FALSE myVar = NA isUndefined(myVar) ## TRUE, with warning "Variable 'myVar' is NA/NULL!"
Note: Returns TRUE for empty lists!
isValidMzQC(x, ...)
isValidMzQC(x, ...)
x |
An mzQC refclass (or list of them), each will be subjected to |
... |
Ellipsis, for recursive argument splitting |
You can pass multiple arguments, which are all checked individually. All of them need to be valid, for TRUE to be returned. The reason for combining both list support for arguments and ellipsis (...) into this function is that JSON arrays are represented as lists and you can simply pass them as a single argument (without the need for do.call()) and get the indices of invalid objects (if any). The ellipsis is useful to avoid clutter, i.e. if (!isValidMzQC(a) || !isValidMzQC(b)) doStuff() is harder to read than if (!isValidMzQC(a,b)) doStuff()
isValidMzQC(MzQCcvParameter$new("MS:4000059")) # FALSE isValidMzQC(MzQCcvParameter$new("MS:4000059", "Number of MS1 spectra")) # TRUE isValidMzQC(list(MzQCcvParameter$new("MS:4000059"))) # FALSE isValidMzQC(list(MzQCcvParameter$new("MS:4000059", "Number of MS1 spectra"))) # TRUE isValidMzQC(list(MzQCcvParameter$new("MS:4000059", "Number of MS1 spectra")), MzQCcvParameter$new()) # FALSE
isValidMzQC(MzQCcvParameter$new("MS:4000059")) # FALSE isValidMzQC(MzQCcvParameter$new("MS:4000059", "Number of MS1 spectra")) # TRUE isValidMzQC(list(MzQCcvParameter$new("MS:4000059"))) # FALSE isValidMzQC(list(MzQCcvParameter$new("MS:4000059", "Number of MS1 spectra"))) # TRUE isValidMzQC(list(MzQCcvParameter$new("MS:4000059", "Number of MS1 spectra")), MzQCcvParameter$new()) # FALSE
Relative filenames are made absolute. Backslashes as path separators are replaced by forward slashes (as commonly seen on Windows).
localFileToURI(local_filename, must_exist = TRUE)
localFileToURI(local_filename, must_exist = TRUE)
local_filename |
Path to a file (can be relative to current getwd(); or absolute) |
must_exist |
Require the file to exist |
A URI starting with "file:///" followed by an absolute path
Details of the software used to create the QC metrics
accession
Accession number identifying the term within its controlled vocabulary.
name
Name of the controlled vocabulary term describing the software tool.
version
Version number of the software tool.
uri
Publicly accessible URI of the software tool or documentation.
description
(optional) Definition of the controlled vocabulary term.
value
(optional) Name of the software tool.
Base class of runQuality/setQuality
metadata
The metadata for this run/setQuality
qualityMetrics
Array of MzQCqualityMetric objects
A controlled vocabulary document, usually pointing to an .obo file
name
Full name of the controlled vocabulary.
uri
Publicly accessible URI of the controlled vocabulary.
version
(optional) Version of the controlled vocabulary.
MzQCcontrolledVocabulary$new( "Proteomics Standards Initiative Quality Control Ontology", "https://github.com/HUPO-PSI/psi-ms-CV/releases/download/v4.1.129/psi-ms.obo", "4.1.129")
MzQCcontrolledVocabulary$new( "Proteomics Standards Initiative Quality Control Ontology", "https://github.com/HUPO-PSI/psi-ms-CV/releases/download/v4.1.129/psi-ms.obo", "4.1.129")
A controlled vocabulary parameter, as detailed in the OBO file
accession
Accession number identifying the term within its controlled vocabulary.
name
Name of the controlled vocabulary term describing the parameter.
value
(optional) Value of the parameter.
description
(optional) Definition of the controlled vocabulary term.
MzQCcvParameter$new("MS:4000070", "retention time acquisition range", c(0.2959, 5969.8172)) isValidMzQC(MzQCcvParameter$new("MS:0000000"))
MzQCcvParameter$new("MS:4000070", "retention time acquisition range", c(0.2959, 5969.8172)) isValidMzQC(MzQCcvParameter$new("MS:0000000"))
The format is "%Y-%m-%dT%H:%M:%S".
datetime
A correctly formatted date time (use as read-only)
dt1 = MzQCDateTime$new("1900-01-01") ## yields "1900-01-01T00:00:00" dt2 = MzQCDateTime$new(Sys.time()) ## test faulty input ## errors with 'character string is not in a standard unambiguous format' try(MzQCDateTime$new('lala'), silent=TRUE) ## test roundtrip conversion from/to JSON dt2$fromData(jsonlite::fromJSON(jsonlite::toJSON(dt1)))
dt1 = MzQCDateTime$new("1900-01-01") ## yields "1900-01-01T00:00:00" dt2 = MzQCDateTime$new(Sys.time()) ## test faulty input ## errors with 'character string is not in a standard unambiguous format' try(MzQCDateTime$new('lala'), silent=TRUE) ## test roundtrip conversion from/to JSON dt2$fromData(jsonlite::fromJSON(jsonlite::toJSON(dt1)))
An inputfile within metadata for a run/setQuality
name
The name MUST uniquely match to a location (specified below) listed in the mzQC file.
location
Unique file location, REQUIRED to be specified as a URI. The file URI is RECOMMENDED to be publicly accessible.
fileFormat
An MzQCcvParameter with 'accession' and 'name'.
fileProperties
An array of MzQCcvParameter, usually with 'accession', 'name' and 'value'. Recommended are at least two entries: a) Completion time of the input file (MS:1000747) and b) Checksum of the input file (any child of: MS:1000561 ! data file checksum type).
The metadata for a run/setQuality
label
Unique name for the run (for runQuality) or set (for setQuality).
inputFiles
Array/list of MzQCinputFile objects
analysisSoftware
Array/list of MzQCanalysisSoftware objects
cvParameters
(optional) Array of cvParameters objects
At least one of runQualities or setQualities MUST be present.
version
Version of the mzQC format.
creationDate
Creation date of the mzQC file.
contactName
Name of the operator/creator of this mzQC file.
contactAddress
Contact address (mail/e-mail or phone)
description
Description and comments about the mzQC file contents.
runQualities
Array of MzQCrunQuality;
setQualities
Array of MzQCsetQuality
controlledVocabularies
Array of CV domains used (obo files)
The central class to store QC information
accession
Accession number identifying the term within its controlled vocabulary.
name
Name of the controlled vocabulary element describing the metric.
description
(optional) Definition of the controlled vocabulary term.
value
(optional) Value of the metric (single value, n-tuple, table, matrix).
The structure is not checked by our mzQC implementation and must be handled by the caller, see toQCMetric
.
unit
(optional) Array of unit(s), stored as MzQcvParameter
The object is an alias for MzQCbaseQuality.
The object is an alias for MzQCbaseQuality.
This is useful for missing list elements (which returns NULL), but when the missing element in refClass should be NA_character_ (and NULL would return an error)
NULL_to_charNA(char_or_NULL)
NULL_to_charNA(char_or_NULL)
char_or_NULL |
A string or NULL |
NULL_to_charNA(NA) ## NA NULL_to_charNA(NULL) ## NA_character_ NULL_to_charNA("hi") ## "hi"
NULL_to_charNA(NA) ## NA NULL_to_charNA(NULL) ## NA_character_ NULL_to_charNA("hi") ## "hi"
This is useful for missing list elements (which returns NULL), but when the missing element in refClass should be NA (and NULL would return an error)
NULL_to_NA(var_or_NULL)
NULL_to_NA(var_or_NULL)
var_or_NULL |
A variable of any kind or NULL |
NULL_to_NA(NA) ## NA NULL_to_NA(NULL) ## NA NULL_to_NA("hi") ## "hi"
NULL_to_NA(NA) ## NA NULL_to_NA(NULL) ## NA NULL_to_NA("hi") ## "hi"
Get the information of each CV term from an obo file.
parseOBO(cv_obo_file)
parseOBO(cv_obo_file)
cv_obo_file |
A local path to an .obo file |
A data.frame containing CV term information
Read a JSON file in mzQC format into an MzQCmzQC root object
readMZQC(filepath)
readMZQC(filepath)
filepath |
A filename (with path) to read from. |
An MzQCmzQC root object from which all the data can be extracted/manipulated
Removes the last suffix (including the last dot) from a filename. If no dot exists, the full string is returned.
removeFileSuffix(filepath)
removeFileSuffix(filepath)
filepath |
A filename (with optional path – which is retained) |
The input with removed suffix
removeFileSuffix("test.tar.gz") # --> 'test.tar' removeFileSuffix("test.mzML") # --> 'test' removeFileSuffix("/path/to/test.mzML") # --> '/path/to/test' removeFileSuffix("test_no_dot") # --> 'test_no_dot'
removeFileSuffix("test.tar.gz") # --> 'test.tar' removeFileSuffix("test.mzML") # --> 'test' removeFileSuffix("/path/to/test.mzML") # --> '/path/to/test' removeFileSuffix("test_no_dot") # --> 'test_no_dot'
Remove a file, if it exists (useful for temporary files which may or may not have been created)
removeIfExists(tmp_filename)
removeIfExists(tmp_filename)
tmp_filename |
A path to a local file |
NULL if file is missing, otherwise TRUE/FALSE depening on successful removal
From an ID, e.g. "MS:1003162" (for PTX-QC), and some additional information, create an 'analysisSoftware' node for mzQC
toAnalysisSoftware(id, version = "unknown", uri = NULL, value = NA_character_)
toAnalysisSoftware(id, version = "unknown", uri = NULL, value = NA_character_)
id |
The CV accession |
version |
The version of the tool which created the metric/mzQC |
uri |
URI to the homepage, or if NULL (default), will be extracted from the definition in the PSI MS-CV (if possible) |
value |
An optional name for the software (if different from the CV's name) |
An MzQCanalysisSoftware object
# use 'version = packageVersion("PTXQC")' if the package is installed toAnalysisSoftware(id = "MS:1003162", version = "1.0.12")
# use 'version = packageVersion("PTXQC")' if the package is installed toAnalysisSoftware(id = "MS:1003162", version = "1.0.12")
Create an 'MzQCqualityMetric' object from two inputs
toQCMetric(id, value, on_violation = c("error", "warn"))
toQCMetric(id, value, on_violation = c("error", "warn"))
id |
The CV accession |
value |
The data, as computed by some QC software in the required format. |
on_violation |
What to do when 'value' is not of the correct type (according to the given 'id')? Default: "error"; or "warn" |
The inputs are:
an ID of a QC metric, e.g. "MS:4000059" (number of MS1 spectra)
a value
The value must be in the correct format depending on the metric. The value type (see below) is checked (a warning/error is given if mismatching): The following requirements for values apply:
single value: R single value; the unit is obtained from the CVs 'has_units'
n-tuple: an R vector, e.g. using c(1,2,3), i.e. all values have the same type; the unit is obtained from the CVs 'has_units'
table: an R data.frame(); all columns defined using CVs 'has_column' must be present (a warning/error is given otherwise)
matrix: an R matrix, i.e. all values have the same type; the unit is obtained from the CVs 'has_units'
Upon violation, an error (default) or a warning is emitted:
toQCMetric(id = "MS:4000059", value = data.frame(n = 1)) # errors: wrong value format
An MzQCanalysisSoftware object
toQCMetric(id = "MS:4000059", value = 13405) # number of MS1 spectra
toQCMetric(id = "MS:4000059", value = 13405) # number of MS1 spectra
The returned TRUE/FALSE has additional attributes in case of errors. Use attributes(result) to access them.
validateFromFile(filepath, verbose = TRUE)
validateFromFile(filepath, verbose = TRUE)
filepath |
A path to a file (e.g. "c:/my.mzQC", or "test.mzQC") |
verbose |
Show extra information if validation fails |
TRUE/FALSE if validation was successful/failed
This method is less performant than validateFromString, because it needs to convert the R object to a JSON string first.
validateFromObj(mzqc_root, verbose = TRUE)
validateFromObj(mzqc_root, verbose = TRUE)
mzqc_root |
An mzQC root object |
verbose |
Show extra information if validation fails |
The returned TRUE/FALSE has additional attributes in case of errors. Use attributes(result) to access them.
TRUE/FALSE if validation was successful/failed
If the string object passed into this function contains multiple elements (length > 1). then they will be concatenated using '\n' before validation.
validateFromString(JSON_string, verbose = TRUE)
validateFromString(JSON_string, verbose = TRUE)
JSON_string |
A string which contains JSON (multiple lines allowed) |
verbose |
Show extra information if validation fails |
The returned TRUE/FALSE has additional attributes in case of errors. Use attributes(result) to access them.
TRUE/FALSE if validation was successful/failed
You can in theory also provide any mzQC subelement, but the resulting mzQC file will not validate since its incomplete.
writeMZQC(filepath, mzqc_obj)
writeMZQC(filepath, mzqc_obj)
filepath |
A filename (with optional path) to write to. |
mzqc_obj |
An MzQCmzQC root object, which is serialized to JSON and then written to disk |
The filename should have '.mzQC' (case sensitive) as suffix. There will be a warning otherwise.