Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/MassBankRecordeR.R
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
.
1 | getMBRecordInfo(directory, csv_name, field_codes="default", colNames="default",recursive=TRUE)
|
directory |
The path to the directory to summarize. Subdirectories are also searched if
|
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
|
colNames |
A vector containing column names to match |
recursive |
If |
pattern |
The pattern to search for file names. Typically |
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")
Saves the results in csvfile
, or error
.
Emma Schymanski <emma.schymanski@uni.lu>, rewritten from getInfo script from Erik Mueller.
MBFileToVector
, getMBRecordEntry
, getMBPeaksAnnos
.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.