Commit 8b3c9e27 authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

finish last model classes and update db.

parent 383eee2f
No preview for this file type
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-29 14:41
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('ippidb', '0007_auto_20170328_2045'),
]
operations = [
migrations.CreateModel(
name='RefCompoundBiblio',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('compound_name', models.CharField(max_length=50, verbose_name='Compound name in the publication')),
('bibliography_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='ippidb.Bibliography')),
('compound_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='ippidb.Compound')),
],
),
migrations.AddField(
model_name='cmpdaction',
name='nb_copy_compounds',
field=models.IntegerField(default=1, verbose_name='Number of copies for the compound'),
preserve_default=False,
),
migrations.AddField(
model_name='cmpdaction',
name='pdb_id',
field=models.CharField(default='NA', max_length=4, verbose_name='PDB ID'),
preserve_default=False,
),
migrations.AddField(
model_name='cmpdaction',
name='ppi_id',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='ippidb.Ppi'),
preserve_default=False,
),
migrations.AddField(
model_name='compoundactivityresult',
name='modulation_type',
field=models.CharField(choices=[('B', 'Binding'), ('I', 'Inhibition'), ('S', 'Stabilization')], default='B', max_length=1, verbose_name='Modulation type'),
preserve_default=False,
),
migrations.AlterField(
model_name='cmpdaction',
name='activation_mode',
field=models.CharField(choices=[('O', 'Orthosteric'), ('A', 'Allosteric')], max_length=1, verbose_name='Activation mode'),
),
migrations.RemoveField(
model_name='cmpdaction',
name='modulation_type',
),
migrations.AlterUniqueTogether(
name='cmpdaction',
unique_together=set([('complex_id', 'compound_id', 'pdb_id')]),
),
migrations.AlterUniqueTogether(
name='refcompoundbiblio',
unique_together=set([('compound_id', 'bibliography_id')]),
),
]
......@@ -119,6 +119,9 @@ class Domain(models.Model):
self.pfam_description = info['description']
super(Domain, self).save(*args, **kwargs)
def __str__(self):
return '{} ({}-{})'.format(self.pfam_acc, self.pfam_id, self.pfam_description)
class ProteinDomainComplex(models.Model):
protein_id = models.ForeignKey('Protein')
domain_id = models.ForeignKey('Domain')
......@@ -277,10 +280,16 @@ class ActivityType(models.Model):
name = models.CharField('Name', max_length=50, unique=True)
class CompoundActivityResult(models.Model):
MODULATION_TYPES = (
('B', 'Binding'),
('I', 'Inhibition'),
('S', 'Stabilization')
)
compound_id = models.ForeignKey(Compound)
test_activity_description_id = models.ForeignKey(TestActivityDescription)
activity_type_id = models.ForeignKey(ActivityType)
activity = models.DecimalField('Activity', max_digits=12, decimal_places=10)
modulation_type = models.CharField('Modulation type', max_length=1, choices=MODULATION_TYPES)
class Meta:
unique_together = (('compound_id', 'test_activity_description_id', 'activity_type_id'),)
......@@ -329,43 +338,22 @@ class CompoundPKResult(models.Model):
class CmpdAction(models.Model):
ACTIVATION_MODES = (
('O', 'Orthosteric'),
('A', 'Allosteric'),
('U', 'Unspecified')
)
MODULATION_TYPES = (
('I', 'Inhibition'),
('S', 'Stabilization')
('A', 'Allosteric')
)
complex_id = models.ForeignKey(ProteinDomainBoundComplex)
compound_id = models.ForeignKey(Compound)
activation_mode = models.CharField('Activation mode', max_length=1, choices=ACTIVATION_MODES)
modulation_type = models.CharField('Modulation type', max_length=1, choices=MODULATION_TYPES)
""""
class Actionevidencetest(models.Model):
idcmpdaction = models.ForeignKey('Cmpdaction', models.DO_NOTHING, ='IDCmpdAction')
idtestactivity = models.ForeignKey('Testactivitydescription', models.DO_NOTHING, ='IDTestActivity')
nbcopycompound = models.IntegerField(='NbCopyCompound', blank=True, null=True)
ppi_id = models.ForeignKey(Ppi)
pdb_id = models.CharField('PDB ID', max_length=4)
nb_copy_compounds = models.IntegerField('Number of copies for the compound')
class Meta:
# managed = False
db_table = 'actionEvidenceTest'
unique_together = (('idcmpdaction', 'idtestactivity'),)
unique_together = (('complex_id', 'compound_id', 'pdb_id'),)
class Refcmpdbiblio(models.Model):
idcompound = models.ForeignKey(Compound, models.DO_NOTHING, ='IDCompound')
idbiblio = models.ForeignKey(Biblio, models.DO_NOTHING, ='IDBiblio')
cmpdnameinbiblio = models.CharField(='CmpdNameInBiblio', max_length=20, blank=True, null=True)
class RefCompoundBiblio(models.Model):
compound_id = models.ForeignKey(Compound)
bibliography_id = models.ForeignKey(Bibliography)
compound_name = models.CharField('Compound name in the publication', max_length=50)
class Meta:
# managed = False
db_table = 'refCmpdBiblio'
unique_together = (('idcompound', 'idbiblio'),)
"""
unique_together = (('compound_id', 'bibliography_id'),)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment