Skip to main content

Mobile Genetic Element database

Project description

MGEdb - Mobile Genetic Element database

MGEdb contains Mobile Genetic Elements sourced from several public databases including RefSeq, Tn registry and ICEberg. The database contain information on the properties, classification and genetic sequence of elements.

The database is shipped with a basic python API and a commandline interface for interacting with and maintaining the database. While the database and API is primarily desiged for the MGEfinder tool other applications are possible.

Installation

The database APIs are developed for python 3.7+, other versions are not activly supported.

Install database dependencies using the requirements file.

pip install -r requirements.txt

Run integration tests with either

make test

or

python setup.py test

Database structure

The database information is stored in mgedb/data. Database records are stored in json format. MGE nucleotide sequences are stored in fasta format in the folder mgedb/data/seqeunces.d.

Database commands

To see the available commands.

mgedb --help

To view a single MGE record or all the records of a given family in the database. Information are by default printed to stdout in a human readable format.

# view MGE record
mgedb view --name mge_name

# view all records from a given family
mgedb view --family mge_family_name

Extract CDS seqeunces and the sequences of the inverted repeats from MGE sequences in the database. These commands extract the ranges that are annotated in MGE records.

# Extract Inverted Repeat sequences annotated in MGEdb
mgedb extract ir output_file

# Extract CDS sequences for each MGE record with annotated CDS in MGEdb
mgedb extract ir output_file

Commands for updating and maintaining the database

Validate that database content conforms to database schema.

mgedb validate

Backup database as a tarball.

mgedb backup

Update database with new records and sequences. The new information need to be formatted in the MGEdb format. Prior to updating it makes an optional backup. Use the flag --dry-run to test the update without changing the database files.

mgedb update /path/to/new_database

Database API

Import and make database instance.

from mgedb import MGEdb

db = MGEdb()

mge_records = db.records

insertion_sequence_26 = mge_records['IS26']

Iterate over database sequences.

from mgedb import MGEdb

db = MGEdb()

mge_sequences = db.record_sequences
for mge in mge_sequences:
    header = mge.title
    sequence = mge.seq

See valid MGE names and MGE types in database

from mgedb import MGEdb

db = MGEdb()

mge_type_abbreviation = db.nomenclature.keys()
valid_insertion_sequence_names = db.nomenclature['is']

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

MGEdb-1.1.1.tar.gz (20.0 MB view hashes)

Uploaded Source

Built Distribution

MGEdb-1.1.1-py3-none-any.whl (20.7 MB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page