Skip to contents

The metadata section/table of the mzTab-M definition is comprehensive, but also tricky to define. The RmzTabM package provides a variety of utility functions that help defining this information. These might be re-used for software package developers to export metabolomics results from their respective software. Importantly, the helper functions listed here only define the core elements for the MTD section, helping with re-arranging and reformatting information available e.g. in data.frame format into the respective fields in the MTD section. Additional (optional) fields might need to be added manually depending on availability for an experiment.

See also the specification of the MTD section for details and more information, in particular on the format of the mzTab-M and on mandatory or optional fields.

Generally, MTD data can be categorized into the following parts:

  • Core information: general information on the experiment. A minimal set can be created using the mtdSkeleton() function, which might be further expanded with additional fields. This section allows to describe the general experimental setup. Also, it should contain references to all controlled vocabulary (CV) ontologies used and refered to in the mzTab-M file.

  • Sample information: optional information on individual samples that were measured with the various assays/runs. The mtdSample() function assists in compiling the information for this section.

  • MS run information: information on the individual MS runs (measurements of the samples). Each data file is one run. Use the mtdMsRun() function to define this part of the metadata section.

  • Assay information: the mtdAssay() function assists in compiling the assay section of the metadata. Mandatory fields are the name (ID) of the assay and the reference to the MS run in which the assay was measured. Optional information on sample reference, external links or custom information can be provided too. In most cases (except multiplexed assays or pre-fractionated samples) one assay will link to one MS run. Each assay must represent one column in the following abundance matrix sections.

  • Study variable information: the mtdStudyVariables() function allows to format study variable information from an experiment into the mzTab-M format. All study variables need to be assigned to at least one assay and must also be reported in the subsequent abundance matrices.

The helper function listed above can be used sequentially to create the metadata information. See the examples below for a general approach how to define the MTD section of an experiment.

In addition, various helper functions are available to assist in MTD data generation:

Value

Return values are described in the help pages of the respective functions.

Note

The general relationship between ms_run, assay and sample:

  • one ms_run is the measurement of one assay. In most use cases one ms_run is associated with one assay.

  • one assay can be measured by several MS runs (if fractionated) or multiple assays can be measured in the same MS run (if multiplexed).

  • one assay is (generally) one sample, but the same sample can be measured with multiple assays (i.e., technical replicates).

See also

SMF-export and SML-export for creating and formatting the small molecule feature (SMF) and small molecule (SML) sections.

setMtdInstrument(), setMtdDatabase(), setMtdCv(), setMtdContact(), setMtdProtocol() and setMtdField().

Author

Philippine Louail, Johannes Rainer, Gabriele Tomè

Examples


## Building the mzTab-M metadata information from a `data.frame` with sample
## information of an experiment. Each row in that `data.frame` is one
## measurement of one sample (i.e., represents one *ms_run*). Columns in
## that `data.frame` provide the phenotypic and experimental variables of
## each sample. The example below represents a simple experiment in which
## 3 samples (e.g. cell lines) were measured. Columns *time_point and
## *cell_count* provide the time point (in hours) when samples were
## collected and the number of cells per sample. In addition, one
## sample has the genotype *WT* and two *KO*. Column `"operator"` contains
## the initials of the researcher extracting the samples
exp <- data.frame(
    sample_name = c("S1_T1", "S1_T2", "S2_T1", "S2_T2", "S3_T1", "S3_T2"),
    sample_id = c("S1", "S1", "S2", "S2", "S3", "S3"),
    time_point = c(0, 6, 0, 6, 0, 6),
    cell_count = c(13000, 8700, 10100, 6000, 14000, 4500),
    genotype = c("WT", "WT", "KO", "KO", "KO", "KO"),
    operator = c("BB", "BB", "BB", "BB", "FB", "FB"),
    file_name = c("s1-t1.mzML", "s1-t2.mzML", "s2-t1.mzML", "s2-t2.mzML",
                  "s3-t1.mzML", "s3-t2.mzML")
)
exp
#>   sample_name sample_id time_point cell_count genotype operator  file_name
#> 1       S1_T1        S1          0      13000       WT       BB s1-t1.mzML
#> 2       S1_T2        S1          6       8700       WT       BB s1-t2.mzML
#> 3       S2_T1        S2          0      10100       KO       BB s2-t1.mzML
#> 4       S2_T2        S2          6       6000       KO       BB s2-t2.mzML
#> 5       S3_T1        S3          0      14000       KO       FB s3-t1.mzML
#> 6       S3_T2        S3          6       4500       KO       FB s3-t2.mzML


#############################################################################
## Core metadata information

## We first compile the general metadata information. For the present
## example we assume that we performed only preprocessing of the raw MS
## data using *xcms*, thus we don't specify annotation databases used for
## the compound identification/annotation. These could be provided through
## the `database*` parameters. Also, the quantification method and unit(s)
## could be specified using respective parameters of the function.
mtd <- mtdSkeleton(
    id = "EXP_001",
    software = "[MS, MS:1001582], xcms, 4.0.0")
mtd
#>       [,1]                                        
#>  [1,] "mzTab-version"                             
#>  [2,] "mzTab-ID"                                  
#>  [3,] "mzTab-profile"                             
#>  [4,] "software[1]"                               
#>  [5,] "quantification_method"                     
#>  [6,] "cv[1]-label"                               
#>  [7,] "cv[1]-full_name"                           
#>  [8,] "cv[1]-version"                             
#>  [9,] "cv[1]-uri"                                 
#> [10,] "cv[2]-label"                               
#> [11,] "cv[2]-full_name"                           
#> [12,] "cv[2]-version"                             
#> [13,] "cv[2]-uri"                                 
#> [14,] "cv[3]-label"                               
#> [15,] "cv[3]-full_name"                           
#> [16,] "cv[3]-version"                             
#> [17,] "cv[3]-uri"                                 
#> [18,] "database[1]"                               
#> [19,] "database[1]-prefix"                        
#> [20,] "database[1]-version"                       
#> [21,] "database[1]-uri"                           
#> [22,] "small_molecule-quantification_unit"        
#> [23,] "small_molecule_feature-quantification_unit"
#> [24,] "small_molecule-identification_reliability" 
#>       [,2]                                                                     
#>  [1,] "2.1.0-M"                                                                
#>  [2,] "EXP_001"                                                                
#>  [3,] "M"                                                                      
#>  [4,] "[,,[MS, MS:1001582], xcms, 4.0.0,]"                                     
#>  [5,] "[MS, MS:1001834, LC-MS label-free quantitation analysis, ]"             
#>  [6,] "MS"                                                                     
#>  [7,] "PSI-MS controlled vocabulary"                                           
#>  [8,] "4.1.138"                                                                
#>  [9,] "https://www.ebi.ac.uk/ols4/ontologies/ms"                               
#> [10,] "PRIDE"                                                                  
#> [11,] "PRIDE PRoteomics IDEntifications (PRIDE) database controlled vocabulary"
#> [12,] "16:10:2023 11:38"                                                       
#> [13,] "https://www.ebi.ac.uk/ols/ontologies/pride"                             
#> [14,] "STATO"                                                                  
#> [15,] "General purpose STATistics Ontology"                                    
#> [16,] "2026-04-20"                                                             
#> [17,] "https://www.ebi.ac.uk/ols4/ontologies/stato"                            
#> [18,] "[,, \"no database\", null ]"                                            
#> [19,] "null"                                                                   
#> [20,] "Unknown"                                                                
#> [21,] "null"                                                                   
#> [22,] "[PRIDE, PRIDE:0000330, Arbitrary quantification unit, ]"                
#> [23,] "[PRIDE, PRIDE:0000330, Arbitrary quantification unit, ]"                
#> [24,] "[MS, MS:1002896, compound identification confidence level, ]"           

## We can add additional content to this *skeleton* MTD information with
## any of the `setMtd*` functions.
## We next add a title and description for the experiment.
mtd <- setMtdField(mtd, field = "title",
    value = "Experiment 1 preprocessed data")
mtd <- setMtdField(mtd, field = "description",
    value = "The preprocessed data of experiment 1 samples.")

## We also add information on the MS instrumentation used
mtd <- setMtdInstrument(mtd,
    name = "[MS, MS:1000449, LTQ Orbitrap,]",
    source = "[MS, MS:1000073, ESI,]",
    analyzer = c("analyzer[1]" = "[MS, MS:1000291, linear ion trap,]"),
    detector = "[MS, MS:1000253, electron multiplier,]",
)

## We can also add contact information
mtd <- setMtdContact(mtd, name = c("frodo", "sauron"),
    affiliation = c("fellowship of the ring", "the dark side"),
    email = c("frodo@shire.net", "sauron@mordor.net"),
    orcid = c("0000-0001-2345-6789", "0000-0001-2345-678X"))

mtd
#>       field                                       
#>  [1,] "mzTab-version"                             
#>  [2,] "mzTab-ID"                                  
#>  [3,] "mzTab-profile"                             
#>  [4,] "title"                                     
#>  [5,] "description"                               
#>  [6,] "instrument[1]-name"                        
#>  [7,] "instrument[1]-source"                      
#>  [8,] "instrument[1]-analyzer[1]"                 
#>  [9,] "instrument[1]-detector"                    
#> [10,] "software[1]"                               
#> [11,] "contact[1]-name"                           
#> [12,] "contact[1]-affiliation"                    
#> [13,] "contact[1]-email"                          
#> [14,] "contact[1]-orcid"                          
#> [15,] "contact[2]-name"                           
#> [16,] "contact[2]-affiliation"                    
#> [17,] "contact[2]-email"                          
#> [18,] "contact[2]-orcid"                          
#> [19,] "quantification_method"                     
#> [20,] "cv[1]-label"                               
#> [21,] "cv[1]-full_name"                           
#> [22,] "cv[1]-version"                             
#> [23,] "cv[1]-uri"                                 
#> [24,] "cv[2]-label"                               
#> [25,] "cv[2]-full_name"                           
#> [26,] "cv[2]-version"                             
#> [27,] "cv[2]-uri"                                 
#> [28,] "cv[3]-label"                               
#> [29,] "cv[3]-full_name"                           
#> [30,] "cv[3]-version"                             
#> [31,] "cv[3]-uri"                                 
#> [32,] "database[1]"                               
#> [33,] "database[1]-prefix"                        
#> [34,] "database[1]-version"                       
#> [35,] "database[1]-uri"                           
#> [36,] "small_molecule-quantification_unit"        
#> [37,] "small_molecule_feature-quantification_unit"
#> [38,] "small_molecule-identification_reliability" 
#>       value                                                                    
#>  [1,] "2.1.0-M"                                                                
#>  [2,] "EXP_001"                                                                
#>  [3,] "M"                                                                      
#>  [4,] "Experiment 1 preprocessed data"                                         
#>  [5,] "The preprocessed data of experiment 1 samples."                         
#>  [6,] "[MS, MS:1000449, LTQ Orbitrap,]"                                        
#>  [7,] "[MS, MS:1000073, ESI,]"                                                 
#>  [8,] "[MS, MS:1000291, linear ion trap,]"                                     
#>  [9,] "[MS, MS:1000253, electron multiplier,]"                                 
#> [10,] "[,,[MS, MS:1001582], xcms, 4.0.0,]"                                     
#> [11,] "frodo"                                                                  
#> [12,] "fellowship of the ring"                                                 
#> [13,] "frodo@shire.net"                                                        
#> [14,] "0000-0001-2345-6789"                                                    
#> [15,] "sauron"                                                                 
#> [16,] "the dark side"                                                          
#> [17,] "sauron@mordor.net"                                                      
#> [18,] "0000-0001-2345-678X"                                                    
#> [19,] "[MS, MS:1001834, LC-MS label-free quantitation analysis, ]"             
#> [20,] "MS"                                                                     
#> [21,] "PSI-MS controlled vocabulary"                                           
#> [22,] "4.1.138"                                                                
#> [23,] "https://www.ebi.ac.uk/ols4/ontologies/ms"                               
#> [24,] "PRIDE"                                                                  
#> [25,] "PRIDE PRoteomics IDEntifications (PRIDE) database controlled vocabulary"
#> [26,] "16:10:2023 11:38"                                                       
#> [27,] "https://www.ebi.ac.uk/ols/ontologies/pride"                             
#> [28,] "STATO"                                                                  
#> [29,] "General purpose STATistics Ontology"                                    
#> [30,] "2026-04-20"                                                             
#> [31,] "https://www.ebi.ac.uk/ols4/ontologies/stato"                            
#> [32,] "[,, \"no database\", null ]"                                            
#> [33,] "null"                                                                   
#> [34,] "Unknown"                                                                
#> [35,] "null"                                                                   
#> [36,] "[PRIDE, PRIDE:0000330, Arbitrary quantification unit, ]"                
#> [37,] "[PRIDE, PRIDE:0000330, Arbitrary quantification unit, ]"                
#> [38,] "[MS, MS:1002896, compound identification confidence level, ]"           

## Other information, such as employed sample processing methods could be
## added in a similar way.


#############################################################################
## Sample information

## We next add sample information to the metadata. In addition to the
## specific sample properties that can be defined using the function's
## parameters, arbitrary custom fields can be defined too. Below we add
## information on sample extraction as custom information.
mtd_s <- mtdSample(
    sample = unique(exp$sample_id),
    species = "[NCBITaxon, NCBITaxon:9606, Homo sapiens, ]",
    tissue = "[BTO, BTO:0000759, liver, ]",
    cell_type = "[CL, CL:0000182, hepatocyte, ]",
    c("[,,Extraction date, 2011-12-21]",
      "[,,Extraction date, 2011-12-22]",
      "[,,Extraction date, 2011-12-23]")
    )
mtd_s
#>                                                                             
#>  [1,] "sample[1]"              "S1"                                         
#>  [2,] "sample[1]-species[1]"   "[NCBITaxon, NCBITaxon:9606, Homo sapiens, ]"
#>  [3,] "sample[1]-tissue[1]"    "[BTO, BTO:0000759, liver, ]"                
#>  [4,] "sample[1]-cell_type[1]" "[CL, CL:0000182, hepatocyte, ]"             
#>  [5,] "sample[1]-custom[1]"    "[,,, [,,Extraction date, 2011-12-21]]"      
#>  [6,] "sample[2]"              "S2"                                         
#>  [7,] "sample[2]-species[1]"   "[NCBITaxon, NCBITaxon:9606, Homo sapiens, ]"
#>  [8,] "sample[2]-tissue[1]"    "[BTO, BTO:0000759, liver, ]"                
#>  [9,] "sample[2]-cell_type[1]" "[CL, CL:0000182, hepatocyte, ]"             
#> [10,] "sample[2]-custom[1]"    "[,,, [,,Extraction date, 2011-12-22]]"      
#> [11,] "sample[3]"              "S3"                                         
#> [12,] "sample[3]-species[1]"   "[NCBITaxon, NCBITaxon:9606, Homo sapiens, ]"
#> [13,] "sample[3]-tissue[1]"    "[BTO, BTO:0000759, liver, ]"                
#> [14,] "sample[3]-cell_type[1]" "[CL, CL:0000182, hepatocyte, ]"             
#> [15,] "sample[3]-custom[1]"    "[,,, [,,Extraction date, 2011-12-23]]"      

mtd <- rbind(mtd, mtd_s)


#############################################################################
## MS run information

## The MS run information should capture information of each individual
## measurement run on an MS instrument. For this, the original data file
## names and location should be provided as well as the format of the
## data files as well as polarity etc.
mtd_msr <- mtdMsRun(
    location = exp$file_name,
    format = "[MS, MS:1000584, mzML file, ]",
    id_format = "[MS, MS:1000530, mzML unique identifier, ]",
    scan_polarity = "positive")

mtd <- rbind(mtd, mtd_msr)


#############################################################################
## Assay information

## Each measurement should be associated to (at least) one assay. For our
## simple example, each row in the `data.frame` represents one assay, with
## each assay being measured in one MS run.
a <- mtdAssay(
    assay = exp$sample_name,
    sample_ref = c("sample[1]", "sample[1]", "sample[2]", "sample[2]",
                   "sample[3]", "sample[3]"),
    ms_run_ref = paste0("ms_run[", seq_len(nrow(exp)), "]")
)
a
#>                                        
#>  [1,] "assay[1]"            "S1_T1"    
#>  [2,] "assay[1]-sample_ref" "sample[1]"
#>  [3,] "assay[1]-ms_run_ref" "ms_run[1]"
#>  [4,] "assay[2]"            "S1_T2"    
#>  [5,] "assay[2]-sample_ref" "sample[1]"
#>  [6,] "assay[2]-ms_run_ref" "ms_run[2]"
#>  [7,] "assay[3]"            "S2_T1"    
#>  [8,] "assay[3]-sample_ref" "sample[2]"
#>  [9,] "assay[3]-ms_run_ref" "ms_run[3]"
#> [10,] "assay[4]"            "S2_T2"    
#> [11,] "assay[4]-sample_ref" "sample[2]"
#> [12,] "assay[4]-ms_run_ref" "ms_run[4]"
#> [13,] "assay[5]"            "S3_T1"    
#> [14,] "assay[5]-sample_ref" "sample[3]"
#> [15,] "assay[5]-ms_run_ref" "ms_run[5]"
#> [16,] "assay[6]"            "S3_T2"    
#> [17,] "assay[6]-sample_ref" "sample[3]"
#> [18,] "assay[6]-ms_run_ref" "ms_run[6]"

mtd <- rbind(mtd, a)


#############################################################################
## Study variable information

## Study variables can be defined directly from the experiment `data.frame`.
## In our example we use the columns (information on) `"time_point"`,
## `"genotype"`, `"cell_count"` and `"operator"`. Importantly, the row-order
## of the provided `data.frame` has to match the order of the assays (and
## MS runs).
svar <- mtdStudyVariables(
    exp, groups = c("time_point", "genotype", "cell_count", "operator"))
svar
#>       [,1]                                         
#>  [1,] "study_variable_group[1]"                    
#>  [2,] "study_variable_group[1]-description"        
#>  [3,] "study_variable_group[1]-type"               
#>  [4,] "study_variable_group[1]-datatype"           
#>  [5,] "study_variable_group[1]-study_variable_refs"
#>  [6,] "study_variable_group[2]"                    
#>  [7,] "study_variable_group[2]-description"        
#>  [8,] "study_variable_group[2]-type"               
#>  [9,] "study_variable_group[2]-datatype"           
#> [10,] "study_variable_group[2]-study_variable_refs"
#> [11,] "study_variable_group[3]"                    
#> [12,] "study_variable_group[3]-description"        
#> [13,] "study_variable_group[3]-type"               
#> [14,] "study_variable_group[3]-datatype"           
#> [15,] "study_variable_group[3]-study_variable_refs"
#> [16,] "study_variable_group[4]"                    
#> [17,] "study_variable_group[4]-description"        
#> [18,] "study_variable_group[4]-type"               
#> [19,] "study_variable_group[4]-datatype"           
#> [20,] "study_variable_group[4]-study_variable_refs"
#> [21,] "study_variable[1]"                          
#> [22,] "study_variable[1]-assay_refs"               
#> [23,] "study_variable[1]-average_function"         
#> [24,] "study_variable[1]-variation_function"       
#> [25,] "study_variable[1]-description"              
#> [26,] "study_variable[2]"                          
#> [27,] "study_variable[2]-assay_refs"               
#> [28,] "study_variable[2]-average_function"         
#> [29,] "study_variable[2]-variation_function"       
#> [30,] "study_variable[2]-description"              
#> [31,] "study_variable[3]"                          
#> [32,] "study_variable[3]-assay_refs"               
#> [33,] "study_variable[3]-average_function"         
#> [34,] "study_variable[3]-variation_function"       
#> [35,] "study_variable[3]-description"              
#> [36,] "study_variable[4]"                          
#> [37,] "study_variable[4]-assay_refs"               
#> [38,] "study_variable[4]-average_function"         
#> [39,] "study_variable[4]-variation_function"       
#> [40,] "study_variable[4]-description"              
#> [41,] "study_variable[5]"                          
#> [42,] "study_variable[5]-assay_refs"               
#> [43,] "study_variable[5]-average_function"         
#> [44,] "study_variable[5]-variation_function"       
#> [45,] "study_variable[5]-description"              
#> [46,] "study_variable[6]"                          
#> [47,] "study_variable[6]-assay_refs"               
#> [48,] "study_variable[6]-average_function"         
#> [49,] "study_variable[6]-variation_function"       
#> [50,] "study_variable[6]-description"              
#> [51,] "study_variable[7]"                          
#> [52,] "study_variable[7]-assay_refs"               
#> [53,] "study_variable[7]-average_function"         
#> [54,] "study_variable[7]-variation_function"       
#> [55,] "study_variable[7]-description"              
#> [56,] "study_variable[8]"                          
#> [57,] "study_variable[8]-assay_refs"               
#> [58,] "study_variable[8]-average_function"         
#> [59,] "study_variable[8]-variation_function"       
#> [60,] "study_variable[8]-description"              
#> [61,] "study_variable[9]"                          
#> [62,] "study_variable[9]-assay_refs"               
#> [63,] "study_variable[9]-average_function"         
#> [64,] "study_variable[9]-variation_function"       
#> [65,] "study_variable[9]-description"              
#> [66,] "study_variable[10]"                         
#> [67,] "study_variable[10]-assay_refs"              
#> [68,] "study_variable[10]-average_function"        
#> [69,] "study_variable[10]-variation_function"      
#> [70,] "study_variable[10]-description"             
#> [71,] "study_variable[11]"                         
#> [72,] "study_variable[11]-assay_refs"              
#> [73,] "study_variable[11]-average_function"        
#> [74,] "study_variable[11]-variation_function"      
#> [75,] "study_variable[11]-description"             
#> [76,] "study_variable[12]"                         
#> [77,] "study_variable[12]-assay_refs"              
#> [78,] "study_variable[12]-average_function"        
#> [79,] "study_variable[12]-variation_function"      
#> [80,] "study_variable[12]-description"             
#>       [,2]                                                                                                          
#>  [1,] "[,,time_point,]"                                                                                             
#>  [2,] "Sample matrix column time_point"                                                                             
#>  [3,] "[STATO, STATO:0000251, continuous variable, ]"                                                               
#>  [4,] "xsd:decimal"                                                                                                 
#>  [5,] "study_variable[1]|study_variable[2]"                                                                         
#>  [6,] "[,,genotype,]"                                                                                               
#>  [7,] "Sample matrix column genotype"                                                                               
#>  [8,] "[STATO, STATO:0000252, categorical variable, ]"                                                              
#>  [9,] "xsd:string"                                                                                                  
#> [10,] "study_variable[3]|study_variable[4]"                                                                         
#> [11,] "[,,cell_count,]"                                                                                             
#> [12,] "Sample matrix column cell_count"                                                                             
#> [13,] "[STATO, STATO:0000251, continuous variable, ]"                                                               
#> [14,] "xsd:decimal"                                                                                                 
#> [15,] "study_variable[5]|study_variable[6]|study_variable[7]|study_variable[8]|study_variable[9]|study_variable[10]"
#> [16,] "[,,operator,]"                                                                                               
#> [17,] "Sample matrix column operator"                                                                               
#> [18,] "[STATO, STATO:0000252, categorical variable, ]"                                                              
#> [19,] "xsd:string"                                                                                                  
#> [20,] "study_variable[11]|study_variable[12]"                                                                       
#> [21,] "0"                                                                                                           
#> [22,] "assay[1]|assay[3]|assay[5]"                                                                                  
#> [23,] "[MS, MS:1002962, mean, ]"                                                                                    
#> [24,] "[MS, MS:1002963, variation coefficient, ]"                                                                   
#> [25,] "Variable time_point, value 0"                                                                                
#> [26,] "6"                                                                                                           
#> [27,] "assay[2]|assay[4]|assay[6]"                                                                                  
#> [28,] "[MS, MS:1002962, mean, ]"                                                                                    
#> [29,] "[MS, MS:1002963, variation coefficient, ]"                                                                   
#> [30,] "Variable time_point, value 6"                                                                                
#> [31,] "WT"                                                                                                          
#> [32,] "assay[1]|assay[2]"                                                                                           
#> [33,] "[MS, MS:1002962, mean, ]"                                                                                    
#> [34,] "[MS, MS:1002963, variation coefficient, ]"                                                                   
#> [35,] "Variable genotype, value WT"                                                                                 
#> [36,] "KO"                                                                                                          
#> [37,] "assay[3]|assay[4]|assay[5]|assay[6]"                                                                         
#> [38,] "[MS, MS:1002962, mean, ]"                                                                                    
#> [39,] "[MS, MS:1002963, variation coefficient, ]"                                                                   
#> [40,] "Variable genotype, value KO"                                                                                 
#> [41,] "13000"                                                                                                       
#> [42,] "assay[1]"                                                                                                    
#> [43,] "[MS, MS:1002962, mean, ]"                                                                                    
#> [44,] "[MS, MS:1002963, variation coefficient, ]"                                                                   
#> [45,] "Variable cell_count, value 13000"                                                                            
#> [46,] "8700"                                                                                                        
#> [47,] "assay[2]"                                                                                                    
#> [48,] "[MS, MS:1002962, mean, ]"                                                                                    
#> [49,] "[MS, MS:1002963, variation coefficient, ]"                                                                   
#> [50,] "Variable cell_count, value 8700"                                                                             
#> [51,] "10100"                                                                                                       
#> [52,] "assay[3]"                                                                                                    
#> [53,] "[MS, MS:1002962, mean, ]"                                                                                    
#> [54,] "[MS, MS:1002963, variation coefficient, ]"                                                                   
#> [55,] "Variable cell_count, value 10100"                                                                            
#> [56,] "6000"                                                                                                        
#> [57,] "assay[4]"                                                                                                    
#> [58,] "[MS, MS:1002962, mean, ]"                                                                                    
#> [59,] "[MS, MS:1002963, variation coefficient, ]"                                                                   
#> [60,] "Variable cell_count, value 6000"                                                                             
#> [61,] "14000"                                                                                                       
#> [62,] "assay[5]"                                                                                                    
#> [63,] "[MS, MS:1002962, mean, ]"                                                                                    
#> [64,] "[MS, MS:1002963, variation coefficient, ]"                                                                   
#> [65,] "Variable cell_count, value 14000"                                                                            
#> [66,] "4500"                                                                                                        
#> [67,] "assay[6]"                                                                                                    
#> [68,] "[MS, MS:1002962, mean, ]"                                                                                    
#> [69,] "[MS, MS:1002963, variation coefficient, ]"                                                                   
#> [70,] "Variable cell_count, value 4500"                                                                             
#> [71,] "BB"                                                                                                          
#> [72,] "assay[1]|assay[2]|assay[3]|assay[4]"                                                                         
#> [73,] "[MS, MS:1002962, mean, ]"                                                                                    
#> [74,] "[MS, MS:1002963, variation coefficient, ]"                                                                   
#> [75,] "Variable operator, value BB"                                                                                 
#> [76,] "FB"                                                                                                          
#> [77,] "assay[5]|assay[6]"                                                                                           
#> [78,] "[MS, MS:1002962, mean, ]"                                                                                    
#> [79,] "[MS, MS:1002963, variation coefficient, ]"                                                                   
#> [80,] "Variable operator, value FB"                                                                                 

## The individual columns got encoded to a `"study_variable_group"` with a
## defined (statistical) type and a datatype. Both are inferred
## automatically from the columns of the provided `data.frame`, but could
## also be manually provided through the respective function arguments.

mtd <- rbind(mtd, svar)

## Finally, the `mtdSort()` function can be used to sort the generated
## two-column matrix in the expected order.
mtd <- mtdSort(mtd)

## This metadata information can next be exported manually, or using the
## dedicated export helper functions to an mzTab-M file.