greenelab / django-genes

A Django package to represent genes
BSD 3-Clause "New" or "Revised" License
2 stars 3 forks source link
server tool web-server

Genes


Genes is a Django app to represent genes.

Download and Install

This package is registered as django-genes in PyPI and is pip installable:

::

pip install django-genes

If any of the following dependency packages are not found on your system, pip will install them too:

Quick Start

  1. Add 'genes' and 'organisms' to your INSTALLED_APPS setting like this:

::

INSTALLED_APPS = ( ... 'organisms', 'genes', )

  1. Run python manage.py migrate command to create genes and organisms models.

  2. (Optional) The following step is only needed if you have django-tastypie installed to create a REST API for your project and would like to have API endpoints for django-organisms and django-genes.

Add the following to your project's urls.py file:

::

There are probably already other imports here, such as:

from django.conf.urls import url, patterns, include

If you have not already done so, import the tastypie API:

from tastypie.api import Api

Import the API Resources for Organisms and Genes:

from organisms.api import OrganismResource from genes.api import GeneResource

If you have not already done so, initialize your API and

add the Organism and Gene Resources to it. You can also register

the CrossRefResource and CrossRefDBResource if you want to have

API endpoints for them as well.

v0_api = Api() v0_api.register(OrganismResource()) v0_api.register(GeneResource()) v0_api.register(CrossRefResource()) v0_api.register(CrossRefDBResource())

In the urlpatterns, include the urls for this api:

urlpatterns = patterns('', ... (r'^api/', include(v0_api.urls)) )

Search Indexes and Data Template

The module search_indexes.py can be used by django haystack (https://github.com/django-haystack/django-haystack) to search genes. It includes the Gene fields that should be included in the search index, and how they should be weighted. The text field refers to a document that is built for the search engine to index. The location of data template for this document is: genes/templates/search/indexes/gene_text.txt.

For more information, see: http://django-haystack.readthedocs.org/en/latest/tutorial.html#handling-data

Usage of Management Commands

This app includes five management commands in management/commands/ sub-directory:

  1. genes_add_xrdb

..

This command adds cross-reference databases for genes. It must be called for every new cross-reference database to populate the gene and cross-reference objects in the database. It requires 2 arguments:

  1. genes_load_geneinfo

..

This command parses gene info file(s) and saves the corresponding gene objects into the database. It takes 2 required arguments and 5 optional arguments:

  1. genes_load_uniprot.py

..

This command can be used to populate database with UniProtKB identifiers. It takes one argument:

  1. genes_load_wb.py

..

This command can be used to populate database with WormBase identifiers. It takes 3 arguments:

  1. genes_load_gene_history.py

..

This management command will read an input gene history file and find all genes whose tax_id match input taxonomy ID. If the gene already exists in the database, the Gene record in database will be set as obsolete; if not, a new obsolete Gene record will be created in the database.

The command accepts 2 required arguments and 3 optional arguments: