A Convenient Class to Store a Codon Coordinate in given Genetic Code cube.
Source:R/allClasses.R
CodonMatrix.Rd
A CodonMatrix is the object created by function codon_matrix
Arguments
- object
A
GRanges-class
object.- group
The name of the base group, 'Z4' or 'Z5'.
- cube
The name of the genetic-code cube applied to get the codon coordinates.
- seq_alias
The 'alias' given to the codon sequence.
See also
base_coord and codon_coord.
Examples
## CodonMatrix is generated by function 'codon_matrix' (inside a
## ListCodonMatrix-class object)
## Let's create DNAStringSet-class object
base <- DNAStringSet(x = c(S1 = 'ACGTGATCAAGT'))
x1 <- codon_matrix(base)
x1
#> ListCodonMatrix object of length: 4
#> Seq.Alias: codon.1 codon.2 codon.3 codon.4 ...
#>
#> -------
#> $codon.1
#> CodonMatrix object with 3 ranges and 1 metadata column:
#> seqnames ranges strand | S1
#> <Rle> <IRanges> <Rle> | <numeric>
#> [1] 1 1-3 + | 0
#> [2] 1 1-3 + | 1
#> [3] 1 1-3 + | 2
#> -------
#> seqinfo: 1 sequence from an unspecified genome; no seqlengths
#>
#>
#> $codon.2
#> CodonMatrix object with 3 ranges and 1 metadata column:
#> seqnames ranges strand | S1
#> <Rle> <IRanges> <Rle> | <numeric>
#> 4 1 4-6 + | 3
#> 5 1 4-6 + | 2
#> 6 1 4-6 + | 0
#> -------
#> seqinfo: 1 sequence from an unspecified genome; no seqlengths
#>
#> ...
#>
#> <2 more CodonMatrix element(s)>
#> Three slots: 'DataList', 'group', 'cube' & 'seq_alias'
#> -------
## Extract the first element
x1[1]
#> ListCodonMatrix object of length: 1
#> Seq.Alias: codon.1 codon.2 codon.3 codon.4
#>
#> -------
#> $codon.1
#> CodonMatrix object with 3 ranges and 1 metadata column:
#> seqnames ranges strand | S1
#> <Rle> <IRanges> <Rle> | <numeric>
#> [1] 1 1-3 + | 0
#> [2] 1 1-3 + | 1
#> [3] 1 1-3 + | 2
#> -------
#> seqinfo: 1 sequence from an unspecified genome; no seqlengths
#> Three slots: 'DataList', 'group', 'cube' & 'seq_alias'
#> -------
x1$codon.1
#> CodonMatrix object with 3 ranges and 1 metadata column:
#> seqnames ranges strand | S1
#> <Rle> <IRanges> <Rle> | <numeric>
#> [1] 1 1-3 + | 0
#> [2] 1 1-3 + | 1
#> [3] 1 1-3 + | 2
#> -------
#> seqinfo: 1 sequence from an unspecified genome; no seqlengths
x1[[1]]
#> CodonMatrix object with 3 ranges and 1 metadata column:
#> seqnames ranges strand | S1
#> <Rle> <IRanges> <Rle> | <numeric>
#> [1] 1 1-3 + | 0
#> [2] 1 1-3 + | 1
#> [3] 1 1-3 + | 2
#> -------
#> seqinfo: 1 sequence from an unspecified genome; no seqlengths