buildLib: buildLib converts an AMDIS' library into a CSV file in the...

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


buildLib is a function to convert a .MSL file of an AMDIS' library into a CSV file with the format required by Metab.


buildLib(AmdisLib, folder, save = TRUE, output = "ion_lib", verbose = TRUE)



when AmdisLib is missing, a dialog box will pop up allowing the user to click-and-point to the .MSL file from which the data is to be read. Alternatively, AmdisLib can take a character string naming the path to the .MSL file to be read or the name of a variable (data frame) containing the .MSL file.


when save = TRUE and folder is missing, a pop up dialog box will be presented to the user. The user can then select the directory to which the results will be saved. Alternatively, folder can take a character string naming the path to the folder where the results must be saved.


a logical vector (TRUE or FALSE) defining if the results must be saved into a CSV file (default = TRUE).


A character string indicating the name of the file storing the results generated by buildLib (default = ion_lib.csv).


A 'logical' defining if the progress bar should be displayed.


The Automated Mass Spectral Deconvolution and Identification System (AMDIS) is a software developed by NIST ( It makes use of a mass spectral library composed of two files, a .CID and a .MSL file. buildLib allows a quick conversion of the AMDIS' library into a .CSV file with the format required by Metab. For this, buildLib requires only the .MSL file of the AMDIS' library.


buildLib returns a data frame containing the following information:

Column 1: The name of each metabolite present in the .MSL file; Column 2: The expected retention time (RT) of each metabolite; Columns 3 to 6: The 4 ion mass fragments used to identify each metabolite. The ion mass fragment 1 is used by MetaBox as reference to detect and quantify each metabolite; Columns 7 to 9: The expected ratio of the ion mass fragments 2, 3 and 4 in relation to the ion mass fragment 1.

In addition, buildLib verifies the existence of metabolites expected at similar RT (less than 1 minute difference) and that use the same ion mass fragments as reference. These metabolites are probably strongly coeluted, which may dificult their correct identification. Metabolites showing these characteristics are presented to the user at the end of the run. We strongly suggest selecting different ion mass fragments for identifying such compounds.

See data(exampleIonLib).


The .MSL file of the AMDIS' library must contain the expected RT of each compound.


Raphael Aggio <>


Aggio, R., Villas-Boas, S. G., & Ruggiero, K. (2011). Metab: an R package for high-throughput analysis of metabolomics data generated by GC-MS. Bioinformatics, 27(16), 2316-2318. doi: 10.1093/bioinformatics/btr379

See Also

htest, MetReport, MetReportNames, normalizeByBiomass, normalizeByInternalStandard, removeFalsePositives,


	### Load example MSL file and show it to user #######
	######## Convert library ########
	testLib <- buildLib(exampleMSLfile, save = FALSE)
	########### Print new library ########

Search within the Metab package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.