DnaSequence
extends AbstractNucleicSequence
in package
Accepts the four deoxyribonucleotides and the IUPAC degenerated symbols already tolerated by SequenceTrait::cleanSequence().
Class DnaSequence
Tags
Table of Contents
Constants
- ALPHABET : mixed = "ACGTMRWSYKVHDBXN"
- COMPLEMENTS : mixed = ["A" => "T", "C" => "G", "G" => "C", "T" => "A"...
- Complement of each symbol of the alphabet, overridden by each concrete class.
- MOL_TYPE : mixed = "DNA"
Methods
- __construct() : mixed
- AbstractMolecularSequence constructor.
- __toString() : string
- Allows the value object to be used wherever the library still expects a raw string.
- complement() : static
- Returns the genetic complement of the sequence, degenerated symbols included.
- countSymbol() : int
- Counts how many times a symbol occurs in the sequence.
- equals() : bool
- Two value objects are equal when they are of the same kind and hold the same symbols.
- getAlphabet() : string
- The symbols accepted by this kind of sequence.
- getGcContent() : float
- Proportion of guanine and cytosine in the sequence, expressed as a percentage. The degenerated symbol S, which stands for G or C, is counted as well.
- getLength() : int
- Number of symbols held by the sequence.
- getMolType() : string
- The molecule type, as used by SequenceManager (DNA, RNA, PROTEIN).
- getValue() : string
- The wrapped sequence, normalized.
- isEmpty() : bool
- isValid() : bool
- Tells whether every symbol of a string belongs to the alphabet of the value object, without building an instance.
- reverse() : static
- Returns the sequence read from the last symbol to the first one.
- reverseComplement() : static
- Returns the complement of the sequence read backwards, which is the strand facing it.
- subSequence() : static
- Extracts a portion of the sequence, keeping the same kind of value object.
- toRna() : RnaSequence
- Transcribes the sequence, thymine becoming uracil.
Constants
ALPHABET
protected
mixed
ALPHABET
= "ACGTMRWSYKVHDBXN"
Tags
COMPLEMENTS
Complement of each symbol of the alphabet, overridden by each concrete class.
protected
mixed
COMPLEMENTS
= ["A" => "T", "C" => "G", "G" => "C", "T" => "A", "M" => "K", "R" => "Y", "W" => "W", "S" => "S", "Y" => "R", "K" => "M", "V" => "B", "H" => "D", "D" => "H", "B" => "V", "X" => "X", "N" => "N"]
Tags
MOL_TYPE
protected
mixed
MOL_TYPE
= "DNA"
Tags
Methods
__construct()
AbstractMolecularSequence constructor.
public
__construct(string $sSequence) : mixed
Whitespace is stripped and the remaining symbols are upper-cased before validation, so raw lines coming from a GenBank, EMBL or FASTA file can be wrapped as they are read.
Parameters
- $sSequence : string
-
The raw sequence string
Tags
__toString()
Allows the value object to be used wherever the library still expects a raw string.
public
__toString() : string
Return values
stringcomplement()
Returns the genetic complement of the sequence, degenerated symbols included.
public
complement() : static
Tags
Return values
staticcountSymbol()
Counts how many times a symbol occurs in the sequence.
public
countSymbol(string $sSymbol) : int
Parameters
- $sSymbol : string
-
A single symbol, case insensitive
Return values
intequals()
Two value objects are equal when they are of the same kind and hold the same symbols.
public
equals(AbstractMolecularSequence $oOther) : bool
Parameters
- $oOther : AbstractMolecularSequence
Return values
boolgetAlphabet()
The symbols accepted by this kind of sequence.
public
getAlphabet() : string
Return values
stringgetGcContent()
Proportion of guanine and cytosine in the sequence, expressed as a percentage. The degenerated symbol S, which stands for G or C, is counted as well.
public
getGcContent() : float
Return values
float —0 when the sequence is empty
getLength()
Number of symbols held by the sequence.
public
getLength() : int
Return values
intgetMolType()
The molecule type, as used by SequenceManager (DNA, RNA, PROTEIN).
public
getMolType() : string
Return values
stringgetValue()
The wrapped sequence, normalized.
public
getValue() : string
Return values
stringisEmpty()
public
isEmpty() : bool
Return values
boolisValid()
Tells whether every symbol of a string belongs to the alphabet of the value object, without building an instance.
public
static isValid(string $sSequence) : bool
Parameters
- $sSequence : string
Return values
boolreverse()
Returns the sequence read from the last symbol to the first one.
public
reverse() : static
Tags
Return values
staticreverseComplement()
Returns the complement of the sequence read backwards, which is the strand facing it.
public
reverseComplement() : static
Tags
Return values
staticsubSequence()
Extracts a portion of the sequence, keeping the same kind of value object.
public
subSequence(int $iStart[, int|null $iLength = null ]) : static
Parameters
- $iStart : int
-
Zero-based position of the first symbol
- $iLength : int|null = null
-
Number of symbols, until the end when omitted
Tags
Return values
statictoRna()
Transcribes the sequence, thymine becoming uracil.
public
toRna() : RnaSequence