maayanlab_bioinformatics.plotting package

Submodules

maayanlab_bioinformatics.plotting.bridge module

maayanlab_bioinformatics.plotting.bridge.bridge_plot(select: Series, weights: Series | None = None)[source]

Use the filter to construct a bridge plot.

import numpy as np
from matplotlib import pyplot as plt
from maayanlab_bioinformatics.plotting import bridge_plot

x, y = bridge_plot(select)
plt.plot(x, y)
plt.vlines(np.argwhere(select.values)[:, 0], ymin=-1, ymax=0)
plt.show()
Parameters:
  • select – (pd.Series) selection of hits (i.e. df['gene'] == 'my_target') in ranked order

  • weights – (pd.Series) optional weights for each hit in the same order

Returns:

(Tuple[np.array, np.array]) x and y arrays ready to be plotted.

maayanlab_bioinformatics.plotting.clustergrammer module

maayanlab_bioinformatics.plotting.clustergrammer.display_clustergrammer(net)[source]

This function displays clustergrammer in a jupyter notebook without dependencies on ipywidgets or any locally installed jupyter extensions. This is convenient for static exports, colab, and appyters.

Example:

from maayanlab_bioinformatics.plotting import display_clustergrammer
from clustergrammer import Network
net = Network()
net.load_df(df)
net.cluster()
display_clustergrammer(net)

maayanlab_bioinformatics.plotting.upset module

maayanlab_bioinformatics.plotting.upset.upset_from_dict_of_sets(inputs: Dict[Hashable, Set[Hashable]])[source]

Given a dictionary of sets, produce input ready for upsetplot python package

We produce this input by computing set intersections of all relevant combinations of sets interacting with one another.

Example:

import upsetplot
from maayanlab_bioinformatics.plotting import upset_from_dict_of_sets
upsetplot.plot(upset_from_dict_of_sets({
  'A': {'a', 'b', 'c'},
  'B': {'b', 'c', 'd'},
  'C': {'d', 'e', 'f'},
}))
Parameters:

inputs – (Dict[Hashable, Set[Hashable]]) Several named sets

Returns:

(pd.DataFrame) in a form ready for upsetplot.plot

Module contents

This module contains various helpers for plotting things