marsilea.plotter.SeqLogo#
- class SeqLogo(matrix, width=0.9, color_encode=None, stack='descending', **kwargs)#
Bases:
StatsBaseSequence logo
- Parameters:
- matrixpandas.DataFrame
Drawing matrix, the data is the height of logo with columns as positions and rows as nucleotides/amino acids letters.
- widthfloat, optional
The width of each letter, by default .9, should be within [0, 1]
- color_encodedict, optional
The color encoding for each letter, should be a dict with key as letter and value as color
- stack{“descending”, “ascending”, “normal”}, default: “descending”
The stacking order of letters, by height. If normal will stack as the order in matrix.
Examples
>>> import pandas as pd >>> from marsilea.plotter import SeqLogo >>> matrix = pd.DataFrame( ... data=np.random.randint(1, 10, (4, 10)), index=list("ACGT") ... ) >>> _, ax = plt.subplots() >>> colors = {"A": "r", "C": "b", "G": "g", "T": "black"} >>> SeqLogo(matrix, color_encode=colors).render(ax)
- render_main = False#