findPalindromes          package:Biostrings          R Documentation

_S_e_a_r_c_h_i_n_g _a _s_e_q_u_e_n_c_e _f_o_r _p_a_l_i_n_d_r_o_m_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     The 'findPalindromes' function finds palindromic substrings in a
     subject string. The palindromes that can be searched for are
     either strict palindromes or 2-arm palindromes (the former being a
     particular case of the latter). With a DNAString or RNAString
     subject, they can also be antipalindromes i.e. the 2 arms are
     reverse-complementary sequences.

_U_s_a_g_e:

       findPalindromes(subject, min.armlength=4, max.ngaps=1, anti=NULL)
       palindromeArmLength(x, anti=NULL, ...)
       palindromeLeftArm(x, anti=NULL, ...)
       palindromeRightArm(x, anti=NULL, ...)

_A_r_g_u_m_e_n_t_s:

 subject: A BString (or derived) object containing the subject string,
          or a BStringViews object. 

min.armlength: An integer giving the minimum length of the arms of the
          palindromes (or antipalindromes) to search for. 

max.ngaps: An integer giving the maximum length of the sequence
          separating the 2 arms of the palindromes (or antipalindromes)
          to search for. Note that by default ('max.ngaps=1'),
          'findPalindromes' will search for strict palindromes (or
          antipalindromes) only. 

    anti: Either 'NULL', 'TRUE' or 'FALSE'. Values 'anti=TRUE' or
          'anti=FALSE' can only be used with a DNAString or RNAString
          subject to specify wether or not the substrings to search for
          must be antipalindromes. By default ('anti=NULL'),
          antipalindromes are searched for. 

       x: A BString (or derived) object containing a 2-arm palindrome
          or antipalindrome, or a BStringViews object containing a set
          of 2-arm palindromes or antipalindromes. 

     ...: Additional arguments to be passed to or from methods. 

_D_e_t_a_i_l_s:

_V_a_l_u_e:

     'findPalindromes' returns a BStringViews object containing all
     palindromes (or antipalindromes) found in 'subject' (one view per
     palindromic substring found).

     'palindromeArmLength' returns the arm length (integer) of the
     2-arm palindrome or antipalindrome 'x'. It will raise an error if
     'x' has no arms. Note that any sequence could be considered a
     2-arm palindrome if we were OK with arms of length 0 but we are
     not: 'x' must have arms of length greater or equal to 1 in order
     to be considered a 2-arm palindrome. The same apply to 2-arm
     antipalindromes. When applied to a BStringViews object 'x',
     'palindromeArmLength' behaves in a vectorized fashion by returning
     an integer vector of the same length as 'x'.

     'palindromeLeftArm' returns an object of the same class as the
     original object 'x' and containing the left arm of 'x'.

     'palindromeRightArm' does the same as 'palindromeLeftArm' but on
     the right arm of 'x'.

     Like 'palindromeArmLength', both 'palindromeLeftArm' and
     'palindromeRightArm' will raise an error if 'x' has no arms. Also,
     when applied to a BStringViews object 'x', both behave in a
     vectorized fashion by returning a BStringViews object of the same
     length as 'x'.

_A_u_t_h_o_r(_s):

     H. Pages

_S_e_e _A_l_s_o:

     'matchPattern', 'matchLRPatterns', 'matchProbePair', 'mask',
     BStringViews-class, DNAString-class

_E_x_a_m_p_l_e_s:

       ## Note that palindromes can be nested
       findPalindromes(DNAString("ACGTTNAACGT-ACGTTNAACGT"))

       ## A real use case
       library(BSgenome.Dmelanogaster.FlyBase.r51)
       chrX <- Dmelanogaster[["X"]]
       noN_chrX <- mask(chrX, "N")
       chrX_pals <- findPalindromes(noN_chrX, min.armlength=50, max.ngaps=20)
       palindromeArmLength(chrX_pals) # 251

       ## Of course, whitespaces matter
       palindromeArmLength(BString("was it a car or a cat I saw"))

       ## Note that the 2 arms of a strict palindrome (or antipalindrome) are equal
       ## to the full sequence.
       palindromeLeftArm(BString("Delia saw I was aileD"))
       palindromeLeftArm(DNAString("N-ACGTT-AACGT-N"))
       palindromeLeftArm(DNAString("N-AAA-N-N-TTT-N"), anti=FALSE)

