isolate_amplicon {LocaTT} | R Documentation |
Trim DNA Sequences to an Amplicon Region Using Forward and Reverse Primer Sequences
Description
Trims DNA sequences to an amplicon region using forward and reverse primer sequences. Ambiguous nucleotides in forward and reverse primers are supported.
Usage
isolate_amplicon(sequences, forward_primer, reverse_primer)
Arguments
sequences |
A character vector of DNA sequences to trim to the amplicon region. |
forward_primer |
A string specifying the forward primer sequence. Can contain ambiguous nucleotides. |
reverse_primer |
A string specifying the reverse primer sequence. Can contain ambiguous nucletodies. |
Details
For each DNA sequence, nucleotides matching and preceding the forward primer are removed, and nucleotides matching and following the reverse complement of the reverse primer are removed. The reverse complement of the reverse primer is internally derived from the reverse primer using the reverse_complement
function. Ambiguous nucleotides in primers (i.e., the forward and reverse primer arguments) are supported through the internal use of the substitute_wildcards
function on the forward primer and the reverse complement of the reverse primer, and primer regions in DNA sequences are located using regular expressions. Trimming will fail for DNA sequences which contain ambiguous nucleotides in their primer regions (e.g., Ns), resulting in NA
s for those sequences.
Value
A character vector of DNA sequences trimmed to the amplicon region. NA
s are returned for DNA sequences which could not be trimmed, which occurs when either primer region is missing from the DNA sequence or when the forward primer region occurs after a region matching the reverse complement of the reverse primer.
Examples
isolate_amplicon(sequences=c("ACACAATCGTGTTTATATTAACTTCAAGAGTGGGCATAGG",
"CGTGACAATCATGTTTGTGATTCGTACAAAAGTGCGTCCT"),
forward_primer="AATCRTGTTT",
reverse_primer="CSCACTHTTG")