Quantcast

Documentation Center

  • Trial Software
  • Product Updates

Representing Sample and Feature Metadata in MetaData Objects

Overview of MetaData Objects

You can store either sample or feature metadata from a microarray gene expression experiment in a MetaData object. The metadata consists of variable names, for example, related to either samples or microarray features, along with descriptions and values for the variables.

A MetaData object stores the metadata in two dataset arrays:

  • Values dataset array — A dataset array containing the measured value of each variable per sample or feature. In this dataset array, the columns correspond to variables and rows correspond to either samples or features. The number and names of the columns in this dataset array must match the number and names of the rows in the Descriptions dataset array. If this dataset array contains sample metadata, then the number and names of the rows (samples) must match the number and names of the columns in the DataMatrix objects in the same ExpressionSet object. If this dataset array contains feature metadata, then the number and names of the rows (features) must match the number and names of the rows in the DataMatrix objects in the same ExpressionSet object.

  • Descriptions dataset array — A dataset array containing a list of the variable names and their descriptions. In this dataset array, each row corresponds to a variable. The row names are the variable names, and a column, named VariableDescription, contains a description of the variable. The number and names of the rows in the Descriptions dataset array must match the number and names of the columns in the Values dataset array.

The following illustrates a dataset array containing the measured value of each variable per sample or feature:

        Gender     Age   Type           Strain             Source    
    A   'Male'     8     'Wild type'    '129S6/SvEvTac'    'amygdala' 
    B   'Male'     8     'Wild type'    '129S6/SvEvTac'    'amygdala' 
    C   'Male'     8     'Wild type'    '129S6/SvEvTac'    'amygdala' 
    D   'Male'     8     'Wild type'    'A/J '             'amygdala' 
    E   'Male'     8     'Wild type'    'A/J '             'amygdala' 
    F   'Male'     8     'Wild type'    'C57BL/6J '        'amygdala'            

The following illustrates a dataset array containing a list of the variable names and their descriptions:

               VariableDescription
id             'Sample  identifier'
Gender         'Gender of the mouse in study'
Age            'The number of weeks since mouse birth'
Type           'Genetic characters'
Strain         'The mouse strain'
Source         'The tissue source for RNA collection'

A MetaData object lets you store, manage, and subset the metadata from a microarray experiment. A MetaData object includes properties and methods that let you access, retrieve, and change metadata from a microarray experiment. These properties and methods are useful to view and analyze the metadata. For a list of the properties and methods, see MetaData class

Constructing MetaData Objects

Constructing a MetaData Object from Two dataset Arrays

  1. Import the bioma.data package so that the MetaData constructor function is available.

    import bioma.data.*
    
  2. Load some sample data, which includes Fisher's iris data of 5 measurements on a sample of 150 irises.

    load fisheriris
    
  3. Create a dataset array from some of Fisher's iris data. The dataset array will contain 750 measured values, one for each of 150 samples (iris replicates) at five variables (species, SL, SW, PL, PW). In this dataset array, the rows correspond to samples, and the columns correspond to variables.

    irisValues = dataset({nominal(species),'species'}, ...
                         {meas, 'SL', 'SW', 'PL', 'PW'});
  4. Create another dataset array containing a list of the variable names and their descriptions. This dataset array will contain five rows, each corresponding to the five variables: species, SL, SW, PL, and PW. The first column will contain the variable name. The second column will have a column header of VariableDescription and contain a description of the variable.

    % Create 5-by-1 cell array of description text for the variables
    varDesc = {'Iris species', 'Sepal Length', 'Sepal Width', ...
               'Petal Length', 'Petal Width'}';
    % Create the dataset array from the variable descriptions
    irisVarDesc = dataset(varDesc, ...
                  'ObsNames', {'species','SL','SW','PL','PW'}, ...
                  'VarNames', {'VariableDescription'})
    
    irisVarDesc = 
    
                   VariableDescription
        species    'Iris species'     
        SL         'Sepal Length'     
        SW         'Sepal Width'      
        PL         'Petal Length'     
        PW         'Petal Width'  
  5. Create a MetaData object from the two dataset arrays.

    MDObj1 = MetaData(irisValues, irisVarDesc);

Constructing a MetaData Object from a Text File

  1. Import the bioma.datapackage so that the MetaData constructor function is available.

    import bioma.data.*
    
  2. View the mouseSampleData.txt file included with the Bioinformatics Toolbox™ software.

    Note that this text file contains two tables. One table contains 130 measured values, one for each of 26 samples (A through Z) at five variables (Gender, Age, Type, Strain, and Source). In this table, the rows correspond to samples, and the columns correspond to variables. The second table has lines prefaced by the # symbol. It contains five rows, each corresponding to the five variables: Gender, Age, Type, Strain, and Source. The first column contains the variable name. The second column has a column header of VariableDescription and contains a description of the variable.

    # id: Sample  identifier					
    # Gender: Gender of the mouse in study					
    # Age: The number of weeks since mouse birth 					
    # Type: Genetic characters					
    # Strain: The mouse strain					
    # Source: The tissue source for RNA collection					
    ID	Gender	Age	Type	Strain	Source
    A	Male	8	Wild type	129S6/SvEvTac	amygdala
    B	Male	8	Wild type	129S6/SvEvTac	amygdala
    C	Male	8	Wild type	129S6/SvEvTac	amygdala
    D	Male	8	Wild type	A/J 	amygdala
    E	Male	8	Wild type	A/J 	amygdala
    F	Male	8	Wild type	C57BL/6J 	amygdala
    G	Male	8	Wild type	C57BL/6J	amygdala
    H	Male	8	Wild type	129S6/SvEvTac	cingulate cortex
    I	Male	8	Wild type	129S6/SvEvTac	cingulate cortex
    J	Male	8	Wild type	A/J	cingulate cortex
    K	Male	8	Wild type	A/J	cingulate cortex
    L	Male	8	Wild type	A/J	cingulate cortex
    M	Male	8	Wild type	C57BL/6J	cingulate cortex
    N	Male	8	Wild type	C57BL/6J	cingulate cortex
    O	Male	8	Wild type	129S6/SvEvTac	hippocampus
    P	Male	8	Wild type	129S6/SvEvTac	hippocampus
    Q	Male	8	Wild type	A/J	hippocampus
    R	Male	8	Wild type	A/J	hippocampus
    S	Male	8	Wild type	C57BL/6J	hippocampus
    T	Male	8	Wild type	C57BL/6J4	hippocampus
    U	Male	8	Wild type	129S6/SvEvTac	hypothalamus
    V	Male	8	Wild type	129S6/SvEvTac	hypothalamus
    W	Male	8	Wild type	A/J	hypothalamus
    X	Male	8	Wild type	A/J	hypothalamus
    Y	Male	8	Wild type	C57BL/6J	hypothalamus
    Z	Male	8	Wild type	C57BL/6J	hypothalamus
    
  3. Create a MetaData object from the metadata in the mouseSampleData.txt file.

    MDObj2 = MetaData('File', 'mouseSampleData.txt', 'VarDescChar', '#')
    
    Sample Names:
        A, B, ...,Z (26 total)
    Variable Names and Meta Information:
    
                  VariableDescription
        Gender    ' Gender of the mouse in study'             
        Age       ' The number of weeks since mouse birth'    
        Type      ' Genetic characters'                       
        Strain    ' The mouse strain'                         
        Source    ' The tissue source for RNA collection'   

For complete information on constructing MetaData objects, see MetaData class.

Using Properties of a MetaData Object

To access properties of a MetaData object, use the following syntax:

objectname.propertyname

For example, to determine the number of variables in a MetaData object:

MDObj2.NVariables

ans =

     5

To set properties of a MetaData object, use the following syntax:

objectname.propertyname = propertyvalue

For example, to set the Description property of a MetaData object:

MDObj1.Description = 'This is my MetaData object for my sample metadata'

    Note:   Property names are case sensitive. For a list and description of all properties of a MetaData object, see MetaData class.

Using Methods of a MetaData Object

To use methods of a MetaData object, use either of the following syntaxes:

objectname.methodname

or

methodname(objectname)

For example, to access the dataset array in a MetaData object that contains the variable values:

MDObj2.variableValues;

To access the dataset array of a MetaData object that contains the variable descriptions:

variableDesc(MDObj2)

ans = 

              VariableDescription
    Gender    ' Gender of the mouse in study'             
    Age       ' The number of weeks since mouse birth'    
    Type      ' Genetic characters'                       
    Strain    ' The mouse strain'                         
    Source    ' The tissue source for RNA collection' 

    Note:   For a complete list of methods of a MetaData object, see MetaData class.

Was this topic helpful?