matchLRPatterns {Biostrings}R Documentation

Find patterns defined by a left and a right part in a sequence

Description

Usage

  matchLRPatterns(Lpattern, Rpattern, max.ngaps, subject, Lmismatch=0, Rmismatch=0,
                  Lfixed=TRUE, Rfixed=TRUE)

Arguments

Lpattern The left part of the pattern.
Rpattern The right part of the pattern.
max.ngaps The max number of gaps in the middle i.e the max distance between the left and right parts of the pattern.
subject A BString (or derived) object containing the target sequence.
Lmismatch The number of mismatches allowed for the left part of the pattern. If non-zero, a fuzzy string searching algorithm is used for matching (see the matchPattern function for more information).
Rmismatch Same as Lmismatch but for the right part of the pattern.
Lfixed Only with a DNAString or RNAString subject can a Lfixed value other than the default (TRUE) be used.
With Lfixed=FALSE, ambiguities (i.e. letters from the IUPAC Extended Genetic Alphabet (see IUPAC_CODE_MAP) that are not from the base alphabet) in the left pattern _and_ in the subject are interpreted as wildcards i.e. they match any letter that they stand for.
See the fixed argument of the matchPattern function for more information.
Rfixed Same as Lfixed but for the right part of the pattern.

Details

Value

A BStringViews object containing all the matches, even when they are overlapping (see the examples below), and where the matches are ordered from left to right (i.e. by ascending starting position).

Author(s)

H. Pages

See Also

matchPattern, matchProbePair, findPalindromes, reverseComplement, BStringViews

Examples

  library(BSgenome.Dmelanogaster.FlyBase.r51)
  subject <- Dmelanogaster[["3R"]]
  Lpattern <- "AGCTCCGAG"
  Rpattern <- "TTGTTCACA"
  matchLRPatterns(Lpattern, Rpattern, 500, subject) # 1 match

  ## Note that matchLRPatterns() will return all matches, even when they are
  ## overlapping:
  subject <- DNAString("AAATTAACCCTT")
  matchLRPatterns("AA", "TT", 0, subject) # 1 match
  matchLRPatterns("AA", "TT", 1, subject) # 2 matches
  matchLRPatterns("AA", "TT", 3, subject) # 3 matches
  matchLRPatterns("AA", "TT", 7, subject) # 4 matches

[Package Biostrings version 2.6.6 Index]