Skip to content
Snippets Groups Projects
Commit 28b9b1e0 authored by Vermaat's avatar Vermaat
Browse files

Drop TranscriptProteinLink database table

This data is now in Redis, by #94.

Fixes #95
parent 790f7baa
No related branches found
No related tags found
No related merge requests found
"""Drop TranscriptProteinLink table
Revision ID: 10692e9f4836
Revises: 1bf1b52f057
Create Date: 2015-11-09 16:11:50.425722
"""
from __future__ import unicode_literals
# revision identifiers, used by Alembic.
revision = '10692e9f4836'
down_revision = u'1bf1b52f057'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_table('transcript_protein_links')
### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_table('transcript_protein_links',
sa.Column('id', sa.INTEGER(), nullable=False),
sa.Column('transcript_accession', sa.VARCHAR(length=20), autoincrement=False, nullable=True),
sa.Column('protein_accession', sa.VARCHAR(length=20), autoincrement=False, nullable=True),
sa.Column('added', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
sa.PrimaryKeyConstraint('id', name=u'transcript_protein_links_pkey')
)
### end Alembic commands ###
......@@ -214,43 +214,6 @@ Index('reference_slice',
unique=True)
# Todo: Perhaps it is a better fit to implement this with Redis.
class TranscriptProteinLink(db.Base):
"""
Cached link between a transcript and protein reference.
"""
__tablename__ = 'transcript_protein_links'
__table_args__ = {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'}
id = Column(Integer, primary_key=True)
#: Accession number for the transcript, not including the version number
#: (e.g., ``NM_018195`, ``XM_005270562``, ``NR_015380``). If `NULL`, the
#: record states that no transcript is linked to the protein.
transcript_accession = Column(String(20), nullable=True, index=True,
unique=True)
#: Accession number for the protein, not including the version number
#: (e.g., ``NP_060665``, ``XP_005258635``). If `NULL`, the record states
#: that no protein is linked to the transcript.
protein_accession = Column(String(20), nullable=True, index=True,
unique=True)
#: Date and time of creation.
added = Column(DateTime)
def __init__(self, transcript_accession=None, protein_accession=None):
if transcript_accession is None and protein_accession is None:
raise ValueError('Link must have a transcript or protein')
self.transcript_accession = transcript_accession
self.protein_accession = protein_accession
self.added = datetime.now()
def __repr__(self):
return '<TranscriptProteinLink transcript=%r protein=%r>' \
% (self.transcript_accession, self.protein_accession)
class Assembly(db.Base):
"""
Genome 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