diff --git a/README.md b/README.md index ceecd67..c2dedad 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ Downloading the executable files from `ftp://ftp.ncbi.nih.gov/blast/executables/ 4. [Prettytable](https://code.google.com/p/prettytable/) 5. [Levenshtein](https://pypi.python.org/pypi/python-Levenshtein/) 6. [Networkx](https://networkx.github.io) +7. It seems that v1.11 of Networkx behaves differently when writing dot files for use with Graphviz. If you have this (or later versions) you also need to install [PyDotPlus](http://pydotplus.readthedocs.org). ##Setup## diff --git a/tracer_func.py b/tracer_func.py index 8ad15e5..a15522f 100644 --- a/tracer_func.py +++ b/tracer_func.py @@ -1055,13 +1055,21 @@ def draw_network_from_cells(cells, output_dir, output_format, dot, neato): colours = {'A' : '1', 'B' : '2', 'G' : '3', 'D' : '5', 'mean_both' : '#a8a8a8bf'} network, draw_tool = make_cell_network_from_dna(cells, colorscheme, colours, False, "box", dot, neato) network_file = "{}/clonotype_network_with_identifiers.dot".format(output_dir) - nx.write_dot(network, network_file) + try: + nx.write_dot(network, network_file) + except AttributeError: + import pydotplus + nx.drawing.nx_pydot.write_dot(network, network_file) command = draw_tool + ['-o', "{output_dir}/clonotype_network_with_identifiers.{output_format}".format(output_dir=output_dir, output_format=output_format), "-T", output_format, network_file] subprocess.check_call(command) network, draw_tool = make_cell_network_from_dna(cells, colorscheme, colours, False, "circle", dot, neato) network_file = "{}/clonotype_network_without_identifiers.dot".format(output_dir) - nx.write_dot(network, network_file) + try: + nx.write_dot(network, network_file) + except AttributeError: + import pydotplus + nx.drawing.nx_pydot.write_dot(network, network_file) command = draw_tool + ['-o', "{output_dir}/clonotype_network_without_identifiers.{output_format}".format(output_dir=output_dir, output_format=output_format), "-T", output_format, network_file] subprocess.check_call(command)