thor.pl.deg
- thor.pl.deg(data=None, genes=None, baseline_from_edge=[0, 0], cmaps=['Oranges', 'Blues'], lw=5, annotate=False, text_offset_x=0.08, text_offset_y=0, text_size=8, **subplots_kwds)[source]
Plot log2foldchange of gene expression against distance from the baseline.
- Parameters:
data (
pandas.DataFrame
) – A DataFrame where rows represent windows/bins and columns include ‘distance’ and gene expression data.genes (
tuple
orlist
of twolist
) – Lists of up-regulated and down-regulated genes to plot.cmaps (
tuple
orlist
, optional) – Colormap names in matplotlib for plotting the genes. Default is [‘Oranges’, ‘Blues’].lw (
float
, optional) – Line width for the plot. Default is 5.annotate (
bool
, optional) – Whether to annotate the lines with the gene names. Default isFalse
.text_offset_x (
float
, optional) – Offset applied to the x position of the annotation texts. Default is 0.08.text_offset_y (
float
, optional) – Offset applied to the y position of the annotation texts. Default is 0.text_size (
float
, optional) – Size of the annotation texts. Default is 8.**subplots_kwds (
dict
, optional) – Keyword arguments for the matplotlib.pyplot subplots function.
Notes
This function plots the log2foldchange of gene expression against the distance from the baseline for up-regulated and down-regulated genes separately.
- Returns:
This function does not return any value. It generates the plot directly.
- Return type:
Examples
>>> import pandas as pd >>> import matplotlib.pyplot as plt
>>> # Assuming data is a pandas DataFrame with columns 'distance', 'gene1', 'gene2', etc. >>> data = pd.DataFrame(...) >>> up_genes = ['gene1', 'gene3', 'gene5'] >>> down_genes = ['gene2', 'gene4', 'gene6'] >>> genes = (up_genes, down_genes)
>>> # Plot the log2foldchange of gene expression against distance using default settings. >>> fringe(data=data, genes=genes)
>>> # Plot the log2foldchange of gene expression against distance with custom settings. >>> fringe(data=data, genes=genes, cmaps=['Reds', 'Greens'], lw=2, annotate=True, text_offset_x=0.1)