Commit 552b582b authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

correct style in `models.py`

parent 0bf2dc69
Pipeline #38819 passed with stages
in 18 minutes and 32 seconds
......@@ -1087,35 +1087,53 @@ class Compound(AutoFillableModel):
"""
Get absolute URL to the corresponding PubChem entry
"""
return f"https://pubchem.ncbi.nlm.nih.gov/compound/{ self.pubchem_id }" if self.pubchem_id else None
return (
f"https://pubchem.ncbi.nlm.nih.gov/compound/{ self.pubchem_id }"
if self.pubchem_id
else None
)
@property
def chembl_url(self):
"""
Get absolute URL to the corresponding Chembl entry
"""
return f"https://www.ebi.ac.uk/chembldb/compound/inspect/{ self.chembl_id }" if self.chembl_id else None
return (
f"https://www.ebi.ac.uk/chembldb/compound/inspect/{ self.chembl_id }"
if self.chembl_id
else None
)
@property
def chemspider_url(self):
"""
Get absolute URL to the corresponding ChemSpider entry
"""
return f"http://www.chemspider.com/Chemical-Structure.{ self.chemspider_id}.html" if self.chemspider_id else None
return (
f"http://www.chemspider.com/Chemical-Structure.{ self.chemspider_id}.html"
if self.chemspider_id
else None
)
@property
def pdbligand_url(self):
"""
Get absolute URL to the corresponding PDB ligand entry
"""
return f"https://www.rcsb.org/ligand/{ self.ligand_id}" if self.ligand_id else None
return (
f"https://www.rcsb.org/ligand/{ self.ligand_id}" if self.ligand_id else None
)
@property
def drugbank_url(self):
"""
Get absolute URL to the corresponding Drugbank entry
"""
return f"https://www.drugbank.ca/drugs/{ self.drugbank_id}" if self.drugbank_id else None
return (
f"https://www.drugbank.ca/drugs/{ self.drugbank_id}"
if self.drugbank_id
else None
)
def clean(self):
"""
......@@ -1611,20 +1629,13 @@ def update_compound_cached_properties(compounds_queryset=None):
le=Subquery(
compounds_queryset.filter(id=OuterRef("id"))
.annotate(
_le=Cast(
1.37 * F("best_activity") / F("nb_atom_non_h"),
FloatField(),
)
_le=Cast(1.37 * F("best_activity") / F("nb_atom_non_h"), FloatField(),)
)
.values("_le")[:1]
),
lle=Subquery(
compounds_queryset.filter(id=OuterRef("id"))
.annotate(
_lle=Cast(
F("best_activity") - F("a_log_p"), FloatField()
)
)
.annotate(_lle=Cast(F("best_activity") - F("a_log_p"), FloatField()))
.values("_lle")[:1]
),
lipinsky_mw=Subquery(
......
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