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

backTranslate

Replace amino acids with codons


Description

Replaces aligned amino acids with their original codon triplets.

Usage

backTranslate(aa.msa, nuc.ffn)

Arguments

aa.msa

A fasta object with a multiple alignment, see msalign.

nuc.ffn

A fasta object with the coding sequences, see readFasta.

Details

This function replaces the aligned amino acids in aa.msa with their original codon triplets. This is possible only when the nucleotide sequences in nuc.ffn are the exact nucleotide sequences behind the protein sequences that are aligned in aa.msa.

It is required that the first token of the Header lines is identical for a protein sequence in aa.msa and its nucleotide version in nuc.ffn, otherwise it is impossible to match them. Thus, they may not appear in the same order in the two input fasta objects.

When aligning coding sequences, one should in general always align their protein sequences, to keep the codon structure, and then use backTranslate to convert this into a nucleotide alignment, if required.

If the nuclotide sequences contain the stop codons, these will be removed.

Value

A fasta object similar to aa.msa, but where each amino acid has been replace by its corresponding codon. All gaps "-" are replaced by triplets "---".

Author(s)

Lars Snipen.

See Also

Examples

msa.file <- file.path(file.path(path.package("microseq"),"extdata"), "small.msa")
aa.msa <- readFasta(msa.file)
nuc.file <- file.path(file.path(path.package("microseq"),"extdata"), "small.ffn")
nuc <- readFasta(nuc.file)
nuc.msa <- backTranslate(aa.msa, nuc)

microseq

Basic Biological Sequence Handling

v2.1.4
GPL-2
Authors
Lars Snipen, Kristian Hovde Liland
Initial release
2021-01-25

We don't support your browser anymore

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