ChaosGameRepresentationCalculator
in package
implements
ChaosGameRepresentationInterface
Migrated from biotools' ChaosGameRepresentationManager, whose computation was tangled with the drawing of the images. The chaos game (Jeffrey, 1990) starts at the centre of a unit square whose corners stand for the bases ; each base moves the point half-way to its corner. The corners are biotools', y growing downward as in an image : C top left (0, 0), G top right (1, 0), A bottom left (0, 1), T bottom right (1, 1). A symbol other than A, C, G or T moves nothing and leaves no point.
The point after the last base of a word depends on that word only (the more recent a base, the coarser the part of the square it fixes), so every oligonucleotide has a place of its own on a 2^k x 2^k grid : its column bit is 1 for G and T, its row bit 1 for A and T, the last base giving the most significant bit. The FCGR (Almeida et al., 2001) shades each cell by the count of its oligonucleotide. The overlapping oligonucleotides are counted ; one holding a symbol other than A, C, G, T is left out. Class ChaosGameRepresentationCalculator
Tags
Table of Contents
Interfaces
- ChaosGameRepresentationInterface
- Interface ChaosGameRepresentationInterface - the computation behind a CGR and an FCGR image, with no drawing : the points of the chaos game, and the counts of the oligonucleotides on their grid.
Constants
- CORNERS : array<string, array{0: float, 1: float}> = ["C" => [0.0, 0.0], "G" => [1.0, 0.0], "A" => [...
- MAX_OLIGO_LENGTH : mixed = 8
Methods
- cell() : array{0: int, 1: int}
- frequencyMatrix() : array<string|int, array<string|int, int>>
- oligoCounts() : array<string, int>
- points() : array<int, array{0: float, 1: float}>
- assertOligoLength() : void
- everyOligo() : array<string|int, string>
Constants
CORNERS
private
array<string, array{0: float, 1: float}>
CORNERS
= ["C" => [0.0, 0.0], "G" => [1.0, 0.0], "A" => [0.0, 1.0], "T" => [1.0, 1.0]]
Each base's corner, [x, y]
MAX_OLIGO_LENGTH
private
mixed
MAX_OLIGO_LENGTH
= 8
Methods
cell()
public
cell(string $sOligo) : array{0: int, 1: int}
Parameters
- $sOligo : string
Tags
Return values
array{0: int, 1: int}frequencyMatrix()
public
frequencyMatrix(DnaSequence $oSequence, int $iOligoLength[, bool $bBothStrands = false ]) : array<string|int, array<string|int, int>>
Parameters
- $oSequence : DnaSequence
- $iOligoLength : int
- $bBothStrands : bool = false
Return values
array<string|int, array<string|int, int>>oligoCounts()
public
oligoCounts(DnaSequence $oSequence, int $iOligoLength[, bool $bBothStrands = false ]) : array<string, int>
Parameters
- $oSequence : DnaSequence
- $iOligoLength : int
- $bBothStrands : bool = false
Tags
Return values
array<string, int>points()
public
points(DnaSequence $oSequence) : array<int, array{0: float, 1: float}>
Parameters
- $oSequence : DnaSequence
Return values
array<int, array{0: float, 1: float}>assertOligoLength()
private
assertOligoLength(int $iOligoLength) : void
Parameters
- $iOligoLength : int
Tags
everyOligo()
private
everyOligo(int $iLength) : array<string|int, string>
Parameters
- $iLength : int
Return values
array<string|int, string> —Every word of A, C, G, T of that length