sampleNames

Class: bioma.data.MetaData
Package: bioma.data

Retrieve or set sample names in MetaData object

Syntax

SamFeatNames = sampleNames(MDObj)
SamFeatNames = sampleNames(MDObj, Subset)
NewMDObj = sampleNames(MDObj, Subset, NewSamFeatNames)

Description

SamFeatNames = sampleNames(MDObj) returns a cell array of strings specifying all sample names in a MetaData object.

SamFeatNames = sampleNames(MDObj, Subset) returns a cell array of strings specifying a subset the sample names in a MetaData object.

NewMDObj = sampleNames(MDObj, Subset, NewSamFeatNames) replaces the sample names specified by Subset in MDObj, a MetaData object, with NewSamFeatNames, and returns NewMDObj, a new MetaData object.

Input Arguments

MDObj

Object of the bioma.data.MetaData class.

Subset

One of the following to specify a subset of the sample names in a MetaData object:

  • String specifying a sample name

  • Cell array of strings specifying sample names

  • Positive integer

  • Vector of positive integers

  • Logical vector

NewSamFeatNames

New sample names for specific names within a MetaData object, specified by one of the following:

  • Numeric vector

  • String or cell array of strings

  • String, which sampleNames uses as a prefix for the sample or feature names, with numbers appended to the prefix

  • Logical true or false (default). If true, sampleNames assigns unique names using the format Sample1, Sample2, etc.

The number of names in NewSamFeatNames must equal the number of samples specified by Subset.

Output Arguments

SamFeatNames

Cell array of strings specifying all or some of the sample names in a MetaData object. The sample names are also the row names of the VarValues dataset array in the MetaData object.

NewMDObj

Object of the bioma.data.MetaData class, returned after replacing specific sample names.

Examples

Construct a MetaData object, and then retrieve the sample names from it:

% Import bioma.data package to make constructor function
% available
import bioma.data.*
% Construct MetaData object from .txt file
MDObj2 = MetaData('File', 'mouseSampleData.txt', 'VarDescChar', '#');
% Retrieve the sample names
SNames = sampleNames(MDObj2)
Was this topic helpful?