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
ff1c07d8
Commit
ff1c07d8
authored
Mar 11, 2019
by
Yoann Dufresne
Browse files
add a little bit of documentation to understand the d_graph detection code
parent
4c766588
Changes
1
Hide whitespace changes
Inline
Sidebyside
deconvolve.py
View file @
ff1c07d8
...
...
@@ 46,12 +46,25 @@ def get_communities(G):
# Extract communites from all the possible dgraphes in the neighborood.
""" This function take two cliques in the graph G and try to find if they are 2 halfes of a dgraph.
1  The algorithm compute overlapp between nodes from first clique to the second and from the
second to the first.
2  Filter the clique pairs that have less than n*(n1)/2 traversing edges (necessary critera
to be considered as dgraph).
3  Find the node order in the half dgraphs by sorting nodes by traversing order.
4  return a paair of half dgraph ordered from the central node (not present in G).
@param cliq1 (resp clq2) the clique that is candidate to be composed of half of the dgraph nodes.
@param G the graph of the neighbors of the central node (not present).
@return A pair of lists that are the 2 halves of the dgraph ordered from the center.
"""
def
compute_d_graph
(
clq1
,
clq2
,
G
):
# Compute the arities between the cliques
arities1
=
{
name
:
0
for
name
in
clq1
}
arities2
=
{
name
:
0
for
name
in
clq2
}
sum_edges
=
0
min_clq_size
=
min
(
len
(
clq1
),
len
(
clq2
))
# Compute link arities
for
node1
in
clq1
:
neighbors
=
list
(
G
.
neighbors
(
node1
))
...
...
@@ 64,7 +77,7 @@ def compute_d_graph(clq1, clq2, G):
sum_edges
+=
1
# Reject if not enought edges
if
sum_edges
<
len
(
clq1
)
*
(
len
(
clq1
)

1
)
/
2
:
if
sum_edges
<
min_clq_size
*
(
min_clq_size

1
)
/
2
:
return
None
print
(
clq1
,
clq2
)
...
...
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