Documentation

ParseKeggAbstractManager implements ParseDatabaseInterface

AbstractYes

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.

Tags
author

Amélie DUVERNET aka Amelaye amelieonline@gmail.com

Table of Contents

Interfaces

ParseDatabaseInterface
Interface ParseDatabaseInterface

Properties

$entry  : string
$names  : array<string|int, mixed>
$rawFields  : array<string|int, mixed>
The lines of each field as readFields() gathered them, but with the indentation past the thirteenth column kept : it tells a wrapped line from a new item.

Methods

__construct()  : mixed
Constructor.
getEntry()  : string
getEntryId()  : string
Extracts the identifier uniquely naming a KEGG record.
getNames()  : array<string|int, mixed>
isEntryEnd()  : bool
Tells whether a line closes a KEGG record. KEGG closes on three slashes where most flat files use two.
isEntryStart()  : bool
Tells whether a line opens a new KEGG record.
joinLines()  : 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.
parseDbLinks()  : array<string|int, mixed>
Reads a DBLINKS field into pairs of database name and identifier, one per line.
parsePathways()  : array<string|int, mixed>
Reads a PATHWAY field into pairs of map identifier and pathway name, one per line : the identifier is the first word (map00010, ec00010, ko00010...), behind a "PATH:" tag in the files before 2008. A line not opening on an identifier continues the name above it.
readData()  : string
Reads the data a line carries, which starts at its thirteenth column.
readEntryId()  : string
Reads the identifier out of an ENTRY line. The words after it name the kind of record rather than the record itself - "C00031 Compound", "T01001 Complete Genome" - so the identifier is the first word, or for an enzyme the two words "EC" and its number ("EC 2.7.1.1 Enzyme").
readFields()  : array<string|int, mixed>
Gathers a record into its fields : one entry per label, holding the data of its own line and of every continuation line below it.
readItems()  : array<string|int, mixed>
Reads a field listing one item per line, a trailing ";" dropped. A long item wraps onto a line indented past the column the items start at, which continues it.
readLabel()  : string
Reads the label a line carries in its first twelve columns.
splitTokens()  : array<string|int, mixed>
Splits the lines of a field into the whitespace-separated identifiers they list.
readNames()  : array<string|int, mixed>
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.

Properties

$rawFields

The lines of each field as readFields() gathered them, but with the indentation past the thirteenth column kept : it tells a wrapped line from a new item.

protected array<string|int, mixed> $rawFields = []

Methods

getEntryId()

Extracts the identifier uniquely naming a KEGG record.

public static getEntryId(array<string|int, mixed> $aFlines, string $sLine) : string
Parameters
$aFlines : array<string|int, mixed>

The whole file, buffered

$sLine : string

The line opening the entry

Return values
string

isEntryEnd()

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

public static isEntryEnd(string $sLine) : bool
Parameters
$sLine : string

The line to analyze

Return values
bool

isEntryStart()

Tells whether a line opens a new KEGG record.

public static isEntryStart(string $sLine) : bool
Parameters
$sLine : string

The line to analyze

Return values
bool

joinLines()

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.

protected joinLines(array<string|int, mixed> $aLines) : string
Parameters
$aLines : array<string|int, mixed>
Return values
string

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

protected parseDbLinks(array<string|int, mixed> $aLines) : array<string|int, mixed>

Format : DBLINKS CAS: 50-99-7

Parameters
$aLines : array<string|int, mixed>
Return values
array<string|int, mixed>

parsePathways()

Reads a PATHWAY field into pairs of map identifier and pathway name, one per line : the identifier is the first word (map00010, ec00010, ko00010...), behind a "PATH:" tag in the files before 2008. A line not opening on an identifier continues the name above it.

protected parsePathways(array<string|int, mixed> $aLines) : array<string|int, mixed>

Format : PATHWAY PATH: map00010 Glycolysis / Gluconeogenesis PATHWAY ec00010 Glycolysis / Gluconeogenesis

Parameters
$aLines : array<string|int, mixed>
Return values
array<string|int, mixed>

readData()

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

protected static readData(string $sLine) : string
Parameters
$sLine : string

The line to analyze

Return values
string

readEntryId()

Reads the identifier out of an ENTRY line. The words after it name the kind of record rather than the record itself - "C00031 Compound", "T01001 Complete Genome" - so the identifier is the first word, or for an enzyme the two words "EC" and its number ("EC 2.7.1.1 Enzyme").

protected static readEntryId(string $sData) : string
Parameters
$sData : string
Return values
string

readFields()

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

protected readFields(array<string|int, mixed> $aFlines) : array<string|int, mixed>
Parameters
$aFlines : array<string|int, mixed>

The lines the script has to parse

Return values
array<string|int, mixed>

readItems()

Reads a field listing one item per line, a trailing ";" dropped. A long item wraps onto a line indented past the column the items start at, which continues it.

protected readItems(string $sField[, bool $bTerminated = false ]) : array<string|int, mixed>

Format : GENES HSA: 3098(HK1) 3099(HK2) ECO: b1234 b2345 b3456 A line opening with "$" continues the word the line above broke off. In a field whose items all end with ";" (SUBSTRATE, PRODUCT), an item wrapped at the first column is told by the missing ";" on the line above.

Parameters
$sField : string

The field label

$bTerminated : bool = false

Every item of the field ends with ";"

Return values
array<string|int, mixed>

readLabel()

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

protected static readLabel(string $sLine) : string
Parameters
$sLine : string

The line to analyze

Return values
string

splitTokens()

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

protected splitTokens(array<string|int, mixed> $aLines) : array<string|int, mixed>
Parameters
$aLines : array<string|int, mixed>
Return values
array<string|int, mixed>

readNames()

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.

private readNames(array<string|int, mixed> $aLines) : array<string|int, mixed>
Parameters
$aLines : array<string|int, mixed>
Return values
array<string|int, mixed>
On this page

Search results