Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Carlos GO
vernal_server
Commits
3351a03f
Commit
3351a03f
authored
Sep 14, 2021
by
Carlos
Browse files
instance info page
parent
a4490d9e
Changes
6
Hide whitespace changes
Inline
Side-by-side
app.py
View file @
3351a03f
import
os
import
json
import
shutil
import
sys
import
logging
...
...
@@ -69,14 +70,46 @@ def motif_json(motif_id):
@
app
.
route
(
'/motif_page/<motif_type>/<motif_id>'
)
def
motif_page
(
motif_type
,
motif_id
):
parents
=
get_parents
(
motif_type
,
motif_id
)
motif_path
=
os
.
path
.
join
(
"static"
,
motif_type
,
motif_id
)
instance_paths
=
[
os
.
path
.
join
(
motif_type
,
motif_id
,
inst
)
for
inst
in
os
.
listdir
(
motif_path
)]
return
render_template
(
"motif_page.html"
,
instance_paths
=
instance_paths
,
parents
=
parents
,
motif_type
=
motif_type
)
parents
=
get_parents
(
motif_type
,
motif_id
)
motif_path
=
os
.
path
.
join
(
"static"
,
motif_type
,
motif_id
,
"graphs"
)
instance_info
=
[]
for
inst
in
os
.
listdir
(
motif_path
):
info
=
{
'drawing_path'
:
os
.
path
.
join
(
motif_type
,
motif_id
,
\
"graphs"
,
inst
),
'motif_id'
:
motif_id
,
'instance_id'
:
inst
.
split
(
"."
)[
0
].
strip
()
}
instance_info
.
append
(
info
)
return
render_template
(
"motif_page.html"
,
instance_info
=
instance_info
,
parents
=
parents
,
motif_type
=
motif_type
)
@
app
.
route
(
'/instance_page/<motif_type>/<motif_id>/<instance>'
)
def
instance_page
(
motif_type
,
motif_id
,
instance
):
drawing_path
=
os
.
path
.
join
(
motif_type
,
motif_id
,
"graphs"
,
f
"
{
instance
}
.png"
)
metadata_path
=
os
.
path
.
join
(
"static"
,
motif_type
,
motif_id
,
"metadata"
,
f
"
{
instance
}
.json"
)
with
open
(
os
.
path
.
join
(
metadata_path
))
as
meta
:
instance_metadata
=
json
.
load
(
meta
)
return
render_template
(
"instance_page.html"
,
drawing_path
=
drawing_path
,
metadata
=
instance_metadata
,
instance
=
instance
,
motif_type
=
motif_type
,
motif_id
=
motif_id
)
@
app
.
route
(
'/graphlets'
)
def
graphlets
():
graphlet_path
=
os
.
path
.
join
(
"static"
,
"graphlets"
)
...
...
static/css/style.css
View file @
3351a03f
...
...
@@ -88,7 +88,7 @@ td {
padding
:
8px
;
}
th
{
text-align
:
center
;
text-align
:
left
;
padding
:
8px
;
}
...
...
templates/gallery.html
View file @
3351a03f
...
...
@@ -29,7 +29,7 @@ Click on a motif drawing to see other instances.
<tr>
<td>
<a
href=
"{{url_for('motif_page', motif_type=motif_type, motif_id='{}'.format(m) ) }}"
>
<img
src=
"{{ url_for('static', filename='{}/{}/0.png'.format(motif_type, m)) }}"
width=
"450px"
id=
"border"
>
<img
src=
"{{ url_for('static', filename='{}/{}/
graphs/
0.png'.format(motif_type, m)) }}"
width=
"450px"
id=
"border"
>
</a></td>
</tr>
...
...
templates/home.html
View file @
3351a03f
...
...
@@ -18,8 +18,7 @@ Select a motif gallery:
<ul>
<li><a
href=
"{{ url_for('gallery', motif_type='motifs_bb') }}"
>
Linear Motifs
</a>
: Nodes aggregated along a single chain.
</li>
<li><a
href=
"{{ url_for('gallery', motif_type='motifs') }}"
>
General Motifs
</a>
: Nodes aggregated can span multiple chains.
</li>
<li><a
href=
"{{ url_for('gallery', motif_type='bioinformatics_1') }}"
>
General Motifs
</a>
: Nodes aggregated can span multiple chains.
</li>
</ul>
<b>
Cite
</b>
<br><br>
...
...
templates/instance_page.html
0 → 100644
View file @
3351a03f
{% extends 'default.html' %}
<head>
{% block body %}
<div
style=
"width: 100%; overflow: hidden;"
>
<a
href=
"{{url_for('motif_page', motif_type=motif_type, motif_id=motif_id ) }}"
>
Back
</a>
<table>
<tr>
<th>
Instance ID
</th>
<th>
PDBID
</th>
<th>
Residues
</th>
</tr>
<tr>
<td>
{{ instance }}
</td>
<td>
<a
href=
"https://www.rcsb.org/structure/{{metadata.pdbid.upper()}}"
>
{{ metadata.pdbid }}
</a>
</td>
<td>
{{ metadata.nodes }}
</td>
</tr>
</table><br><br>
<img
src=
"{{ url_for('static', filename=drawing_path)}}"
style=
"width:250px"
>
</div>
</body>
{% endblock %}
templates/motif_page.html
View file @
3351a03f
...
...
@@ -8,9 +8,15 @@
Instances
<br>
{% for instance_
path
in instance_
paths
%}
{% for instance_
info
in instance_
info
%}
<img
src=
"{{ url_for('static', filename=instance_path)}}"
style=
"width:250px"
>
<a
href=
"{{ url_for('instance_page', motif_type=motif_type,
motif_id=instance_info.motif_id, instance=instance_info.instance_id) }}"
>
<img
src=
"{{ url_for('static', filename=instance_info.drawing_path)}}"
style=
"width:250px"
>
</a>
{% endfor %}
...
...
@@ -25,7 +31,7 @@ Parent Motifs <br>
{% for p in parents %}
<a
href=
"{{url_for('motif_page', motif_type=motif_type, motif_id='{}'.format(p)) }}"
>
<img
src=
"{{ url_for('static', filename='{}/{}/0.png'.format(motif_type, p)) }}"
style=
"width:200px"
>
<img
src=
"{{ url_for('static', filename='{}/{}/
graphs/
0.png'.format(motif_type, p)) }}"
style=
"width:200px"
>
</a>
{% endfor %}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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