Documentation

ParseEmblManager extends ParseDbAbstractManager

FinalYes

Class ParseEmblManager EMBL flat files use the same "one field per record type, feature table shared with GenBank" shape as GenBank's LOCUS/DEFINITION/ACCESSION/.../FEATURES/ORIGIN, only the line tags differ (2-char codes like ID/AC/DE/OS/OC/RN/FT/SQ instead of full keywords).

This class mirrors ParseGenbankManager's decomposition (one private parseXxx() per record type, \ArrayIterator lookahead) applied to those EMBL tags.

Tags
author

Amélie DUVERNET aka Amelaye amelieonline@gmail.com

Table of Contents

Properties

$accession  : array<string|int, mixed>
$authors  : array<string|int, mixed>
$features  : array<string|int, mixed>
$gbSequence  : GbSequence
$keywords  : array<string|int, mixed>
$references  : array<string|int, mixed>
$sequence  : Sequence
$spDatabank  : array<string|int, mixed>
$srcForm  : SrcForm
$aLines  : ArrayIterator
$bAccessionLineSeen  : bool
Whether an AC line has already been parsed for the entry being read. Only the very first accession of the very first AC line is the entry's primary accession (already captured from the ID line); every accession on every AC line after that, continuation lines included, is a genuine secondary accession and must be kept.

Methods

__construct()  : mixed
Constructor.
getAccession()  : array<string|int, mixed>
getAuthors()  : array<string|int, mixed>
getEntryId()  : string
Extracts the identifier uniquely naming a EMBL entry.
getFeatures()  : array<string|int, mixed>
getFormat()  : string
The name this format is known by in the collection records and in DatabaseParserFactory.
getGbSequence()  : GbSequence
getKeywords()  : array<string|int, mixed>
getmin()  : int
Gets the minimum of three (usually numeric) values $x, $y, and $z.
getReferences()  : array<string|int, mixed>
getSequence()  : Sequence
getSpDatabank()  : array<string|int, mixed>
getSrcForm()  : SrcForm
intrim()  : mixed
Removes "internal spaces" (as opposed to leading and trailing spaces) from a string.
isEntryEnd()  : bool
Tells whether a line closes a EMBL entry.
isEntryStart()  : bool
Tells whether a line opens a new EMBL entry.
left()  : bool|string
Returns the first $numchars characters of a string.
parseDataFile()  : Sequence
Parses an EMBL data file and returns a Seq object containing parsed data.
rem_right()  : bool|string
Removes $charcount characters from the right (end) of a string.
right()  : bool|string
Returns the substring beginning at $numchars characters from the right end of a string.
setAccession()  : void
setAuthors()  : void
setFeatures()  : void
setGbSequence()  : void
setKeywords()  : void
setReferences()  : void
setSequence()  : void
setSpDatabank()  : void
setSrcForm()  : void
trim_element()  : mixed
trim_element() removes leading and trailing spaces from a string. In conjunction with the array_walk() function, it removes spaces from each element of an array.
parseInsdcFeature()  : mixed
Parses one feature of an INSDC feature table, shared by GenBank and EMBL, whose columns are the same : the key from column 6, the location (possibly wrapped over several lines) and the /qualifier lines from column 22. $aFlines is read ahead to find where the feature ends : a line holding something in its first 12 columns starts another feature or section, so EMBL hands its lines with their "FT" tag blanked out.
parseLocationBounds()  : array<string|int, mixed>
Parses an INSDC feature location (shared by GenBank and EMBL) into its outer bounds and strand, 1-based and inclusive. The location as written is kept apart (Feature::getFtLocation()) : these bounds only frame it.
parseAccession()  : mixed
Parses AC line(s).
parseDate()  : mixed
Parses DT lines - only the "Created" one is kept, to mirror GenBank's single date field.
parseDescription()  : mixed
Parses DE line(s), possibly on several lines.
parseId()  : mixed
Parses the ID line.
parseKeywords()  : mixed
Parses KW line(s).
parseOldId()  : mixed
Parses the ID line of the layout used before release 87, which has no sequence version. Its first word is the entry name (HSERPG), a mnemonic, not the accession : the primary accession is the first one of the AC line (see parseAccession()).
parseOrganism()  : mixed
Parses the OS line and the OC lines that follow it.
parseReferences()  : mixed
Parses a reference block : the RN line, then RC, RP, RX, RG, RA, RT and RL lines, in that order and each optional, any of them but RN possibly continued on several lines.
parseSequence()  : mixed
Parses the SQ header line and every sequence data line that follows it, up to "//" or the end of the lines, a record cut short having none.

Properties

$bAccessionLineSeen

Whether an AC line has already been parsed for the entry being read. Only the very first accession of the very first AC line is the entry's primary accession (already captured from the ID line); every accession on every AC line after that, continuation lines included, is a genuine secondary accession and must be kept.

private bool $bAccessionLineSeen = false

Methods

getAccession()

public getAccession() : array<string|int, mixed>
Return values
array<string|int, mixed>

getAuthors()

public getAuthors() : array<string|int, mixed>
Return values
array<string|int, mixed>

getEntryId()

Extracts the identifier uniquely naming a EMBL entry.

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

getFeatures()

public getFeatures() : array<string|int, mixed>
Return values
array<string|int, mixed>

getFormat()

The name this format is known by in the collection records and in DatabaseParserFactory.

public static getFormat() : string
Return values
string

getKeywords()

public getKeywords() : array<string|int, mixed>
Return values
array<string|int, mixed>

getmin()

Gets the minimum of three (usually numeric) values $x, $y, and $z.

public getmin(int $x, int $y, int $z) : int

For now, this can't handle situations when one or more arguments is FALSE.

Parameters
$x : int
$y : int
$z : int
Return values
int

getReferences()

public getReferences() : array<string|int, mixed>
Return values
array<string|int, mixed>

getSpDatabank()

public getSpDatabank() : array<string|int, mixed>
Return values
array<string|int, mixed>

intrim()

Removes "internal spaces" (as opposed to leading and trailing spaces) from a string.

public intrim(string $string) : mixed
Parameters
$string : string

isEntryEnd()

Tells whether a line closes a EMBL entry.

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

The line to analyze

Return values
bool

isEntryStart()

Tells whether a line opens a new EMBL entry.

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

The line to analyze

Return values
bool

left()

Returns the first $numchars characters of a string.

public left(string $str, int $numchars) : bool|string
Parameters
$str : string
$numchars : int
Return values
bool|string

parseDataFile()

Parses an EMBL data file and returns a Seq object containing parsed data.

public parseDataFile(array<string|int, mixed> $aFlines) : Sequence
Parameters
$aFlines : array<string|int, mixed>

The lines the script has to parse

Tags
throws
Exception
Return values
Sequence —

$oSequence

rem_right()

Removes $charcount characters from the right (end) of a string.

public rem_right(string $str[, int $charcount = 1 ]) : bool|string
Parameters
$str : string
$charcount : int = 1
Return values
bool|string

right()

Returns the substring beginning at $numchars characters from the right end of a string.

public right(string $str, int $numchars) : bool|string
Parameters
$str : string
$numchars : int
Return values
bool|string

setAccession()

public setAccession(array<string|int, mixed> $accession) : void
Parameters
$accession : array<string|int, mixed>

setAuthors()

public setAuthors(array<string|int, mixed> $authors) : void
Parameters
$authors : array<string|int, mixed>

setFeatures()

public setFeatures(array<string|int, mixed> $features) : void
Parameters
$features : array<string|int, mixed>

setKeywords()

public setKeywords(array<string|int, mixed> $keywords) : void
Parameters
$keywords : array<string|int, mixed>

setReferences()

public setReferences(array<string|int, mixed> $references) : void
Parameters
$references : array<string|int, mixed>

setSpDatabank()

public setSpDatabank(array<string|int, mixed> $spDatabank) : void
Parameters
$spDatabank : array<string|int, mixed>

trim_element()

trim_element() removes leading and trailing spaces from a string. In conjunction with the array_walk() function, it removes spaces from each element of an array.

public trim_element(mixed &$value, mixed $key) : mixed
Parameters
$value : mixed
$key : mixed

parseInsdcFeature()

Parses one feature of an INSDC feature table, shared by GenBank and EMBL, whose columns are the same : the key from column 6, the location (possibly wrapped over several lines) and the /qualifier lines from column 22. $aFlines is read ahead to find where the feature ends : a line holding something in its first 12 columns starts another feature or section, so EMBL hands its lines with their "FT" tag blanked out.

protected parseInsdcFeature(ArrayIterator $oLines, array<string|int, mixed> $aFlines, string $sKey) : mixed
Parameters
$oLines : ArrayIterator

The parser's line iterator, on the feature's key line

$aFlines : array<string|int, mixed>

The lines, as read ahead

$sKey : string

The feature key

Tags
throws
Exception

parseLocationBounds()

Parses an INSDC feature location (shared by GenBank and EMBL) into its outer bounds and strand, 1-based and inclusive. The location as written is kept apart (Feature::getFtLocation()) : these bounds only frame it.

protected parseLocationBounds(string $sLocation) : array<string|int, mixed>
  • complement(), join() and order() wrappers and the "<" / ">" partial marks are stripped ;
  • "a..b" spans a to b, "a" is one base, "a.b" one base somewhere in a..b and "a^b" the site between two bases : both give a..b ;
  • a segment of another entry ("J00194.1:100..202") lies on another sequence and is left out ; a location made of such segments only has no bounds here (null, null) ;
  • the segments of a join() are listed in the order they are transcribed. When the record is circular, all of them lie on the same strand and that order goes back past the origin (join(4900..5000,1..100), or join(complement(1..100),complement(4900..5000)) on the other strand), that order goes back exactly once, from the last base of the molecule to the first, and the join is not an order(), the bounds are from = 4900, to = 100 : from > to, the origin-crossing convention of PlasmidFeature, as for a single segment written "4900..100". Otherwise - a linear record, an order(), a trans-spliced gene (plant organelle nad1, rps12) whose segments are listed out of order - they are the lowest start and the highest end.
Parameters
$sLocation : string

The raw location text, e.g. "complement(join(<1..10,50..>60))".

Return values
array<string|int, mixed> —

[$iFrom, $iTo, $sStrand] - $sStrand is "-" when every segment of this entry is complemented, "+" when none is, null when the location lies on both strands (a trans-spliced join(complement(a..b),c..d)).

parseAccession()

Parses AC line(s).

private parseAccession() : mixed

Format : AC AB012345;

Tags
throws
Exception

parseDate()

Parses DT lines - only the "Created" one is kept, to mirror GenBank's single date field.

private parseDate() : mixed

Format : DT DD-MMM-YEAR (Rel. XX, Created)

Tags
throws
Exception

parseDescription()

Parses DE line(s), possibly on several lines.

private parseDescription(array<string|int, mixed> $aFlines) : mixed
Parameters
$aFlines : array<string|int, mixed>
Tags
throws
Exception

parseId()

Parses the ID line.

private parseId() : mixed

Format : ID ENTRYNAME; SV VERSION; TOPOLOGY; MOLTYPE; DATACLASS; DIVISION; LENGTH BP. Before release 87 (2006) : ID ENTRYNAME DATACLASS; [circular] MOLTYPE; DIVISION; LENGTH BP.

Tags
throws
Exception

parseKeywords()

Parses KW line(s).

private parseKeywords([array<string|int, mixed> $aFlines = [] ]) : mixed

Format : KW WORD1; WORD2; WORD3.

Parameters
$aFlines : array<string|int, mixed> = []
Tags
throws
Exception

parseOldId()

Parses the ID line of the layout used before release 87, which has no sequence version. Its first word is the entry name (HSERPG), a mnemonic, not the accession : the primary accession is the first one of the AC line (see parseAccession()).

private parseOldId(array<string|int, string> $aParts) : mixed
Parameters
$aParts : array<string|int, string>

"ENTRYNAME DATACLASS", "[circular ]MOLTYPE", "DIVISION", "LENGTH BP."

parseOrganism()

Parses the OS line and the OC lines that follow it.

private parseOrganism(array<string|int, mixed> $aFlines) : mixed

Format : OS Species (common name) OC Lineage; Tokens; Separated; By; Semicolons.

Parameters
$aFlines : array<string|int, mixed>
Tags
throws
Exception

parseReferences()

Parses a reference block : the RN line, then RC, RP, RX, RG, RA, RT and RL lines, in that order and each optional, any of them but RN possibly continued on several lines.

private parseReferences(array<string|int, mixed> $aFlines) : mixed

Example : RN [1] RC Comment. RP 1-120 RX DOI; 10.1016/0022-2836(89)90226-7. RX PUBMED; 12345678. RG The Consortium RA Smith J., Doe A.; RT "A test reference"; RL J. Test Biol. 1(1):1-10(2020). The author names keep their initials as written ("Smith J."), as GenBank's do.

Parameters
$aFlines : array<string|int, mixed>
Tags
throws
Exception

parseSequence()

Parses the SQ header line and every sequence data line that follows it, up to "//" or the end of the lines, a record cut short having none.

private parseSequence() : mixed
Tags
throws
Exception
On this page

Search results