Main Content

set

Set property of object

Description

newObject = set(object,Name,Value) returns a new object that is a copy of object with properties set to the values specified by using one or more name-value pairs. Use single quotes around the property name. For example, newObj = set(brObj,'Sequence',{'ACTCAG','GTCATG'}) specifies the Sequence property of brObj. You can specify any property name, except NSeqs. See BioRead or BioMap for their properties.

example

set(object,propertyName) displays all possible values for the specified property PropName of the object.

set(object) displays all properties of the object and their possible values.

example

allProperties = set(object) returns the structure allProperties containing all properties of object and their possible values.

example

Examples

collapse all

Store read data from a SAM-formatted file in a BioRead object. Set 'InMemory' to true to load the object into memory so that you can modify its properties.

br = BioRead('SRR005164_1_50.fastq','InMemory',true)
br = 
  BioRead with properties:

     Quality: {50x1 cell}
    Sequence: {50x1 cell}
      Header: {50x1 cell}
       NSeqs: 50
        Name: ''

Check the list of object properties and their possible values. For example, the Header property takes a cell array of strings as its value.

allProperties = set(br)
allProperties = struct with fields:
     Quality: 'Cell array of strings.'
    Sequence: 'Cell array of strings.'
      Header: 'Cell array of strings.'
       NSeqs: 'Non negative integer.'
        Name: 'String.'

Specify custom header information that follows the pattern Header_1, Header_2, ... ,Header_50.

headers = cell(50,1);
for i = 1:50
    headers(i) = {['Header_' int2str(i)]};
end

Set the header property of the br object. Use the same object as the output to update an existing object.

br = set(br,'Header',headers)
br = 
  BioRead with properties:

     Quality: {50x1 cell}
    Sequence: {50x1 cell}
      Header: {50x1 cell}
       NSeqs: 50
        Name: ''

br.Header(1)
ans = 1x1 cell array
    {'Header_1'}

Alternatively, you can set the property by using the dot notation.

br.Header = headers
br = 
  BioRead with properties:

     Quality: {50x1 cell}
    Sequence: {50x1 cell}
      Header: {50x1 cell}
       NSeqs: 50
        Name: ''

Input Arguments

collapse all

Object containing the read data, specified as a BioRead or BioMap object. If the object is not stored in memory, you cannot modify its properties, except the Name property.

Example: readData

Name of the object property, specified as a character vector or string.

Example: 'Sequence'

Output Arguments

collapse all

New object with updated properties, returned as a BioRead or BioMap object.

Structure containing all properties and their possible values, returned as a struct. The field names are the property names, and the values are cell arrays of possible property values.

Version History

Introduced in R2010a