メインコンテンツ

palindromes

Find palindromes in sequence

    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 of the palindromes.

    example

    ___ = palindromes(SeqNT,Name=Value) specifies options using one or more name-value arguments in addition to the arguments in previous syntaxes.

    example

    Examples

    collapse all

    Find the palindromes in a simple nucleotide sequence.

    [p,l,s] = palindromes("GCTAGTAACGTATATATAAT") 
    p = 2×1
    
        11
        12
    
    
    l = 2×1
    
         7
         7
    
    
    s = 2×1 cell
        {'TATATAT'}
        {'ATATATA'}
    
    

    Find the complementary palindromes in a simple nucleotide sequence.

    [pc,lc,sc] = ...
        palindromes("TAGCTTGTCACTGAGGCCA", ...
                    Complement=true)
    pc = 
    8
    
    lc = 
    7
    
    sc = 1×1 cell array
        {'TCACTGA'}
    
    

    Generate a random nucleotide sequence.

    a = randseq(100)
    a = 
    'GGCGCATTCAGATGTGTTGCCTATGCTGATATCATAGAAATTTTTTTATACGATAAAGCTTCTGACAATCATTATCTTACGCTTGACCGGTACGGATCAA'
    

    Find the palindromes in this sequence.

    [pos,len,pal] = palindromes(a)
    pos = 3×1
    
        40
        41
        42
    
    
    len = 3×1
    
        9
        6
        6
    
    
    pal = 3×1 cell array
        "'ATTTTTTTA'"
        "'TTTTTT'"
        "'TTTTTT'"
    
    

    Input Arguments

    collapse all

    Sequence, specified as one of these values:

    Data Types: double | char | string | struct

    Name-Value Arguments

    collapse all

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Example: Complement=true

    Minimum length for palindromes, specified as an integer.

    Data Types: double

    Indicator to return complementary palindromes, specified as true or false. Complementary palindromes are palindromes whose elements match their complementary pairs A-T (or U) and C-G instead of an exact nucleotide match.

    Data Types: logical

    Output Arguments

    collapse all

    Starting indices, returned as integers.

    Lengths of the palindromes, returned as integers.

    Array of the palindromes, returned as a cell array.

    Version History

    Introduced before R2006a