Skip to content

Commit

Permalink
Added fix for Networkx v1.11 write_dot changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mstubb committed Feb 22, 2016
1 parent 6041a49 commit e22a895
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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##
Expand Down
12 changes: 10 additions & 2 deletions tracer_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit e22a895

Please sign in to comment.