Skip to contents

Download a HMDB XML file and process it into a table

Usage

hmdb_table(dataset = "metabolites", fields = NULL)

Arguments

dataset

Character: name of an HMDB XML dataset, such as "metabolites", "proteins", "urine", "serum", "csf", "saliva", "feces", "sweat".

fields

Character: fields to extract from the XML. This is a very minimal parser that is able to extract the text content of simple fields and multiple value fields which contain a list of leaves within one container tag under the record tag. A full list of fields available in HMDB is available by the hmdb_protein_fields and hmdb_metabolite_fields functions. By default, all fields available in the dataset are extracted.

Value

A data frame (tibble) with each column corresponding to a field.

Examples

hmdb_table()
#> # A tibble: 217,920 × 33
#>    accession   name                  version status description chemical_formula
#>    <chr>       <chr>                 <chr>   <chr>  <chr>       <chr>           
#>  1 HMDB0000001 1-Methylhistidine     5.0     quant… "1-Methylh… C7H11N3O2       
#>  2 HMDB0000002 1,3-Diaminopropane    5.0     quant… "1,3-Diami… C3H10N2         
#>  3 HMDB0000005 2-Ketobutyric acid    5.0     quant… "2-Ketobut… C4H6O3          
#>  4 HMDB0000008 2-Hydroxybutyric acid 5.0     quant… "2-Hydroxy… C4H8O3          
#>  5 HMDB0000010 2-Methoxyestrone      5.0     quant… "2-Methoxy… C19H24O3        
#>  6 HMDB0000011 3-Hydroxybutyric acid 5.0     quant… "3-Hydroxy… C4H8O3          
#>  7 HMDB0000012 Deoxyuridine          5.0     quant… "Deoxyurid… C9H12N2O5       
#>  8 HMDB0000014 Deoxycytidine         5.0     quant… "Deoxycyti… C9H13N3O4       
#>  9 HMDB0000015 Cortexolone           5.0     quant… "Cortexolo… C21H30O4        
#> 10 HMDB0000016 Deoxycorticosterone   5.0     quant… "11-Deoxyc… C21H30O3        
#> # ℹ 217,910 more rows
#> # ℹ 27 more variables: average_molecular_weight <chr>,
#> #   monisotopic_molecular_weight <chr>, iupac_name <chr>,
#> #   traditional_iupac <chr>, cas_registry_number <chr>, smiles <chr>,
#> #   inchi <chr>, inchikey <chr>, state <chr>, synthesis_reference <chr>,
#> #   chemspider_id <chr>, drugbank_id <chr>, foodb_id <chr>,
#> #   pubchem_compound_id <chr>, pdb_id <chr>, chebi_id <chr>, …