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
97f344a3
Commit
97f344a3
authored
Aug 15, 2020
by
Carlos GO
Browse files
pick motif id
parent
d5b5603b
Changes
3
Hide whitespace changes
Inline
Side-by-side
app.py
View file @
97f344a3
...
...
@@ -21,10 +21,12 @@ import numpy as np
app
=
Flask
(
__name__
)
motifs_id
=
"motifs_bb"
MOTIF_PATH
=
os
.
path
.
join
(
"static"
,
motifs_id
)
def
get_parents
(
this_motif
):
this_motif
=
ms
.
Multiset
(
map
(
int
,
this_motif
.
split
(
"-"
)))
motif_ids
=
os
.
listdir
(
"static/motifs"
)
motif_ids
=
os
.
listdir
(
MOTIF_PATH
)
parents
=
[]
for
motif
in
motif_ids
:
that_motif
=
ms
.
Multiset
(
map
(
int
,
motif
.
split
(
"-"
)))
...
...
@@ -36,10 +38,10 @@ def get_parents(this_motif):
@
app
.
route
(
"/"
)
def
home
():
motif_ids
=
os
.
listdir
(
"static/motifs"
)
motif_ids
=
os
.
listdir
(
MOTIF_PATH
)
motif_dict
=
defaultdict
(
list
)
for
mot
in
motif_ids
:
if
len
(
os
.
listdir
(
f
"
static/motifs
/
{
mot
}
"
))
<
1
:
if
len
(
os
.
listdir
(
f
"
{
MOTIF_PATH
}
/
{
mot
}
"
))
<
1
:
continue
size
=
len
(
mot
.
split
(
"-"
))
motif_dict
[
size
].
append
(
mot
)
...
...
@@ -47,7 +49,7 @@ def home():
for
size
in
sorted
(
motif_dict
.
keys
()):
sorted_dict
[
size
]
=
motif_dict
[
size
]
return
render_template
(
"home.html"
,
motif_dict
=
sorted_dict
)
return
render_template
(
"home.html"
,
motifs_id
=
motifs_id
,
motif_dict
=
sorted_dict
)
@
app
.
route
(
"/hmp"
)
def
hmp
():
...
...
@@ -63,11 +65,12 @@ def motif_json(motif_id):
@
app
.
route
(
'/motif_page/<motif_id>'
)
def
motif_page
(
motif_id
):
parents
=
get_parents
(
motif_id
)
motif_path
=
os
.
path
.
join
(
"static"
,
"motifs"
,
motif_id
)
instance_paths
=
[
os
.
path
.
join
(
"
motifs
"
,
motif_id
,
inst
)
for
inst
in
os
.
listdir
(
motif_path
)]
motif_path
=
os
.
path
.
join
(
MOTIF_PATH
,
motif_id
)
instance_paths
=
[
os
.
path
.
join
(
motifs
_id
,
motif_id
,
inst
)
for
inst
in
os
.
listdir
(
motif_path
)]
return
render_template
(
"motif_page.html"
,
instance_paths
=
instance_paths
,
parents
=
parents
)
parents
=
parents
,
motifs_id
=
motifs_id
)
@
app
.
route
(
'/graphlets'
)
def
graphlets
():
...
...
templates/home.html
View file @
97f344a3
...
...
@@ -29,7 +29,7 @@ Click on a motif drawing to see other instances.
<tr>
<td>
<a
href=
"{{url_for('motif_page', motif_id='{}'.format(m)) }}"
>
<img
src=
"{{ url_for('static', filename='motifs/{}/0.png'.format(m)) }}"
width=
"450px"
id=
"border"
>
<img
src=
"{{ url_for('static', filename='
{
motifs
_id}
/{}/0.png'.format(
motifs_id,
m)) }}"
width=
"450px"
id=
"border"
>
</a></td>
</tr>
...
...
templates/motif_page.html
View file @
97f344a3
...
...
@@ -25,7 +25,7 @@ Parent Motifs <br>
{% for p in parents %}
<a
href=
"{{url_for('motif_page', motif_id='{}'.format(p)) }}"
>
<img
src=
"{{ url_for('static', filename='
motifs
/{}/0.png'.format(p)) }}"
style=
"width:200px"
>
<img
src=
"{{ url_for('static', filename='
{}
/{}/0.png'.format(
motifs_id,
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