getMBRecordInfo: Summarize MassBank Entries in Directory of MassBank Records

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/MassBankRecordeR.R

Description

This function returns a summary csv containing the entries in all MassBank records in the given directory matching the list of field_codes. Uses getMBRecordEntry.

Usage

1
getMBRecordInfo(directory, csv_name, field_codes="default", colNames="default",recursive=TRUE)

Arguments

directory

The path to the directory to summarize. Subdirectories are also searched if recursive is TRUE.

csv_name

Name (with/without path) of the csv file to save the results.

field_codes

A vector containing strings to match in the MassBank records. Setting "default" will output default values, see Details.

colNames

A vector containing column names to match field_codes. These must be in the same order. If "default", trimmed versions of the default field_codes are used. If "field_codes", then the entries in field_codes are used.

recursive

If TRUE, subdirectories are included, if FALSE, only given directory is included.

pattern

The pattern to search for file names. Typically *.txt but can be adjusted.

Details

Use getMBRecordPeaks, getMBRecordPeakAnnotations and/or getMBPeaksAnnos to retrieve peaks and peak annotations. This function uses getMBRecordEntry to retrieve individual entries from records. If NULL, then NA is printed to the csv. If multiple entries match (e.g. for CH$NAME), then one entry in the csv is made, separated with a pipe (|). This function will exit with an error if the length of field_codes and colNames do not match. The default settings are: field_codes <- c("ACCESSION", "CH$NAME", "CH$SMILES", "CH$EXACT_MASS", "CH$FORMULA", "CH$IUPAC", "CH$LINK: CAS", "CH$LINK: PUBCHEM CID", "CH$LINK: INCHIKEY", "CH$LINK: CHEMSPIDER", "AC$MASS_SPECTROMETRY: COLLISION_ENERGY", "AC$MASS_SPECTROMETRY: FRAGMENTATION_MODE", "AC$CHROMATOGRAPHY: COLUMN_NAME", "AC$CHROMATOGRAPHY: RETENTION_TIME", "MS$FOCUSED_ION: PRECURSOR_M/Z", "MS$FOCUSED_ION: PRECURSOR_TYPE") colNames <- c("ACCESSION", "NAME", "SMILES", "NEUTRAL_EXACT_MASS", "FORMULA", "StdInChI", "CAS_RN", "PUBCHEM_CID", "InChIKey", "CHEMSPIDER_ID", "COLLISION_ENERGY", "FRAGMENTATION_MODE", "COLUMN_NAME", "RETENTION_TIME", "PRECURSOR_MZ", "PRECURSOR_TYPE")

Value

Saves the results in csvfile, or error.

Author(s)

Emma Schymanski <emma.schymanski@uni.lu>, rewritten from getInfo script from Erik Mueller.

See Also

MBFileToVector, getMBRecordEntry, getMBPeaksAnnos.

Examples

1
2
3
4
directory <- system.file("extdata", "recdata", package = "ReSOLUTION")
# note this overwrites any file of the same name ...
csv_name <- paste0(getwd(),"/test.csv")
getMBRecordInfo(directory, csv_name, field_codes="default", colNames="default",recursive=TRUE)

schymane/ReSOLUTION documentation built on May 22, 2021, 3:41 a.m.