Skip to contents

This function takes a single argument, a DNA sequence as a character string, and counts the number of A's, C's, G's, and T's in the sequence. The counts are returned as a named vector.

Usage

count_bases(sequence)

Arguments

sequence

a character string containing a DNA sequence

Value

a named integer vector containing the counts of A's, C's, G's, and T's

Examples

sequence <- "ATCGAGCTAGCTAGCTAGCTAGCT"
count_bases(sequence)
#> A C G T 
#> 6 6 6 6 
# A  C  G  T
# 6  6  6  6