Commit 671c927f authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

minor reformats for models

parent e98462c6
......@@ -76,9 +76,9 @@ class Bibliography(AutoFillableModel):
source = models.CharField(
'Bibliographic type', max_length=2, choices=SOURCES, default=SOURCES[0][0])
id_source = models.CharField('Bibliographic ID', max_length=25)
title = models.CharField('Title', max_length=300)
journal_name = models.CharField('Journal name', max_length=50, null=True, blank=True)
authors_list = models.CharField('Authors list', max_length=500)
title = models.TextField('Title')
journal_name = models.TextField('Journal name', null=True, blank=True)
authors_list = models.TextField('Authors list')
biblio_year = models.PositiveSmallIntegerField('Year')
cytotox = models.BooleanField('Cytotoxicity data', default=False)
in_silico = models.BooleanField('in silico study', default=False)
......@@ -162,7 +162,7 @@ class Bibliography(AutoFillableModel):
class Taxonomy(AutoFillableModel):
"""
Taxonomy IDs (from NCBI Taxonomy)
Taxonomy IDs (from NCBI Taxonomy)
and the corresponding human-readable name
"""
taxonomy_id = models.DecimalField(
......@@ -186,7 +186,7 @@ class Taxonomy(AutoFillableModel):
class MolecularFunction(AutoFillableModel):
"""
Molecular functions (from Gene Ontology)
Molecular functions (from Gene Ontology)
and the corresponding human-readable description
"""
go_id = models.CharField('Gene Ontology ID', unique=True, max_length=10)
......@@ -214,7 +214,7 @@ class MolecularFunction(AutoFillableModel):
class Protein(AutoFillableModel):
"""
Protein information (from Uniprot)
Protein information (from Uniprot)
and the corresponding human-readable name
"""
uniprot_id = models.CharField('Uniprot ID', unique=True, max_length=10)
......@@ -275,7 +275,7 @@ class Protein(AutoFillableModel):
class Domain(AutoFillableModel):
"""
Domain (i.e. Protein domain) information (from PFAM)
Domain (i.e. Protein domain) information (from PFAM)
"""
pfam_acc = models.CharField('Pfam Accession', max_length=10, unique=True)
pfam_id = models.CharField('Pfam Family Identifier', max_length=20)
......@@ -470,8 +470,8 @@ class CompoundManager(models.Manager):
# Lipinsky a_log_p (<5)
qs = qs.annotate(lipinsky_a_log_p=Case(When(a_log_p__lte=5, then=True), default=False, output_field=BooleanField()))
# Lipinsky global
qs = qs.annotate(lipinsky_score=Cast(F('lipinsky_mw'), IntegerField())+Cast(F('lipinsky_hba'), IntegerField())+ \
Cast(F('lipinsky_hbd'), IntegerField()) + Cast(F('lipinsky_a_log_p'), IntegerField()))
qs = qs.annotate(lipinsky_score=Cast(F('lipinsky_mw'), IntegerField()) + Cast(F('lipinsky_hba'), IntegerField()) +
Cast(F('lipinsky_hbd'), IntegerField()) + Cast(F('lipinsky_a_log_p'), IntegerField()))
qs = qs.annotate(lipinsky=Case(When(lipinsky_score__gte=3, then=True), default=False, output_field=BooleanField()))
# Veber hba_hbd (<=12)
qs = qs.annotate(hba_hbd=F('nb_acceptor_h')+F('nb_donor_h'))
......@@ -481,14 +481,12 @@ class CompoundManager(models.Manager):
# Veber Rotatable Bonds (<=10)
qs = qs.annotate(veber_rb=Case(When(nb_rotatable_bonds__lte=10, then=True), default=False, output_field=BooleanField()))
# Veber global (Rotatable bonds and (hba_hbd or tpsa))
#qs = qs.annotate(veber=F('veber_rb').bitand(F('veber_hba_hbd').bitor(F('veber_tpsa'))))
qs = qs.annotate(veber=Case(When(Q(Q(nb_rotatable_bonds__lte=10) & (Q(hba_hbd__lte=12) | Q(tpsa__lte=140))), then=True), default=False, output_field=BooleanField()))
# Pfizer AlogP (<=3)
qs = qs.annotate(pfizer_a_log_p=Case(When(a_log_p__lte=3, then=True), default=False, output_field=BooleanField()))
# Pfizer TPSA (>=75)
qs = qs.annotate(pfizer_tpsa=Case(When(tpsa__gte=75, then=True), default=False, output_field=BooleanField()))
# Pfizer global (AlogP and TPSA)
#qs = qs.annotate(pfizer=F('pfizer_a_log_p').bitand(F('pfizer_tpsa')))
qs = qs.annotate(pfizer=Case(When(Q(Q(a_log_p__lte=3) & Q(tpsa__gte=75)), then=True), default=False, output_field=BooleanField()))
# PDB ligand available
qs = qs.annotate(pdb_ligand_av=Cast(Max(Case(When(compoundaction__ligand_id__isnull=False, then=1), default=0, output_field=IntegerField())), BooleanField()))
......@@ -514,7 +512,7 @@ class CompoundManager(models.Manager):
qs = qs.annotate(insilico_av=Cast(Max(Case(When(refcompoundbiblio__bibliography__in_silico=True, then=1), default=0, output_field=IntegerField())), BooleanField()))
# number of tests available
qs = qs.annotate(tests_av=Count('compoundactivityresult', distinct=True))
#@formatter:on
# @formatter:on
return qs
......
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