Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
talent
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Hoksza
talent
Commits
3ced45b6
Commit
3ced45b6
authored
5 years ago
by
David Hoksza
Browse files
Options
Downloads
Patches
Plain Diff
using template reaction positions when laying out not mapped connecting species
parent
3a790fb3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
talent/layout.py
+14
-6
14 additions, 6 deletions
talent/layout.py
with
14 additions
and
6 deletions
talent/layout.py
+
14
−
6
View file @
3ced45b6
...
@@ -1662,7 +1662,7 @@ def get_graph_stats(g, layout_key=None) -> Stats:
...
@@ -1662,7 +1662,7 @@ def get_graph_stats(g, layout_key=None) -> Stats:
return
stats
return
stats
def
l_not_mapped_connecting_species
(
g_res
,
tgt_orig
,
to_layout
,
nodes_mapping
,
tmp_stats
):
def
l_not_mapped_connecting_species
(
g_res
,
tgt_orig
,
tmp_orig
,
to_layout
,
nodes_mapping
,
md
,
tmp_stats
):
for
r1_tgt
,
r2_tgt
,
s_ids_to_add
,
new_ids
,
cn_existing
in
to_layout
:
for
r1_tgt
,
r2_tgt
,
s_ids_to_add
,
new_ids
,
cn_existing
in
to_layout
:
...
@@ -1680,10 +1680,12 @@ def l_not_mapped_connecting_species(g_res, tgt_orig, to_layout, nodes_mapping, t
...
@@ -1680,10 +1680,12 @@ def l_not_mapped_connecting_species(g_res, tgt_orig, to_layout, nodes_mapping, t
return
sum
(
poss_filtered
)
/
len
(
ids
)
if
len
(
poss_filtered
)
>
0
else
None
return
sum
(
poss_filtered
)
/
len
(
ids
)
if
len
(
poss_filtered
)
>
0
else
None
# 1. Find out whether to use horizontal or vertical vector
# 1. Find out whether to use horizontal or vertical vector
r1_center
=
get_average_pos
(
list
(
g_res
[
r1_tgt
]))
# We use two strategies, one
r2_center
=
get_average_pos
(
list
(
g_res
[
r2_tgt
]))
if
r1_center
[
0
]
==
r2_center
[
0
]
and
r1_center
[
1
]
==
r2_center
[
1
]
and
len
(
s_ids_to_add
):
r1_center_tgt
=
get_average_pos
(
list
(
g_res
[
r1_tgt
]))
r2_center_tgt
=
get_average_pos
(
list
(
g_res
[
r2_tgt
]))
if
r1_center_tgt
[
0
]
==
r2_center_tgt
[
0
]
and
r1_center_tgt
[
1
]
==
r2_center_tgt
[
1
]
and
len
(
s_ids_to_add
):
# This is a situation when two species are connected with two reactions which is a special situations and needs to be handled separately
# This is a situation when two species are connected with two reactions which is a special situations and needs to be handled separately
# We need to find the orientation of the reactions which is based on existing connecting species and their already laid out neighbors
# We need to find the orientation of the reactions which is based on existing connecting species and their already laid out neighbors
aux_poss
=
[]
aux_poss
=
[]
...
@@ -1706,7 +1708,13 @@ def l_not_mapped_connecting_species(g_res, tgt_orig, to_layout, nodes_mapping, t
...
@@ -1706,7 +1708,13 @@ def l_not_mapped_connecting_species(g_res, tgt_orig, to_layout, nodes_mapping, t
poss
[
s_id
]
=
np
.
array
(
cn_pos
+
dir
*
settings
.
render
.
optimal_species_reaction_dist
*
2
)
poss
[
s_id
]
=
np
.
array
(
cn_pos
+
dir
*
settings
.
render
.
optimal_species_reaction_dist
*
2
)
else
:
else
:
r_vect
=
r1_center
-
r2_center
# If possible we will use position of the reaction from template to find out how to lay out the connecting species
# The reason for using template and not the nascent result target is that it can be missing some of the nodes (such as ODS) which
# might be important for deciding the orientation of the line on which the connecting species should be laid out
r1_center_tmp_tgt
=
gu
.
get_original_layout
(
tmp_orig
,
md
[
0
][
r1_tgt
]).
get_center
()
if
r1_tgt
in
md
[
0
]
and
md
[
0
][
r1_tgt
]
is
not
None
else
r1_center_tgt
r2_center_tmp_tgt
=
gu
.
get_original_layout
(
tmp_orig
,
md
[
0
][
r2_tgt
]).
get_center
()
if
r2_tgt
in
md
[
0
]
and
md
[
0
][
r2_tgt
]
is
not
None
else
r2_center_tgt
r_vect
=
r1_center_tmp_tgt
-
r2_center_tmp_tgt
# TODO: consider the role of the added species (we can place reactants and and products in such a way that the lines will cross unnecessarilly)
# TODO: consider the role of the added species (we can place reactants and and products in such a way that the lines will cross unnecessarilly)
if
gr
.
utils
.
is_more_horizontal
(
r_vect
):
if
gr
.
utils
.
is_more_horizontal
(
r_vect
):
dir
=
np
.
array
([
0
,
1
])
dir
=
np
.
array
([
0
,
1
])
...
@@ -1859,7 +1867,7 @@ def tl_not_mapped_connecting_species(g_res: nx.MultiGraph, tmp, tgt, md, laid_ou
...
@@ -1859,7 +1867,7 @@ def tl_not_mapped_connecting_species(g_res: nx.MultiGraph, tmp, tgt, md, laid_ou
to_layout
.
append
((
r1_tgt
,
r2_tgt
,
s_ids_to_add
,
new_ids
,
cn_existing
))
to_layout
.
append
((
r1_tgt
,
r2_tgt
,
s_ids_to_add
,
new_ids
,
cn_existing
))
l_not_mapped_connecting_species
(
g_res
,
tgt_orig
,
to_layout
,
nodes_mapping
,
tmp_stats
)
l_not_mapped_connecting_species
(
g_res
,
tgt_orig
,
tmp
.
get_reaction_graph
(),
to_layout
,
nodes_mapping
,
md
,
tmp_stats
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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