stlearn.pl.gene_plot

stlearn.pl.gene_plot(adata: AnnData, gene_symbols: Optional[Union[str, list]] = None, threshold: Optional[float] = None, method: str = 'CumSum', contour: bool = False, step_size: Optional[int] = None, title: Optional[str] = None, figsize: Optional[Tuple[float, float]] = None, cmap: Optional[str] = 'Spectral_r', use_label: Optional[str] = None, list_clusters: Optional[list] = None, ax: Optional[Axes] = None, fig: Optional[Figure] = None, show_plot: Optional[bool] = True, show_axis: Optional[bool] = False, show_image: Optional[bool] = True, show_color_bar: Optional[bool] = True, color_bar_label: Optional[str] = '', zoom_coord: Optional[float] = None, crop: Optional[bool] = True, margin: Optional[bool] = 100, size: Optional[float] = 7, image_alpha: Optional[float] = 1.0, cell_alpha: Optional[float] = 0.7, use_raw: Optional[bool] = False, fname: Optional[str] = None, dpi: Optional[int] = 120, vmin: Optional[float] = None, vmax: Optional[float] = None) Optional[AnnData][source]

Allows the visualization of a single gene or multiple genes as the values of dot points or contour in the Spatial transcriptomics array.

Parameters:
  • adata – Annotated data matrix.

  • title – Title name of the figure.

  • figsize – Figure size with the format (width,height).

  • cmap – Color map to use for continous variables or discretes variables (e.g. viridis, Set1,…).

  • use_label – Key for the label use in adata.obs (e.g. leiden, louvain,…).

  • list_clusters – A set of cluster to be displayed in the figure (e.g. [0,1,2,3]).

  • ax – A matplotlib axes object.

  • show_plot – Option to display the figure.

  • show_image – Option to display the H&E image.

  • show_color_bar – Option to display color bar.

  • crop – Option to crop the figure based on the spot locations.

  • margin – Margin to crop.

  • size – Spot size to display in figure.

  • image_alpha – Opacity of H&E image.

  • cell_alpha – Opacity of spots/cells.

  • use_raw – Option to use adata.raw data.

  • fname – Output path to the output if user want to save the figure.

  • dpi – Dots per inch values for the output.

  • gene_symbols – Single gene (str) or multiple genes (list) that user wants to display. It should be available in adata.var_names.

  • threshold – Threshold to display genes in the figure.

  • method – Method to combine multiple genes: ‘CumSum’ is cummulative sum of genes expression values, ‘NaiveMean’ is the mean of the genes expression values.

  • contour – Option to show the contour plot.

  • step_size – Determines the number and positions of the contour lines / regions.

Examples

>>> import stlearn as st
>>> adata = st.datasets.example_bcba()
>>> genes = ["BRCA1","BRCA2"]
>>> st.pl.gene_plot(adata, gene_symbols = genes)