Main Content

setSubset

Update elements of object

Description

example

newObject = setSubset(object,elements,subset) returns a new object that is a copy of object with a subset of elements set to elements. A one-to-one relationship must exist between the number and order of elements in elements and subset.

Examples

collapse all

Construct two BioRead objects, one with 10 elements, and one with 2 elements. Trim the headers to the first white space.

struct1 = fastqread('SRR005164_1_50.fastq',...
                    'blockread', [1 10], 'trimheaders', true);
struct2 = fastqread('SRR005164_1_50.fastq',...
                    'blockread', [11 12], 'trimheaders', true);
brObj1  = BioRead(struct1)
brObj1 = 
  BioRead with properties:

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

brObj2  = BioRead(struct2)
brObj2 = 
  BioRead with properties:

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

Replace the first two elements in brObj1 with the elements in brObj2. The object brObj2 must contain the same number of elements as the number of elements in subset (in this case, 2).

subset = [1:2];
brObj1 = setSubset(brObj1,brObj2,subset)
brObj1 = 
  BioRead with properties:

     Quality: {10x1 cell}
    Sequence: {10x1 cell}
      Header: {10x1 cell}
       NSeqs: 10
        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

Object containing information related to the read data, specified as a BioRead or BioMap object. The object must contain the same number of elements as the number of elements in subset.

Example: brObject

Subset of elements in the object, specified as a vector of positive integers, logical vector, string vector, or cell array of character vectors containing valid sequence headers.

Example: [1 3]

Tip

When you use a sequence header (or a cell array of headers) for subset, a repeated header specifies all elements with that header.

Output Arguments

collapse all

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

Introduced in R2010a