.. only:: html

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

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

    .. _sphx_glr_draw_aln_plot_aln-coevolution.py:


Evaluating coevolution
======================

A method on the alignment provides an interface to the simpler (and yet robust and fast) methods for estimating coevolution. The default measure is normalised mutual information (NMI).

Display coevolution as a heatmap
################################


.. code-block:: default


    from cogent3 import load_aligned_seqs


    aln = load_aligned_seqs("../../data/brca1.fasta", moltype="dna")
    aln = aln.no_degenerates(motif_length=3)
    aln = aln.get_translation()
    aln = aln[:100]  # for compute speed in testing the documentation
    coevo = aln.coevolution(show_progress=False, drawable="heatmap")
    coevo.show()




.. raw:: html
    :file: images/sphx_glr_plot_aln-coevolution_001.html





Display coevolution scores as a Violin plot
###########################################


.. code-block:: default


    coevo = aln.coevolution(show_progress=False, drawable="violin")
    coevo.show(width=300)




.. raw:: html
    :file: images/sphx_glr_plot_aln-coevolution_002.html





Display coevolution scores as a Boxplot
#######################################


.. code-block:: default


    coevo = aln.coevolution(show_progress=False, drawable="box")
    coevo.show(width=300)



.. raw:: html
    :file: images/sphx_glr_plot_aln-coevolution_003.html






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

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


.. _sphx_glr_download_draw_aln_plot_aln-coevolution.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-coevolution.py <plot_aln-coevolution.py>`



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

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


.. only:: html

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

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