\Amelaye\BioPHP\Domain\Sequence\ServiceSequenceAlignmentManager

Represents the result of an alignment performed by various third-party software such as ClustalW. The alignment is usually found in a file that uses a particular format. Right now, my code supports only FASTA and CLUSTAL formats.

Properties and methods allow users to perform post-alignment operations, manipulations, etc.

Summary

Methods
Properties
Constants
__construct()
getSeqSet()
setFilename()
setFormat()
parseClustal()
parseFasta()
parseFile()
sortAlpha()
getMaxiLength()
getGapCount()
getIsFlush()
charAtRes()
substrBwRes()
colToRes()
resToCol()
subalign()
select()
resVar()
consensus()
addSequence()
deleteSequence()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
validationRes()
calcMaxPercent()
$sequenceManager
$aAlphabet
$iLength
$iGapCount
$aSeqSet
$bFlush
$sFilename
$sFormat
N/A

Properties

$sequenceManager

$sequenceManager : \Amelaye\BioPHP\Domain\Sequence\Service\SequenceManager

Dependency injection for the Sequences Services

Type

normal

$aAlphabet

$aAlphabet : array

Letters of the alphabet

Type

normal

$iLength

$iLength : int

The length of the longest sequence in the alignment set.

Type

normal

$iGapCount

$iGapCount : int

The total number of gaps ("-") in all sequences in the alignment set.

Type

normal

$aSeqSet

$aSeqSet : \ArrayIterator

An array containing all the sequences in the alignment set.

As ArrayIterator I dropped the former next(), prev(), fetch(), last(), first() functions, easy pieceeeee <3

Type

\ArrayIterator

$bFlush

$bFlush : bool

A boolean or logical value: TRUE if all the sequences in the alignment have the same length, FALSE otherwise.

Type

normal

$sFilename

$sFilename : string

Filename of the original parsed file.

Type

normal

$sFormat

$sFormat : string

Format of the original parsed file.

Type

normal

Methods

__construct()

__construct(\Amelaye\BioPHP\Domain\Sequence\Builder\SequenceBuilder  $sequenceManager) : mixed

SequenceAlignmentManager constructor.

Parameters

\Amelaye\BioPHP\Domain\Sequence\Builder\SequenceBuilder $sequenceManager

Returns

mixed

getSeqSet()

getSeqSet() : \ArrayIterator

The sequences array ... then you can rewind(), next(), prev() on it

Returns

\ArrayIterator

setFilename()

setFilename(string  $sFilename) : mixed

Sets a specific filename : the file to parse

Parameters

string $sFilename

Returns

mixed

setFormat()

setFormat(string  $sFormat) : mixed

Sets a specific format : FASTA or CLUSTAL

Parameters

string $sFormat

Returns

mixed

parseClustal()

parseClustal() : mixed

Parses Clustal Files and create Sequence object

Throws

\Exception

Returns

mixed

parseFasta()

parseFasta() : mixed

Parses Fasta Files and create Sequence object

Throws

\Exception

Returns

mixed

parseFile()

parseFile() : mixed

Main method - Parses FASTA or CLUSTAL file This "fetches" all sequences into the $aSeqSet property of the service.

Returns

mixed

sortAlpha()

sortAlpha(string  $sOption = "ASC") : mixed

Rearranges the sequences in an alignment set alphabetically by their sequence id.

In addition, you can specify if you wish it be in ascending or descending order via $sOption. The sOption accepts either "ASC" or "DESC" in whatever case (uppercase, lowercase, mixed case). This determines the sort order of the alignment set.

Parameters

string $sOption

ASCendant or DESCendant

Throws

\Exception

Returns

mixed

getMaxiLength()

getMaxiLength() : int

Returns the length of the longest sequence in an alignment set.

Throws

\Exception

Returns

int

getGapCount()

getGapCount() : int

Counts the number of gaps ("-") found in all sequences in an alignment set.

Throws

\Exception

Returns

int —

The number of "gap characters" in the all sequences in the alignment set.

getIsFlush()

getIsFlush() : bool

Tests if all the sequences in an alignment set have the same length.

Throws

\Exception

Returns

bool

charAtRes()

charAtRes(int  $iSeqIdx, int  $iRes) : bool

Returns the character found at a given residue number in a given sequence.

Parameters

int $iSeqIdx

Index of the sequence in the array

int $iRes

The residue number of the character we wish to get or extract

Throws

\Exception

Returns

bool —

| string A single character representing an amino acid residue or a "gap".

substrBwRes()

substrBwRes(int  $iSeqIdx, int  $iResStart, int  $iResEnd) : string

Gets the substring between two residues in a sequence that is part of an alignment set.

Parameters

int $iSeqIdx

Index of the sequence in the array

int $iResStart

Start of the subsequence

int $iResEnd

End of the subsequence

Throws

\Exception

Returns

string —

| boolean A substring within the specified sequence.

colToRes()

colToRes(int  $iSeqIdx, int  $iCol) : bool|string

Converts a column number to a residue number in a sequence that is part of an alignment set.

Parameters

int $iSeqIdx

Index number of the desired sequence within the alignment set.

int $iCol

The column number which we want to convert to a residue number.

Throws

\Exception

Returns

bool|string —

An integer representing the residue number corresponding to the given column number.

resToCol()

resToCol(int  $iSeqIdx, int  $iRes) : bool|int

Converts a residue number to a column number in a sequence in an alignment set.

Parameters

int $iSeqIdx

The index number of the desired sequence in the alignment set.

int $iRes

The residue number we wish to convert into a column number.

Throws

\Exception

Returns

bool|int —

An integer representing the column number corresponding to the given residue number.

subalign()

subalign(int  $iStart, int  $iEnd) : mixed

Creates a new alignment set from a series of contiguous/consecutive sequences.

Parameters

int $iStart

The index number of the first sequence to include in the new SeqAlign object.

int $iEnd

The index number of the last sequence to include in the new SeqAlign object.

Throws

\Exception

Returns

mixed

select()

select() : mixed

Creates a new alignment set from non-consecutive sequences found in another existing alignment set.

Throws

\Exception

Returns

mixed

resVar()

resVar(int  $iThreshold = 100) : array

Determines the index position of both variant and invariant residues according to a given "percentage threshold" similar to that in the consensus() method.

Parameters

int $iThreshold

a number between 0 to 100, indicating the percentage threshold below which the current index position is considered variant, and on or above which the current index position is considered invariant. If omitted, this is set to 100 by default.

Throws

\Exception

Returns

array

consensus()

consensus(int  $iThreshold = 100) : string

Returns the consensus string for an alignment set. See technical reference for details.

Parameters

int $iThreshold

A number between 0 to 100, indicating the percentage threshold before (or below which) the unknown character "?" is used in a particular position or column in the consensus string. If omitted, this is set to 100 by default.

Throws

\Exception

Returns

string —

The consensus string formed according to the given threshold.

addSequence()

addSequence(\Amelaye\BioPHP\Domain\Sequence\Entity\Sequence  $oSequence) : int

Adds a sequence to an alignment set. It does not perform any sequence alignment.

Parameters

\Amelaye\BioPHP\Domain\Sequence\Entity\Sequence $oSequence

The object to be added to the alignment set.

Throws

\Exception

Returns

int —

The number of sequences in the alignment set after the call.

deleteSequence()

deleteSequence(string  $iSequenceId) : int

Deletes or removes a sequence from an alignment set.

Parameters

string $iSequenceId

The id of the sequence to be deleted from the alignment set.

Throws

\Exception

Returns

int —

The number of sequences in the alignment set after the call.

validationRes()

validationRes(int  $iSeqIdx, int  $iRes, int  $iNonGapCount, int  $iLength, string  $sContext) : bool|int|string

Fetches something found at a given residue number in a given sequence

Parameters

int $iSeqIdx

The index number of the desired sequence in the alignment set.

int $iRes

The residue number we wish to convert.

int $iNonGapCount

Number of non-gap characters

int $iLength

Length of a sequence

string $sContext

The original function calling

Throws

\Exception

Returns

bool|int|string

calcMaxPercent()

calcMaxPercent(array  $aGlobFreq, int  $i, array  $aKeys) : float|int

Calculates the max percentage of frequencies

Parameters

array $aGlobFreq

Array of frequencies of the letters

int $i

Current iteration

array $aKeys

Keys of the array of frequencies

Returns

float|int