Skip to content

Commit 1bc05c1

Browse files
committed
deploy: 039fc75
1 parent d50b48a commit 1bc05c1

File tree

4 files changed

+176
-55
lines changed

4 files changed

+176
-55
lines changed

_sources/tutorial/tutorial_smartview.rst.txt

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ The concepts that ETE uses to describe the visualization are:
6060
from previous layouts.
6161

6262

63-
Launching the explorer
64-
----------------------
63+
Using the explorer
64+
------------------
6565

6666
To start the visualization of a tree, we can use the :func:`explore
6767
<ete4.Tree.explore>` method as shown above::
@@ -102,6 +102,68 @@ example::
102102
input()
103103

104104

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+
105167
Verbose mode
106168
~~~~~~~~~~~~
107169

searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tutorial/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ <h1>Tutorial<a class="headerlink" href="#tutorial" title="Link to this heading">
7373
</li>
7474
<li class="toctree-l1"><a class="reference internal" href="tutorial_smartview.html">Tree drawing and exploration (web)</a><ul>
7575
<li class="toctree-l2"><a class="reference internal" href="tutorial_smartview.html#overview">Overview</a></li>
76-
<li class="toctree-l2"><a class="reference internal" href="tutorial_smartview.html#launching-the-explorer">Launching the explorer</a></li>
76+
<li class="toctree-l2"><a class="reference internal" href="tutorial_smartview.html#using-the-explorer">Using the explorer</a></li>
7777
<li class="toctree-l2"><a class="reference internal" href="tutorial_smartview.html#customizing-the-visualization">Customizing the visualization</a></li>
7878
<li class="toctree-l2"><a class="reference internal" href="tutorial_smartview.html#combining-styles-and-faces">Combining styles and faces</a></li>
7979
</ul>

0 commit comments

Comments
 (0)