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
f209b66f
Commit
f209b66f
authored
7 years ago
by
Hervé MENAGER
Browse files
Options
Downloads
Patches
Plain Diff
migrate TestCytotoxicityDescription (fix #28)
Former-commit-id: 67806cbeb81fdcc7428cb60b69155b7531f002e7
parent
188b35ab
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/management/commands/import_v1_data.py
+37
-3
37 additions, 3 deletions
ippisite/ippidb/management/commands/import_v1_data.py
with
37 additions
and
3 deletions
ippisite/ippidb/management/commands/import_v1_data.py
+
37
−
3
View file @
f209b66f
...
...
@@ -6,7 +6,8 @@ import mysql.connector
from
ippidb.models
import
Bibliography
,
Protein
,
Taxonomy
,
MolecularFunction
,
\
Domain
,
ProteinDomainBoundComplex
,
ProteinDomainPartnerComplex
,
Symmetry
,
Ppi
,
PpiComplex
,
Disease
,
\
Compound
,
MDDRCompoundImport
,
MDDRActivityClass
,
TestActivityDescription
,
CellLine
,
RefCompoundBiblio
,
CompoundAction
Compound
,
MDDRCompoundImport
,
MDDRActivityClass
,
TestActivityDescription
,
CellLine
,
RefCompoundBiblio
,
\
CompoundAction
,
TestCytotoxDescription
class
MyConverter
(
mysql
.
connector
.
conversion
.
MySQLConverter
):
...
...
@@ -313,12 +314,14 @@ select distinct protein.NumUniprot, domain.PfamNumAccession , complexe.NbCopy,
else
:
self
.
stdout
.
write
(
self
.
style
.
SUCCESS
(
'
Successfully inserted {} {}
'
.
format
(
row
[
0
],
row
[
1
])))
CellLine
.
objects
.
all
().
delete
()
self
.
stdout
.
write
(
self
.
style
.
SUCCESS
(
'
Successfully flushed cell lines table
'
))
cursor
.
execute
(
"""
SELECT * FROM testActivityDescription
"""
)
rows
=
cursor
.
fetchall
()
TestActivityDescription
.
objects
.
all
().
delete
()
CellLine
.
objects
.
all
().
delete
()
self
.
stdout
.
write
(
self
.
style
.
SUCCESS
(
'
Successfully flushed test activity descriptions
table and cell lines
table
'
))
self
.
style
.
SUCCESS
(
'
Successfully flushed test activity descriptions table
'
))
for
row
in
rows
:
try
:
tad
=
TestActivityDescription
()
...
...
@@ -348,6 +351,37 @@ select distinct protein.NumUniprot, domain.PfamNumAccession , complexe.NbCopy,
else
:
self
.
stdout
.
write
(
self
.
style
.
SUCCESS
(
'
Successfully inserted {}
'
.
format
(
row
[
2
])))
cursor
.
execute
(
"""
SELECT * FROM testCytotoxDescription
"""
)
rows
=
cursor
.
fetchall
()
TestCytotoxDescription
.
objects
.
all
().
delete
()
self
.
stdout
.
write
(
self
.
style
.
SUCCESS
(
'
Successfully flushed test cytotoxicity descriptions table
'
))
for
row
in
rows
:
try
:
tcd
=
TestCytotoxDescription
()
cursor
.
execute
(
"""
select IDSource from biblio where IDBiblio={}
"""
.
format
(
row
[
1
]))
biblio_row
=
cursor
.
fetchone
()
biblio
=
Bibliography
.
objects
.
get
(
id_source
=
biblio_row
[
0
])
tcd
.
biblio
=
biblio
tcd
.
test_name
=
row
[
2
]
tcd
.
compound_concentration
=
row
[
4
]
if
row
[
3
]
is
not
None
:
tcd
.
cell_line
,
created
=
CellLine
.
objects
.
get_or_create
(
name
=
row
[
3
])
tcd
.
save
()
except
Exception
as
e
:
if
options
[
'
stoponfail
'
]:
import
traceback
self
.
stderr
.
write
(
traceback
.
format_exc
())
raise
CommandError
(
'
Failed inserting {} {}
'
.
format
(
row
[
1
],
row
[
2
]))
else
:
self
.
stdout
.
write
(
self
.
style
.
ERROR
(
'
Failed inserting {} {}
'
.
format
(
row
[
1
],
row
[
2
])))
else
:
self
.
stdout
.
write
(
self
.
style
.
SUCCESS
(
'
Successfully inserted {}
'
.
format
(
row
[
2
])))
if
options
[
'
mddr
'
]:
from
pybel
import
readfile
MDDRCompoundImport
.
objects
.
all
().
delete
()
...
...
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