Draw sequence logos

Sequence logo’s display sequence information. They’re extensively applied to transcription factor binding site (TFBS) display. They can also be applied to sequence alignments more generally.

Drawing logo for a TFBS

We use the TFBS for the TAT box binding protein.

from cogent3 import load_aligned_seqs
from cogent3.parse import jaspar


_, pwm = jaspar.read("../../data/tbp.jaspar")
freqarr = pwm.to_freq_array()
freqarr[:5]  # illustrating the contents of the MotifFreqsArray
TCAG
00.07970.37280.15680.3907
10.79430.11830.04110.0463
20.09000.00000.90490.0051
30.96140.02570.00770.0051
40.07710.00000.91000.0129


logo = freqarr.logo()
logo.show(height=250, width=500)