Learn R Programming

microseq (version 1.2)

amplicon: Primer matching

Description

Extracts subsequences from DNA that matches a specified primer pair.

Usage

amplicon(dna, forward, reverse)

Arguments

dna
Character vector containing the DNA sequences.
forward
String specifying the forward primer.
reverse
String specifying the reverse primer.

Value

A list with the same number of elements as the argument dna. Each list element contains a string vector with all amplicons resulting from the primer matching. If there is no primer pair match the corresponding string vector is empty.

Details

An amplicon is a subsequence limited by a matching pair of short oligos, called primers.

The forward primer is a short DNA sequence in the 5' to 3' direction. This can match on both strands of the dna sequence. The reverse primer is also a short DNA sequence in 5' to 3' direction, and can also match on both strands of dna.

For a dna sequence to produce an amplicon there must be an exact match of the forward on one strand followed by an exact match of the reverse on the other strand. The amplicon is the subsequence starting with the forward and ending with the reverse primer.

Both primers may contain ambiguity symbols according to the IUPAC standard. Primers are matched by gregexpr, which will not register self-overlapping matches. In case of multiple (non-overlapping) matches, this function will return all possible amplicons resulting from the primer matching.

Examples

Run this code
ex.file <- file.path(file.path(path.package("microseq"),"extdata"),"small.fasta")
fdta <- readFasta(ex.file)
amp.lst.1 <- amplicon( fdta$Sequence, forward="AAATTC", reverse="CCAGA" )
amp.lst.2 <- amplicon( fdta$Sequence, forward="AANNTC", reverse="CCNGT" ) # more matches due to N's

Run the code above in your browser using DataLab