iTOL¶
About¶
iTOL provides a Python API and a command-line tool for the Tree of Life (iTOL).
This API is intentionally designed for interacting with iTOL server. The author suggests use this API to handle big datasets or programmatically manipulated phylogenetic trees and associated annotation datasets. The API allows users interact with iTOL server using Python or shell. In order to visualize your data, an active internet connection to iTO server is required.
Installation¶
iTOL
has been uploaded to PyPI, so the easiest way to install it is via pip
:
pip install iTOL
Usage¶
Use in terminal¶
If you only want to upload/download existing tree file and/or associated dataset files, you are
encouraged to use the command-line tool itol
from a terminal.
Check the usage of command-line too itol
first:
$ itol -h
usage: itol DATA [OPTIONS]
Command line tool for ITOL (http://itol.embl.de) bach access.
positional arguments:
DATA A tree file name, a ZIP file name, a tree ID or URL.
optional arguments:
-h, --help show this help message and exit
-i uploadID Your upload ID (ID for batch uploading).
-n treeName The name you assigned to the tree.
-p projectName Project name, required if uploadID is assigned.
-d treeDescription Description of your tree.
-f F Output file format, default: pdf. Graphical formats:
svg, eps, pdf and png; text formats: newick, nexus and
phyloxml
-o O Path of the output file.
-a Force zip all text files along with the tree file.
Upload a tree file to iTOL server:
$ itol /path/to/tree_file
Upload a tree file to iTOL server and using a uploadID and project name:
$ itol /path/to/tree_file -i uploadID -p project_name
Upload a tree file to iTOL server and using a uploadID, project name and assign a tree name:
$ itol /path/to/tree_file -i uploadID -p project_name -n tree_name
Upload a tree file to iTOL server and using a uploadID, project name and, tree name and a tree description:
$ itol /path/to/tree_file -i uploadID -p project_name -n tree_name -d tree_description
Download a image of a tree from iTOL server using treeID:
$ itol treeID
Download a image of a tree from iTOL server using tree URL:
$ itol tree_URL
Download a image of a tree from iTOL server using tree URL and save in png
format:
$ itol tree_URL -f png
Download a image of a tree from iTOL server using tree URL and save in png
format with name of
iTOL.png
:
$ itol tree_URL -f png -o iTOL.png
Download a image of a tree from iTOL server and display it in circular mode:
$ itol tree_URL --display_mode 2
Download a image of a tree from iTOL server, display it in circular mode and make the first dataset visible:
$ itol tree_URL --display_mode 2 --datasets_visible 0
Use in Python¶
Using iTOL
module from Python Shell or script is much more flexible than using the command-line
tool from shell and users are able to access all methods for generating annotation files and interact
with iTOL server inside python.
from iTOL import TOL
# Initiate the base class by providing a tree file and work directory (not always necessary)
t = TOL(tfile='path/to/tree_file', wd='path/to/work/directory')
# Data for coloring the tree
data = [
(8518, 'label', '#0000ff'),
('6529', 'label', '#00ff00', 'bold', '2'),
(6321, 'label', '#ff8000', 'bold-italic', 0.5),
('6529|8463', 'clade', '#0000ff', 'normal', 3),
('8090|8033', 'clade', '#ff0000', 'dashed', 0.5),
('7539|1744', 'branch', '#00ff00', 'dashed', 5),
('5784|7550', 'range', '#ff0000', 'Group A'),
('7396|2154', 'range', '#aaffaa', 'Group B'),
('2055|539', 'range', '#aaaaff', 'Group C')
]
# Generating annotation file for color setting
t.color(data)
# Data for making pie chart
data = [(8518, -1, 30, 20, 32, 50), ('6529', 0.5, 20, 33, 23, 46), (6321, 1, 15, 18, 40, 35)]
# Generating annotation file for pie char
t.pie(data)
# Upload the tree and the generated annotation files to iTOL server
t.upload(uid='You upload ID', tn='tree Name', pn='project name', td='tree description')
# Download the tree image (using default name and default format)
t.download()
# Download the tree image in png format and save it to iTOL.png
t.download(fmt='png', outfile='iTOL.png')
# Download the tree image display in circular mode, both datasets visible,and save it to
# iTOL.png file in png format
t.download(fmt='png', outfile='iTOL_visible.png', display_mode=2, datasets_visible='0,1')
Since using iTOL
module in Python is more flexible, users are strongly encouraged to check
out the examples
directory for more examples.
Development¶
Users or developers are NOT encouraged to directly run the example code stored in the
examples
directory. If you want to run these codes to test iTOL, the author STRONGLY
suggest that you create an account on iTOL website, and replace the upload ID in these examples.
Without replacing the upload ID, you may upload all your data into a Demo or Program project
set by the author and mess up the whole project.
API Reference¶
Python API for phylogenetic tree visualization in Interactive Tree of Life (ITOL).
TODO: add method handles data get()
and post()
methods using built-in urllib
instead of requests
.
TODO: add support for Python 2. Current codes have only been tested under Python 3.6 (August 17, 2018)
-
class
iTOL.iTOL.
TOL
(tfile='', zfile='', wd='iTOL', leave=True)¶ Base class Handles tree visualization in Interactive Tree of Life (ITOL).
Method upload handles upload tree to iTOL and download handles image download (or export). All other methods are designed to generate annotation files.
Except upload and download methods, all methods have a positional argument
data
which is a nested list consisting of tuples or lists. Elements in each inner tuple or list are described within each method. All these methods also have two common optional arguments:separator
andoutfile
. The former was set to comma as its default value and the later joins method name and text file extension (.txt) as the default name of the notation file. Users are strongly encouraged to modify these two arguments according to their datasets. For each method, all keywords in mandatory and optional settings that only can be set within annotation file are elaborated listed as keyword argument (lower case) along with their default values. Keywords for optional settings can be set or changed later in the web interface are not listed, if user need to pass them to concerned method, they can be passed as additional keyword arguments (use lower cases argument name). Each method will generate an annotation file in specified work directory if the method call did not fail. The doc string for each method only listed information about the positional argument and some keyword arguments, for information about the rest of arguments and details can be found in ITOL help page or annotation template files.-
alignment
(data, separator='comma', dataset_label='alignment', color='#ff0000', custom_color_scheme='CUSTOM_COLOR_SCHEME, COLOR_SCHEME, A=#d2d0c9, M=#d2d0c9, I=#d2d0c9, L=#d2d0c9, V=#d2d0c9, P=#746f69, G=#746f69, C=#746f69, F=#d0ad16, Y=#d0ad16, W=#d0ad16, S=#34acfb, T=#34acfb, N=#34acfb, Q=#34acfb, R=#34fb54, K=#34fb54, H=#34fb54, D=#fb4034, E=#fb4034', outfile='alignment.txt', **kwargs)¶ Handles multiple sequence alignments visualization.
Parameters: data – str, path of an alignment file (in FASTA format). See help/dataset_alignment_template.txt for details. TODO: add support for handling alignment files in different formats (i.e. phylip, clustal, …)
-
binary
(data, separator='comma', dataset_label='binary', color='#ff0000', field_shapes='1', field_labels='f1', field_colors='#ff0000', outfile='binary.txt', **kwargs)¶ Handles binary datasets visualization.
Parameters: data – list, a nested list consisting of tuples or lists. Each inner tuple or list should have at least 2 elements which define node id and one shape or combined shapes. If use combined shapes, the delimiter between different shapes should be consisted with the argument separator. See dataset_binary_template.txt for more details.
- The nested list
data
shows a general data structure. - The field_shapes define the shape of four fields corresponding to data.
- The shape_labels define the label of each field.
- The field_colors define the color of each field.
Example:
data = [(8518, '1,0,-1,0'), ('6529', 1, 0, -1, 0), (6321, 0, 1, 0, -1), (2055, 0, 0, 0, -1)] filed_shape = '2,4,5,1' field_labels = 'f2,f4,f5,f1' field_colors = '#ff0000,#00ff00,#ffff00,#ff8000'
- The nested list
-
boxplot
(data, separator='comma', dataset_label='boxplot', color='#ff0000', dataset_scale='', outfile='boxplot.txt', **kwargs)¶ Handles boxplot visualization.
Parameters: data – list, a nested list consisting of tuples or lists. Each inner tuple or list should have at least 2 elements which define node id(s) and multiple values. See dataset_boxplot_template.txt for more details.
The nested list
data
shows a general data structure (ID1, minimum, q1, median, q3, maximum, value1, …):data = [(8518, 20, 25, 32, 44, 55, 60), ('6529', 20, 23, 30, 46, 58, 18), (6321, 15, 18, 29, 35, 45, 40)]
-
color
(data, separator='comma', outfile='color.txt', **kwargs)¶ Handles branch colors, styles, colored ranges and label colors/front style (TREE_COLORS annotation file).
Parameters: data – list, a nested list consisting of tuples or lists. Each inner tuple or list should have at least 3 elements which define the node, type and color in order. Possible types are range, clade, branch, and label, an additional element may be optional or required. See colors_styles_template.txt for more details.
- The nested list
colors
shows a general data structure and these data will set: - Leaf label for node 8518 will be displayed in purple
- Leaf label for node 6529 will be displayed in green, bold and twice the regular font size
- Leaf label for node 6321 will be displayed in orange, bold italic and half the regular font size
- Internal clade with solid branches and colored in purple
- Internal clade with dashed branches and colored in yellow
- Internal branch with dashed branches and colored in green
- Colored range in red
- Colored range in green
- Colored range in purple
Example:
colors = [(8518, 'label', '#0000ff'), ('6529', 'label', '#00ff00', 'bold', '2'), (6321, 'label', '#ff8000', 'bold-italic', 0.5), ('6529|8463', 'clade', '#0000ff', 'normal', 3), ('8090|8033', 'clade', '#ff0000', 'dashed', 0.5), ('7539|1744', 'branch', '#00ff00', 'dashed', 5), ('5784|7550', 'range', '#ff0000', 'Group A'), ('7396|2154', 'range', '#aaffaa', 'Group B'), ('2055|539', 'range', '#aaaaff', 'Group C')]
- The nested list
-
connection
(data, separator='comma', dataset_label='connection', color='#ff0000', legend_title='', legend_shapes=0, legend_colors=0, legend_labels=0, outfile='connection.txt', **kwargs)¶ Handles connections visualization.
Parameters: data – list, a nested list consisting of tuples or lists. Each inner tuple or list should have 5 elements which define a single connection between 2 nodes and consists of the following format: NODE1, NODE2, WIDTH, COLOR, LABEL. Color can be specified in hexadecimal string. See dataset_connections_template.txt for details.
The nested list
data
shows a general data structure (NODE1, NODE2, WIDTH, COLOR, LABEL):data = [(8518, 2055, 4, '#ff0000', 'Con-A'), ('7396', 7102, 2, '#ffff00', 'Con-B')]
-
domain
(data, separator='comma', dataset_label='domain', color='#ff0000', width=1000, dataset_scale=0, legend_title='', legend_shapes='', legend_colors='', legend_labels='', outfile='domain.txt', **kwargs)¶ Handles protein domains visualization.
Parameters: data – list, a nested list consisting of tuples or lists. Each inner tuple or list should have at least 3 elements which define node id(s), total protein length (an integer) and unlimited number of domain definition strings. Each domain definition string consists of 5 parts, separated with vertical lines: shape|start|end|color|label See http://itol.embl.de/help/dataset_boxplot_template.txt for more details.
The nested list
data
shows a general data structure (ID1, length, D1, D2, D3, …):data = [(8518, 1200, 'RE|100|150|#ff0000|SH2', 'EL|400|500|#0000ff|SH3', 'OC|700|900|#00ff00|PH')]
-
download
(tid='', fmt='pdf', outfile='', **kwargs)¶ Download (or export) data from ITOL server (batch download).
Parameters: - tid – str, ITOL tree ID or URL (of the tree) which will be exported.
- fmt – str, output file format, supported values are: svg, eps, pdf and png for graphical formats and newick, nexus and phyloxml for text formats.
- outfile – str, path of the output file.
- kwargs – optional parameters see https://itol.embl.de/help.cgi#bExOpt for more details.
Returns: str, path of the output file.
-
gradient
(data, separator='comma', dataset_label='gradient', color='#ff0000', legend_title='', legend_shapes='', legend_colors='', legend_labels='', outfile='gradient.txt', **kwargs)¶ Handles colored gradients
Parameters: data – list, a nested list consisting of tuples or list. Each inner tuple or list should have 2 elements which define node id(s) and a value. Internal tree nodes can be specified using IDs, or using the ‘last common ancestor’ method described in ITOL help page <http://itol.embl.de/help.cgi>. See dataset_gradient_template.txt for more details.
The nested list
data
shows a general data structure (ID and and a value):data = [(8518, 200), ('6529', 330), (6321, 180), (2055, 403), ('9151', 500), ('1921', 360)]
-
heatmap
(data, separator='comma', dataset_label='heatmap', color='#ff0000', field_labels='f1 f2 f3 f4 f5 f6', field_tree='', legend_title='', legend_shapes='', legend_colors='', legend_labels='', outfile='heatmap.txt', **kwargs)¶ Handles heatmap visualization.
Parameters: data – list, a nested list consisting of tuples or lists. Each inner tuple or list should have at least 2 elements which define node id(s) and multiple values. See dataset_heatmap_template.txt for more details.
The nested list
data
shows a general data structure (ID, value1, value2, value3…):data = [(8518, 30, 20, 32, 50), ('6529', 20, 33, 23, 46), (6321, 15, 18, 40, 35)]
The field_labels define name of four fields:
field_labels = 'A,B,C,D'
-
image
(data, separator='comma', dataset_label='image', color='#ff0000', outfile='image.txt', **kwargs)¶ Handling image dataset visualization.
Parameters: data – list, a nested list consisting of tuples or lists. Each inner tuple or list should have 7 elements which define node id, position, size_factor, rotation, horizontal_shift, vertical_shift, and image_url. See dataset_image_template.txt for more details.
Example:
data = [('9606', -1, 1, 0, 0, 0, 'http://itol.embl.de/img/species/9606.jpg'), ('4530', 1, 1, 0, 0, 0, 'http://itol.embl.de/img/species/4530.jpg'), ('6239|6239', 0, 1, 90, 0, 0, 'http://itol.embl.de/img/species/6239.jpg')]
Note
DATASET_IMAGE is not supported in batch mode yet, this method can be used to generated the data file for image. When you try to upload the data file to the ITOL server, a warning will be issued. If you try to use the
.download()
method to download data, an error (Invalid SVG received from headless browser) will be logged. The purpose of this method is mainly for programmatically generating hte data file for image. In future, if batch access of DATASET_IMAGE is allowed, then you can feel free to use the full function of this method.
-
label
(data, separator='comma', outfile='label.txt', **kwargs)¶ Handling the text assigned to leaf nodes, or changing the internal node names (displayed in mouse-over popups).
Parameters: data – list, a nested list consisting of tuples or lists. Each inner tuple or lists should have 2 elements which define node id and label. Internal tree nodes can be specified using IDs directly, or using the ‘last common ancestor’ method described in iTOL help pages. See labels_template.txt for more details.
- The nested list
colors
shows a general data structure and these data will set: - Leaf label for node 8518 will be renamed to Baq hxzgs
- Leaf label for node 6529 will be renamed to Wjk nduvpbl
- Leaf label for node 6321 will be renamed to Zbumxj osiapem
- A internal branch will be renamed to Clade A (clade name displayed in mouseover popups)
- A internal branch will be renamed to Clade B (clade name displayed in mouseover popups)
- A internal branch will be renamed to Clade C (clade name displayed in mouseover popups)
Example:
labels = [(8518, 'Baq hxzgs'), ('6529', 'Wjk nduvpbl'), (6321, 'Zbumxj osiapem'), ('5784|7550', 'Clade A'), ('7396|2154', 'Clade B'), ('2055|539', 'Clade C')]
- The nested list
-
line
(data, separator='comma', dataset_label='line', color='#ff0000', line_colors='', axis_x='', axis_y='', outfile='line.txt', **kwargs)¶ Handles line chart visualization.
Parameters: data – list, a nested list consisting of tuples. Each inner tuple or list should have at least 3 elements which define node id and 2 or more points associated. For each individual point, a string consisting of X and Y values separated by a vertical line. See dataset_linechart_template.txt for more details.
The nested list
data
shows a general data structure (ID, X1|Y1 X2|Y2 X3|Y3, …).data = [(8518, ‘-10|-15’, ‘0|0’, ‘5|3’), (‘6529’, ‘0|0’, ‘10|5’, ‘20|10’, ‘30|15’)]
Note
DATASET_LINECHART is not supported in batch mode yet, this method can be used to generated the data file for line chart. When you try to upload the data file to the ITOL server, a warning will be issued. If you try to use the
.download()
method to download data, an error (Invalid SVG received from headless browser) will be logged. The purpose of this method is mainly for programmatically generating the data file for lines. In future, if batch access of DATASET_LINECHART is allowed, then you can feel free to use the full function of this method.
-
mbar
(data, separator='comma', dataset_label='mbar', color='#ff0000', field_colors='#ff0000, #00ff00, #0000ff', field_labels='f1, f2, f3', dataset_scale='', legend_title='', legend_shapes='', legend_colors='', legend_labels='', outfile='mbar.txt')¶ Handles multi-value bar chart.
Parameters: data – list, a nested list consisting of tuples or lists. Each inner tuple or list should have at least 3 elements which define node id and multiple numeric value which are displayed as stocked or aligned bar chart. See dataset_multibar_template.txt for more details.
The nested list
data
shows a general data structure:data = [(8518, 200, 320), ('6529', 330, 230), (6321, 180, 400), (2055, 403, 500), ('9151', 500, 350)]
-
pie
(data, separator='comma', dataset_label='pie', color='#ff0000', field_colors='#ff0000, #00ff00, #0000ff', field_labels='f1, f2, f3', legend_title='', legend_shapes='', legend_colors='', legend_labels='', outfile='pie.txt', **kwargs)¶ Handles pie chart.
Parameters: data – list, a nested list consisting of tuples or lists. Each tuples or list should have at least 5 elements which define node id, position, radius, and multiple numeric value (at least 2 values) which are displayed as a pie chart directly on the branch, or outside the tree. See dataset_piechart_template.txt for more details.
- The nested list
data
shows a general data structure (ID, position, radius, value1, value2, value3…). - The field_labels define label name of each field
- The filed_colors define label color of each field
Example:
data = [(8518, -1, 30, 20, 32, 50), ('6529', 0.5, 20, 33, 23, 46), (6321, 1, 15, 18, 40, 35)] field_labels = 'A,B,C' field_colors = '#ff0000,#00ff00,#ffff00'
- The nested list
-
popup
(data, separator='comma', outfile='popup.txt', **kwargs)¶ Handles custom text/html which will be displayed in mouse-over popups for nodes/leaves.
Parameters: data – list, a nested list consisting of tuples or lists. Each inner tuple should have 2 elements which define node id and label content. Content can be plain text or any valid HTML (including links to external web sites, or IMG tags pointing to external images). Internal tree nodes can be specified using IDs directly, or using the ‘last common ancestor’ method described in ITOL help page. See popup_info_template.txt for more details.
The nested list
popups
shows a general data structure and these data will set two popup items:s1 = 'This is the popup title,<h1>Some header</h1><p>Information comes here</p>' s2 = '<img src="https://images-na.ssl-images-amazon.com/images/I/91gyeWnRc2L._SL1500_.jpg"/>' n1 = 'Zbumxj osiapem, info popup,<h1>Homo sapiens</h1><p style="color:blue">More info at' n2 = '<a target="_blank" href="https://en.wikipedia.org/wiki/Binomial_nomenclature"> WiKi</a></p>' popups = [('6304|7550', s1 + s2), (6321, n1 + n2)]
-
sbar
(data, separator='comma', dataset_label='sbar', color='#ff0000', dataset_scale='', legend_title='', legend_shapes='', legend_colors='', legend_labels='', outfile='sbar.txt', **kwargs)¶ Handles simple bar chart.
Parameters: data – list, a nested list consisting of tuples or lists. Each inner tuple or list should have 2 elements which define node id and a single numeric value which is displayed as a bar outside the tree. Internal tree nodes can be specified using IDs directly, or using the ‘last common ancestor’ method described in ITOL help page. See dataset_simplebar_template.txt for more details.
The nested list
data
shows a general data structure:data = [(8518, 200), ('6529', 330), (6321, 180), (2055, 403), ('9151', 500), ('1921', 360)]
-
shape
(data, separator='comma', dataset_label='shape', color='#ff0000', field_colors='#ff0000, #00ff00, #0000ff', field_labels='f1, f2, f3', outfile='shape.txt', **kwargs)¶ Handles external shapes visualization.
Parameters: data – list, a nested list consisting of tuples or lists. Each inner tuple or list should have at least 2 elements which define node id and multiple values. See dataset_external_shapes_template.txt. The nested list
data
shows a general data structure (ID1, length, D1, D2, D3, …):data = [(8518, 20, 25, 32, 44, 55, 60), ('6529', 20, 23, 30, 46, 58, 18), (6321, 15, 18, 29, 35, 45, 40)]
-
strip
(data, separator='comma', dataset_label='strip', color='#ff0000', color_branch=0, legend_title='', legend_shapes=0, legend_colors=0, legend_labels=0, outfile='strip.txt', **kwargs)¶ Handles colored strips.
Parameters: data – list, a nested list consisting of tuples or lists. Each inner tuple or list should have at least 2 elements which define node id(s) and color, possible third element should be a string (string is displayed in the mouse-over popups). Internal tree nodes can be specified using IDs directly, or using the ‘last common ancestor’ method described in ITOL help page. See dataset_color_strip_template.txt for details.
The nested list
data
shows a general data structure (ID, color, <label>):data = [(8518, '#0000ff', 'Baq hxzgs'), ('6529', '#00ff00'), (6321, '#ff8000', 'Zbumxj osiapem')]
-
symbol
(data, separator='comma', dataset_label='symbol', color='#ff0000', legend_title='', legend_shapes=0, legend_colors=0, legend_labels=0, outfile='symbol.txt', **kwargs)¶ Handling external shapes.
Parameters: data – list, a nested list consisting of tuples. Each inner tuple or list should have at least 6 elements which define node id, symbol, size, color, fill, position, may or may not followed by an additional element label. See dataset_symbols_template.txt for more details. The nested list
data
shows a general data structure (ID, symbol, size, color, fill, position, label):data = [(8518, 1, 20, '#ff0000', 1, 0, 'A'), ('6529', 2, 40, '#00ff00', 0, 0.5, 'B'), (6321, 3, 60, '#ffff00', 1, 1, 'C')]
-
text
(data, separator='comma', dataset_label='text', color='#ff0000', outfile='text.txt', **kwargs)¶ Handles text labels.
Parameters: data – list, a nested list consisting of tuples or lists. Each inner tuple or list should have at least 2 elements which define node id and a label, possible additional elements can be tailed in the order of position, color, style, size factor, and rotation. See dataset_text_template.txt for more details.
The nested list
data
shows a general data structure (ID, label, position, color, style, size_factor, rotation):data = [(8518, 'Baq hxzgs', '-1', '#0000ff', 'bold', 2, 0), ('6529', 'Wjk nduvpbl', 0, '#00ff00', 'italic', 1), (6321, 'Zbumxj osiapem', 1, '#ff8000', 'bold-italic', 1)]
-
upload
(tn='', uid='', pn='', td='', folder=False)¶ Zip tree file and all notation files (text files have .txt extension) inside work directory into a zip file and upload the zip file to ITOL server (batch upload).
Parameters: - tn – str, if not provided, the basename of the tree file will be used instead.
- uid – str, your upload ID, which is generated when you enable batch uploading in your account. If an uploadID is not provided, the tree will not be associated with any account, and will be deleted after 30 days.
- pn – str, required if ID is specified, case sensitive, and should be unique in your account.
- td – str, description of your tree, ignored if ID is not specified.
- folder – bool, whether zip all text files (must have .txt extension) in the work directory or not. If set to True, zip all text files in the folder, otherwise only zip and upload the tree file.
Note
A new ZIP archive (named iTOL.tree.zip) will be automatically created in work directory every time you call this method if tfile was provided via argument
tfile
. If a ZIP file was provided via argumentzfile
, the ZIP file will not be touched but directly upload to ITOL server.
-
-
iTOL.iTOL.
_args
(args, data, separator, outfile, tag, wd)¶ Private function handles arguments parse and writing config file (user should not use this functionary directly).
Parameters: - args – dict, all local keyword arguments.
- data – nested tuple or a list. Each inner element should have at least 3 elements which define the node, type and color.
- separator –
the separator which is used to delimit the setting text (tab, space or comma), default: comma.
Note
Not like writing iTOL setting file, the name of separator here is case insensitive. You should always keep in mind that depend on your data, separator does matter.
- outfile – str, path of the output file.
- tag – string, name tag of the config file.
- wd – str, path of the work directory.
Returns: str, formatted text.
-
iTOL.iTOL.
_sd
(data, separator)¶ Private function for handles separator and data block (user should not use this functionary directly).
Parameters: - data – nested tuple or list. Each inner element should have at least 3 elements which define the node, type and color.
- separator – the separator which is used to delimit the setting text (tab, space or comma), default: comma.
Note
Unlike writing iTOL setting file manually, the name of the separator here is case insensitive. However, you should always keep in mind that depend on your data, separator does matter.
Returns: formatted string.