Sequence Features#

A sequence “feature” is an annotated segment, with the annotations being generated either computationally, e.g. repeat classification, or experimentally, e.g. single nucleotide polymorphism. In this example, we just load both sequence and features from a GenBank record.

Drawing all features on a sequence segment#

We load chromosome I of Caenorhabditis elegans.

from cogent3 import load_seq

seq = load_seq("data/C-elegans-chromosome-I.gb", moltype="dna")
seq
0
IGCCTAAGCCTAAGCCTAAGCCTAAGCCTAAGCCTAAGCCTAAGCCTAAGCCTAAGCCTAA

DnaSequence, length=15,072,434 (truncated to 60)

As you can see it’s quite large. It doesn’t make sense to try and display all the features, so we will slice it down to a 10kbp segment.

seq = seq[25000:35000]

Drawing features is then limited to features within that segment.

fig = seq.get_drawable()
fig.show(height=400, width=700)

Note

If a feature extends outside the displayed segment, it’s hover text indicates it as “(incomplete)”.

Drawing selected feature biotypes#

We specify what biotypes we want to display.

fig = seq.get_drawable(biotype=("gene", "CDS", "mRNA"))
fig.show(height=300, width=650)