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
d5486b14
Commit
d5486b14
authored
Aug 07, 2019
by
Yoann Dufresne
Browse files
prepare d2 graph to realoding by moving construction steps to annexe functions
parent
36834b36
Changes
2
Hide whitespace changes
Inline
Side-by-side
deconvolution/d2_graph.py
View file @
d5486b14
...
...
@@ -7,10 +7,12 @@ from d_graph import compute_all_max_d_graphs, filter_dominated, list_domination_
class
D2Graph
(
object
):
"""D2Graph (read it (d-graph)²)"""
def
__init__
(
self
,
graph
,
index_size
=
3
,
verbose
=
True
,
debug
=
False
):
def
__init__
(
self
,
graph
):
super
(
D2Graph
,
self
).
__init__
()
self
.
graph
=
graph
def
construct_from_barcodes
(
self
,
index_size
=
3
,
verbose
=
True
,
debug
=
False
):
# Compute all the d-graphs
if
verbose
:
print
(
"Compute the unit d-graphs"
)
...
...
@@ -67,6 +69,10 @@ class D2Graph(object):
fp
.
write
(
f
"
{
d_graph
.
idx
}
{
neighbor_idx
}
{
dist
}
\n
"
)
def
load_from_gexf
(
self
,
filename
):
pass
def
create_index_from_tuples
(
self
,
tuple_size
=
3
):
index
=
{}
...
...
deconvolution/to_d2_graph.py
View file @
d5486b14
...
...
@@ -26,7 +26,8 @@ def main():
G
=
nx
.
read_gexf
(
filename
)
# Index size must be changed for general purpose. 8 is good for d=5
d2g
=
d2
.
D2Graph
(
G
,
index_size
=
8
)
d2g
=
d2
.
D2Graph
(
G
)
d2g
.
construct_from_barcodes
(
index_size
=
8
)
d2g
.
save
(
f
"
{
args
.
output_prefix
}
.tsv"
)
G
,
names
=
d2g
.
to_nx_graph
()
...
...
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