Skip to Main Content Skip to Search
Product Documentation

palindromes - Find palindromes in sequence

Syntax

[Position, Length] = palindromes(SeqNT)
[Position, Length, Pal] = palindromes(SeqNT)

... = palindromes(SeqNT, ..., 'Length', LengthValue, ...)
... = palindromes(SeqNT, ..., 'Complement', ComplementValue, ...)

Arguments

SeqNT

One of the following:

LengthValueInteger specifying a minimum length for palindromes. Default is 6.
ComplementValueControls the return of complementary palindromes, that is, where the elements match their complementary pairs A-T (or U) and C-G instead of an exact nucleotide match. Choices are true or false (default).

Description

[Position, Length] = palindromes(SeqNT) finds all palindromes in sequence SeqNT with a length greater than or equal to 6, and returns the starting indices, Position, and the lengths of the palindromes, Length.

[Position, Length, Pal] = palindromes(SeqNT) also returns a cell array, Pal, of the palindromes.

... = palindromes(SeqNT, ...'PropertyName', PropertyValue, ...) calls palindromes with optional properties that use property name/property value pairs. You can specify one or more properties in any order. Each PropertyName must be enclosed in single quotation marks and is case insensitive. These property name/property value pairs are as follows:


... = palindromes(SeqNT, ..., 'Length', LengthValue, ...)
finds all palindromes longer than or equal to LengthValue. Default is 6.

... = palindromes(SeqNT, ..., 'Complement', ComplementValue, ...) controls the return of complementary palindromes, that is, where the elements match their complementary pairs A-T (or A-U) and C-G instead of an exact nucleotide match. Choices for ComplementValue are true or false (default).

Examples

Find the palindromes in a simple nucleotide sequence.

[p,l,s] = palindromes('GCTAGTAACGTATATATAAT')

p =
    11
    12
l =
     7
     7
s = 
    'TATATAT'
    'ATATATA'

Find the complementary palindromes in a simple nucleotide sequence.

[pc,lc,sc] = palindromes('TAGCTTGTCACTGAGGCCA',...
                         'Complement',true)
pc =
     8
lc =
     7
sc = 
    'TCACTGA'

Find the palindromes in a random nucleotide sequence.

a = randseq(100)

a =
TAGCTTCATCGTTGACTTCTACTAA
AAGCAAGCTCCTGAGTAGCTGGCCA
AGCGAGCTTGCTTGTGCCCGGCTGC
GGCGGTTGTATCCTGAATACGCCAT

[pos,len,pal]=palindromes(a)

pos =
    74
len =
     6
pal = 
    'GCGGCG' 

See Also

regexp | seqcomplement | seqrcomplement | seqreverse | seqshowwords | strfind

  


Free Computational Biology Interactive Kit

See how to analyze, visualize, and model biological data and systems using MathWorks products.

Get free kit

Trials Available

Try the latest computational biology products.

Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS