complement {tidysq} | R Documentation |
Create complement sequence from dnasq or rnasq object
Description
Creates the complementary sequence from a given RNA or DNA sequence. The function keeps the type of sequence intact.
Usage
complement(x, ...)
## S3 method for class 'sq_dna_bsc'
complement(x, ..., NA_letter = getOption("tidysq_NA_letter"))
## S3 method for class 'sq_dna_ext'
complement(x, ..., NA_letter = getOption("tidysq_NA_letter"))
## S3 method for class 'sq_rna_bsc'
complement(x, ..., NA_letter = getOption("tidysq_NA_letter"))
## S3 method for class 'sq_rna_ext'
complement(x, ..., NA_letter = getOption("tidysq_NA_letter"))
Arguments
x |
[ |
... |
further arguments to be passed from or to other methods. |
NA_letter |
[ |
Details
This function matches elements of sequence to their complementary letters.
For unambiguous letters, "C
" is matched with "G
" and "A
"
is matched with either "T
" (thymine) or "U
" (uracil), depending
on whether input is of dna or rna type.
Ambiguous letters are matched as well, for example "N
" (any
nucleotide) is matched with itself, while "B
" (not alanine) is matched
with "V
" (not thymine/uracil).
Value
sq
object of the same type as input but
built of nucleotides complementary to those in the entered sequences.
See Also
Functions interpreting sq in biological context:
%has%()
,
find_motifs()
,
translate()
Examples
# Creating DNA and RNA sequences to work on:
sq_dna <- sq(c("ACTGCTG", "CTTAGA", "CCCT", "CTGAATGT"),
alphabet = "dna_bsc")
sq_rna <- sq(c("BRAUDUG", "URKKBKUCA", "ANKRUGBNNG", "YYAUNAAAG"),
alphabet = "rna_ext")
# Here complement() function is used to make PCR (Polymerase Chain Reaction)
# primers. Every sequence is rewritten to its complementary equivalent as
# in the following example: AAATTTGGG -> TTTAAACCC.
complement(sq_dna)
complement(sq_rna)
# Each sequence have now a complementary equivalent, which can be helpful
# during constructing PCR primers.