.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        Click :ref:`here <sphx_glr_download_draw_aln_plot_aln-info-plot.py>`     to download the full example code
    .. rst-class:: sphx-glr-example-title

    .. _sphx_glr_draw_aln_plot_aln-info-plot.py:


Information analysis of an alignment
====================================

Information here is in the formal sense -- maximum entropy minus the entropy at a position. This is fast to compute and is an indicator of the variability at a position.

Illustrated with a simple example
#################################


.. code-block:: default


    from cogent3 import load_aligned_seqs, make_aligned_seqs, make_seq


    s1 = make_seq('TGATGTAAGGTAGTT', name='s1', moltype="dna")
    s2 = make_seq('--CTGGAAGGGT---', name='s2', moltype="dna")

    seqs = make_aligned_seqs(data=[s1, s2], array_align=False, 
                             moltype='dna')
    draw = seqs.information_plot(window=2, include_gap=True)
    draw.show(width=500, height=400)




.. raw:: html
    :file: images/sphx_glr_plot_aln-info-plot_001.html





On a sample data set
********************

Clicking on any of the legend items causes that to disappear from the plot.


.. code-block:: default


    aln = load_aligned_seqs('../../data/brca1.fasta', moltype='protein')

    fig = aln.information_plot(stat='median')
    # sphinx_gallery_thumbnail_number = 2
    fig.show(width=500, height=400)



.. raw:: html
    :file: images/sphx_glr_plot_aln-info-plot_002.html






.. rst-class:: sphx-glr-timing

   **Total running time of the script:** ( 0 minutes  1.322 seconds)


.. _sphx_glr_download_draw_aln_plot_aln-info-plot.py:


.. only :: html

 .. container:: sphx-glr-footer
    :class: sphx-glr-footer-example



  .. container:: sphx-glr-download sphx-glr-download-python

     :download:`Download Python source code: plot_aln-info-plot.py <plot_aln-info-plot.py>`



  .. container:: sphx-glr-download sphx-glr-download-jupyter

     :download:`Download Jupyter notebook: plot_aln-info-plot.ipynb <plot_aln-info-plot.ipynb>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
