# GENtle/Databases

The GENtle database management dialog is where sequences are stored and retrieved. DNA and amino acid sequences, primers, alignments, and projects all go to databases, which can be local (for one computer only) or shared (used by the whole work group, institute, etc.).

## Management

The "Management" tab can be reached through the File menu, the Tools/Manage database menu, the Ctrl-O and Ctrl-S keys ("open" and "save", respectively), or the appropriate buttons in the toolbar. The tab consists of two or three parts:

### Filter

The filter section allows to filter the database entries so the list(s) below show only the matching entries.
The filter text box limits the shown sequences to those whose name (or description or sequence, depending on the checkboxes) contain that text. Multiple search words are separated by a space (" ") and work as a logical AND. Thus, entering "pgex igf" in the filter text box shows only those sequences whose name (or description) contain both the word "pgex" and "igf". The search in not case-sensitive, so searching for "igf" or "IGF" will make no difference.
The checkboxes on the right limit the display to any combination of DNA, protein (amino acid sequences), and primers. If non of these is selected, all types of entries are shown, including alignments. As already described, search for text can be extended beyond the sequence name to description and the sequence itself through two other checkboxes, where description search is enabled as default.

### Lists

One or two lists are shown, depending on the appropriate checkbox above the left list. The database(s) to search/display can be selected via the drop-down box(es). One list with full width is good for an overview of a single database, whereas two lists are needed for moving and copying entries between databases; also, a search will be run on both databases simultaneously.
Entries will be sorted alphabetically. Every entry has a small icon associated with its type. There are icons for DNA, amino acid sequences, primers, and alignments. There is also a project icon, but these will only be shown when opening/saving a project.
A single entry can be selected by clicking with the left mouse button. When opening a file, a double click or pressing RETURN on a selected entry will open it. Multiple entries can be selected by dragging a rectangle with the mouse, or by holding down the SHIFT and/or CTRL keys. A multiple selection can be opened via RETURN.
Grabbing selected entries with the left mouse button and dragging them into the other list will move these entries to that database. To copy these entries, hold down the CTRL key when releasing the left mouse button over the target list.
Selected entries can be opened, renamed, and deleted via their context menu.

### Save

If you save an entry to a database, there will be an additional line below the lists. It consists of a drop-down box with the database to save the entry to, and a text box for the name. The name of the database is remembered if you originally opened that entry from a database, otherwise the standard database is the default.
Saving an entry to a database where an entry with that name already exists will lead to the following:
* If the sequence of the entry in the database is exactly the same as the sequence of the entry you're trying to save, a message box will ask you if you really want to overwrite that entry.
* If the sequence of the entry in the database differs from the sequence of the entry you're trying to save, a message box will tell you that this action was prevented. This will avoid accidental overwriting of an entry with a different sequence. If you are very certain you want to replace that entry, you will have to delete the entry in the database manually via the context menu, as described above.

## Databases

Currently, GENtle supports sqlite and MySQL databases, both of them freely available. Each has different advantages and disadvantages, though both are integrated seamlessly into GENtle. Once set up, all functions are available on all databases, no matter the type.
The "Databases" tab keeps a list of all the databases that can be accessed. New databases can be created, and existing can be added to or removed from that list. The exception is the local database, which is essential for the functioning of GENtle and therefore can not be removed. Removal of a database will not delete the database itself, only the entry in the list.
One of the databases in the list is the default database. The default database can be set by selecting its entry in the list, then clicking the As Default button. The default database can carry shared enzyme groups.

### Sqlite

Sqlite is already integrated in GENtle, so no separate installation or setup of any kind is required. A sqlite database consists of a single file with the ending ".db". For each GENtle installation, a database ("local.db") is automatically created. New sqlite databases can be created, or existing ones added to GENtle, on the "Databases" tab in the dialog. To take such a database with you (e.g., for use at home or on a laptop), just copy the ".db" file. While sqlite databases are easy to set up and maintain, sharing them across a network tends to be slow, depending on the size of the database.

### MySQL

MySQL is a professional client/server database system that will reliably store and serve millions of entries. It is ideal for shared databases, as even a huge number of stored sequences will not slow it down significantly, even across a network. However, there are some steps required to use MySQL databases with GENtle:
* A "server" computer on your network, that is, a computer that is running most of the time, and preferably is not used for direct work. If the server is not running, or disconnected from the network, no one will be able to access the MySQL database and the sequences stored in it!
* The MySQL server software (4.1 works fine, other versions will likely do as well), which available for free here.
* Someone to configure the MySQL server (not as complicated as it sounds)
Once the MySQL setup is complete, MySQL databases can be created (by one) and added to all the GENtle clients that should have access.