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
c9f90cbf
Commit
c9f90cbf
authored
Apr 29, 2020
by
Yoann Dufresne
Browse files
remove sum method to replace by a for: x2 speedup
parent
061f4092
Changes
2
Hide whitespace changes
Inline
Side-by-side
deconvolution/dgraph/CliqueDGFactory.py
View file @
c9f90cbf
...
...
@@ -67,7 +67,8 @@ class CliqueDGFactory(AbstractDGFactory):
observed_link
=
len
(
c1
&
c2
)
# Intersections of the nodes are glued links
neighbor_intersection
=
clique_neighbors_set
[
c1_idx
]
&
c2
neighbors_multiset
=
clique_neighbors_multiset
[
c1_idx
]
observed_link
+=
sum
(
neighbors_multiset
[
x
]
for
x
in
neighbor_intersection
)
# Sum the links between the cliques
for
x
in
neighbor_intersection
:
observed_link
+=
neighbors_multiset
[
x
]
# Sum the links between the cliques
# Awaited links
d_approx
=
max
(
len
(
c1
),
len
(
c2
))
...
...
experiments/clique_graph_eval.py
View file @
c9f90cbf
...
...
@@ -10,6 +10,8 @@ from deconvolution.dgraph.CliqueDGFactory import CliqueDGFactory
def
parse_arguments
():
parser
=
argparse
.
ArgumentParser
(
description
=
"Tests on graph barcode"
)
parser
.
add_argument
(
'barcode_graph'
,
help
=
'The barcode graph file. Must be a gexf formatted file.'
)
parser
.
add_argument
(
'--threads'
,
'-t'
,
type
=
int
,
help
=
"Number of threads to use (Set 1 for profiling)"
)
parser
.
add_argument
(
'--verbose'
,
'-v'
,
action
=
'store_true'
,
help
=
"Set the verbose flag"
)
args
=
parser
.
parse_args
()
return
args
...
...
@@ -77,10 +79,10 @@ def analyse_clique_graph(barcode_graph):
return
continuous
,
len
(
clique_graph
.
nodes
())
def
analyse_d_graphs
(
barcode_graph
):
def
analyse_d_graphs
(
barcode_graph
,
threads
=
8
,
verbose
=
False
):
# Generate udgs
factory
=
CliqueDGFactory
(
barcode_graph
,
1
)
udg_per_node
=
factory
.
generate_all_dgraphs
(
threads
=
1
)
udg_per_node
=
factory
.
generate_all_dgraphs
(
threads
=
threads
,
verbose
=
verbose
)
# Remove duplicate udgs
udgs
=
{}
for
udg_node_lst
in
udg_per_node
.
values
():
...
...
@@ -100,12 +102,12 @@ def analyse_d_graphs(barcode_graph):
def
main
():
args
=
parse_arguments
()
g
=
nx
.
read_gexf
(
args
.
barcode_graph
)
# prev_time = time.time()
# continuous, total = analyse_clique_graph(g)
# print("cliques", time.time() - prev_time)
# print(continuous, "/", total)
prev_time
=
time
.
time
()
continuous
,
total
=
analyse_clique_graph
(
g
)
print
(
"cliques"
,
time
.
time
()
-
prev_time
)
print
(
continuous
,
"/"
,
total
)
prev_time
=
time
.
time
()
continuous
,
total
=
analyse_d_graphs
(
g
)
continuous
,
total
=
analyse_d_graphs
(
g
,
threads
=
args
.
threads
,
verbose
=
args
.
verbose
)
print
(
"udgs"
,
time
.
time
()
-
prev_time
)
print
(
continuous
,
"/"
,
total
)
...
...
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