Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

getSubset

Class: BioRead

Create object containing subset of elements from object

Syntax

NewObj = getSubset(BioObj, Subset)
NewObj = getSubset(BioObj, 'SelectReference', R)
NewObj = getSubset(..., 'ParameterName', ParameterValue)

Description

NewObj = getSubset(BioObj, Subset) returns NewObj, a new object containing a subset of the elements from BioObj. getSubset returns object elements specified by Subset. If BioObj is indexed, then NewObj is indexed. If BioObj is in memory, then NewObj is in memory.

NewObj = getSubset(BioObj, 'SelectReference', R) for BioObj objects of the BioMap class creates a subset object with only the short reads mapped to R.

NewObj = getSubset(..., 'ParameterName', ParameterValue) accepts one or more comma-separated parameter name/value pairs. Specify ParameterName inside single quotes.

Input Arguments

BioObj

Object of the BioRead or BioMap class.

Subset

One of the following to specify a subset of the elements in BioObj:

  • Vector of positive integers

  • Logical vector

  • Cell array of character vectors containing valid sequence headers

    Note:   If you use a cell array of headers to specify Subset, be aware that a repeated header specifies all elements with that header.

R

Vector of positive integers indexing the SequenceDictionary property of BioObj or a cell array of character vectors specifying the actual names of references in objects of the BioMap class.

Name-Value Pair Arguments

'Name'

Character vector specifying a name for NewObj. This information populates the Name property of NewObj.

Default: Empty character vector

'InMemory'

Logical specifying whether getSubset uses indexed access to the source file or loads the contents of the source file into memory. If the data specified for the subset is still large, set to false to use indexed access and be memory efficient. If the data specified for the subset fits in memory, set to true to load the data into memory, which lets you access NewObj faster and update its properties.

If BioObj was not constructed using indexed access and is already in memory, the InMemory name/value pair is ignored, and the data is automatically placed in memory.

Default: false

Output Arguments

NewObj

Object of the BioRead or BioMap class. If BioObj is in memory, then NewObj is in memory. If BioObj is indexed, then NewObj is indexed, unless you set the InMemory parameter name/value pair to true.

Examples

Retrieve a subset of elements from a BioRead object:

% Construct a BioRead object from a FASTQ file 
BRObj = BioRead('SRR005164_1_50.fastq');
% Retrieve the information associated with the second and third
% elements in the object
getSubset(BRObj, [2 3]);
getSubset(BRObj, [2:3]);
getSubset(BRObj, {'SRR005164.2', 'SRR005164.3'});
getSubset(BRObj, [false true true]);
% Create a new BioRead object containing the first and third elements
% from the object
NewBRObj = getSubset(BRObj, [1 3]);
Was this topic helpful?