From fde0cae714cc5b142ccca0f0f9d8adf579b0d9a8 Mon Sep 17 00:00:00 2001 From: Amirhossein Afshinfard <31241012+afshinfard@users.noreply.github.com> Date: Thu, 1 Apr 2021 09:52:20 -0700 Subject: [PATCH] V1.0.0 fixes (#167) * happy pylint (newly added linter) Now to iterate over a `dict`, the only acceptable way is two call `.items()` * disable pylint for two lines due to bugs temporarily disabling pylint as it has an active bug for two lines: https://github.com/PyCQA/pylint/issues/3675 * fix typo * happy pylint warnings * Happy pylint recoms * fix typo --- physlr/physlr.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/physlr/physlr.py b/physlr/physlr.py index 3e3e9df0..4f042c1e 100644 --- a/physlr/physlr.py +++ b/physlr/physlr.py @@ -571,7 +571,7 @@ def determine_backbones_of_trees(g, prune_junctions): for subcomponent in nx.connected_components(gcomponents): gsubcomponent = g.subgraph(subcomponent) u, v, _ = Physlr.diameter_of_tree(gsubcomponent, weight="m") - path = nx.shortest_path(gsubcomponent, u, v, weight="m") + path = nx.shortest_path(gsubcomponent, u, v, weight="m") # pylint: disable=E1121, E1123 paths.append(path) paths.sort(key=len, reverse=True) print( @@ -1178,7 +1178,7 @@ def physlr_mst_troubleshoot(self): for component in nx.connected_components(gmst): gcomponent = gmst.subgraph(component) branch_lengths = Physlr.measure_branch_length(gcomponent) - for u, v in branch_lengths: + for u, v in branch_lengths.items(): gmst[u][v]["l"] = min(branch_lengths[(u, v)], branch_lengths[(v, u)]) print(int(timeit.default_timer() - t0), "Measured branches.", file=sys.stderr, flush=True) @@ -1266,7 +1266,7 @@ def physlr_tiling_graph(self): g = self.read_graph(self.args.FILES) Physlr.filter_edges(g, self.args.m) backbones = self.determine_backbones(g) - tiling = {u for path in backbones for u in nx.shortest_path(g, path[0], path[-1])} + tiling = {u for path in backbones for u in nx.shortest_path(g, path[0], path[-1])} # pylint: disable=E1121, E1123 subgraph = g.subgraph(tiling) self.write_graph(subgraph, sys.stdout, self.args.graph_format) @@ -2186,7 +2186,7 @@ def physlr_bed_to_path(self): orientation = "." scaffolds.append((tname, tstart, orientation, qname)) scaffolds.sort() - print(int(timeit.default_timer() - t0), f"Ordered and oriented queries.", file=sys.stderr) + print(int(timeit.default_timer() - t0), "Ordered and oriented queries.", file=sys.stderr) num_scaffolds = 0 num_contigs = 0 @@ -2432,7 +2432,7 @@ def path_to_fasta_no_arcs(seqs, paths, gaps): if not path: continue - all_unoriented = all([name[-1] == "." for name in path]) + all_unoriented = all((name[-1] == "." for name in path)) if all_unoriented: continue