Skip to content

Commit

Permalink
Drop TranscriptProteinLink database table
Browse files Browse the repository at this point in the history
This data is now in Redis, by #94.

Fixes #95
  • Loading branch information
martijnvermaat committed Nov 9, 2015
1 parent 790f7ba commit 28b9b1e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 37 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"""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 ###
37 changes: 0 additions & 37 deletions mutalyzer/db/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,43 +214,6 @@ def __repr__(self):
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.
Expand Down

0 comments on commit 28b9b1e

Please sign in to comment.