Database download module

To download the database, call download_database().

The other functions in this module provide basic functionality for checking where the database is stored, and deleting old versions if necessary.

API documentation

pyknotid.catalogue.getdb.clean_all_databases()[source]

Deletes all database files.

pyknotid.catalogue.getdb.clean_old_databases()[source]

Deletes old database files (all but the most recent version).

pyknotid.catalogue.getdb.download_database()[source]

Downloads the knots database to download_target_dir().

pyknotid.catalogue.getdb.download_target_dir()[source]

Returns the directory to which the knots database will be downloaded.

pyknotid.catalogue.getdb.find_database(db_version=None)[source]

Returns the path to the knots.db file.

find_db looks in the following locations, in order of precedence:

  1. The local folder (containing getdb.py). This is convenient if you have built your own database.
  2. The directory returned by appdirs.user_data_dir (depends on the OS).

If the database cannot be found, an exception is raised.

You can download a prebuilt database using download_database().

Parameters:db_version (int) – The database version to find. Defaults to None, in which case the current db_version from pyknotid.catalogue.database is used.
pyknotid.catalogue.getdb.require_database(func)[source]

Decorator that causes a function to query find_database before returning.