next up previous contents
Next: The Entry Structure Up: Genetic Databases Previous: Map Files and Patricia

Accessing a Darwin Sequence Database

This section contains a complete description of the Darwin built-in type database and details how to access the individual components of a genetic database. We begin by loading a genetic database and assigning it to the (default) system variable DB.

> DB := ReadDb('Sample/SH2');
The DB name has a special status in Darwin. When performing matches on entries of a database, the matching algorithms require that the database be assigned to DB in most cases.

Table [*] lists the various selectors available for the structured type database. These selectors allow us access to the information kept in the .map file.

Table: The selectors for objects of type database.
1.1 
Table: The selectors for objects of type database.
Selector Description
Entry, i Returns the offset of the ith entry
FileName Returns the external filename.1
Pat, i Returns the offset into the patricia
  array of the ith sequence character.
string Returns the database as a string.
TotAA Returns the total number of bases.
TotChars Returns the total number of characters
  from all fields of the database.
TotEntries Returns the total number of entries.
type Returns the type of the database.2
 
1 This does not include any path information.
2 This is either type Peptide, DNA, RNA, or Mixed.

> DB[FileName];
Sample/SH2
> DB[type];                   
Peptide
> DB[TotAA];
43582
> DB[TotChars];
76825
> DB[TotEntries];   
78
> DB[Entry, 10];
12701
> DB[Pat, 1];                   
75820
> DB[string];
<DBNAME>SH2 Database</DBNAME><DBRELEASE>1.0</DBREL ..(76825).. 
G</SEQ></E>

Darwin allows multiple sequence databases to be loaded simultaneously. These can be assigned to any valid Darwin name. For instance,

> SP := ReadDb('~cbrg/DB/SwissProt');       # load SwissProt &
>                              #  assign it to the variable SP

SP := Peptide file(/homes/cbrg/DB/SwissProt(34675450), no index, 52205
 entries, 18531385 aminoacids)

> EMBL := ReadDb('~cbrg/DB/EMBL39/EMBL39.fun');    # load EMBL &
>                                   #  assign it to variable EMBL
> DB := SP;
DB := Peptide file(/homes/cbrg/DB/SwissProt(34675450), no index, 52205
 entries, 18531385 aminoacids)
With the assignment of SP to DB, the Swiss-Prot database becomes the current database. The type of both variables is database.
> type(SP, database);
true
> type(EMBL, database);
true
The system variable DB holds special status in Darwin. The database assigned to DB is the current database, that is, when any searches and matches are performed, they are performed here.



 
next up previous contents
Next: The Entry Structure Up: Genetic Databases Previous: Map Files and Patricia
Gaston Gonnet
1998-09-15