hklarner / pyboolnet

PyBoolNet is a Python package for the generation, modification and analysis of Boolean networks.
43 stars 21 forks source link

igraph2image FileNotFoundError #91

Closed yzongy closed 2 years ago

yzongy commented 2 years ago

Hi, I was running:

igraph = primes2igraph(primes)
igraph2image(igraph, "test_simpleModel.pdf")

and got this error:

INFO created None Traceback (most recent call last): File "/Users/yzongy/BooleanNetworks/test.py", line 21, in igraph2image(igraph, "test_simpleModel.pdf") File "/Users/yzongy/.pyenv/versions/3.9.7/lib/python3.9/site-packages/pyboolnet/interaction_graphs.py", line 213, in igraph2image digraph2image(igraph, fname_image, layout_engine=layout_engine) File "/Users/yzongy/.pyenv/versions/3.9.7/lib/python3.9/site-packages/pyboolnet/digraphs.py", line 274, in digraph2image proc = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) File "/Users/yzongy/.pyenv/versions/3.9.7/lib/python3.9/subprocess.py", line 951, in init self._execute_child(args, executable, preexec_fn, close_fds, File "/Users/yzongy/.pyenv/versions/3.9.7/lib/python3.9/subprocess.py", line 1821, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/fdp'

I would be very grateful if you could guide me through it.

Best,

Bill

hklarner commented 2 years ago

Hi Bill,

looks like you don't have Graphviz installed. You are on Windows, right?

yzongy commented 2 years ago

Hi,

Thanks for your quick reply. I am on Mac and have installed graphviz 2.50.0

hklarner commented 2 years ago

The command /usr/bin/fdp is missing. fdp is the default layout engine. What happens when you call fdp in the terminal? What happens when you call dot in the terminal? What happens when you change the layout engine to dot?

igraph2image(igraph, "test_simpleModel.pdf", layout_engine="dot")
yzongy commented 2 years ago

Hi Hannes,

I tried all engines one by one but still not working.

Are there any other approaches for visualisation?

Best,

Bill

hklarner commented 2 years ago

What happens when you type dot in the terminal?

yzongy commented 2 years ago

Hi Hannes,

It did work when fdp or dot was called in the terminal, which printed XML file from a dot file: $ fdp -Tsvg irma.dot

hklarner commented 2 years ago

Right. So you can use pyboolnet to create the dot file and then call fdp or dot yourself from the command line.

If you want to create the pdf from pyboolnet you need to find out the path for the layout engines e.g. fdp and dot and make changes to the settings.cfg file.

Find out the path to your layout engines by calling $which fdp or $whereis fdp.

The settings.cfg file is in the pyboolnet directory on your computer. You can find out where you have pyboolnet installed by importing pyboolnet and calling .__file__ on it:

$ python3
>>> import pyboolnet
>>> pyboolnet.__file__
~/lib/python3.8/site-packages/pyboolnet

The settings file will then be located in

yzongy commented 2 years ago

It works! Thanks for your time and step by step guidance!

Best,

Bill

hklarner commented 2 years ago

Great. Let me know if anything else comes up.