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
f79427c3
Commit
f79427c3
authored
7 years ago
by
Hervé MENAGER
Browse files
Options
Downloads
Patches
Plain Diff
create Symmetry table initial contents
(closes #9)
parent
8a93ac1c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
ippisite/db.sqlite3
+0
-0
0 additions, 0 deletions
ippisite/db.sqlite3
ippisite/ippidb/admin.py
+4
-0
4 additions, 0 deletions
ippisite/ippidb/admin.py
ippisite/ippidb/management/commands/import_v1_data.py
+38
-1
38 additions, 1 deletion
ippisite/ippidb/management/commands/import_v1_data.py
with
42 additions
and
1 deletion
ippisite/db.sqlite3
+
0
−
0
View file @
f79427c3
No preview for this file type
This diff is collapsed.
Click to expand it.
ippisite/ippidb/admin.py
+
4
−
0
View file @
f79427c3
...
@@ -28,6 +28,10 @@ class ProteinDomainPartnerComplexAdmin(admin.ModelAdmin):
...
@@ -28,6 +28,10 @@ class ProteinDomainPartnerComplexAdmin(admin.ModelAdmin):
list_display
=
(
'
protein_id
'
,
'
domain_id
'
,
'
ppc_copy_nb
'
)
list_display
=
(
'
protein_id
'
,
'
domain_id
'
,
'
ppc_copy_nb
'
)
list_display_links
=
(
'
protein_id
'
,
'
domain_id
'
,
'
ppc_copy_nb
'
)
list_display_links
=
(
'
protein_id
'
,
'
domain_id
'
,
'
ppc_copy_nb
'
)
@admin.register
(
Symmetry
)
class
Symmetry
(
admin
.
ModelAdmin
):
list_display
=
(
'
code
'
,
'
description
'
)
for
model
in
apps
.
get_app_config
(
'
ippidb
'
).
models
.
values
():
for
model
in
apps
.
get_app_config
(
'
ippidb
'
).
models
.
values
():
try
:
try
:
admin
.
site
.
register
(
model
)
admin
.
site
.
register
(
model
)
...
...
This diff is collapsed.
Click to expand it.
ippisite/ippidb/management/commands/import_v1_data.py
+
38
−
1
View file @
f79427c3
...
@@ -2,7 +2,7 @@ from django.core.management import BaseCommand, CommandError
...
@@ -2,7 +2,7 @@ from django.core.management import BaseCommand, CommandError
import
mysql.connector
import
mysql.connector
from
ippidb.models
import
Bibliography
,
Protein
,
Taxonomy
,
MolecularFunction
,
\
from
ippidb.models
import
Bibliography
,
Protein
,
Taxonomy
,
MolecularFunction
,
\
Domain
,
ProteinDomainBoundComplex
,
ProteinDomainPartnerComplex
Domain
,
ProteinDomainBoundComplex
,
ProteinDomainPartnerComplex
,
Symmetry
class
Command
(
BaseCommand
):
class
Command
(
BaseCommand
):
...
@@ -37,6 +37,13 @@ class Command(BaseCommand):
...
@@ -37,6 +37,13 @@ class Command(BaseCommand):
default
=
False
,
default
=
False
,
help
=
'
Flush and migrate complexes
'
,
help
=
'
Flush and migrate complexes
'
,
)
)
parser
.
add_argument
(
'
--symmetries
'
,
action
=
'
store_true
'
,
dest
=
'
symmetries
'
,
default
=
False
,
help
=
'
Flush and create symmetries
'
,
)
parser
.
add_argument
(
parser
.
add_argument
(
'
--stoponfail
'
,
'
--stoponfail
'
,
action
=
'
store_true
'
,
action
=
'
store_true
'
,
...
@@ -142,3 +149,33 @@ class Command(BaseCommand):
...
@@ -142,3 +149,33 @@ class Command(BaseCommand):
self
.
stdout
.
write
(
self
.
style
.
ERROR
(
'
Failed inserting {} {}
'
.
format
(
row
[
0
],
row
[
1
])))
self
.
stdout
.
write
(
self
.
style
.
ERROR
(
'
Failed inserting {} {}
'
.
format
(
row
[
0
],
row
[
1
])))
else
:
else
:
self
.
stdout
.
write
(
self
.
style
.
SUCCESS
(
'
Successfully inserted {} {}
'
.
format
(
row
[
0
],
row
[
1
])))
self
.
stdout
.
write
(
self
.
style
.
SUCCESS
(
'
Successfully inserted {} {}
'
.
format
(
row
[
0
],
row
[
1
])))
if
options
[
'
symmetries
'
]:
Symmetry
.
objects
.
all
().
delete
()
self
.
stdout
.
write
(
self
.
style
.
SUCCESS
(
'
Successfully flushed symmetries table
'
))
rows
=
[
[
'
AS
'
,
'
asymmetric
'
],
[
'
C2
'
,
'
C2 symmetry
'
],
[
'
D2
'
,
'
D2 symmetry
'
],
[
'
C3
'
,
'
C3 symmetry
'
],
[
'
D3
'
,
'
D3 symmetry
'
],
[
'
C4
'
,
'
C4 symmetry
'
],
[
'
D4
'
,
'
D4 symmetry
'
],
[
'
C5
'
,
'
C5 symmetry
'
],
[
'
D5
'
,
'
D5 symmetry
'
],
]
for
row
in
rows
:
try
:
symmetry
=
Symmetry
()
symmetry
.
code
=
row
[
0
]
symmetry
.
description
=
row
[
1
]
symmetry
.
save
()
except
Exception
as
e
:
if
options
[
'
stoponfail
'
]:
import
traceback
self
.
stderr
.
write
(
traceback
.
format_exc
())
raise
CommandError
(
'
Failed inserting {} {}
'
.
format
(
row
[
0
],
row
[
1
]))
else
:
self
.
stdout
.
write
(
self
.
style
.
ERROR
(
'
Failed inserting {} {}
'
.
format
(
row
[
0
],
row
[
1
])))
else
:
self
.
stdout
.
write
(
self
.
style
.
SUCCESS
(
'
Successfully inserted {} {}
'
.
format
(
row
[
0
],
row
[
1
])))
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