Learn R Programming

seqinr (version 1.0-6)

comp: complements a nucleic acid sequence

Description

Complements a sequence, for instance if the sequence is "a","c","g","t" it returns "t","g","c","a". All other values will return NA. This is not the reverse complementary strand.

Usage

comp(seq)

Arguments

seq
a vector of chars

Value

  • a vector of characters which is the complement of the sequence.

References

citation("seqinr")

See Also

Because ssDNA sequences are always written in the 5'->3' direction, use rev(comp(seq)) to get the reverse complementary strand (see rev).

Examples

Run this code
##
## Show that comp() does not return the reverve complementary strand:
##
c2s(comp(s2c("aaaattttggggcccc")))
##
## Show how to get the reverse complementary strand:
##
c2s(rev(comp(s2c("aaaattttggggcccc"))))
##
## Show what's happen with non allowed values:
##
c2s(rev(comp(s2c("aaaaXttttYggggZcccc"))))

Run the code above in your browser using DataLab