Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Yoann DUFRESNE
linked reads molecule ordering
Commits
f75e2095
Commit
f75e2095
authored
May 06, 2020
by
Yoann Dufresne
Browse files
time optimization for evaluate method
parent
956c8710
Changes
1
Hide whitespace changes
Inline
Side-by-side
deconvolution/main/evaluate.py
View file @
f75e2095
...
...
@@ -180,7 +180,7 @@ def print_dgraphs_summary(frequencies, light_print=False):
def
str_to_udg_lists
(
s
):
udg
=
s
.
replace
(
"]"
,
""
).
replace
(
' ['
,
'['
)
return
udg
.
split
(
'['
)
return
udg
.
split
(
'['
)
[
1
:]
def
parse_dg_name
(
gr
,
name
):
udg
=
nx
.
get_node_attributes
(
gr
,
'udg'
)[
name
]
...
...
@@ -247,20 +247,24 @@ def print_d2_summary(connected_components, longest_path, covered_vars={}, light_
def
compute_next_nodes
(
d2_component
):
# First parse dg names
dg_names
=
{}
for
node
in
d2_component
.
nodes
():
dg_names
[
node
]
=
parse_dg_name
(
d2_component
,
node
)
next_nodes
=
{}
for
node
in
d2_component
.
nodes
():
# Parse the current node name
head
,
h1
,
h2
=
parse_
dg_name
(
d2_component
,
node
)
head
,
h1
,
h2
=
dg_name
s
[
node
]
next_nodes
[
node
]
=
{}
neighbors
=
list
(
d2_component
.
neighbors
(
node
))
# Get the current molecule idxs
molecule_idxs
=
mols_from_node
(
head
[
1
])
for
mol_idx
in
molecule_idxs
:
nexts
=
[]
for
neighbor
in
neighbors
:
nei_head
,
_
,
_
=
parse_
dg_name
(
d2_component
,
neighbor
)
for
neighbor
in
d2_component
[
node
]
:
nei_head
,
_
,
_
=
dg_name
s
[
neighbor
]
nei_mols
=
mols_from_node
(
nei_head
[
1
])
nei_mols
=
[
x
for
x
in
nei_mols
if
x
>
mol_idx
]
...
...
@@ -406,7 +410,7 @@ def verify_graph_edges(d2_component):
for
c
in
[
c1
,
c2
]:
for
c_node
in
c
:
nei_mols
=
mols_from_node
(
c_node
.
split
()[
0
])
nei_mols
=
[
x
for
x
in
nei_mols
if
x
>
mol_idx
]
# fixme: also look at the <= molecules for more robustness
nei_mols
=
[
x
for
x
in
nei_mols
if
x
>
mol_idx
]
# fixme: also look at the <= molecules for more robustness
# If there are molecule next
if
len
(
nei_mols
)
>
0
:
...
...
Write
Preview
Supports
Markdown
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!
Cancel
Please
register
or
sign in
to comment