\App\Domain\Sequence\InterfacesSequenceAlignmentInterface

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
Constants
getSeqSet()
setFilename()
setFormat()
parseClustal()
parseFasta()
parseFile()
sortAlpha()
getMaxiLength()
getGapCount()
getIsFlush()
charAtRes()
substrBwRes()
colToRes()
resToCol()
subalign()
select()
resVar()
consensus()
addSequence()
deleteSequence()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

getSeqSet()

getSeqSet() : \ArrayIterator

The sequences array .

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

Returns

\ArrayIterator

setFilename()

setFilename(string  $sFilename) 

Sets a specific filename : the file to parse

Parameters

string $sFilename

setFormat()

setFormat(string  $sFormat) 

Sets a specific format : FASTA or CLUSTAL

Parameters

string $sFormat

parseClustal()

parseClustal() 

Parses Clustal Files and create Sequence object

Throws

\Exception

parseFasta()

parseFasta() 

Parses Fasta Files and create Sequence object

Throws

\Exception

parseFile()

parseFile() 

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

sortAlpha()

sortAlpha(string  $sOption = "ASC") 

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

getMaxiLength()

getMaxiLength() : integer

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

Throws

\Exception

Returns

integer

getGapCount()

getGapCount() : integer

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

Throws

\Exception

Returns

integer —

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

getIsFlush()

getIsFlush() : boolean

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

Throws

\Exception

Returns

boolean

charAtRes()

charAtRes(integer  $iSeqIdx, integer  $iRes) : boolean

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

Parameters

integer $iSeqIdx

Index of the sequence in the array

integer $iRes

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

Throws

\Exception

Returns

boolean —

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

substrBwRes()

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

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

Parameters

integer $iSeqIdx

Index of the sequence in the array

integer $iResStart

Start of the subsequence

integer $iResEnd

End of the subsequence

Throws

\Exception

Returns

string —

| boolean A substring within the specified sequence.

colToRes()

colToRes(integer  $iSeqIdx, integer  $iCol) : boolean|string

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

Parameters

integer $iSeqIdx

Index number of the desired sequence within the alignment set.

integer $iCol

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

Throws

\Exception

Returns

boolean|string —

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

resToCol()

resToCol(integer  $iSeqIdx, integer  $iRes) : boolean|integer

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

Parameters

integer $iSeqIdx

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

integer $iRes

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

Throws

\Exception

Returns

boolean|integer —

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

subalign()

subalign(integer  $iStart, integer  $iEnd) 

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

Parameters

integer $iStart

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

integer $iEnd

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

Throws

\Exception

select()

select() 

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

Throws

\Exception

resVar()

resVar(integer  $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

integer $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(integer  $iThreshold = 100) : string

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

Parameters

integer $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(\App\Domain\Sequence\Entity\Sequence  $oSequence) : integer

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

Parameters

\App\Domain\Sequence\Entity\Sequence $oSequence

The object to be added to the alignment set.

Throws

\Exception

Returns

integer —

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

deleteSequence()

deleteSequence(string  $iSequenceId) : integer

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

integer —

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