Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ippidb-web
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
iPPIDB
ippidb-web
Commits
671c927f
Commit
671c927f
authored
6 years ago
by
Hervé MENAGER
Browse files
Options
Downloads
Patches
Plain Diff
minor reformats for models
parent
e98462c6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ippisite/ippidb/models.py
+10
-12
10 additions, 12 deletions
ippisite/ippidb/models.py
with
10 additions
and
12 deletions
ippisite/ippidb/models.py
+
10
−
12
View file @
671c927f
...
...
@@ -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
.
Char
Field
(
'
Title
'
,
max_length
=
300
)
journal_name
=
models
.
Char
Field
(
'
Journal name
'
,
max_length
=
50
,
null
=
True
,
blank
=
True
)
authors_list
=
models
.
Char
Field
(
'
Authors list
'
,
max_length
=
500
)
title
=
models
.
Text
Field
(
'
Title
'
)
journal_name
=
models
.
Text
Field
(
'
Journal name
'
,
null
=
True
,
blank
=
True
)
authors_list
=
models
.
Text
Field
(
'
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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment