Skip to content
Snippets Groups Projects
Commit 8543a5bd authored by Vermaat's avatar Vermaat
Browse files

Rename GRCh36 to NCBI36

Not sure how this came to be, but NCBI36 was incorrectly named GRCh36.
Changing this, however, breaks the sort order in assembly lists. So we
now sort on the UCSC alias (hg18).

Fixes #8
parent 9882df54
No related branches found
No related tags found
No related merge requests found
......@@ -19,6 +19,8 @@ Release date to be decided.
<https://git.lumc.nl/mutalyzer/mutalyzer/issues/30>`_).
- Fix importing transcript mappings from UCSC database (`GitLab#9
<https://git.lumc.nl/mutalyzer/mutalyzer/issues/9>`_).
- Rename GRCh36 to NCBI36 (`GitLab#8
<https://git.lumc.nl/mutalyzer/mutalyzer/issues/8>`_).
Version 2.0.3
......
{
"name": "GRCh36",
"name": "NCBI36",
"alias": "hg18",
"taxonomy_id": 9606,
"taxonomy_common_name": "Homo sapiens",
......
"""Rename GRCh36 assembly to NCBI36
Revision ID: 2e062969eb54
Revises: 402ff01b0d5d
Create Date: 2014-10-22 13:09:17.336650
"""
from __future__ import unicode_literals
# revision identifiers, used by Alembic.
revision = '2e062969eb54'
down_revision = u'402ff01b0d5d'
from alembic import op
from sqlalchemy import sql
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
assemblies = sql.table('assemblies',
sql.column('name', sa.String(30)))
# https://alembic.readthedocs.org/en/latest/ops.html#alembic.operations.Operations.execute
op.execute(assemblies.update().where(assemblies.c.name == op.inline_literal('GRCh36')).values({'name': op.inline_literal('NCBI36')}))
### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
assemblies = sql.table('assemblies',
sql.column('name', sa.String(30)))
# https://alembic.readthedocs.org/en/latest/ops.html#alembic.operations.Operations.execute
op.execute(assemblies.update().where(assemblies.c.name == op.inline_literal('NCBI36')).values({'name': op.inline_literal('GRCh36')}))
### end Alembic commands ###
......@@ -267,6 +267,9 @@ class Assembly(db.Base):
#: NCBI taxonomy name (e.g., ``Homo sapiens``, ``Mus musculus``).
taxonomy_common_name = Column(String(50), nullable=False)
#: Criteria to order assemblies by in user-visible lists.
order_by_criteria = taxonomy_common_name.asc(), alias.asc()
def __init__(self, name, taxonomy_id, taxonomy_common_name, alias=None):
self.name = name
self.taxonomy_id = taxonomy_id
......
......@@ -77,8 +77,7 @@ def list_assemblies():
List genome assemblies.
"""
assemblies = Assembly.query \
.order_by(Assembly.taxonomy_common_name.asc(),
Assembly.name.asc()) \
.order_by(*Assembly.order_by_criteria) \
.all()
for assembly in assemblies:
......
......@@ -397,8 +397,7 @@ def position_converter():
code=301)
assemblies = Assembly.query \
.order_by(Assembly.taxonomy_common_name.asc(),
Assembly.name.asc()) \
.order_by(*Assembly.order_by_criteria) \
.all()
assembly_name_or_alias = request.args.get('assembly_name_or_alias',
......@@ -518,8 +517,7 @@ def reference_loader():
Reference sequence loader form.
"""
assemblies = Assembly.query \
.order_by(Assembly.taxonomy_common_name.asc(),
Assembly.name.asc()) \
.order_by(*Assembly.order_by_criteria) \
.all()
return render_template('reference-loader.html',
......@@ -580,8 +578,7 @@ def reference_loader_submit():
% (method, unicode(request.form), request.remote_addr))
assemblies = Assembly.query \
.order_by(Assembly.taxonomy_common_name.asc(),
Assembly.name.asc()) \
.order_by(*Assembly.order_by_criteria) \
.all()
retriever = Retriever.GenBankRetriever(output)
......@@ -749,8 +746,7 @@ def batch_jobs():
job_type = request.args.get('job_type', 'name-checker')
assemblies = Assembly.query \
.order_by(Assembly.taxonomy_common_name.asc(),
Assembly.name.asc()) \
.order_by(*Assembly.order_by_criteria) \
.all()
assembly_name_or_alias = request.args.get('assembly_name_or_alias',
settings.DEFAULT_ASSEMBLY)
......@@ -776,8 +772,7 @@ def batch_jobs_submit():
batch_file = request.files.get('file')
assemblies = Assembly.query \
.order_by(Assembly.taxonomy_common_name.asc(),
Assembly.name.asc()) \
.order_by(*Assembly.order_by_criteria) \
.all()
assembly_name_or_alias = request.form.get('assembly_name_or_alias',
settings.DEFAULT_ASSEMBLY)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment