DatabaseManager
in package
implements
DatabaseInterface
uses
FormatsTrait
This class does many things like create and/or read a collection of database's index files, initialize certain SeqDB properties, etc.
Syntax: $seqdb = new seqdb($dbname, $dbformat, $file1, $file2, ...); Behavior: if $dbname exists and user gave no specific values for $file1, $file2, ... then seqdb() object USES/OPENS existing database (index files). if $dbname exists and user gave specific values for $file1, $file2, ... then seqdb() object OVERWRITES existing database (index files). if $dbname does not exist, then seqdb() object CREATES new database. even if $file1, $file2, ... are not specified. We provide the create() method to explicitly create a new database. We provide the use() or open() method to explicitly use an existing database.
Tags
Table of Contents
Interfaces
- DatabaseInterface
- Interface RecordingOnLocalDb
Properties
Methods
- __construct() : mixed
- DatabaseManager constructor.
- fetch() : ParseSwissprotManager|ParseGenbankManager|ParseEmblManager|bool
- Retrieves all data from the specified sequence record and returns them in the form of a Seq object. This method invokes one of several parser methods.
- getmin() : int
- Gets the minimum of three (usually numeric) values $x, $y, and $z.
- intrim() : mixed
- Removes "internal spaces" (as opposed to leading and trailing spaces) from a string.
- left() : bool|string
- Returns the first $numchars characters of a string.
- recording() : mixed
- Records the new elements of a collection, reads a collection db exists fileX args ACTION Y Y create Y N use N Y create N N create
- 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.
- 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.
- line2r() : array<string|int, mixed>|bool
- Copies the lines belonging to a single sequence entry into an array.
Properties
$em
protected
EntityManager
$em
= null
$sPath
protected
string
$sPath
Methods
__construct()
DatabaseManager constructor.
public
__construct(EntityManagerInterface $em, string $sPath) : mixed
Parameters
- $em : EntityManagerInterface
-
Entity Manager, for Doctrine
- $sPath : string
-
Path to the data
fetch()
Retrieves all data from the specified sequence record and returns them in the form of a Seq object. This method invokes one of several parser methods.
public
fetch(string $sSeqId) : ParseSwissprotManager|ParseGenbankManager|ParseEmblManager|bool
Parameters
- $sSeqId : string
-
The id of the seq obj.
Tags
Return values
ParseSwissprotManager|ParseGenbankManager|ParseEmblManager|boolgetmin()
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
intintrim()
Removes "internal spaces" (as opposed to leading and trailing spaces) from a string.
public
intrim(string $string) : mixed
Parameters
- $string : string
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|stringrecording()
Records the new elements of a collection, reads a collection db exists fileX args ACTION Y Y create Y N use N Y create N N create
public
recording(string $sDbName[, string $sDbFormat = "GENBANK" ], mixed ...$sDataFile) : mixed
Parameters
- $sDbName : string
-
Name of the database
- $sDbFormat : string = "GENBANK"
-
Format of the database
- $sDataFile : mixed
-
Files to parse
Tags
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|stringright()
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|stringtrim_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
line2r()
Copies the lines belonging to a single sequence entry into an array.
private
line2r(mixed $fpseq, mixed $sDbFormat[, mixed $iLineNo = 0 ]) : array<string|int, mixed>|bool
Parameters
- $fpseq : mixed
- $sDbFormat : mixed
- $iLineNo : mixed = 0