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.
parseLocationBounds()  : array<string|int, mixed>
Parses an INSDC feature location (shared by GenBank and EMBL) into its outer bounds and strand. Strips the complement()/join() wrappers and the "<"/">" fuzzy-boundary markers.
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.
parseFeatures()  : mixed
Parses one feature: the FT key/location line, then every /qualifier="value" line that follows it until the next feature key or the end of the feature table.
parseId()  : mixed
Parses the ID line.
parseKeywords()  : mixed
Parses KW line(s).
parseOrganism()  : mixed
Parses the OS line and the OC lines that follow it.
parseReferences()  : mixed
Parses a reference block: RN, then optionally RP, RX, RA, RT, RL.
parseSequence()  : mixed
Parses the SQ header line and every sequence data line that follows it, up to "//".

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

parseLocationBounds()

Parses an INSDC feature location (shared by GenBank and EMBL) into its outer bounds and strand. Strips the complement()/join() wrappers and the "<"/">" fuzzy-boundary markers.

protected parseLocationBounds(string $sLocation) : array<string|int, mixed>

For a join() of several comma-separated segments (a spliced feature), Feature has no room to keep each exon separately, so this returns the lowest start and the highest end across every segment.

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 the location was wrapped in complement(...), "+" otherwise.

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

parseFeatures()

Parses one feature: the FT key/location line, then every /qualifier="value" line that follows it until the next feature key or the end of the feature table.

private parseFeatures(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.

Tags
throws
Exception

parseKeywords()

Parses KW line(s).

private parseKeywords() : mixed

Format : KW WORD1; WORD2; WORD3.

Tags
throws
Exception

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: RN, then optionally RP, RX, RA, RT, RL.

private parseReferences(array<string|int, mixed> $aFlines) : mixed
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 "//".

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

Search results