diff --git a/ippisite/db.sqlite3 b/ippisite/db.sqlite3 index 4322d387f7390adb118f06d2b776199986ca1340..47ec17349e4b67ca860f635c93619456554a9e2f 100644 Binary files a/ippisite/db.sqlite3 and b/ippisite/db.sqlite3 differ diff --git a/ippisite/ippidb/migrations/0008_auto_20170329_1441.py b/ippisite/ippidb/migrations/0008_auto_20170329_1441.py new file mode 100644 index 0000000000000000000000000000000000000000..a4226179155219adea04ba3b82a39d7d71e0d581 --- /dev/null +++ b/ippisite/ippidb/migrations/0008_auto_20170329_1441.py @@ -0,0 +1,66 @@ +# -*- 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')]), + ), + ] diff --git a/ippisite/ippidb/models.py b/ippisite/ippidb/models.py index 325a849ee7e96127cc8e42639192b4d5c8927432..73de8458539437385dce0540cea8f25e73073cf9 100644 --- a/ippisite/ippidb/models.py +++ b/ippisite/ippidb/models.py @@ -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'),)