\Amelaye\BioPHP\Domain\Parser\Service ParseEmblManager

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.

Summary

Methods
Properties
Constants
getFormat
isEntryStart
isEntryEnd
getEntryId
parseDataFile
left
right
intrim
getmin
rem_right
trim_element
__construct
getAccession
getSequence
getAuthors
getGbSequence
getFeatures
getKeywords
getReferences
getSrcForm
getSpDatabank
setAccession
setSequence
setAuthors
setFeatures
setKeywords
setReferences
setSrcForm
setGbSequence
setSpDatabank
No public properties found
No public constants found
parseLocationBounds
accession
sequence
authors
features
keywords
references
srcForm
gbSequence
spDatabank
No protected constants found
parseId
parseAccession
parseDate
parseDescription
parseKeywords
parseOrganism
parseReferences
parseFeatures
parseSequence
aLines
bAccessionLineSeen
No private constants found

Properties

$accession

$accession : array

Type

array<string|int, mixed> —

$sequence

$sequence : \Amelaye\BioPHP\Domain\Sequence\Entity\Sequence

Type

Sequence

$authors

$authors : array

Type

array<string|int, mixed> —

$features

$features : array

Type

array<string|int, mixed> —

$keywords

$keywords : array

Type

array<string|int, mixed> —

$references

$references : array

Type

array<string|int, mixed> —

$srcForm

$srcForm : \Amelaye\BioPHP\Domain\Sequence\Entity\SrcForm

Type

SrcForm

$gbSequence

$gbSequence : \Amelaye\BioPHP\Domain\Sequence\Entity\GbSequence

Type

GbSequence

$spDatabank

$spDatabank : array

Type

array<string|int, mixed> —

$aLines

$aLines : \ArrayIterator

Type

ArrayIterator

$bAccessionLineSeen

$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.

Type

bool —

Methods

getFormat()

getFormat() : string

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

Returns

string —

isEntryStart()

isEntryStart(string  $sLine) : bool

Tells whether a line opens a new EMBL entry.

Parameters

string $sLine

The line to analyze

Returns

bool —

isEntryEnd()

isEntryEnd(string  $sLine) : bool

Tells whether a line closes a EMBL entry.

Parameters

string $sLine

The line to analyze

Returns

bool —

getEntryId()

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

Extracts the identifier uniquely naming a EMBL entry.

Parameters

array $aFlines

The whole file, buffered

string $sLine

The line opening the entry

Returns

string —

parseDataFile()

parseDataFile(array  $aFlines) : \Amelaye\BioPHP\Domain\Sequence\Entity\Sequence

Parses a GenBank data file and returns a Seq object containing parsed data.

Parameters

array $aFlines

The lines the script has to parse

Throws

\Exception

Returns

\Amelaye\BioPHP\Domain\Sequence\Entity\Sequence —

$oSequence

left()

left(string  $str, int  $numchars) : bool|string

Returns the first $numchars characters of a string.

Parameters

string $str
int $numchars

Returns

bool|string —

right()

right(string  $str, int  $numchars) : bool|string

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

Parameters

string $str
int $numchars

Returns

bool|string —

intrim()

intrim(string  $string) : mixed

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

Parameters

string $string

Returns

mixed —

getmin()

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

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

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

Parameters

int $x
int $y
int $z

Returns

int —

rem_right()

rem_right(string  $str, int  $charcount = 1) : bool|string

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

Parameters

string $str
int $charcount

Returns

bool|string —

trim_element()

trim_element(mixed  $value, mixed  $key) : 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.

Parameters

mixed $value
mixed $key

Returns

mixed —

__construct()

__construct() : mixed

Constructor.

Returns

mixed —

getAccession()

getAccession() : array

Returns

array —

getSequence()

getSequence() : \Amelaye\BioPHP\Domain\Sequence\Entity\Sequence

Returns

\Amelaye\BioPHP\Domain\Sequence\Entity\Sequence —

getAuthors()

getAuthors() : array

Returns

array —

getGbSequence()

getGbSequence() : \Amelaye\BioPHP\Domain\Sequence\Entity\GbSequence

Returns

\Amelaye\BioPHP\Domain\Sequence\Entity\GbSequence —

getFeatures()

getFeatures() : array

Returns

array —

getKeywords()

getKeywords() : array

Returns

array —

getReferences()

getReferences() : array

Returns

array —

getSrcForm()

getSrcForm() : \Amelaye\BioPHP\Domain\Sequence\Entity\SrcForm

Returns

\Amelaye\BioPHP\Domain\Sequence\Entity\SrcForm —

getSpDatabank()

getSpDatabank() : array

Returns

array —

setAccession()

setAccession(array  $accession) : void

Parameters

array $accession

Returns

void —

setSequence()

setSequence(\Amelaye\BioPHP\Domain\Sequence\Entity\Sequence  $sequence) : void

Parameters

\Amelaye\BioPHP\Domain\Sequence\Entity\Sequence $sequence

Returns

void —

setAuthors()

setAuthors(array  $authors) : void

Parameters

array $authors

Returns

void —

setFeatures()

setFeatures(array  $features) : void

Parameters

array $features

Returns

void —

setKeywords()

setKeywords(array  $keywords) : void

Parameters

array $keywords

Returns

void —

setReferences()

setReferences(array  $references) : void

Parameters

array $references

Returns

void —

setSrcForm()

setSrcForm(\Amelaye\BioPHP\Domain\Sequence\Entity\SrcForm  $srcForm) : void

Parameters

\Amelaye\BioPHP\Domain\Sequence\Entity\SrcForm $srcForm

Returns

void —

setGbSequence()

setGbSequence(\Amelaye\BioPHP\Domain\Sequence\Entity\GbSequence  $gbSequence) : void

Parameters

\Amelaye\BioPHP\Domain\Sequence\Entity\GbSequence $gbSequence

Returns

void —

setSpDatabank()

setSpDatabank(array  $spDatabank) : void

Parameters

array $spDatabank

Returns

void —

parseLocationBounds()

parseLocationBounds(string  $sLocation) : array

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.

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

string $sLocation

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

Returns

array —

[$iFrom, $iTo, $sStrand] - $sStrand is "-" when the location was wrapped in complement(...), "+" otherwise.

parseId()

parseId() : mixed

Parses the ID line.

Format : ID ENTRYNAME; SV VERSION; TOPOLOGY; MOLTYPE; DATACLASS; DIVISION; LENGTH BP.

Throws

\Exception

Returns

mixed —

parseAccession()

parseAccession() : mixed

Parses AC line(s).

Format : AC AB012345;

Throws

\Exception

Returns

mixed —

parseDate()

parseDate() : mixed

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

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

Throws

\Exception

Returns

mixed —

parseDescription()

parseDescription(array  $aFlines) : mixed

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

Parameters

array $aFlines

Throws

\Exception

Returns

mixed —

parseKeywords()

parseKeywords() : mixed

Parses KW line(s).

Format : KW WORD1; WORD2; WORD3.

Throws

\Exception

Returns

mixed —

parseOrganism()

parseOrganism(array  $aFlines) : mixed

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

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

Parameters

array $aFlines

Throws

\Exception

Returns

mixed —

parseReferences()

parseReferences(array  $aFlines) : mixed

Parses a reference block: RN, then optionally RP, RX, RA, RT, RL.

Parameters

array $aFlines

Throws

\Exception

Returns

mixed —

parseFeatures()

parseFeatures(array  $aFlines) : 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.

Parameters

array $aFlines

Throws

\Exception

Returns

mixed —

parseSequence()

parseSequence() : mixed

Parses the SQ header line and every sequence data line that follows it, up to "//".

Throws

\Exception

Returns

mixed —