.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/visualization/plot_clonal.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_visualization_plot_clonal.py: Visualizing a tree in clonal format ----------------------------------- This example shows how to visualize an inferred tree. .. GENERATED FROM PYTHON SOURCE LINES 7-12 .. code-block:: Python import scphylo as scp # sphinx_gallery_thumbnail_path = "_static/thumbnails/clonal.png" .. GENERATED FROM PYTHON SOURCE LINES 13-14 First, we load a binary inferred single-cell genotype data. .. GENERATED FROM PYTHON SOURCE LINES 14-18 .. code-block:: Python inferred = scp.io.read( scp.ul.get_file("scphylo.datasets/test/fp_0-fn_0-na_0.ground.CFMatrix") ) .. GENERATED FROM PYTHON SOURCE LINES 19-20 Next we convert the inferred genotype matrix to a tree object. .. GENERATED FROM PYTHON SOURCE LINES 20-22 .. code-block:: Python tree = scp.ul.to_tree(inferred) .. GENERATED FROM PYTHON SOURCE LINES 23-25 Then we can draw the tree in `clonal` format i.e. mutations at the edges and cells at at the nodes of the tree. .. GENERATED FROM PYTHON SOURCE LINES 25-28 .. code-block:: Python # scp.pl.clonal_tree(tree) # TODO: fix .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.467 seconds) **Estimated memory usage:** 9 MB .. _sphx_glr_download_auto_examples_visualization_plot_clonal.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_clonal.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_clonal.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_