setSubsequence
Update partial sequences
Description
returns a new object that is a copy of newObject
= setSubsequence(object
,subsequences
,subset
,positions
)object
with the partial
sequences of a subset of elements set to subsequences
. The
positions
argument specifies the sequence positions to be
updated by subsequences
. A one-to-one relationship must exist
between the number and order of elements in subsequences
and
subset
.
Examples
Update Partial Sequences
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: ''
Assume that you want to update the sequences of the first two reads partially (for example, the first five positions). First check the existing sequences.
br.Sequence(1:2)
ans = 2x1 cell
{'TGGCTTTAAAGCAGAACTTGTGAAAGAAGGAAAGCATTATGATTATCTGGCTAAGCTTAGCATTGTTTAGAA' }
{'TTACACTATCCTCTGATTACCAAAGACGTTTCTCGGTCATACAGACAGTCCTTGAGCAAGGGAAGAATTTATTTGCAGGCAAAAAAGTGTCCAACCGTATCGTGAGTATCGACCGGCATTACCTT'}
Define the subsequences. Each subsequence must have the same length.
subSequences = {'ATTCG','TACTA'}
subSequences = 1x2 cell
{'ATTCG'} {'TACTA'}
Update the first five positions of the first two reads. The number of positions must equal the length of each subsequence. In this example, the total number of positions is five, as is the length of each subsequence. br2
is a copy of br
with updated read sequences. If you need to update the br object itself, set it as the output of the function.
positions = [1:5]; subset = [1 2]; br2 = setSubsequence(br,subSequences,subset,positions); br2.Sequence(1:2)
ans = 2x1 cell
{'ATTCGTTAAAGCAGAACTTGTGAAAGAAGGAAAGCATTATGATTATCTGGCTAAGCTTAGCATTGTTTAGAA' }
{'TACTACTATCCTCTGATTACCAAAGACGTTTCTCGGTCATACAGACAGTCCTTGAGCAAGGGAAGAATTTATTTGCAGGCAAAAAAGTGTCCAACCGTATCGTGAGTATCGACCGGCATTACCTT'}
Input Arguments
subsequences
— Partial read sequences
cell array of character vectors | string vector
Partial read sequences, specified as a cell array of character vectors or string vector. Each character vector or string (that is, each sequence) must be the same length.
Example: {'TGGCTTC','AAAGCAG'}
subset
— Subset of elements in object
vector of positive integers | logical vector | string vector | cell array of character vectors
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.
positions
— Sequence positions
vector of positive integers | logical vector
Sequence positions, specified as a vector of positive integers or logical
vector. The number of positions must equal the length of every character
vector or string in subsequences
.
Example: [1:5]
Output Arguments
newObject
— New object with updated properties
BioRead
object | BioMap
object
New object with updated properties, returned as a BioRead
or BioMap
object.
Version History
Introduced in R2010a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)