Skip to content
GitLab
Menu
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
2ca17eb4
Commit
2ca17eb4
authored
May 11, 2020
by
Yoann Dufresne
Browse files
Merge branch 'master' of gitlab.pasteur.fr:ydufresne/10x-deconvolve
parents
455f6e88
a5259676
Changes
2
Hide whitespace changes
Inline
Side-by-side
deconvolution/main/d2_path_evaluation.py
View file @
2ca17eb4
...
...
@@ -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 @
2ca17eb4
...
...
@@ -2,6 +2,7 @@
import
sys
sys
.
setrecursionlimit
(
10000
)
import
argparse
from
termcolor
import
colored
import
networkx
as
nx
...
...
@@ -184,7 +185,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
]
...
...
@@ -315,7 +319,7 @@ def recursive_longest_path(current_node, current_molecule, next_nodes, longest_p
longest
=
0
longest_next
=
None
min_mol_idx
=
current_molecule
+
10000
min_mol_idx
=
float
(
'inf'
)
# Recursively compute the longest path
for
mol_idx
,
node
in
next_nodes
[
current_node
][
current_molecule
]:
size
,
_
,
_
=
recursive_longest_path
(
node
,
mol_idx
,
next_nodes
,
longest_paths
)
...
...
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