alphabetFrequency {Biostrings}R Documentation

Function to calculate the frequency of letters in a biological sequence

Description

This function calculates the frequency of each letter in the (base) alphabet for a biological sequence.

Usage

  alphabetFrequency(x, baseOnly=TRUE)

Arguments

x A BString, DNAString, RNAString or BStringViews object.
baseOnly TRUE or FALSE. If TRUE, the returned vector only contains frequencies for the letters in the "base" alphabet + the gap symbol i.e. "A", "C", "G", "T" + "-" when x is a DNAString object (or a BStringViews object with a DNAString subject), and "U", "G", "C", "A" + "-" when x is a RNAString object (or a BStringViews object with a RNAString subject). When x is a BString object (or a BStringViews object with a BString subject), then the baseOnly argument is ignored.

Value

An integer vector. If x is a DNAString or RNAString object (or a BStringViews object with a DNAString or RNAString subject), then the returned vector is named with the letters in the alphabet. If the baseOnly argument is TRUE, then the returned vector has an extra element named 'other'. If x is a BStringViews object, then the returned vector contains the cumulated frequencies found in each view.

Author(s)

H. Pages

See Also

BString, DNAString, RNAString, BStringViews

Examples

  data(yeastSEQCHR1)
  yeast1 <- DNAString(yeastSEQCHR1)
  alphabetFrequency(yeast1)
  alphabetFrequency(yeast1, baseOnly=FALSE)

[Package Biostrings version 2.0.3 Index]