File: plot_aln-dotplot-2.rst

package info (click to toggle)
python-cogent 2023.2.12a1%2Bdfsg-2%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 12,416 kB
  • sloc: python: 89,165; makefile: 117; sh: 16
file content (44 lines) | stat: -rw-r--r-- 1,236 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
.. jupyter-execute::
    :hide-code:

    import set_working_directory

Dotplot with annotated sequences
================================

If sequences in a dotplot have been annotated, the ``dotplot()`` method returns an ``AnnotatedDrawable``.

Reloading from json
-------------------

The data file, ``tp53.json``, was created from a query of ensembl for one-to-one orthologs of human TP53 between Human, Macaque, Orangutan and Marmoset. The resulting sequences were annotated with the location of the CDS for the canonical transcript, then the ``SequenceCollection`` was saved as json using ``cogent3.app.write_json``.

.. jupyter-execute::

    from cogent3.app.io import get_data_store, load_json

    loader = load_json()
    seqs = loader("data/tp53.json")
    dp = seqs.dotplot(name1="Macaque", name2="Marmoset", width=600)
    dp.show()

.. jupyter-execute::
    :hide-code:

    outpath = set_working_directory.get_thumbnail_dir() / "plot_aln-dotplot-2.png"

    dp.write(outpath)

Removing annotation tracks
--------------------------

.. jupyter-execute::

    help(dp.remove_track)

Thus we could remove the left annotation track, for instance with

.. jupyter-execute::

    dp.remove_track(left_track=True)
    dp.show()