Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

words

To get all words from an alphabet.


Description

Generates a vectors of all the words from a given alphabet, with right positions varying faster, for instance if the alphabet is (c("0","1") and the length is 2 you will obtain c("00", "01", "10", "11")

Usage

words(length = 3, alphabet = s2c("acgt"))

Arguments

length

the number of characters in the words

alphabet

a vector of characters

Value

A vector of string whith length characters.

Author(s)

J.R. Lobry

References

citation("seqinr")

See Also

Examples

#
# Get all 64 codons:
#
stopifnot(all(words() ==
c("aaa", "aac", "aag", "aat", "aca", "acc", "acg", "act", "aga", "agc", "agg", 
   "agt", "ata", "atc", "atg", "att","caa", "cac", "cag", "cat", "cca", "ccc", 
   "ccg", "cct", "cga", "cgc", "cgg", "cgt", "cta", "ctc", "ctg", "ctt", "gaa",
   "gac", "gag", "gat", "gca", "gcc", "gcg", "gct", "gga", "ggc", "ggg", "ggt", 
   "gta", "gtc", "gtg", "gtt", "taa", "tac", "tag", "tat", "tca", "tcc", "tcg", 
   "tct", "tga", "tgc", "tgg", "tgt", "tta", "ttc", "ttg", "ttt")))
#
# Get all codons with u c a g for bases:
#
words(alphabet = s2c("ucag"))
#
# Get all tetranucleotides:
#
words(length = 4)
#
# Get all dipeptides:
#
words(length = 2, alphabet = a()[-1])

seqinr

Biological Sequences Retrieval and Analysis

v4.2-16
GPL (>= 2)
Authors
Delphine Charif [aut], Olivier Clerc [ctb], Carolin Frank [ctb], Jean R. Lobry [aut, cph], Anamaria Necşulea [ctb], Leonor Palmeira [ctb], Simon Penel [cre], Guy Perrière [ctb]
Initial release
2022-05-19

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.