@@ -102,6 +102,68 @@ example::
102
102
input()
103
103
104
104
105
+ Remote visualization
106
+ ~~~~~~~~~~~~~~~~~~~~
107
+
108
+ It is possible to run ETE remotely and explore the tree from our
109
+ computer's browser.
110
+
111
+ Basically::
112
+
113
+ ssh -L 5000:localhost:5000 nice_big_machine
114
+
115
+ and then, running ETE from there (with ipython for example)::
116
+
117
+ from ete4 import Tree
118
+ t = Tree(open('mytree.nw'))
119
+ t.explore(port=5000, open_browser=False)
120
+
121
+ We should then be able to explore the tree by pointing our browser at
122
+ http://localhost:5000 .
123
+
124
+
125
+ Details about port forwarding
126
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
127
+
128
+ When we do ``t.explore() ``, ETE will launch a "backend server" (a
129
+ program running in parallel) that serves the web pages with the GUI,
130
+ and responds to the requests for drawing the tree. By default, that
131
+ server will listen in port 5000, or if that port is taken, in port
132
+ 5001, or 5002 if not, etc. And it will try to open the browser to
133
+ access the default web page. This is convenient when running locally.
134
+
135
+ But if we want to run ETE in a different machine and visualize
136
+ locally, we can redirect anything sent to that port 5000 where the
137
+ server is. This can be convenient because the ``nice_big_machine ``
138
+ will do the heavy work of opening a big tree, and recompute fast, etc.
139
+ And only the necessary graphics are sent to our computer. To `forward
140
+ that port
141
+ <https://help.ubuntu.com/community/SSH/OpenSSH/PortForwarding> `_, we
142
+ just add the ``-L 5000:localhost:5000 `` part to the ssh command.
143
+
144
+ Some inconveniences are that, if we do ``t.explore() ``, the port 5000
145
+ may be already used, and then ETE starts in another port, and
146
+ forwarding the 5000 doesn't help. To avoid that, we can launch it
147
+ with::
148
+
149
+ t.explore(port=5000)
150
+
151
+ Now, if port 5000 is busy, the explorer will just fail and tell us so
152
+ (maybe we just closed another ETE explorer, and the operating system
153
+ takes some seconds to free the port). In that case, we can wait 10
154
+ seconds or so and retry. Or, if there is another ETE running (from us
155
+ or from anyone else in that computer), we can redo everything (``ssh
156
+ ... ``, ``t.explore(...) ``) using another port (from 1024 to 49151).
157
+
158
+ Finally, we add the ``open_browser=False `` argument so it doesn't try
159
+ to open a web browser in the remote computer. And depending on how
160
+ slow the connection to the remote computer is, we may want to have the
161
+ ETE server use compression for the data, adding ``compress=True ``. All
162
+ together, it would look like::
163
+
164
+ t.explore(port=5000, open_browser=False, compress=True)
165
+
166
+
105
167
Verbose mode
106
168
~~~~~~~~~~~~
107
169
0 commit comments