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
b15e9b3c
Commit
b15e9b3c
authored
May 07, 2020
by
Rayan Chikhi
Browse files
robustness fixes
parent
c3537900
Changes
2
Hide whitespace changes
Inline
Side-by-side
deconvolution/main/d2_path_evaluation.py
View file @
b15e9b3c
...
...
@@ -85,6 +85,12 @@ def is_coherent_path(central_nodes,path_len):
assert
(
len
(
mols_in_central_nodes
)
==
path_len
+
1
)
return
is_there_path_acc
(
mols_in_central_nodes
)
def
get_barcode
(
x
):
if
'udg'
in
graph
.
nodes
[
x
]:
return
graph
.
nodes
[
x
][
'udg'
].
split
()[
0
]
else
:
return
graph
.
nodes
[
x
][
'label'
]
""" the main function that tests for accuracy of random paths """
graph
=
None
def
evaluate_accuracy_paths
(
path_len
,
max_paths_per_node
=
100
):
...
...
@@ -101,7 +107,7 @@ def evaluate_accuracy_paths(path_len,max_paths_per_node=100):
seen_paths
.
add
(
tuple
(
sorted
(
path
)))
assert
(
len
(
path
)
==
path_len
+
1
)
#print("path",path)
central_nodes
=
[
g
raph
.
nodes
[
x
][
'udg'
].
split
()[
0
]
for
x
in
path
]
central_nodes
=
[
g
et_barcode
(
x
)
for
x
in
path
]
assert
(
len
(
central_nodes
)
==
path_len
+
1
)
#print(path,central_nodes)
if
is_coherent_path
(
central_nodes
,
path_len
):
...
...
@@ -131,7 +137,7 @@ def evaluate_sensitivity_paths(path_len,overlap_length=7000):
from
collections
import
defaultdict
molecules_to_nodes
=
defaultdict
(
list
)
for
node
in
graph
.
nodes
():
central_node
=
g
raph
.
n
ode
s
[
node
][
'udg'
].
split
()[
0
]
central_node
=
g
et_barc
ode
(
node
)
mols
=
central_node_to_molecules
(
central_node
)
all_molecules
|=
set
(
mols
)
for
mol
in
mols
:
...
...
deconvolution/main/evaluate.py
View file @
b15e9b3c
...
...
@@ -184,7 +184,10 @@ def str_to_udg_lists(s):
def
parse_dg_name
(
gr
,
name
):
udg
=
nx
.
get_node_attributes
(
gr
,
'udg'
)[
name
]
central
,
h1
,
h2
=
str_to_udg_lists
(
udg
)
res
=
str_to_udg_lists
(
udg
)
if
len
(
res
)
!=
3
:
print
(
"parsing problem:"
,
res
)
central
,
h1
,
h2
=
res
idx
=
name
score
=
nx
.
get_node_attributes
(
gr
,
'score'
)[
name
]
...
...
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