[R] counting number of "G" in "TCGGGGGACAATCGGTAACCCGTCT"

Patrick Aboyoun paboyoun at fhcrc.org
Tue Jul 15 18:29:30 CEST 2008


Henrik,
As Wolfgang mentioned, the Biostrings package in Bioconductor has a 
number of sequence manipulation functions. The alphabetFrequency 
function would get you what you need.

 > library(Biostrings)
 > alphabetFrequency(DNAString("TCGGGGGACAATCGGTAACCCGTCT"))
A C G T M R W S Y K V H D B N - +
5 7 8 5 0 0 0 0 0 0 0 0 0 0 0 0 0
 > alphabetFrequency(DNAString("TCGGGGGACAATCGGTAACCCGTCT"), baseOnly = 
TRUE)
    A     C     G     T other
    5     7     8     5     0


Patrick


Wolfgang Huber wrote:
> Hi,
>
> And the Bioconductor package "Biostrings" is the place to go for any
> serious work with sequences.
>



More information about the R-help mailing list