base2codon: Split a DNA sequence into codons

base2codonR Documentation

Split a DNA sequence into codons

Description

This function split a DNA sequence into a codon sequence.

Usage

base2codon(x, ...)

## S4 method for signature 'character'
base2codon(x)

## S4 method for signature 'DNAStringSet'
base2codon(x)

## S4 method for signature 'DNAMultipleAlignment'
base2codon(x)

Arguments

x

A character string, DNAStringSet-class or DNAMultipleAlignment-class object carrying the a DNA sequence.

...

Not in use.

Details

It is expected that the provided DNA sequence is multiple of 3, otherwise gaps are added to the end of the sequence.

Value

If the argument of 'x' is character string, then a character vector of codons will returned. If the argument of 'x' is DNAStringSet-class or DNAMultipleAlignment-class object, then a matrix of codons is returned.

Author(s)

Robersy Sanchez https://genomaths.com. 01/15/2022

Examples


## Gaps are added at the sequence end.
seq <- c("ACCT")
base2codon(x = seq)

## This DNA sequence is multiple of 3
seq <- c("ACCTCA")
base2codon(x = seq)

## Load a DNAStringSet. A matrix of codons is returned
data("aln", package = "GenomAutomorphism")
base2codon(x = aln)


genomaths/GenomAutomorphism documentation built on May 10, 2024, 12:11 a.m.