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
419b3ecc
Commit
419b3ecc
authored
Feb 18, 2020
by
Yoann Dufresne
Browse files
bugfix: correct filtering ; verbose: add verbose to parallel jobs
parent
0ff34ba2
Changes
2
Hide whitespace changes
Inline
Side-by-side
deconvolution/dgraph/AbstractDGFactory.py
View file @
419b3ecc
...
...
@@ -2,19 +2,32 @@ import networkx as nx
from
abc
import
abstractmethod
from
multiprocessing
import
Pool
,
Value
from
deconvolution.dgraph.FixedDGIndex
import
FixedDGIndex
from
deconvolution.dgraph.FixedDGIndex
import
FixedDGIndex
,
AbstractDGIndex
counter
=
None
def
process_node
(
factory
,
node
):
global
counter
my_value
=
counter
.
value
counter
.
value
+=
1
if
factory
.
verbose
:
print
(
f
"
{
my_value
}
: Generating d-graphs"
)
# udg generation
neighbors
=
list
(
factory
.
graph
.
neighbors
(
node
))
subgraph
=
nx
.
Graph
(
factory
.
graph
.
subgraph
(
neighbors
))
dgs
=
factory
.
generate_by_node
(
node
,
subgraph
)
global
counter
counter
.
value
+=
1
if
factory
.
verbose
:
print
(
f
"
\r
{
counter
.
value
}
/
{
factory
.
nb_nodes
}
node analysis"
,
end
=
''
)
print
(
f
"
{
my_value
}
: d-graphs generated, starting filtering"
)
print
(
f
"
{
my_value
}
:
{
len
(
dgs
)
}
graphs to filter"
)
# udg domination filtering
dgs
=
AbstractDGIndex
.
filter_entry
(
dgs
)
if
factory
.
verbose
:
print
(
f
"
{
my_value
}
(
{
factory
.
nb_nodes
}
) terminated"
)
return
node
,
dgs
...
...
@@ -34,6 +47,9 @@ class AbstractDGFactory:
global
counter
counter
=
Value
(
'i'
,
0
)
if
verbose
:
print
(
"Start parallel work"
)
results
=
None
with
Pool
(
processes
=
threads
)
as
pool
:
results
=
pool
.
starmap
(
process_node
,
zip
(
...
...
deconvolution/dgraph/CliqueDGFactory.py
View file @
419b3ecc
...
...
@@ -77,6 +77,4 @@ class CliqueDGFactory(AbstractDGFactory):
d_graph
.
put_halves
(
clq1
,
clq2
,
subgraph
)
node_d_graphs
.
add
(
d_graph
)
# Filter dominated
node_d_graphs
=
AbstractDGIndex
.
filter_entry
(
node_d_graphs
)
return
node_d_graphs
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