diff --git a/ippisite/db.sqlite3 b/ippisite/db.sqlite3 index db5d773a7c69fd5c0d0e7127f3eb1efe378bb8eb..7ec7dd61212668b2fff2d44382e67427c4c30d13 100644 Binary files a/ippisite/db.sqlite3 and b/ippisite/db.sqlite3 differ diff --git a/ippisite/ippidb/management/commands/import_v1_data.py b/ippisite/ippidb/management/commands/import_v1_data.py index f5419e9bc6c182f2262b7447d36e855de388c538..de644fccde949c7dd2019a953793a6a7b502fb61 100644 --- a/ippisite/ippidb/management/commands/import_v1_data.py +++ b/ippisite/ippidb/management/commands/import_v1_data.py @@ -228,7 +228,50 @@ select distinct protein.NumUniprot, domain.PfamNumAccession , complexe.NbCopy, compound.log_d = row[13] #LogD compound.a_log_p = row[14] #ALogP compound.mean_atom_vol_vdw = row[15] #MeanAtomVolVdW - compound.molecular_weight = row[16] + compound.molecular_weight = row[16] #MolecularWeight + compound.nb_acceptor_h = row[17] #NbAcceptorH + compound.nb_aliphatic_amines = row[18] #NbAliphaticsAmines + compound.nb_aromatic_bonds = row[19] #NbAromaticBonds + compound.nb_aromatic_ether = row[20] #NbAromaticsEther + compound.nb_aromatic_sssr = row[21] #NbAromaticsSSSR + compound.nb_atom = row[22] #NbAtom + compound.nb_atom_non_h = row[23] #NbAtomNonH + compound.nb_benzene_like_rings = row[24] #NbBenzLikeRings + compound.nb_bonds = row[25] #NbBonds + compound.nb_bonds_non_h = row[26] #NbBondsNonH + compound.nb_br = row[27] #NbBr + compound.nb_c = row[28] #NbC + compound.nb_chiral_centers = row[29] #NbChiralCenters + compound.nb_circuits = row[30] #NbCircuits + compound.nb_cl = row[31] #NbCl + compound.nb_csp2 = row[32] #NbCsp2 + compound.nb_csp3 = row[33] #NbCsp3 + compound.nb_donor_h = row[34] #NbDonorH + compound.nb_double_bonds = row[35] #NbDoubleBonds + compound.nb_f = row[36] #NbF + compound.nb_i = row[37] #NbI + compound.nb_multiple_bonds = row[38] #NbMultBonds + compound.nb_n = row[39] #NbN + compound.nb_o = row[40] #NbO + compound.nb_rings = row[41] #NbRings + compound.nb_rotatable_bonds = row[42] #NbRotatableBonds + compound.randic_index = row[44] #RandicIndex + compound.rdf070m = row[45] #RDF070m + compound.rotatable_bond_fraction = row[46] #RotatableBondFraction + compound.sum_atom_polar = row[47] #SumAtomPolar + compound.sum_atom_vol_vdw = row[48] #SumAtomVolVdW + compound.tpsa = row[51] #TPSA + compound.ui = row[52] #Ui + compound.wiener_index = row[54] #WienerIndex + if row[55]!='N': + compound.common_name = row[55] #CmpdNameSh + compound.pubchem_id = row[56] #IdPubchem + if row[57]!='N': + compound.chemspider_id = row[57] #IdPubchem + compound.chembl_id = row[58] + compound.iupac_name = row[59] + #compound.mddr_compound = row[60] + #FIXME lookup MDDR to get the right ID compound.save() except Exception as e: if options['stoponfail']: diff --git a/ippisite/ippidb/migrations/0015_auto_20170519_1442.py b/ippisite/ippidb/migrations/0015_auto_20170519_1442.py new file mode 100644 index 0000000000000000000000000000000000000000..1fca3005fce46c0e16f303ccfd014beb9c630e59 --- /dev/null +++ b/ippisite/ippidb/migrations/0015_auto_20170519_1442.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.1 on 2017-05-19 14:42 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('ippidb', '0014_auto_20170519_1243'), + ] + + operations = [ + migrations.AlterField( + model_name='compound', + name='pubchem_id', + field=models.CharField(blank=True, max_length=10, null=True, verbose_name='Pubchem ID'), + ), + ] diff --git a/ippisite/ippidb/migrations/0016_auto_20170519_1453.py b/ippisite/ippidb/migrations/0016_auto_20170519_1453.py new file mode 100644 index 0000000000000000000000000000000000000000..f33ad147e4718a43b7b49bbe90ed61510e000e8e --- /dev/null +++ b/ippisite/ippidb/migrations/0016_auto_20170519_1453.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.1 on 2017-05-19 14:53 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('ippidb', '0015_auto_20170519_1442'), + ] + + operations = [ + migrations.AlterField( + model_name='compound', + name='iupac_name', + field=models.CharField(blank=True, max_length=255, null=True, verbose_name='IUPAC name'), + ), + ] diff --git a/ippisite/ippidb/migrations/0017_auto_20170519_1500.py b/ippisite/ippidb/migrations/0017_auto_20170519_1500.py new file mode 100644 index 0000000000000000000000000000000000000000..f62efeeaadac44fe2c45aed5f9a3e3a704165015 --- /dev/null +++ b/ippisite/ippidb/migrations/0017_auto_20170519_1500.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.1 on 2017-05-19 15:00 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('ippidb', '0016_auto_20170519_1453'), + ] + + operations = [ + migrations.AlterField( + model_name='compound', + name='chembl_id', + field=models.CharField(blank=True, max_length=30, null=True, verbose_name='Chembl ID'), + ), + ] diff --git a/ippisite/ippidb/migrations/0018_auto_20170522_1501.py b/ippisite/ippidb/migrations/0018_auto_20170522_1501.py new file mode 100644 index 0000000000000000000000000000000000000000..2986ba98f06fc35caa42f508d3876dc97978a3d9 --- /dev/null +++ b/ippisite/ippidb/migrations/0018_auto_20170522_1501.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.1 on 2017-05-22 15:01 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('ippidb', '0017_auto_20170519_1500'), + ] + + operations = [ + migrations.CreateModel( + name='MDDRActivityClass', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('activity_class', models.CharField(max_length=100, unique=True, verbose_name='Activity Class')), + ], + options={ + 'verbose_name_plural': 'MDDR activity classes', + }, + ), + migrations.AlterUniqueTogether( + name='mddrcompoundactivityclass', + unique_together=set([]), + ), + migrations.RemoveField( + model_name='mddrcompoundactivityclass', + name='mddr_compound', + ), + migrations.DeleteModel( + name='MDDRCompoundActivityClass', + ), + migrations.AddField( + model_name='mddrcompoundimport', + name='activity_classes', + field=models.ManyToManyField(to='ippidb.MDDRActivityClass'), + ), + ] diff --git a/ippisite/ippidb/models.py b/ippisite/ippidb/models.py index 5678657f079b2806ecc3062e716539eb0b563a72..48fb10e3e572e09bb0d6d417c1f654449194c7e8 100644 --- a/ippisite/ippidb/models.py +++ b/ippisite/ippidb/models.py @@ -236,13 +236,22 @@ class Compound(models.Model): ui = models.DecimalField('Unsaturation index', max_digits=4, decimal_places=2) wiener_index = models.IntegerField('Wiener index') common_name = models.CharField('Common name', unique=True, max_length=20, blank=True, null=True) - pubchem_id = models.CharField('Pubchem ID', unique=True, max_length=10, blank=True, null=True) + pubchem_id = models.CharField('Pubchem ID', max_length=10, blank=True, null=True) 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) + chembl_id = models.CharField('Chembl ID', max_length=30, blank=True, null=True) + iupac_name = models.CharField('IUPAC name', max_length=255, blank=True, null=True) mddr_compound = models.ForeignKey('MDDRCompoundImport', blank=True, null=True) +class MDDRActivityClass(models.Model): + activity_class = models.CharField('Activity Class', max_length=100, unique=True) + + class Meta: + verbose_name_plural = "MDDR activity classes" + + def __str__(self): + return self.activity_class + class MDDRCompoundImport(models.Model): mddr_compound_id = models.IntegerField('MDDR compound ID') mddr_name = models.CharField('MDDR name', max_length=40) @@ -250,6 +259,7 @@ class MDDRCompoundImport(models.Model): canonical_smile = models.CharField('Canonical Smile', max_length=500, unique=True, blank=True, null=True) #TODO index this table on canonical_smile db_import_date = models.DecimalField('MDDR release year/month', max_digits=6, decimal_places=0) + activity_classes = models.ManyToManyField(MDDRActivityClass) class Meta: # over multiple releases of the MDDR database, the same compound can evolve in its development phase @@ -257,16 +267,6 @@ class MDDRCompoundImport(models.Model): unique_together = (('mddr_compound_id', 'mddr_name', 'dvpmt_phase'),) verbose_name_plural = "MDDR compound imports" - -class MDDRCompoundActivityClass(models.Model): - mddr_compound = models.ForeignKey(MDDRCompoundImport) - activity_class = models.CharField('Activity Class', max_length=100) - - class Meta: - unique_together = (('mddr_compound', 'activity_class'),) - verbose_name_plural = "MDDR compound activity classes" - - class MDDRSimilarity(models.Model): canonical_smile_ippidb = models.CharField('Canonical Smile for IPPIDB compound', max_length=500, unique=True, blank=True, null=True) canonical_smile_mddr = models.CharField('Canonical Smile for MDDR Compound', max_length=500, unique=True, blank=True, null=True)