{"id":20074648,"url":"https://github.com/greenelab/django-genes","last_synced_at":"2025-05-05T21:31:58.475Z","repository":{"id":57420218,"uuid":"97642470","full_name":"greenelab/django-genes","owner":"greenelab","description":"A Django package to represent genes","archived":false,"fork":false,"pushed_at":"2019-02-14T15:09:59.000Z","size":103,"stargazers_count":2,"open_issues_count":12,"forks_count":3,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-10-13T22:20:17.077Z","etag":null,"topics":["server","tool","web-server"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/greenelab.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-18T20:48:49.000Z","updated_at":"2020-09-29T20:11:18.000Z","dependencies_parsed_at":"2022-09-14T08:40:25.472Z","dependency_job_id":null,"html_url":"https://github.com/greenelab/django-genes","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greenelab%2Fdjango-genes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greenelab%2Fdjango-genes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greenelab%2Fdjango-genes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greenelab%2Fdjango-genes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/greenelab","download_url":"https://codeload.github.com/greenelab/django-genes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224470631,"owners_count":17316704,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["server","tool","web-server"],"created_at":"2024-11-13T14:53:14.810Z","updated_at":"2024-11-13T14:53:15.540Z","avatar_url":"https://github.com/greenelab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nGenes\n*****\n\nGenes is a Django app to represent genes.\n\n\nDownload and Install\n====================\n\nThis package is registered as ``django-genes`` in PyPI and is pip\ninstallable:\n\n::\n\n   pip install django-genes\n\nIf any of the following dependency packages are not found on your\nsystem, ``pip`` will install them too:\n\n* ``django 1.8 or later`` (Django web framework)\n\n* ``django-organisms`` (``Organisms`` model, which is required by\n  ``Genes`` model)\n\n* ``django-haystack`` (see ``Search Indexes and Data Template``\n  section.)\n\n* ``django-fixtureless`` (for unittest, see ``tests.py``)\n\n\nQuick Start\n===========\n\n1. Add **'genes'** and **'organisms'** to your ``INSTALLED_APPS``\nsetting like this:\n\n::\n\n   INSTALLED_APPS = (\n       ...\n       'organisms',\n       'genes',\n   )\n\n2. Run ``python manage.py migrate`` command to create ``genes`` and\n``organisms`` models.\n\n3. **(Optional)** The following step is only needed if you have\ndjango-tastypie installed to create a REST API for your project and\nwould like to have API endpoints for ``django-organisms`` and\n``django-genes``.\n\nAdd the following to your project's ``urls.py`` file:\n\n::\n\n   # There are probably already other imports here, such as:\n   # from django.conf.urls import url, patterns, include\n\n   # If you have not already done so, import the tastypie API:\n   from tastypie.api import Api\n\n   # Import the API Resources for Organisms and Genes:\n   from organisms.api import OrganismResource\n   from genes.api import GeneResource\n\n   # If you have not already done so, initialize your API and\n   # add the Organism and Gene Resources to it. You can also register\n   # the CrossRefResource and CrossRefDBResource if you want to have\n   # API endpoints for them as well.\n   v0_api = Api()\n   v0_api.register(OrganismResource())\n   v0_api.register(GeneResource())\n   v0_api.register(CrossRefResource())\n   v0_api.register(CrossRefDBResource())\n\n   # In the urlpatterns, include the urls for this api:\n   urlpatterns = patterns('',\n       ...\n       (r'^api/', include(v0_api.urls))\n   )\n\n\nSearch Indexes and Data Template\n================================\n\nThe module ``search_indexes.py`` can be used by **django haystack**\n(https://github.com/django-haystack/django-haystack) to search genes.\nIt includes the Gene fields that should be included in the search\nindex, and how they should be weighted. The ``text`` field refers to a\ndocument that is built for the search engine to index. The location of\ndata template for this document is:\n``genes/templates/search/indexes/gene_text.txt``.\n\nFor more information, see:\nhttp://django-haystack.readthedocs.org/en/latest/tutorial.html#handling-data\n\n\nUsage of Management Commands\n============================\n\nThis app includes five management commands in ``management/commands/``\nsub-directory:\n\n\n1. genes_add_xrdb\n-----------------\n\n..\n\n   This command adds cross-reference databases for genes. It **must**\n   be called for every new cross-reference database to populate the\n   gene and cross-reference objects in the database. It requires 2\n   arguments:\n\n   * name: the name of the database\n\n   * URL: the URL for that database, with the string '_REPL_' added at\n     the end of the URL\n\n   For example, this command adds Ensembl as a cross-reference\n   database:\n\n   ::\n\n      python manage.py genes_add_xrdb --name=Ensembl --URL=http://www.ensembl.org/Gene/Summary?g=_REPL_\n\n   And this command adds MIM as a cross-reference database:\n\n   ::\n\n      python manage.py genes_add_xrdb --name=MIM --URL=http://www.ncbi.nlm.nih.gov/omim/_REPL_\n\n\n2. genes_load_geneinfo\n----------------------\n\n..\n\n   This command parses gene info file(s) and saves the corresponding\n   gene objects into the database. It takes 2 required arguments and 5\n   optional arguments:\n\n   * (Required) geneinfo_file: location of gene info file;\n\n   * (Required) taxonomy_id: taxonomy ID for organism for which genes\n     are being populated;\n\n   * (Optional) gi_tax_id: alternative taxonomy ID for some organisms\n     (such as S. cerevisiae);\n\n   * (Optional) symbol_col: symbol column in gene info file. Default\n     is 2;\n\n   * (Optional) systematic_col: systematic column in gene info file.\n     Default is 3;\n\n   * (Optional) alias_col: the column containing gene aliases. If a\n     hyphen '-' or blank space ' ' is passed, symbol_col will be used.\n     Default is 4.\n\n   * (Optional) put_systematic_in_xrdb: name of cross-reference\n     Database for which you want to use organism systematic IDs as\n     CrossReference IDs. This is useful for Pseudomonas, for example,\n     as systematic IDs are saved into PseudoCAP cross-reference\n     database.\n\n   The following example shows how to download a gzipped human gene\n   info file from NIH FTP server, and populate the database based on\n   this file.\n\n   ::\n\n      # Create a temporary data directory:\n      mkdir data\n\n      # Download a gzipped human gene info file into data directory:\n      wget -P data/ -N ftp://ftp.ncbi.nih.gov/gene/DATA/GENE_INFO/Mammalia/Homo_sapiens.gene_info.gz\n\n      # Unzip downloaded file:\n      gunzip -c data/Homo_sapiens.gene_info.gz \u003e data/Homo_sapiens.gene_info\n\n      # Call genes_load_geneinfo to populate the database:\n      python manage.py genes_load_geneinfo --geneinfo_file=data/Homo_sapiens.gene_info --taxonomy_id=9606 --systematic_col=3 --symbol_col=2\n\n\n3. genes_load_uniprot.py\n------------------------\n\n..\n\n   This command can be used to populate database with UniProtKB\n   identifiers. It takes one argument:\n\n   * uniprot_file: location of a file mapping UniProtKB IDs to Entrez\n     and Ensembl IDs\n\n   **Important:** Before calling this command, please make sure that\n   both Ensembl and Entrez identifiers have been loaded into the\n   database.\n\n   After downloading the gzipped file, use ``zgrep`` command to get\n   the lines we need (the original file is quite large), then run this\n   command:\n\n   ::\n\n      wget -P data/ -N ftp://ftp.uniprot.org/pub/databases/uniprot/current_release/knowledgebase/idmapping/idmapping.dat.gz\n      zgrep -e \"GeneID\" -e \"Ensembl\" data/idmapping.dat.gz \u003e data/uniprot_entrez_ensembl.txt\n      python manage.py genes_load_uniprot --uniprot_file=data/uniprot_entrez_ensembl.txt\n\n\n4. genes_load_wb.py\n-------------------\n\n..\n\n   This command can be used to populate database with WormBase\n   identifiers. It takes 3 arguments:\n\n   * (Required) wb_url: URL of wormbase xrefs file;\n\n   * (Optional) db_name: the name of the cross-reference database,\n     default is 'WormBase'.\n\n   As is expected, the WormBase cross-reference database should be\n   populated using the ``genes_add_xrdb`` command (see command #1)\n   before this command to populate the WormBase identifiers. Here is\n   an example:\n\n   ::\n\n      # Find latest version of WormBase here:\n      # http://www.wormbase.org/about/release_schedule#102--10-1\n      python manage.py genes_load_wb --wb_url=ftp://ftp.wormbase.org/pub/wormbase/releases/WS243/species/c_elegans/PRJNA13758/c_elegans.PRJNA13758.WS243.xrefs.txt.gz\n\n\n5. genes_load_gene_history.py\n-----------------------------\n\n..\n\n   This management command will read an input gene history file and\n   find all genes whose tax_id match input taxonomy ID. If the gene\n   already exists in the database, the Gene record in database will be\n   set as obsolete; if not, a new obsolete Gene record will be created\n   in the database.\n\n   The command accepts 2 required arguments and 3 optional arguments:\n\n   * (Required) gene_history_file: Input gene history file. A gzipped\n     example file can be found at:\n     ftp://ftp.ncbi.nih.gov/gene/DATA/gene_history.gz\n\n   * (Required) tax_id: Taxonomy ID assigned by NCBI to a certain\n     organism. Genes of the other organisms in input file will be\n     skipped.\n\n   * (Optional) tax_id_col: column number of tax_id in input file.\n     Default is 1.\n\n   * (Optional) discontinued_id_col: column number of discontinued\n     GeneID in input file. Default is 3.\n\n   * (Optional) discontinued_symbol_col: column number of gene's\n     discontinued symbol in input file. Default is 4.\n\n   Note that column numbers in the last three arguments all start from\n   1, **not** 0.\n\n   For example, to add obsolete genes whose tax_id is 208964 in the\n   file \"gene_history\", we will use the command like this:\n\n   ::\n\n      # Download file into your data directory:\n      cd /data_dir; wget ftp://ftp.ncbi.nih.gov/gene/DATA/gene_history.gz\n\n      # Unzip the downloaded file into \"gene_history\"\n      gunzip gene_history.gz\n\n      # Run management command:\n      python manage.py genes_load_gene_history /data_dir/gene_history 208964 --tax_id_col=1 --discontinued_id_col=3 --discontinued_symbol_col=4\n\n   (Here ``--tax_id_col=1 --discontinued_id_col=3\n   --discontinued_symbol_col=4`` are optional because they are using\n   default values.)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreenelab%2Fdjango-genes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgreenelab%2Fdjango-genes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreenelab%2Fdjango-genes/lists"}