dna2codonDT | R Documentation |
Convert a DNA coding sequence into a data.table of codons, nucleotide indexes, DNA triplet sequences, and amino acids. If provided with coding sequences split into exons, these will also be incorporated into the table.
dna2codonDT(dnaSeq, type, compressTab = FALSE, geneticCode = 1)
dnaSeq |
Character: For a coding sequence (e.g., cDNA transcript), a single
character vector. For a group of exons, a list of character vectors.
See argument |
type |
Character: one of |
compressTab |
Logical: Should the table be compressed? Default is TRUE, in which case, each row is a unique codon. If FALSE, then each codon is represented by 3 rows, one for each nucleotide comprising the codon. |
geneticCode |
Integer: A value relating to the |
The argument type
dictates what to pass to the argument
dnaSeq
. If you want to translate a coding sequence (cDNA transcript),
then type=='cds'
and dnaSeq
must recieve a single character,
the DNA sequence.
If you want to translate a series of exons, then type='exon'
and
dnaSeq
must receive a list, where each indexed item in the list is
a character vector, the DNA exon sequence. Note, it is assumed that the
exon sequences are ordered correctly, from first to last.
For both cases, the function assumes that the sequence is in the correct reading frame.
Returns a data.table with the following columns when compressTab==TRUE
:
$CODON
= The codon number, 1:N.
$NUC.GENE
= The nucleotides positions comprising the codon, from
1 to the gene's length.
$DNA
= The DNA bases.
$AMINO
= The amino acid residue.
$EXON
= The exon number, but only when type=='exon'
.
Otherwise, if compressTab==FALSE
:
$CODON
= The codon number, 1:N.
$NUC.GENE
= The nucleotides position within the gene, from
from 1 to the gene's length.
$NUC.CODON
= The nucleotides positions within the codon, from
1 to 3.
$DNA
= The DNA bases.
$AMINO
= The amino acid residue.
$EXON
= The exon number, but only when type=='exon'
.
X <- 'ATGCGTACTTCA'
dna2codonDT(X, compressTab=TRUE)
dna2codonDT(X, compressTab=FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.