Skip to content
Commits on Source (2)
......@@ -6,7 +6,7 @@ Priority: optional
Build-Depends: debhelper (>= 12~),
dh-python,
python-dev,
python-networkx
python-networkx (>= 2.2)
Standards-Version: 4.3.0
Vcs-Browser: https://salsa.debian.org/med-team/ragout
Vcs-Git: https://salsa.debian.org/med-team/ragout.git
......@@ -18,7 +18,7 @@ Depends: ${shlibs:Depends},
${python:Depends},
${misc:Depends},
sibelia,
python-networkx
python-networkx (>= 2.2)
Description: Reference-Assisted Genome Ordering UTility
Ragout (Reference-Assisted Genome Ordering UTility) is a tool for
chromosome-level scaffolding using multiple references. Given initial
......
From d49a5c46f73c1a4a2bfcbf5bbe41b9d2dab5f5f0 Mon Sep 17 00:00:00 2001
From: Tatiana Malygina <merlettaia@gmail.com>
Date: Mon, 25 Mar 2019 16:09:21 +0300
Origin: https://github.com/fenderglass/Ragout/pull/41
Subject: [PATCH] replace edges_iter iterator with edges iterator in networkx
graphs
---
ragout/breakpoint_graph/breakpoint_graph.py | 2 +-
ragout/breakpoint_graph/chimera_detector.py | 2 +-
ragout/breakpoint_graph/inferer.py | 4 ++--
ragout/scaffolder/merge_iters.py | 4 ++--
scripts/debug-report.py | 6 +++---
5 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/ragout/breakpoint_graph/breakpoint_graph.py b/ragout/breakpoint_graph/breakpoint_graph.py
index c9aa6c2..e73afd9 100644
--- a/ragout/breakpoint_graph/breakpoint_graph.py
+++ b/ragout/breakpoint_graph/breakpoint_graph.py
@@ -272,7 +272,7 @@ def _output_graph(graph, out_file):
"""
with open(out_file, "w") as fout:
fout.write("graph {\n")
- for v1, v2, data in graph.edges_iter(data=True):
+ for v1, v2, data in graph.edges(data=True):
fout.write("{0} -- {1}".format(v1, v2))
if len(data):
extra = list(map(lambda (k, v) : "{0}=\"{1}\"".format(k, v),
diff --git a/ragout/breakpoint_graph/chimera_detector.py b/ragout/breakpoint_graph/chimera_detector.py
index d72440f..06b8f08 100644
--- a/ragout/breakpoint_graph/chimera_detector.py
+++ b/ragout/breakpoint_graph/chimera_detector.py
@@ -98,7 +98,7 @@ def _get_contig_breaks(self, bp_graph):
logger.debug("Processing component of size {0}"
.format(len(subgr.bp_graph)))
- for (u, v, data) in subgr.bp_graph.edges_iter(data=True):
+ for (u, v, data) in subgr.bp_graph.edges(data=True):
if data["genome_id"] != subgr.target:
continue
diff --git a/ragout/breakpoint_graph/inferer.py b/ragout/breakpoint_graph/inferer.py
index a2c8134..7cdc5c3 100644
--- a/ragout/breakpoint_graph/inferer.py
+++ b/ragout/breakpoint_graph/inferer.py
@@ -115,7 +115,7 @@ def _trim_known_edges(self, graph):
Removes edges with known target adjacencies (red edges from paper)
"""
trimmed_graph = graph.copy()
- for v1, v2 in graph.edges_iter():
+ for v1, v2 in graph.edges():
if not trimmed_graph.has_node(v1) or not trimmed_graph.has_node(v2):
continue
@@ -142,7 +142,7 @@ def _min_weight_matching(graph):
"""
Finds a perfect matching with minimum weight
"""
- for v1, v2 in graph.edges_iter():
+ for v1, v2 in graph.edges():
graph[v1][v2]["weight"] = -graph[v1][v2]["weight"] #want minimum weght
MIN_LOG_SIZE = 20
diff --git a/ragout/scaffolder/merge_iters.py b/ragout/scaffolder/merge_iters.py
index fd6c9cd..66be623 100644
--- a/ragout/scaffolder/merge_iters.py
+++ b/ragout/scaffolder/merge_iters.py
@@ -179,7 +179,7 @@ def project(self):
red_edges = []
black_edges = []
- for (u, v, data) in subgr.edges_iter(data=True):
+ for (u, v, data) in subgr.edges(data=True):
if data["scf_set"] == "old":
red_edges.append((u, v))
else:
@@ -201,7 +201,7 @@ def project(self):
logger.debug("Made {0} k-breaks".format(num_kbreaks))
adjacencies = {}
- for (u, v, data) in self.bp_graph.edges_iter(data=True):
+ for (u, v, data) in self.bp_graph.edges(data=True):
if data["scf_set"] == "old":
gap, support = 0, []
if not data["infinity"]:
diff --git a/scripts/debug-report.py b/scripts/debug-report.py
index 017d3c8..e118f46 100755
--- a/scripts/debug-report.py
+++ b/scripts/debug-report.py
@@ -113,11 +113,11 @@ def compose_breakpoint_graph(base_dot, predicted_dot, true_edges):
predicted_edges = nx.read_dot(predicted_dot)
out_graph = nx.MultiGraph()
- for v1, v2, data in base_graph.edges_iter(data=True):
+ for v1, v2, data in base_graph.edges(data=True):
color = g2c(data["genome_id"])
label = "oo" if data["infinity"] == "True" else ""
out_graph.add_edge(v1, v2, color=color, label=label)
- for v1, v2 in predicted_edges.edges_iter():
+ for v1, v2 in predicted_edges.edges():
out_graph.add_edge(v1, v2, color="red", style="dashed")
for (v1, v2, infinite) in true_edges:
label = "oo" if infinite else ""
@@ -140,7 +140,7 @@ def output_graph(graph, output_dir, only_predicted):
if only_predicted:
to_show = False
- for v1, v2, data in subgr.edges_iter(data=True):
+ for v1, v2, data in subgr.edges(data=True):
if data.get("style") == "dashed":
to_show = True
break
From e3a06ef1256cf132903bbf19c9d4e11ea846e6df Mon Sep 17 00:00:00 2001
From: Tatiana Malygina <merlettaia@gmail.com>
Date: Mon, 25 Mar 2019 16:19:40 +0300
Origin: https://github.com/fenderglass/Ragout/pull/41
Subject: [PATCH] fix TypeError: object of type 'dictionary-keyiterator' has no
len()
---
ragout/scaffolder/merge_iters.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/ragout/scaffolder/merge_iters.py b/ragout/scaffolder/merge_iters.py
index 66be623..3536f5c 100644
--- a/ragout/scaffolder/merge_iters.py
+++ b/ragout/scaffolder/merge_iters.py
@@ -174,7 +174,7 @@ def project(self):
subgraphs = list(nx.connected_component_subgraphs(self.bp_graph))
for subgr in subgraphs:
#this is a cycle
- if any(len(subgr.neighbors(node)) != 2 for node in subgr.nodes()):
+ if any(len(subgr[node]) != 2 for node in subgr.nodes()):
continue
red_edges = []
@@ -193,6 +193,7 @@ def project(self):
self.bp_graph.remove_edge(u, v)
self.adj_graph.remove_edge(u, v)
for u, v in black_edges:
+ print(self.bp_graph[u][v])
link = self.bp_graph[u][v][0]["link"]
infinity = self.bp_graph[u][v][0]["infinity"]
self.bp_graph.add_edge(u, v, scf_set="old",
From f4d4e2223a337abdbc5873fd6560e1494e55342d Mon Sep 17 00:00:00 2001
From: Tatiana Malygina <merlettaia@gmail.com>
Date: Mon, 25 Mar 2019 17:08:08 +0300
Origin: https://github.com/fenderglass/Ragout/pull/41
Subject: [PATCH] fix AttributeError: 'set' object has no attribute 'items'
---
ragout/breakpoint_graph/inferer.py | 2 +-
ragout/breakpoint_graph/repeat_resolver.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/ragout/breakpoint_graph/inferer.py b/ragout/breakpoint_graph/inferer.py
index 7cdc5c3..eb47032 100644
--- a/ragout/breakpoint_graph/inferer.py
+++ b/ragout/breakpoint_graph/inferer.py
@@ -151,7 +151,7 @@ def _min_weight_matching(graph):
"size {0}".format(len(graph)))
edges = nx.max_weight_matching(graph, maxcardinality=True)
unique_edges = set()
- for v1, v2 in edges.items():
+ for v1, v2 in edges:
if not (v2, v1) in unique_edges:
unique_edges.add((v1, v2))
diff --git a/ragout/breakpoint_graph/repeat_resolver.py b/ragout/breakpoint_graph/repeat_resolver.py
index b3054e5..a20ea11 100644
--- a/ragout/breakpoint_graph/repeat_resolver.py
+++ b/ragout/breakpoint_graph/repeat_resolver.py
@@ -362,7 +362,7 @@ def _profile_similarity(profile, genome_ctx, repeats, same_len):
def _max_weight_matching(graph):
edges = nx.max_weight_matching(graph, maxcardinality=True)
unique_edges = set()
- for v1, v2 in edges.items():
+ for v1, v2 in edges:
if not (v2, v1) in unique_edges:
unique_edges.add((v1, v2))
install_newick.patch
d49a5c46f73c1a4a2bfcbf5bbe41b9d2dab5f5f0.patch
e3a06ef1256cf132903bbf19c9d4e11ea846e6df.patch
f4d4e2223a337abdbc5873fd6560e1494e55342d.patch