Dotplot with annotated sequences#

Note

These docs now use the new_type core objects via the following setting.

import os

# using new types without requiring an explicit argument
os.environ["COGENT3_NEW_TYPE"] = "1"

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

Reloading sequences and annotations#

The data file, tp53-annotations.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 annotation_db was saved as json using annotation_db.to_json().

import cogent3

ann_db = cogent3.load_annotations(
    path="data/tp53-annotations.json"
)
seqs = cogent3.load_unaligned_seqs(
    "data/tp53.fa", moltype="dna"
)
seqs.annotation_db = ann_db
dp = seqs.dotplot(name1="Macaque", name2="Marmoset", width=600)
dp.show()

Removing annotation tracks#

help(dp.remove_track)
Help on method remove_track in module cogent3.draw.drawable:

remove_track(left_track=False, bottom_track=False) -> None method of cogent3.draw.drawable.AnnotatedDrawable instance
    Parameters
    ----------
    left_track : bool
        the left track is removed
    bottom_track : bool
        the bottom track is removed

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

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