Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
iPPIDB
ippidb-web
Commits
9bbf34f2
Commit
9bbf34f2
authored
Dec 23, 2020
by
Hervé MENAGER
Browse files
fix style for models.py
parent
24ca2db5
Pipeline
#45760
failed with stages
in 10 minutes and 27 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
ippisite/ippidb/models.py
View file @
9bbf34f2
...
...
@@ -1166,27 +1166,26 @@ class Compound(AutoFillableModel):
return
urls
def
get_bioschemas
(
self
,
request
):
json_data
=
{
"@type"
:
"MolecularEntity"
,
"@context"
:
"http://schema.org"
}
json_data
[
'name'
]
=
str
(
self
)
json_data
=
{
"@type"
:
"MolecularEntity"
,
"@context"
:
"http://schema.org"
}
json_data
[
"name"
]
=
str
(
self
)
if
self
.
pk
is
not
None
:
json_data
[
'
url
'
]
=
request
.
build_absolute_uri
(
self
.
get_absolute_url
())
json_data
[
"
url
"
]
=
request
.
build_absolute_uri
(
self
.
get_absolute_url
())
if
self
.
inchi
is
not
None
:
json_data
[
'
inChI
'
]
=
self
.
inchi
json_data
[
"
inChI
"
]
=
self
.
inchi
if
self
.
iupac_name
!=
""
:
json_data
[
'
iupacName
'
]
=
self
.
iupac_name
json_data
[
"
iupacName
"
]
=
self
.
iupac_name
if
self
.
molecular_weight
is
not
None
:
json_data
[
'
molecularWeight
'
]
=
self
.
molecular_weight
json_data
[
"
molecularWeight
"
]
=
self
.
molecular_weight
if
self
.
inchikey
is
not
None
:
json_data
[
'
inChIKey
'
]
=
self
.
inchikey
json_data
[
"
inChIKey
"
]
=
self
.
inchikey
if
self
.
chembl_id
is
not
None
:
json_data
[
'image'
]
=
f
"https://www.ebi.ac.uk/chembl/api/data/image/
{
self
.
chembl_id
}
.svg"
json_data
[
"image"
]
=
f
"https://www.ebi.ac.uk/chembl/api/data/image/
{
self
.
chembl_id
}
.svg"
if
self
.
canonical_smile
is
not
None
:
json_data
[
'
smiles
'
]
=
self
.
canonical_smile
if
len
(
self
.
sameas_urls
)
>
0
:
json_data
[
'
sameAs
'
]
=
self
.
sameas_urls
json_data
[
"
smiles
"
]
=
self
.
canonical_smile
if
len
(
self
.
sameas_urls
)
>
0
:
json_data
[
"
sameAs
"
]
=
self
.
sameas_urls
return
json_data
def
clean
(
self
):
...
...
@@ -1668,7 +1667,10 @@ class ContributionManager(models.Manager):
if
current_user
.
is_anonymous
:
qs
=
qs
.
exclude
(
validated
=
False
)
elif
not
current_user
.
is_superuser
:
qs
=
qs
.
exclude
(
Q
(
validated
=
False
),
~
Q
(
contributor
=
current_user
),)
qs
=
qs
.
exclude
(
Q
(
validated
=
False
),
~
Q
(
contributor
=
current_user
),
)
return
qs
def
validated
(
self
):
...
...
@@ -1737,7 +1739,10 @@ 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
]
),
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment