\Amelaye\BioPHP\Domain\Parser\Service ParseKeggAbstractManager

Class ParseKeggAbstractManager KEGG describes metabolism through several files - compound, enzyme, reaction, ortholog, genome - written in one same grammar : a label in the first twelve columns, its data from the thirteenth, a line leaving the label column blank continuing the field above it, and "///" closing the record. That grammar and the ENTRY and NAME fields every record carries live here; each subclass adds the fields of its own file.

Where Legacy/kegg.inc.php kept one flag per field and closed a field only when the next one opened, the fields are gathered first and read afterwards, which spares each subclass the three-branch dance and closes the last field of a record whether or not "///" follows it.

Summary

Methods
Properties
Constants
__construct
isEntryStart
isEntryEnd
getEntryId
getEntry
getNames
No public properties found
No public constants found
readEntryId
readLabel
readData
readFields
joinLines
splitTokens
parsePathways
parseDbLinks
entry
names
No protected constants found
readNames
No private properties found
No private constants found

Properties

$entry

$entry : string

Type

string —

$names

$names : array

Type

array<string|int, mixed> —

Methods

__construct()

__construct() : mixed

Constructor.

Returns

mixed —

isEntryStart()

isEntryStart(string  $sLine) : bool

Tells whether a line opens a new KEGG record.

Parameters

string $sLine

The line to analyze

Returns

bool —

isEntryEnd()

isEntryEnd(string  $sLine) : bool

Tells whether a line closes a KEGG record. KEGG closes on three slashes where most flat files use two.

Parameters

string $sLine

The line to analyze

Returns

bool —

getEntryId()

getEntryId(array  $aFlines, string  $sLine) : string

Extracts the identifier uniquely naming a KEGG record.

Parameters

array $aFlines

The whole file, buffered

string $sLine

The line opening the entry

Returns

string —

getEntry()

getEntry() : string

Returns

string —

getNames()

getNames() : array

Returns

array —

readEntryId()

readEntryId(string  $sData) : string

Reads the identifier out of an ENTRY line. Its last word names the kind of record rather than the record itself - "C00031 Compound", "EC 2.7.1.1 Enzyme" - so the identifier is what comes before it, which for an enzyme is the two words "EC" and its number.

Parameters

string $sData

Returns

string —

readLabel()

readLabel(string  $sLine) : string

Reads the label a line carries in its first twelve columns.

Parameters

string $sLine

The line to analyze

Returns

string —

readData()

readData(string  $sLine) : string

Reads the data a line carries, which starts at its thirteenth column.

Parameters

string $sLine

The line to analyze

Returns

string —

readFields()

readFields(array  $aFlines) : array

Gathers a record into its fields : one entry per label, holding the data of its own line and of every continuation line below it.

Parameters

array $aFlines

The lines the script has to parse

Returns

array —

joinLines()

joinLines(array  $aLines) : string

Joins the lines of a field into one string. A line opening with "$" continues the word the line above broke off, so it joins without a space.

Parameters

array $aLines

Returns

string —

splitTokens()

splitTokens(array  $aLines) : array

Splits the lines of a field into the whitespace-separated identifiers they list.

Parameters

array $aLines

Returns

array —

parsePathways()

parsePathways(array  $aLines) : array

Reads a PATHWAY field into pairs of map identifier and pathway name.

Format : PATHWAY PATH: map00010 Glycolysis / Gluconeogenesis

Parameters

array $aLines

Returns

array —

parseDbLinks()

parseDbLinks(array  $aLines) : array

Reads a DBLINKS field into pairs of database name and identifier, one per line.

Format : DBLINKS CAS: 50-99-7

Parameters

array $aLines

Returns

array —

readNames()

readNames(array  $aLines) : array

Reads the NAME field, which gives the record its preferred name first and its synonyms after. A semicolon separates them, whether they sit on one line or on several.

Parameters

array $aLines

Returns

array —