Could not plot phenotypic comparison
AtoanyFierro opened this issue · comments
I tried to plot phenotypic comparison using these lines:
hpo.plot(
patient = patients['ORPHA:104']['cohort'][0]['phenotype'],
disease = {
'name': patients['ORPHA:104']['name'],
'id': patients['ORPHA:104']['id'],
'phenotype': patients['ORPHA:104']['phenotype']})
But it did not work, I got this:
FileNotFoundError Traceback (most recent call last)
~\anaconda3\envs\OIA\lib\site-packages\pydot.py in create(self, prog, format, encoding)
1925 arguments=arguments,
-> 1926 working_dir=tmp_dir,
1927 )
~\anaconda3\envs\OIA\lib\site-packages\pydot.py in call_graphviz(program, arguments, working_dir, **kwargs)
138 stdout=subprocess.PIPE,
--> 139 **kwargs
140 )
~\anaconda3\envs\OIA\lib\subprocess.py in init(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text)
799 errread, errwrite,
--> 800 restore_signals, start_new_session)
801 except:
~\anaconda3\envs\OIA\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)
1206 os.fspath(cwd) if cwd is not None else None,
-> 1207 startupinfo)
1208 finally:
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
FileNotFoundError Traceback (most recent call last)
in
4 'name': patients['ORPHA:104']['name'],
5 'id': patients['ORPHA:104']['id'],
----> 6 'phenotype': patients['ORPHA:104']['phenotype']})
7
8 #plot does not work
~\AppData\Roaming\Python\Python37\site-packages\rarecrowds\utils\hpo.py in plot(self, patient, disease)
230 G = self.Graph.subgraph(list(hpo_set))
231 ## Prepare the data
--> 232 plt_data = prepare_data(G, patient_set, disease_set)
233
234 edge_trace = go.Scatter(
~\AppData\Roaming\Python\Python37\site-packages\rarecrowds\utils\hpo.py in prepare_data(G, patient_set, disease_set)
173 mapping = {n: n.replace(":", "_") for n in G.nodes}
174 G = nx.relabel_nodes(G, mapping)
--> 175 pos = nx.drawing.nx_pydot.graphviz_layout(G, prog="dot")
176 ## Set positions of each item
177 data = {
~\anaconda3\envs\OIA\lib\site-packages\networkx\drawing\nx_pydot.py in graphviz_layout(G, prog, root)
255 This is a wrapper for pydot_layout.
256 """
--> 257 return pydot_layout(G=G, prog=prog, root=root)
258
259
~\anaconda3\envs\OIA\lib\site-packages\networkx\drawing\nx_pydot.py in pydot_layout(G, prog, root)
304 # List of low-level bytes comprising a string in the dot language converted
305 # from the passed graph with the passed external GraphViz command.
--> 306 D_bytes = P.create_dot(prog=prog)
307
308 # Unique string decoded from these bytes with the preferred locale encoding
~\anaconda3\envs\OIA\lib\site-packages\pydot.py in new_method(f, prog, encoding)
1732 """Refer to docstring of method create
."""
1733 return self.create(
-> 1734 format=f, prog=prog, encoding=encoding)
1735 name = 'create_{fmt}'.format(fmt=frmt)
1736 self.setattr(name, new_method)
~\anaconda3\envs\OIA\lib\site-packages\pydot.py in create(self, prog, format, encoding)
1931 args[1] = '"{prog}" not found in path.'.format(
1932 prog=prog)
-> 1933 raise OSError(*args)
1934 else:
1935 raise
FileNotFoundError: [WinError 2] "dot" not found in path.
Yes, I am seeing something similar in Windows. I had initially developed this in Linux and it worked just fine. There is some literature already about these issues with graphviz's dot program. I get a similar error, but not quite the same:
"dot" with args ['-Tdot', 'C:\\Users\\botas\\AppData\\Local\\Temp\\tmp54t4tz9x'] returned code: 1
stdout, stderr:
b''
b"'dot.bat' is not recognized as an internal or external command,\r\noperable program or batch file.\r\n"
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-9-117c01dd9a9e> in <module>
6 'name': patients['ORPHA:324']['name'],
7 'id': patients['ORPHA:324']['id'],
----> 8 'phenotype': patients['ORPHA:324']['phenotype']})
~\Anaconda3\lib\site-packages\rarecrowds\utils\hpo.py in plot(self, patient, disease)
230 G = self.Graph.subgraph(list(hpo_set))
231 ## Prepare the data
--> 232 plt_data = prepare_data(G, patient_set, disease_set)
233
234 edge_trace = go.Scatter(
~\Anaconda3\lib\site-packages\rarecrowds\utils\hpo.py in prepare_data(G, patient_set, disease_set)
173 mapping = {n: n.replace(":", "_") for n in G.nodes}
174 G = nx.relabel_nodes(G, mapping)
--> 175 pos = nx.drawing.nx_pydot.graphviz_layout(G, prog="dot")
176 ## Set positions of each item
177 data = {
~\Anaconda3\lib\site-packages\networkx\drawing\nx_pydot.py in graphviz_layout(G, prog, root)
255 This is a wrapper for pydot_layout.
256 """
--> 257 return pydot_layout(G=G, prog=prog, root=root)
258
259
~\Anaconda3\lib\site-packages\networkx\drawing\nx_pydot.py in pydot_layout(G, prog, root)
304 # List of low-level bytes comprising a string in the dot language converted
305 # from the passed graph with the passed external GraphViz command.
--> 306 D_bytes = P.create_dot(prog=prog)
307
308 # Unique string decoded from these bytes with the preferred locale encoding
~\Anaconda3\lib\site-packages\pydot.py in new_method(f, prog, encoding)
1732 """Refer to docstring of method `create`."""
1733 return self.create(
-> 1734 format=f, prog=prog, encoding=encoding)
1735 name = 'create_{fmt}'.format(fmt=frmt)
1736 self.__setattr__(name, new_method)
~\Anaconda3\lib\site-packages\pydot.py in create(self, prog, format, encoding)
1959 prog=prog,
1960 arguments=arguments,
-> 1961 code=process.returncode,
1962 )
1963 )
AssertionError: "dot" with args ['-Tdot', 'C:\\Users\\botas\\AppData\\Local\\Temp\\tmp54t4tz9x'] returned code: 1
Maybe @hchittanuru3 has some insights on how to go about this one. Ideas?