Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
linked reads molecule ordering
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Yoann DUFRESNE
linked reads molecule ordering
Commits
a652cd40
Commit
a652cd40
authored
5 years ago
by
Yoann Dufresne
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of gitlab.pasteur.fr:ydufresne/10x-deconvolve
parents
1bc64e01
391412f8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
deconvolution/evaluate.py
+13
-17
13 additions, 17 deletions
deconvolution/evaluate.py
with
13 additions
and
17 deletions
deconvolution/evaluate.py
+
13
−
17
View file @
a652cd40
...
...
@@ -167,17 +167,13 @@ def print_path_summary(frequencies, neighborhood, light_print=False, file_pointe
# ------------- D2 Graph -------------
def
parse_dg_name
(
name
):
name
=
name
.
replace
(
"
]
"
,
""
).
replace
(
'
[
'
,
'
[
'
)
header
,
h1
,
h2
=
name
.
split
(
'
[
'
)
def
parse_dg_name
(
gr
,
name
):
udg
=
nx
.
get_node_attributes
(
gr
,
'
udg
'
)[
name
]
udg
=
udg
.
replace
(
"
]
"
,
""
).
replace
(
'
[
'
,
'
[
'
)
central
,
h1
,
h2
=
udg
.
split
(
'
[
'
)
# Parse header
header
=
header
.
split
(
"
"
)
idx
=
central
=
score
=
-
1
if
len
(
header
)
==
3
:
idx
,
central
,
score
=
header
else
:
central
,
score
=
header
idx
=
name
score
=
nx
.
get_node_attributes
(
gr
,
'
score
'
)[
name
]
# Parse hands
h1
=
h1
.
split
(
'
,
'
)
...
...
@@ -267,7 +263,7 @@ def compute_next_nodes(d2_component):
for
node
in
d2_component
.
nodes
():
# Parse the current node name
head
,
h1
,
h2
=
parse_dg_name
(
node
)
head
,
h1
,
h2
=
parse_dg_name
(
d2_component
,
node
)
next_nodes
[
node
]
=
{}
neighbors
=
list
(
d2_component
.
neighbors
(
node
))
...
...
@@ -276,7 +272,7 @@ def compute_next_nodes(d2_component):
for
mol_idx
in
molecule_idxs
:
nexts
=
[]
for
neighbor
in
neighbors
:
nei_head
,
_
,
_
=
parse_dg_name
(
neighbor
)
nei_head
,
_
,
_
=
parse_dg_name
(
d2_component
,
neighbor
)
nei_mols
=
mols_from_node
(
nei_head
[
1
])
nei_mols
=
[
x
for
x
in
nei_mols
if
x
>
mol_idx
]
...
...
@@ -401,7 +397,7 @@ def verify_graph_edges(d2_component):
udg_molecules_dict
=
dict
()
for
node
in
d2_component
.
nodes
():
# Parse the current node name
head
,
c1
,
c2
=
parse_dg_name
(
node
)
head
,
c1
,
c2
=
parse_dg_name
(
d2_component
,
node
)
# Construct the molecule(s) that this udg really 'reflects'
# i.e. the udg has a central node and two cliques
...
...
@@ -440,10 +436,10 @@ def verify_graph_edges(d2_component):
# Then: annotate edges as to whether they're real (their udg_molecule(s) are nearby) or fake
for
n1
,
n2
,
data
in
d2_component
.
edges
(
data
=
True
):
# Parse the current node name
head
,
c1
,
c2
=
parse_dg_name
(
n1
)
head
,
c1
,
c2
=
parse_dg_name
(
d2_component
,
n1
)
node_udg_molecules
=
udg_molecules_dict
[
head
[
0
]]
n_head
,
n_c1
,
n_c2
=
parse_dg_name
(
n2
)
n_head
,
n_c1
,
n_c2
=
parse_dg_name
(
d2_component
,
n2
)
neighbor_udg_molecules
=
udg_molecules_dict
[
n_head
[
0
]]
if
nearby_udg_molecules
(
node_udg_molecules
,
neighbor_udg_molecules
):
...
...
@@ -456,7 +452,7 @@ def verify_graph_edges(d2_component):
# also, annotate nodes by their putative molecule found
for
n
,
data
in
d2_component
.
nodes
(
data
=
True
):
# Parse the current node name
head
,
c1
,
c2
=
parse_dg_name
(
n
)
head
,
c1
,
c2
=
parse_dg_name
(
d2_component
,
n
)
node_udg_molecules
=
udg_molecules_dict
[
head
[
0
]]
data
[
'
udg_molecule
'
]
=
'
_
'
.
join
(
list
(
map
(
str
,
node_udg_molecules
)))
...
...
@@ -468,7 +464,7 @@ def verify_graph_edges(d2_component):
nodes_to_remove
=
[]
for
n
,
data
in
d2_component
.
nodes
(
data
=
True
):
# Parse the current node name
head
,
c1
,
c2
=
parse_dg_name
(
n
)
head
,
c1
,
c2
=
parse_dg_name
(
d2_component
,
n
)
if
"
_
"
in
data
[
'
udg_molecule
'
]
or
data
[
'
udg_molecule
'
]
==
''
:
if
"
_
"
in
data
[
'
udg_molecule
'
]:
m1
,
m2
=
list
(
map
(
int
,
data
[
'
udg_molecule
'
].
split
(
"
_
"
)))
...
...
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