diff --git a/ippisite/db.sqlite3 b/ippisite/db.sqlite3 index 418ffe91ef59f6e2db941d723da526c109b5b5f5..d0f0db2af8cd80bce56b7148c24a74b09675dec6 100644 Binary files a/ippisite/db.sqlite3 and b/ippisite/db.sqlite3 differ diff --git a/ippisite/ippidb/admin.py b/ippisite/ippidb/admin.py index 516d271971ece864b049bec7e22e11e50e1ba6f7..dc4f162a8eabad23ea8491c384f210cd84bfc67a 100644 --- a/ippisite/ippidb/admin.py +++ b/ippisite/ippidb/admin.py @@ -20,13 +20,13 @@ class DomainAdmin(admin.ModelAdmin): @admin.register(ProteinDomainBoundComplex) class ProteinDomainBoundComplexAdmin(admin.ModelAdmin): - list_display = ('protein_id', 'domain_id', 'ppc_copy_nb', 'ppp_copy_nb_per_p', 'pockets_nb') - list_display_links = ('protein_id', 'domain_id', 'ppc_copy_nb', 'ppp_copy_nb_per_p', 'pockets_nb') + list_display = ('protein', 'domain', 'ppc_copy_nb', 'ppp_copy_nb_per_p', 'pockets_nb') + list_display_links = ('protein', 'domain', 'ppc_copy_nb', 'ppp_copy_nb_per_p', 'pockets_nb') @admin.register(ProteinDomainPartnerComplex) class ProteinDomainPartnerComplexAdmin(admin.ModelAdmin): - list_display = ('protein_id', 'domain_id', 'ppc_copy_nb') - list_display_links = ('protein_id', 'domain_id', 'ppc_copy_nb') + list_display = ('protein', 'domain', 'ppc_copy_nb') + list_display_links = ('protein', 'domain', 'ppc_copy_nb') @admin.register(Symmetry) class Symmetry(admin.ModelAdmin): diff --git a/ippisite/ippidb/forms.py b/ippisite/ippidb/forms.py index 6c83082fd0c98373d0ae7fa95909b5e3f4fec84d..d7364dac8dd8d664a3bbccc54bd3cce6c813bd9d 100644 --- a/ippisite/ippidb/forms.py +++ b/ippisite/ippidb/forms.py @@ -22,10 +22,10 @@ class ProteinForm(ModelForm): class ProteinDomainComplexForm(ModelForm): class Meta: model = ProteinDomainComplex - fields = ['protein_id', 'domain_id', 'ppc_copy_nb'] + fields = ['protein', 'domain', 'ppc_copy_nb'] class PpiForm(ModelForm): class Meta: model = Ppi - fields = ['complex_id', 'cc_nb', 'pdb_id', 'symmetry_id'] + fields = ['complex', 'cc_nb', 'pdb_id', 'symmetry'] diff --git a/ippisite/ippidb/migrations/0009_auto_20170517_2020.py b/ippisite/ippidb/migrations/0009_auto_20170517_2020.py new file mode 100644 index 0000000000000000000000000000000000000000..51fbffd8892fe1bb4048f3d395ac5d898cfd12cf --- /dev/null +++ b/ippisite/ippidb/migrations/0009_auto_20170517_2020.py @@ -0,0 +1,196 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.5 on 2017-05-17 20:20 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('ippidb', '0008_auto_20170329_1441'), + ] + + operations = [ + migrations.RenameField( + model_name='cmpdaction', + old_name='complex_id', + new_name='complex', + ), + migrations.RenameField( + model_name='cmpdaction', + old_name='compound_id', + new_name='compound', + ), + migrations.RenameField( + model_name='cmpdaction', + old_name='ppi_id', + new_name='ppi', + ), + migrations.RenameField( + model_name='compound', + old_name='mddr_compound_id', + new_name='mddr_compound', + ), + migrations.RenameField( + model_name='compoundactivityresult', + old_name='activity_type_id', + new_name='activity_type', + ), + migrations.RenameField( + model_name='compoundactivityresult', + old_name='compound_id', + new_name='compound', + ), + migrations.RenameField( + model_name='compoundactivityresult', + old_name='test_activity_description_id', + new_name='test_activity_description', + ), + migrations.RenameField( + model_name='compoundcytotoxicityresult', + old_name='compound_id', + new_name='compound', + ), + migrations.RenameField( + model_name='compoundcytotoxicityresult', + old_name='test_cytotoxicity_description_id', + new_name='test_cytotoxicity_description', + ), + migrations.RenameField( + model_name='compoundpkresult', + old_name='compound_id', + new_name='compound', + ), + migrations.RenameField( + model_name='compoundpkresult', + old_name='test_pk_description_id', + new_name='test_pk_description', + ), + migrations.RenameField( + model_name='disease', + old_name='ppi_id', + new_name='ppi', + ), + migrations.RenameField( + model_name='mddrcompoundactivityclass', + old_name='mddr_compound_id', + new_name='mddr_compound', + ), + migrations.RenameField( + model_name='ppi', + old_name='complex_id', + new_name='complex', + ), + migrations.RenameField( + model_name='ppi', + old_name='symmetry_id', + new_name='symmetry', + ), + migrations.RenameField( + model_name='proteindomaincomplex', + old_name='domain_id', + new_name='domain', + ), + migrations.RenameField( + model_name='proteindomaincomplex', + old_name='protein_id', + new_name='protein', + ), + migrations.RenameField( + model_name='refcompoundbiblio', + old_name='bibliography_id', + new_name='bibliography', + ), + migrations.RenameField( + model_name='refcompoundbiblio', + old_name='compound_id', + new_name='compound', + ), + migrations.RenameField( + model_name='testactivitydescription', + old_name='biblio_id', + new_name='biblio', + ), + migrations.RenameField( + model_name='testactivitydescription', + old_name='complex_id', + new_name='complex', + ), + migrations.RenameField( + model_name='testactivitydescription', + old_name='ppi_id', + new_name='ppi', + ), + migrations.RenameField( + model_name='testcytotoxdescription', + old_name='biblio_id', + new_name='biblio', + ), + migrations.RenameField( + model_name='testpkdescription', + old_name='biblio_id', + new_name='biblio', + ), + migrations.RemoveField( + model_name='compound', + name='dh_Petitjean', + ), + migrations.RemoveField( + model_name='compound', + name='diam_graph_non_h_petitjean', + ), + migrations.RemoveField( + model_name='compound', + name='g_petitjean', + ), + migrations.RemoveField( + model_name='compound', + name='ig_petitjean', + ), + migrations.RemoveField( + model_name='compound', + name='radius_graph_non_h_petitjean', + ), + migrations.RemoveField( + model_name='compound', + name='surface_vdw_petitjean', + ), + migrations.RemoveField( + model_name='compound', + name='thickness_petitjean', + ), + migrations.RemoveField( + model_name='compound', + name='vol_vdw_petitjean', + ), + migrations.AlterField( + model_name='compound', + name='canonical_smile', + field=models.CharField(max_length=500, unique=True, verbose_name='Canonical Smile'), + ), + migrations.AlterUniqueTogether( + name='cmpdaction', + unique_together=set([('complex', 'compound', 'pdb_id')]), + ), + migrations.AlterUniqueTogether( + name='compoundactivityresult', + unique_together=set([('compound', 'test_activity_description', 'activity_type')]), + ), + migrations.AlterUniqueTogether( + name='compoundcytotoxicityresult', + unique_together=set([('compound', 'test_cytotoxicity_description')]), + ), + migrations.AlterUniqueTogether( + name='compoundpkresult', + unique_together=set([('compound', 'test_pk_description')]), + ), + migrations.AlterUniqueTogether( + name='mddrcompoundactivityclass', + unique_together=set([('mddr_compound', 'activity_class')]), + ), + migrations.AlterUniqueTogether( + name='refcompoundbiblio', + unique_together=set([('compound', 'bibliography')]), + ), + ] diff --git a/ippisite/ippidb/models.py b/ippisite/ippidb/models.py index a5417a44add003a9ada9675ede6aa53a9ac3a269..226227f7cb44c4d7d4afaa21f5b6eb89b684a87f 100644 --- a/ippisite/ippidb/models.py +++ b/ippisite/ippidb/models.py @@ -119,8 +119,8 @@ class Domain(models.Model): 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') + protein = models.ForeignKey('Protein') + domain = models.ForeignKey('Domain') ppc_copy_nb = models.IntegerField('Number of copies of the protein in the complex') class Meta: @@ -151,13 +151,13 @@ class Symmetry(models.Model): class Ppi(models.Model): ppi_id = models.IntegerField('PPI identifier') - complex_id = models.ForeignKey(ProteinDomainComplex) + complex = models.ForeignKey(ProteinDomainComplex) cc_nb = models.IntegerField('Number of copies of the complex in the PPI', default=1) pdb_id = models.CharField('PDB ID', max_length=4) - symmetry_id = models.ForeignKey(Symmetry) + symmetry = models.ForeignKey(Symmetry) class Disease(models.Model): - ppi_id = models.ForeignKey(Ppi) + ppi = models.ForeignKey(Ppi) disease_name = models.CharField('Disease', max_length=30) # is there any database/nomenclature for diseases? @@ -212,7 +212,7 @@ class Compound(models.Model): chemspider_id = models.CharField('Chemspider ID', unique=True, max_length=10, blank=True, null=True) chembl_id = models.CharField('Chembl ID', unique=True, max_length=30, blank=True, null=True) iupac_name = models.CharField('IUPAC name', unique=True, max_length=255, blank=True, null=True) - mddr_compound_id = models.ForeignKey('MDDRCompoundImport', blank=True, null=True) + mddr_compound = models.ForeignKey('MDDRCompoundImport', blank=True, null=True) class MDDRCompoundImport(models.Model): @@ -231,11 +231,11 @@ class MDDRCompoundImport(models.Model): class MDDRCompoundActivityClass(models.Model): - mddr_compound_id = models.ForeignKey(MDDRCompoundImport) + mddr_compound = models.ForeignKey(MDDRCompoundImport) activity_class = models.CharField('Activity Class', max_length=100) class Meta: - unique_together = (('mddr_compound_id', 'activity_class'),) + unique_together = (('mddr_compound', 'activity_class'),) verbose_name_plural = "MDDR compound activity classes" @@ -261,9 +261,9 @@ class TestActivityDescription(models.Model): ('I', 'Inhibition'), ('S', 'Stabilization') ) - complex_id = models.ForeignKey(ProteinDomainBoundComplex) - biblio_id = models.ForeignKey(Bibliography) - ppi_id = models.ForeignKey(Ppi, blank=True, null=True) + complex = models.ForeignKey(ProteinDomainBoundComplex) + biblio = models.ForeignKey(Bibliography) + ppi = models.ForeignKey(Ppi, blank=True, null=True) test_name = models.CharField('Test name', max_length=100) test_type = models.CharField('Test type', max_length=5, choices=TEST_TYPES) test_modulation_type = models.CharField('Test modulation type', max_length=1, choices=TEST_MODULATION_TYPES) @@ -279,34 +279,34 @@ class CompoundActivityResult(models.Model): ('I', 'Inhibition'), ('S', 'Stabilization') ) - compound_id = models.ForeignKey(Compound) - test_activity_description_id = models.ForeignKey(TestActivityDescription) - activity_type_id = models.ForeignKey(ActivityType) + compound = models.ForeignKey(Compound) + test_activity_description = models.ForeignKey(TestActivityDescription) + activity_type = 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'),) + unique_together = (('compound', 'test_activity_description', 'activity_type'),) class TestCytotoxDescription(models.Model): - biblio_id = models.ForeignKey(Bibliography) + biblio = models.ForeignKey(Bibliography) test_name = models.CharField('Cytotoxicity test name', max_length=100) cell_line = models.ForeignKey(CellLine) compound_concentration = models.DecimalField('Compound concentration in μM', max_digits=7, decimal_places=3, blank=True, null=True) class CompoundCytotoxicityResult(models.Model): - compound_id = models.ForeignKey(Compound) - test_cytotoxicity_description_id = models.ForeignKey(TestCytotoxDescription) + compound = models.ForeignKey(Compound) + test_cytotoxicity_description = models.ForeignKey(TestCytotoxDescription) toxicity = models.BooleanField('Toxicity', default=False) class Meta: - unique_together = (('compound_id', 'test_cytotoxicity_description_id'),) + unique_together = (('compound', 'test_cytotoxicity_description'),) class AdministrationMode(models.Model): name = models.CharField('Administration mode', max_length=20, blank=True, null=True) class TestPKDescription(models.Model): - biblio_id = models.ForeignKey(Bibliography) + biblio = models.ForeignKey(Bibliography) test_name = models.CharField('Pharmacokinetic test name', max_length=100) organism = models.ForeignKey(Taxonomy) administration_mode = models.ForeignKey(AdministrationMode, blank=True, null=True) @@ -314,8 +314,8 @@ class TestPKDescription(models.Model): dose_interval = models.IntegerField('Dose interval, in hours', blank=True, null=True) class CompoundPKResult(models.Model): - compound_id = models.ForeignKey(Compound) - test_pk_description_id = models.ForeignKey(TestPKDescription) + compound = models.ForeignKey(Compound) + test_pk_description = models.ForeignKey(TestPKDescription) tolerated = models.NullBooleanField('Tolerated', null=True) auc = models.IntegerField('Area under curve (ng.mL-1.hr)', blank=True, null=True) clearance = models.DecimalField('Clearance (mL/hr)', max_digits=7, decimal_places=3, blank=True, null=True) @@ -326,7 +326,7 @@ class CompoundPKResult(models.Model): voldistribution = models.DecimalField('Volume distribution (Vd)', max_digits=5, decimal_places=2, blank=True, null=True) class Meta: - unique_together = (('compound_id', 'test_pk_description_id'),) + unique_together = (('compound', 'test_pk_description'),) class CmpdAction(models.Model): @@ -334,20 +334,20 @@ class CmpdAction(models.Model): ('O', 'Orthosteric'), ('A', 'Allosteric') ) - complex_id = models.ForeignKey(ProteinDomainBoundComplex) - compound_id = models.ForeignKey(Compound) + complex = models.ForeignKey(ProteinDomainBoundComplex) + compound = models.ForeignKey(Compound) activation_mode = models.CharField('Activation mode', max_length=1, choices=ACTIVATION_MODES) - ppi_id = models.ForeignKey(Ppi) + ppi = 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: - unique_together = (('complex_id', 'compound_id', 'pdb_id'),) + unique_together = (('complex', 'compound', 'pdb_id'),) class RefCompoundBiblio(models.Model): - compound_id = models.ForeignKey(Compound) - bibliography_id = models.ForeignKey(Bibliography) + compound = models.ForeignKey(Compound) + bibliography = models.ForeignKey(Bibliography) compound_name = models.CharField('Compound name in the publication', max_length=50) class Meta: - unique_together = (('compound_id', 'bibliography_id'),) + unique_together = (('compound', 'bibliography'),)