Documentation

SequenceAlignmentInterface

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.

Tags
author

Amélie DUVERNET aka Amelaye amelieonline@gmail.com

todo

: length doit représenter la totalité des séquences

Table of Contents

Methods

addSequence()  : int
Adds a sequence to an alignment set. It does not perform any sequence alignment.
charAtRes()  : bool|string
Returns the character found at a given residue number in a given sequence.
colToRes()  : bool|string
Converts a column number to a residue number in a sequence that is part of an alignment set.
consensus()  : string
Returns the consensus string for an alignment set. See technical reference for details.
deleteSequence()  : int
Deletes or removes a sequence from an alignment set.
getGapCount()  : int
Counts the number of gaps ("-") found in all sequences in an alignment set.
getIsFlush()  : bool
Tests if all the sequences in an alignment set have the same length.
getMaxiLength()  : int
Returns the length of the longest sequence in an alignment set.
getSeqSet()  : ArrayIterator
The ArrayIterator of sequences ... then you can rewind(), next(), prev(), offsetGet(), count() on it
parseClustal()  : mixed
Parses Clustal Files and create Sequence object
parseFasta()  : mixed
Parses Fasta Files and create Sequence object
parseFile()  : mixed
Main method - Parses FASTA or CLUSTAL file This "fetches" all sequences into the $aSeqSet property of the service.
resToCol()  : bool|int
Converts a residue number to a column number in a sequence in an alignment set.
resVar()  : array<string|int, mixed>
Determines the index position of both variant and invariant residues according to a given "percentage threshold" similar to that in the consensus() method.
select()  : mixed
Creates a new alignment set from non-consecutive sequences found in another existing alignment set.
setFilename()  : mixed
Sets a specific filename : the file to parse
setFormat()  : mixed
Sets a specific format : FASTA or CLUSTAL
sortAlpha()  : mixed
Rearranges the sequences in an alignment set alphabetically by their sequence id.
subalign()  : mixed
Creates a new alignment set from a series of contiguous/consecutive sequences.
substrBwRes()  : string|bool
Gets the substring between two residues in a sequence that is part of an alignment set.

Methods

addSequence()

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

public addSequence(Sequence $oSequence) : int
Parameters
$oSequence : Sequence

The object to be added to the alignment set.

Tags
throws
Exception
Return values
int —

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

charAtRes()

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

public charAtRes(int $iSeqIdx, int $iRes) : bool|string
Parameters
$iSeqIdx : int

Index of the sequence in the array

$iRes : int

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

Tags
throws
Exception
Return values
bool|string —

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

colToRes()

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

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

Index number of the desired sequence within the alignment set.

$iCol : int

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

Tags
throws
Exception
Return values
bool|string —

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

consensus()

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

public consensus([int $iThreshold = 100 ]) : string
Parameters
$iThreshold : int = 100

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.

Tags
throws
Exception
Return values
string —

The consensus string formed according to the given threshold.

deleteSequence()

Deletes or removes a sequence from an alignment set.

public deleteSequence(string $iSequenceId) : int
Parameters
$iSequenceId : string

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

Tags
throws
Exception
Return values
int —

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

getGapCount()

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

public getGapCount() : int
Tags
throws
Exception
Return values
int —

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

getIsFlush()

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

public getIsFlush() : bool
Tags
throws
Exception
Return values
bool

getMaxiLength()

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

public getMaxiLength() : int
Tags
throws
Exception
Return values
int

getSeqSet()

The ArrayIterator of sequences ... then you can rewind(), next(), prev(), offsetGet(), count() on it

public getSeqSet() : ArrayIterator
Return values
ArrayIterator

parseClustal()

Parses Clustal Files and create Sequence object

public parseClustal() : mixed
Tags
throws
Exception

parseFasta()

Parses Fasta Files and create Sequence object

public parseFasta() : mixed
Tags
throws
Exception
Todo

: setting start and stop

parseFile()

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

public parseFile() : mixed

resToCol()

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

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

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

$iRes : int

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

Tags
throws
Exception
Return values
bool|int —

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

resVar()

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

public resVar([int $iThreshold = 100 ]) : array<string|int, mixed>
Parameters
$iThreshold : int = 100

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.

Tags
throws
Exception
Return values
array<string|int, mixed>

select()

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

public select() : mixed
Tags
throws
Exception
Todo

: length is wrong

setFilename()

Sets a specific filename : the file to parse

public setFilename(string $sFilename) : mixed
Parameters
$sFilename : string

setFormat()

Sets a specific format : FASTA or CLUSTAL

public setFormat(string $sFormat) : mixed
Parameters
$sFormat : string

sortAlpha()

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

public sortAlpha([string $sOption = "ASC" ]) : mixed

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
$sOption : string = "ASC"

ASCendant or DESCendant

Tags
throws
Exception

subalign()

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

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

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

$iEnd : int

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

Tags
throws
Exception

substrBwRes()

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

public substrBwRes(int $iSeqIdx, int $iResStart[, int $iResEnd = 0 ]) : string|bool
Parameters
$iSeqIdx : int

Index of the sequence in the array

$iResStart : int

Start of the subsequence

$iResEnd : int = 0

End of the subsequence

Tags
throws
Exception
Return values
string|bool —

A substring within the specified sequence.

On this page

Search results