Documentation

ParseSwissprotManager extends ParseDbAbstractManager

FinalYes

Class ParseSwissprotManager

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|null
$geneNames  : array<string|int, mixed>
Gene names, as groups of synonyms: ( (GNAME1, GNAME2), (GNAME3) ).
$notupdDate  : string
Date of the last annotation update, read from the DT lines.
$sequpdDate  : string
Date of the last sequence update, read from the DT lines. The Sequence entity only carries the creation date, so the two other DT dates stay on the parser.
$taxonomyId  : string
NCBI taxonomy identifier of the source organism (OX line), "" when absent

Methods

__construct()  : mixed
Constructor.
getAccession()  : array<string|int, mixed>
getAuthors()  : array<string|int, mixed>
getEntryId()  : string
Extracts the identifier uniquely naming a Swiss-Prot entry.
getFeatures()  : array<string|int, mixed>
getFormat()  : string
The name this format is known by in the collection records and in DatabaseParserFactory.
getGbSequence()  : GbSequence
getGeneNames()  : array<string|int, mixed>
Gene names (GN line), as groups of synonyms.
getKeywords()  : array<string|int, mixed>
getmin()  : int
Gets the minimum of three (usually numeric) values $x, $y, and $z.
getNotupdDate()  : string
Date of the last annotation update (DT line).
getReferences()  : array<string|int, mixed>
getSequence()  : Sequence
getSequpdDate()  : string
Date of the last sequence update (DT line).
getSpDatabank()  : array<string|int, mixed>
getSrcForm()  : SrcForm
getTaxonomyId()  : string
NCBI taxonomy identifier of the source organism (OX line), "9606" for Homo sapiens ; "" when the entry has none.
intrim()  : mixed
Removes "internal spaces" (as opposed to leading and trailing spaces) from a string.
isEntryEnd()  : bool
Tells whether a line closes a Swiss-Prot entry.
isEntryStart()  : bool
Tells whether a line opens a new Swiss-Prot entry.
left()  : bool|string
Returns the first $numchars characters of a string.
parseDataFile()  : Sequence
Parses a Swiss-Prot / UniProtKB data file. Both layouts are read : the original one ("ID TNFA_HUMAN STANDARD; PRT; 233 AA.", "DT ... (REL. 01, CREATED)", "RX MEDLINE; n.") and the current UniProt one ("ID POLS2_HUMAN Reviewed; 855 AA.", "DT ..., integrated into UniProtKB/Swiss-Prot.", "RX PubMed=n; DOI=...;", structured DE and GN lines), as described in the UniProtKB user manual. The feature table is read in its column layout (key, from, to, description, continued on lines whose key column is blank) and in the one used since release 2019_11 ("FT CHAIN 47..855" followed by /note="..." qualifiers).
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.
buildACFields()  : array<string|int, mixed>
Parses AC lines, which may be several Format : AC P01375; Q9UIV3;
buildDEFields()  : mixed
Sets the description from the DE lines, joined, and whether the sequence is a fragment : "(FRAGMENT)." or "(FRAGMENTS)." ending the original layout, "Flags: Fragment;" or "Flags: Fragments;" in the UniProt one.
buildDRField()  : mixed
Parses DR lines Format : DR DATA_BANK; PRIMARY_IDENTIFIER; SECONDARY_IDENTIFIER[; ...]. [ISOFORM] The first two identifiers are kept ; a trailing isoform reference ("[Q5K4E3-1]") is not part of them.
buildDTFields()  : mixed
Parses DT Line, in the original layout ("21-JUL-1986 (REL. 01, CREATED)", "LAST SEQUENCE UPDATE", "LAST ANNOTATION UPDATE") or the UniProt one ("15-MAR-2005, integrated into UniProtKB/Swiss-Prot.", "sequence version 2.", "entry version 123.").
buildFTField()  : mixed
Parses one feature of the FT lines, with the lines continuing it.
buildGNField()  : mixed
Sets the gene names from the GN lines, as groups of synonyms.
buildIDFields()  : mixed
Parses ID line Format : ID PROTNAME_PROTSOURCE DATA_CLASS; [MOL_TYPE;] LENGTH AA.
buildKWFields()  : mixed
Parses KW Fields Format : KW WORD1; WORD2; WORD3; etc .
buildOCField()  : mixed
Parses OC lines Format : OC EUKARYOTA; METAZOA; CHORDATA; VERTEBRATA; TETRAPODA; MAMMALIA; OC EUTHERIA; PRIMATES.
buildOSFields()  : mixed
Parses OS line Format : OS HOMO SAPIENS (HUMAN).
buildRNField()  : mixed
Parses a reference : the RN line and the RP, RC, RX, RG, RA, RT and RL lines following it, each of which may span several lines.
buildSQField()  : mixed
Parses SQ lines and below SQ SEQUENCE XXXX AA; XXXXX MW; XXXXX CN;
featureDescription()  : string
Joins the description lines of a feature : free text continued over several lines, or the /note="..." qualifier of the 2019_11 layout. A line broken right after a hyphen continues the same word ("PROSITE-" + "ProRule"). The evidence tags ({ECO:0000255}), the /FTId, /id and /evidence qualifiers and the final period are provenance and punctuation, not description.
featurePosition()  : int|null
makeRefArray()  : mixed
Creates the Reference and Author entities, numbered as the RN lines number them.

Properties

$geneNames

Gene names, as groups of synonyms: ( (GNAME1, GNAME2), (GNAME3) ).

private array<string|int, mixed> $geneNames = []

$notupdDate

Date of the last annotation update, read from the DT lines.

private string $notupdDate = ""

$sequpdDate

Date of the last sequence update, read from the DT lines. The Sequence entity only carries the creation date, so the two other DT dates stay on the parser.

private string $sequpdDate = ""

$taxonomyId

NCBI taxonomy identifier of the source organism (OX line), "" when absent

private string $taxonomyId = ""

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 Swiss-Prot 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

getGeneNames()

Gene names (GN line), as groups of synonyms.

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

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

getNotupdDate()

Date of the last annotation update (DT line).

public getNotupdDate() : string
Return values
string

getReferences()

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

getSequpdDate()

Date of the last sequence update (DT line).

public getSequpdDate() : string
Return values
string

getSpDatabank()

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

getTaxonomyId()

NCBI taxonomy identifier of the source organism (OX line), "9606" for Homo sapiens ; "" when the entry has none.

public getTaxonomyId() : string
Return values
string

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 Swiss-Prot 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 Swiss-Prot 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 a Swiss-Prot / UniProtKB data file. Both layouts are read : the original one ("ID TNFA_HUMAN STANDARD; PRT; 233 AA.", "DT ... (REL. 01, CREATED)", "RX MEDLINE; n.") and the current UniProt one ("ID POLS2_HUMAN Reviewed; 855 AA.", "DT ..., integrated into UniProtKB/Swiss-Prot.", "RX PubMed=n; DOI=...;", structured DE and GN lines), as described in the UniProtKB user manual. The feature table is read in its column layout (key, from, to, description, continued on lines whose key column is blank) and in the one used since release 2019_11 ("FT CHAIN 47..855" followed by /note="..." qualifiers).

public parseDataFile(array<string|int, mixed> $aFlines) : Sequence
Parameters
$aFlines : array<string|int, mixed>
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)).

buildACFields()

Parses AC lines, which may be several Format : AC P01375; Q9UIV3;

private buildACFields(array<string|int, mixed> &$aAccess) : array<string|int, mixed>
Parameters
$aAccess : array<string|int, mixed>
Tags
throws
Exception
Return values
array<string|int, mixed>

buildDEFields()

Sets the description from the DE lines, joined, and whether the sequence is a fragment : "(FRAGMENT)." or "(FRAGMENTS)." ending the original layout, "Flags: Fragment;" or "Flags: Fragments;" in the UniProt one.

private buildDEFields(array<string|int, string> $aLines) : mixed
Parameters
$aLines : array<string|int, string>

The DE lines, label removed

buildDRField()

Parses DR lines Format : DR DATA_BANK; PRIMARY_IDENTIFIER; SECONDARY_IDENTIFIER[; ...]. [ISOFORM] The first two identifiers are kept ; a trailing isoform reference ("[Q5K4E3-1]") is not part of them.

private buildDRField() : mixed

Example: DR EMBL; AJ627034; CAF25303.1; -; mRNA.

Tags
throws
Exception

buildDTFields()

Parses DT Line, in the original layout ("21-JUL-1986 (REL. 01, CREATED)", "LAST SEQUENCE UPDATE", "LAST ANNOTATION UPDATE") or the UniProt one ("15-MAR-2005, integrated into UniProtKB/Swiss-Prot.", "sequence version 2.", "entry version 123.").

private buildDTFields() : mixed
Tags
throws
Exception

buildFTField()

Parses one feature of the FT lines, with the lines continuing it.

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

Column layout : FT KEY FROM TO DESCRIPTION, a continuation line leaving the key column (6-13) blank. Layout since 2019_11 : FT KEY FROM..TO, followed by /note="...", /evidence="..." and /id="..." lines. The collapsed one-space form of the oldest samples ("FT CHAIN 77 233 TUMOR NECROSIS FACTOR.") has no continuation line. A position written "<1", ">855" or "?" (unknown) gives its number, or null when unknown.

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

buildGNField()

Sets the gene names from the GN lines, as groups of synonyms.

private buildGNField(array<string|int, string> $aLines) : mixed

Original layout, one line : GNAME1 OR GNAME2 ( (GNAME1, GNAME2) ), GNAME1 AND GNAME2 ( (GNAME1), (GNAME2) ), GNAME1 AND (GNAME2 OR GNAME3) ( (GNAME1), (GNAME2, GNAME3) ). UniProt layout : "Name=PRSS36; Synonyms=A, B; OrderedLocusNames=...; ORFNames=...;", a line holding only "and" separating two genes ; each gene gives one group, its name first.

Parameters
$aLines : array<string|int, string>

The GN lines, label removed

buildIDFields()

Parses ID line Format : ID PROTNAME_PROTSOURCE DATA_CLASS; [MOL_TYPE;] LENGTH AA.

private buildIDFields() : mixed

The molecule type ("PRT") only appears in the original layout ; a UniProt entry is always a protein, so it is "PRT" either way.

Tags
throws
Exception

buildKWFields()

Parses KW Fields Format : KW WORD1; WORD2; WORD3; etc .

private buildKWFields(string &$sKeywords) : mixed

..

Parameters
$sKeywords : string
Tags
throws
Exception

buildOCField()

Parses OC lines Format : OC EUKARYOTA; METAZOA; CHORDATA; VERTEBRATA; TETRAPODA; MAMMALIA; OC EUTHERIA; PRIMATES.

private buildOCField(string &$sOrganism, int &$iOrgaCpt) : mixed
Parameters
$sOrganism : string
$iOrgaCpt : int
Tags
throws
Exception

buildOSFields()

Parses OS line Format : OS HOMO SAPIENS (HUMAN).

private buildOSFields(string &$sSource, int &$iSourceCpt) : mixed
Parameters
$sSource : string
$iSourceCpt : int
Tags
throws
Exception

buildRNField()

Parses a reference : the RN line and the RP, RC, RX, RG, RA, RT and RL lines following it, each of which may span several lines.

private buildRNField(array<string|int, mixed> $aFlines, array<string|int, mixed> &$aReferences) : mixed

Example : RN [1] RP NUCLEOTIDE SEQUENCE [MRNA] (ISOFORM 1). RC TISSUE=Liver; RX PubMed=15536082; DOI=10.1074/jbc.M409139200; RA Cal S., Quesada V.; RT "Human polyserase-2, a novel enzyme."; RL J. Biol. Chem. 280:1953-1961(2005). The original layout wrote RX as "MEDLINE; 87217060." and had no RT line.

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

buildSQField()

Parses SQ lines and below SQ SEQUENCE XXXX AA; XXXXX MW; XXXXX CN;

private buildSQField() : mixed
Tags
throws
Exception

featureDescription()

Joins the description lines of a feature : free text continued over several lines, or the /note="..." qualifier of the 2019_11 layout. A line broken right after a hyphen continues the same word ("PROSITE-" + "ProRule"). The evidence tags ({ECO:0000255}), the /FTId, /id and /evidence qualifiers and the final period are provenance and punctuation, not description.

private featureDescription(array<string|int, string> $aLines[, string $sKey = "" ]) : string

The residues of a VAR_SEQ, VARIANT or CONFLICT ("MSLAWLAAEGLR" + "LSSRRA -> MQ (in isoform 2)") are wrapped at the column without a space, which the joining must not add inside them.

Parameters
$aLines : array<string|int, string>
$sKey : string = ""

The feature key

Return values
string

featurePosition()

private featurePosition(string $sPosition) : int|null
Parameters
$sPosition : string

"77", "<1", ">855" or "?"

Return values
int|null —

Null for an unknown position

makeRefArray()

Creates the Reference and Author entities, numbered as the RN lines number them.

private makeRefArray(array<string|int, mixed> $aReferences) : mixed
Parameters
$aReferences : array<string|int, mixed>
Tags
throws
Exception
On this page

Search results