Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ippidb-web
Manage
Activity
Members
Labels
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
dbf86171
Commit
dbf86171
authored
7 years ago
by
Hervé MENAGER
Browse files
Options
Downloads
Patches
Plain Diff
CompoundAction migration, WIP
Former-commit-id: e5b8790a83d03bd6d01fa8925caf0bb10e2caaa3
parent
12dc1385
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ippisite/ippidb/management/commands/import_v1_data.py
+31
-2
31 additions, 2 deletions
ippisite/ippidb/management/commands/import_v1_data.py
with
31 additions
and
2 deletions
ippisite/ippidb/management/commands/import_v1_data.py
+
31
−
2
View file @
dbf86171
...
...
@@ -6,7 +6,7 @@ import mysql.connector
from
ippidb.models
import
Bibliography
,
Protein
,
Taxonomy
,
MolecularFunction
,
\
Domain
,
ProteinDomainBoundComplex
,
ProteinDomainPartnerComplex
,
Symmetry
,
Ppi
,
PpiComplex
,
Disease
,
\
Compound
,
MDDRCompoundImport
,
MDDRActivityClass
,
TestActivityDescription
,
CellLine
,
RefCompoundBiblio
Compound
,
MDDRCompoundImport
,
MDDRActivityClass
,
TestActivityDescription
,
CellLine
,
RefCompoundBiblio
,
CompoundAction
class
MyConverter
(
mysql
.
connector
.
conversion
.
MySQLConverter
):
...
...
@@ -102,6 +102,8 @@ class Command(BaseCommand):
conn
=
mysql
.
connector
.
connect
(
converter_class
=
MyConverter
,
host
=
"
localhost
"
,
user
=
"
root
"
,
password
=
"
ippidb
"
,
database
=
"
ippidb
"
)
cursor
=
conn
.
cursor
()
cursor_aux
=
conn
.
cursor
(
buffered
=
True
)
cursor_aux2
=
conn
.
cursor
(
buffered
=
True
)
if
options
[
'
bibliographies
'
]:
cursor
.
execute
(
"""
SELECT * FROM biblio
"""
)
rows
=
cursor
.
fetchall
()
...
...
@@ -234,8 +236,9 @@ select distinct protein.NumUniprot, domain.PfamNumAccession , complexe.NbCopy,
Disease
.
objects
.
all
().
delete
()
Ppi
.
objects
.
all
().
delete
()
PpiComplex
.
objects
.
all
().
delete
()
CompoundAction
.
objects
.
all
().
delete
()
self
.
stdout
.
write
(
self
.
style
.
SUCCESS
(
'
Successfully flushed protein domain complex, PPI, and disease tables
'
))
self
.
style
.
SUCCESS
(
'
Successfully flushed protein domain complex, PPI,
compound actions,
and disease tables
'
))
ppi_ids_mapping
=
{}
for
row
in
rows
:
try
:
...
...
@@ -272,6 +275,32 @@ select distinct protein.NumUniprot, domain.PfamNumAccession , complexe.NbCopy,
ppi_complex
.
complex
=
c
ppi_complex
.
cc_nb
=
1
ppi_complex
.
save
()
if
row
[
3
]
is
not
None
:
sql_ca_string
=
'''
select distinct c.CanonicalSmile from cmpdAction as ca
inner join compound as c on ca.IDCompound=c.IDCompound where ca.IDComplexeBound=
'''
\
+
str
(
row
[
3
])
cursor_aux
.
execute
(
sql_ca_string
)
rows_aux
=
cursor_aux
.
fetchall
()
for
row_aux
in
rows_aux
:
if
row_aux
is
None
:
self
.
stdout
.
write
(
sql_ca_string
)
continue
canonical_smile
=
row_aux
[
0
]
sql_bse_string
=
'''
select CodePDB from bindingSiteEvidence where IDPPI=
'''
+
str
(
ppi
.
id
)
cursor_aux
.
execute
(
sql_bse_string
)
row_aux2
=
cursor_aux2
.
fetchone
()
if
row_aux2
is
None
:
pdb_id_ca
=
None
else
:
pdb_id_ca
=
row_aux2
[
0
]
c
=
Compound
.
objects
.
get
(
canonical_smile
=
canonical_smile
)
ca
=
CompoundAction
()
ca
.
compound
=
c
ca
.
ppi
=
ppi
ca
.
activation_mode
=
'
U
'
ca
.
nb_copy_compounds
=
1
ca
.
pdb_id
=
pdb_id_ca
ca
.
save
()
except
Exception
as
e
:
if
options
[
'
stoponfail
'
]:
import
traceback
...
...
This diff is collapsed.
Click to expand it.
Preview
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!
Save comment
Cancel
Please
register
or
sign in
to comment