Commit 138172fb authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

add new "name" property for the PPI based on proteins in complexes

Former-commit-id: cac6d4ec52af22686f1f100b4b6662ebd5b7c2ee
parent 1f45bfda
......@@ -220,6 +220,17 @@ class Ppi(models.Model):
# this is the less efficient query ever seen, FIXME
return PpiComplex.objects.filter(ppi=self, complex__in=ProteinDomainBoundComplex.objects.all())
def name(self):
all_protein_names = set([ppi_complex.complex.protein.short_name for ppi_complex in self.get_ppi_complexes()])
bound_protein_names = set([ppi_complex.complex.protein.short_name for ppi_complex in self.get_ppi_bound_complexes()])
partner_protein_names = all_protein_names - bound_protein_names
bound_str = ','.join(bound_protein_names)
partner_str = ','.join(partner_protein_names)
name = bound_str
if partner_str!='':
name += ' / ' + partner_str
return name
class PpiComplex(models.Model):
ppi = models.ForeignKey(Ppi)
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