Documentation

CircularDnaSequence extends DnaSequence

FinalYes

A DNA sequence with no first or last symbol : position 0 follows the last symbol, so rotating and slicing must be able to cross that origin. All the methods below are zero-based, consistently with AbstractMolecularSequence::subSequence(). Extracting a piece, with sliceCircular() across the origin or with subSequence() within it, yields a plain, linear DnaSequence : a fragment cut out of a circular molecule is no longer circular, and may be empty.

Class CircularDnaSequence

Tags
author

Amélie DUVERNET aka Amelaye amelieonline@gmail.com

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
CircularDnaSequence 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.
gcFraction()  : float
Proportion of strong bases (G, C, and S standing for either) among the bases known to be strong or weak (A, T, U, W and those) : an N, or any other ambiguity code mixing both, tells nothing about it and is left out of the count, as Biopython's gc_fraction does by default.
getAlphabet()  : string
The symbols accepted by this kind of sequence.
getGcContent()  : float
Proportion of guanine and cytosine in the sequence, expressed as a percentage : see gcFraction().
getGcFraction()  : float
getGcPercent()  : float
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.
positionModulo()  : int
Brings a zero-based position back within [0, length[, wrapping around the origin as many times as needed. A position equal to the length, or a negative one, is therefore always valid.
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.
rotateTo()  : self
Returns the same circular molecule read starting from a different zero-based origin. Rotating by zero or by a multiple of the sequence length yields a sequence with the same symbols.
sliceCircular()  : DnaSequence
Extracts a linear fragment of the circular molecule, wrapping past the origin when the slice reaches the last symbol before covering its whole requested length.
subSequence()  : DnaSequence
Extracts a portion of the molecule as written from its origin, without crossing it (see sliceCircular() to cross it). It used to be a CircularDnaSequence, as if the piece were closed into a ring of its own, and an empty piece threw.
toRna()  : RnaSequence
Transcribes the sequence, thymine becoming uracil.

Constants

ALPHABET

protected mixed ALPHABET = "ACGTMRWSYKVHDBXN"
Tags
inheritDoc

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
inheritDoc

MOL_TYPE

protected mixed MOL_TYPE = "DNA"
Tags
inheritDoc

Methods

__construct()

CircularDnaSequence constructor.

public __construct(string $sSequence) : mixed
Parameters
$sSequence : string

The raw sequence string, must not be empty once normalized

Tags
throws
InvalidSequenceException

When a symbol does not belong to the alphabet, or the sequence is empty

__toString()

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

public __toString() : string
Return values
string

countSymbol()

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
int

gcFraction()

Proportion of strong bases (G, C, and S standing for either) among the bases known to be strong or weak (A, T, U, W and those) : an N, or any other ambiguity code mixing both, tells nothing about it and is left out of the count, as Biopython's gc_fraction does by default.

public static gcFraction(string $sSequence) : float

"GCNN" gives 1, "GCSW" 0.75. The one definition every GC content of this library uses.

Parameters
$sSequence : string

Either case

Return values
float —

Between 0 and 1 ; 0 when no base tells G/C from A/T

getAlphabet()

The symbols accepted by this kind of sequence.

public getAlphabet() : string
Return values
string

getGcContent()

Proportion of guanine and cytosine in the sequence, expressed as a percentage : see gcFraction().

public getGcContent() : float

Beware that SkewResult::getGcContent() and CpGIsland::getGcContent() give a fraction (0 to 1) : getGcPercent() and getGcFraction() say which scale they use, on all of these classes.

Return values
float —

0 when the sequence holds no base telling G/C from A/T

getGcFraction()

public getGcFraction() : float
Return values
float —

The G+C content as a fraction, 0 to 1

getGcPercent()

public getGcPercent() : float
Return values
float —

The G+C content as a percentage, 0 to 100

getMolType()

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

public getMolType() : string
Return values
string

isValid()

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
bool

positionModulo()

Brings a zero-based position back within [0, length[, wrapping around the origin as many times as needed. A position equal to the length, or a negative one, is therefore always valid.

public positionModulo(int $iPosition) : int
Parameters
$iPosition : int

Any zero-based position, may be negative or oversized

Return values
int —

The equivalent position within [0, length[

rotateTo()

Returns the same circular molecule read starting from a different zero-based origin. Rotating by zero or by a multiple of the sequence length yields a sequence with the same symbols.

public rotateTo(int $iPosition) : self
Parameters
$iPosition : int

Zero-based position of the new origin

Tags
throws
InvalidSequenceException
Return values
self

sliceCircular()

Extracts a linear fragment of the circular molecule, wrapping past the origin when the slice reaches the last symbol before covering its whole requested length.

public sliceCircular(int $iStart, int $iLength) : DnaSequence
Parameters
$iStart : int

Zero-based position of the first symbol, may be negative or oversized, normalized with positionModulo()

$iLength : int

Number of symbols to extract, at most the sequence length

Tags
throws
InvalidSequenceException

When $iLength is negative or exceeds the sequence length

Return values
DnaSequence —

A linear fragment, not a circular one

subSequence()

Extracts a portion of the molecule as written from its origin, without crossing it (see sliceCircular() to cross it). It used to be a CircularDnaSequence, as if the piece were closed into a ring of its own, and an empty piece threw.

public subSequence(int $iStart[, int|null $iLength = null ]) : DnaSequence
Parameters
$iStart : int

Zero-based position of the first symbol

$iLength : int|null = null

Number of symbols, until the end when omitted

Tags
throws
InvalidSequenceException
Return values
DnaSequence —

A linear fragment

On this page

Search results