\Amelaye\BioPHP\Domain\Sequence\ValueObject AbstractNucleicSequence

Holds what DNA and RNA have in common : a complement table covering the IUPAC degenerated symbols, and the GC content.

Class AbstractNucleicSequence

Summary

Methods
Properties
Constants
complement
reverseComplement
getGcContent
__construct
getValue
__toString
getMolType
getAlphabet
getLength
isEmpty
equals
subSequence
reverse
countSymbol
isValid
No public properties found
No public constants found
No protected methods found
No protected properties found
COMPLEMENTS
ALPHABET
MOL_TYPE
No private methods found
No private properties found
No private constants found

Constant

COMPLEMENTS

COMPLEMENTS = []

Complement of each symbol of the alphabet, overridden by each concrete class.

ALPHABET

ALPHABET = ""

Symbols accepted by the value object, overridden by each concrete class.

MOL_TYPE

MOL_TYPE = ""

Molecule type of the value object, overridden by each concrete class.

Methods

complement()

complement() : static

Returns the genetic complement of the sequence, degenerated symbols included.

Throws

\Amelaye\BioPHP\Domain\Sequence\ValueObject\InvalidSequenceException

Returns

static —

reverseComplement()

reverseComplement() : static

Returns the complement of the sequence read backwards, which is the strand facing it.

Throws

\Amelaye\BioPHP\Domain\Sequence\ValueObject\InvalidSequenceException

Returns

static —

getGcContent()

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.

Returns

float —

0 when the sequence is empty

__construct()

__construct(string  $sSequence) : mixed

AbstractMolecularSequence constructor.

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

string $sSequence

The raw sequence string

Throws

\Amelaye\BioPHP\Domain\Sequence\ValueObject\InvalidSequenceException

When a symbol does not belong to the alphabet

Returns

mixed —

getValue()

getValue() : string

The wrapped sequence, normalized.

Returns

string —

__toString()

__toString() : string

Allows the value object to be used wherever the library still expects a raw string.

Returns

string —

getMolType()

getMolType() : string

The molecule type, as used by SequenceManager (DNA, RNA, PROTEIN).

Returns

string —

getAlphabet()

getAlphabet() : string

The symbols accepted by this kind of sequence.

Returns

string —

getLength()

getLength() : int

Number of symbols held by the sequence.

Returns

int —

isEmpty()

isEmpty() : bool

Returns

bool —

equals()

equals(\Amelaye\BioPHP\Domain\Sequence\ValueObject\AbstractMolecularSequence  $oOther) : bool

Two value objects are equal when they are of the same kind and hold the same symbols.

Parameters

\Amelaye\BioPHP\Domain\Sequence\ValueObject\AbstractMolecularSequence $oOther

Returns

bool —

subSequence()

subSequence(int  $iStart, int|null  $iLength = null) : static

Extracts a portion of the sequence, keeping the same kind of value object.

Parameters

int $iStart

Zero-based position of the first symbol

int|null $iLength

Number of symbols, until the end when omitted

Throws

\Amelaye\BioPHP\Domain\Sequence\ValueObject\InvalidSequenceException

Returns

static —

reverse()

reverse() : static

Returns the sequence read from the last symbol to the first one.

Throws

\Amelaye\BioPHP\Domain\Sequence\ValueObject\InvalidSequenceException

Returns

static —

countSymbol()

countSymbol(string  $sSymbol) : int

Counts how many times a symbol occurs in the sequence.

Parameters

string $sSymbol

A single symbol, case insensitive

Returns

int —

isValid()

isValid(string  $sSequence) : bool

Tells whether every symbol of a string belongs to the alphabet of the value object, without building an instance.

Parameters

string $sSequence

Returns

bool —