Skip to content

Database

Praduman Goyal edited this page Aug 20, 2019 · 2 revisions

Technical Stack

MySQL

Database schema

MWB file
PDF file
SQL file

The schema is provided to get the understanding of the database structure and manipulating the SQL dump according to the schema. It is strictly not advisable to use this schema to manually create the structure in the MySQL database and should only be handled by the Django ORM using migrate scripts.

Migrating the database

The SQL data

The SQL dump strictly needs to be in the given format. The ensembl dump can be easily formatted according to the required way using the script manipulate.sh residing in the root folder. The script does nothing significant other than renaming the tables to prefix it with core_. After that, it adds the column names in the Insert statements to ensure the right column names are used. The manipulate.sh can be used following the steps:

  1. Rename your dump to db.sql and place in the same directory as of manipulate.sh.
  2. Open the same directory in your terminal and type ./manipulate.sh.
  3. After completion, just import the updated db.sql normally to the created database

The species data

The populate_species.py script can be used to add species thumbnail, description and common name to the database once the scientific name and taxon id is populated. The script can be run:

  1. Activate your environment

    Go to the ecircdb-backend directory and activate the created environment

    $ source <env_name>/bin/activate
  2. Run shell

    $ python manage.py shell
  3. Run the script

    Ensure that your device is connected with an active internet connection needed to download the relevant information from the Ensembl and Wikipedia

    import populate_species.py

The quality reports

The sample fastqc quality reports need to be in the following format. However, the files can be anywhere and the corresponding path can be included in the core_sample table. But, the following format can be used for the pre-configured ensembl dump:

/ecircdb-backend/media/fastq_export/<species_common_name_in_lowercase>/QC/<sample_accession_in_lowercase>_fastqc.html

For ex.

/ecircdb-backend/media/fastq_export/dog/QC/do22633_fastqc.html

Clone this wiki locally