Commit 5b7e42ef authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

add methods to retrieve complexes

from PPI, CompoundAction, TestActivityDescription
fixes #37
parent b57cfd6e
No preview for this file type
......@@ -156,6 +156,19 @@ class Ppi(models.Model):
def __str__(self):
return '{} PPI, PDB:{}'.format(self.symmetry.description, self.pdb_id or 'unknown')
def get_ppi_complexes(self):
"""
return all ppi complexes belonging to this ppi
"""
return PpiComplex.objects.filter(ppi=self)
def get_ppi_bound_complexes(self):
"""
return bound ppi complexes belonging to this ppi
"""
#this is the less efficient query ever seen, FIXME
return PpiComplex.objects.filter(ppi=self, complex__in=ProteinDomainBoundComplex.objects.all())
class PpiComplex(models.Model):
ppi = models.ForeignKey(Ppi)
complex = models.ForeignKey(ProteinDomainComplex)
......@@ -281,11 +294,14 @@ class TestActivityDescription(models.Model):
cell_line = models.ForeignKey(CellLine)
def get_complexes(self):
return None
# if test_modulation_type is Binding, return all bound complexes for the Ppi
# if test_modulation_type is Inhibition, return all Ppi complexes
# if test_modulation_type is Stabilization, return all bound complexes for the Ppi
# this should be added to the Ppi class as well
"""
get the complexes tested for this PPI
depends on the modulation type
"""
if self.test_modulation_type=='I':
return self.ppi.get_ppi_complexes()
else:
return self.ppi.get_ppi_bound_complexes()
class CompoundActivityResult(models.Model):
MODULATION_TYPES = (
......@@ -364,9 +380,11 @@ class CmpdAction(models.Model):
unique_together = (('ppi', 'compound', 'activation_mode', 'pdb_id'),)
def get_complexes(self):
return None
# return all bound complexes for the Ppi
# this should be added to the Ppi class as well
"""
get the complexes involved in the compound action
which are always the bound complexes
"""
return ppi.get_ppi_bound_complexes()
class RefCompoundBiblio(models.Model):
compound = models.ForeignKey(Compound)
......
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