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
c9f90cbf
Commit
c9f90cbf
authored
5 years ago
by
Yoann Dufresne
Browse files
Options
Downloads
Patches
Plain Diff
remove sum method to replace by a for: x2 speedup
parent
061f4092
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
deconvolution/dgraph/CliqueDGFactory.py
+2
-1
2 additions, 1 deletion
deconvolution/dgraph/CliqueDGFactory.py
experiments/clique_graph_eval.py
+9
-7
9 additions, 7 deletions
experiments/clique_graph_eval.py
with
11 additions
and
8 deletions
deconvolution/dgraph/CliqueDGFactory.py
+
2
−
1
View file @
c9f90cbf
...
@@ -67,7 +67,8 @@ class CliqueDGFactory(AbstractDGFactory):
...
@@ -67,7 +67,8 @@ class CliqueDGFactory(AbstractDGFactory):
observed_link
=
len
(
c1
&
c2
)
# Intersections of the nodes are glued links
observed_link
=
len
(
c1
&
c2
)
# Intersections of the nodes are glued links
neighbor_intersection
=
clique_neighbors_set
[
c1_idx
]
&
c2
neighbor_intersection
=
clique_neighbors_set
[
c1_idx
]
&
c2
neighbors_multiset
=
clique_neighbors_multiset
[
c1_idx
]
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
# Awaited links
d_approx
=
max
(
len
(
c1
),
len
(
c2
))
d_approx
=
max
(
len
(
c1
),
len
(
c2
))
...
...
This diff is collapsed.
Click to expand it.
experiments/clique_graph_eval.py
+
9
−
7
View file @
c9f90cbf
...
@@ -10,6 +10,8 @@ from deconvolution.dgraph.CliqueDGFactory import CliqueDGFactory
...
@@ -10,6 +10,8 @@ from deconvolution.dgraph.CliqueDGFactory import CliqueDGFactory
def
parse_arguments
():
def
parse_arguments
():
parser
=
argparse
.
ArgumentParser
(
description
=
"
Tests on graph barcode
"
)
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
(
'
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
()
args
=
parser
.
parse_args
()
return
args
return
args
...
@@ -77,10 +79,10 @@ def analyse_clique_graph(barcode_graph):
...
@@ -77,10 +79,10 @@ def analyse_clique_graph(barcode_graph):
return
continuous
,
len
(
clique_graph
.
nodes
())
return
continuous
,
len
(
clique_graph
.
nodes
())
def
analyse_d_graphs
(
barcode_graph
):
def
analyse_d_graphs
(
barcode_graph
,
threads
=
8
,
verbose
=
False
):
# Generate udgs
# Generate udgs
factory
=
CliqueDGFactory
(
barcode_graph
,
1
)
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
# Remove duplicate udgs
udgs
=
{}
udgs
=
{}
for
udg_node_lst
in
udg_per_node
.
values
():
for
udg_node_lst
in
udg_per_node
.
values
():
...
@@ -100,12 +102,12 @@ def analyse_d_graphs(barcode_graph):
...
@@ -100,12 +102,12 @@ def analyse_d_graphs(barcode_graph):
def
main
():
def
main
():
args
=
parse_arguments
()
args
=
parse_arguments
()
g
=
nx
.
read_gexf
(
args
.
barcode_graph
)
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
()
prev_time
=
time
.
time
()
continuous
,
total
=
analyse_clique_graph
(
g
)
continuous
,
total
=
analyse_d_graphs
(
g
,
threads
=
args
.
threads
,
verbose
=
args
.
verbose
)
print
(
"
cliques
"
,
time
.
time
()
-
prev_time
)
print
(
continuous
,
"
/
"
,
total
)
prev_time
=
time
.
time
()
continuous
,
total
=
analyse_d_graphs
(
g
)
print
(
"
udgs
"
,
time
.
time
()
-
prev_time
)
print
(
"
udgs
"
,
time
.
time
()
-
prev_time
)
print
(
continuous
,
"
/
"
,
total
)
print
(
continuous
,
"
/
"
,
total
)
...
...
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