Drawing Utilities¶

circe.draw.plot_ccan(adata, ccan_module, ccan_col='CCAN', varp='atac_network', **kwargs)¶

Plot the connections of a ccan module. Only connections between 2 regions of the ccan module are plotted.

Parameters:
  • adata (anndata.AnnData) – Annotated anndata object. Should contain both a varp object that contains the cis-coaccessibility network and an obs column with the ccan module names.

  • ccan_module (str) – Name of the ccan module to plot.

  • ccan_col (str) – Column name for the ccan module in adata.var.

  • varp (str) – Key for the peak-to-peak coaccessibility network in adata.varp.

  • **kwargs (dict) – Additional parameters for plot_connections.

Return type:

None

circe.draw.plot_connections(connections, chromosome, start, end, abs_threshold=0.4, only_positive=False, sep=('_', '_'), ax_labels=True, transparency_by_score=True, adaptative_x_axis=True, width_by_score=True, figsize=(20, 6), ax=None, arc_params={}, regions_params={}, peak1_col=None, peak2_col=None, score_col=None, varp=None)¶

Plot connections between regions in a chromosome window.

Parameters:
  • connections (pd.DataFrame | anndata.AnnData) – DataFrame with columns [‘Peak1’, ‘Peak2’, ‘score’]. If an AnnData object is passed, the columns are inferred from the object. (varp slot with varp parameter as key)

  • chromosome (str) – Chromosome name.

  • start (int) – Start of the window.

  • end (int) – End of the window.

  • abs_threshold (float) – Minimum absolute value of the score to plot a connection.

  • only_positive (bool) – If True, only positive scores are plotted.

  • sep (tuple) – Tuple with two strings to separate the chromosome name from the start and end of the region.

  • ax_labels (bool) – If True, the axis labels are shown.

  • transparency_by_score (bool) – If True, the transparency of the arcs is proportional to the score.

  • width_by_score (bool) – If True, the width of the arcs is proportional to the score.

  • figsize (tuple) – Figure size.

  • ax (matplotlib.axes.Axes) – Axes object.

  • arc_params (dict) – Parameters for the Arc patches.

  • regions_params (dict) – Parameters for the Rectangle patches.

  • peak1_col (str) – Column name for the first peak.

  • peak2_col (str) – Column name for the second peak.

  • score_col (str) – Column name for the score.

  • varp (str) – Key to extract atac network if anndata object passed.

Return type:

None

circe.draw.plot_connections_genes(connections, genes, chromosome, start, end, ax=None, legend=True, peak1_col=None, peak2_col=None, score_col=None, varp=None, chromosome_col=None, start_col=None, end_col=None, name_col=None, strand_col=None, abs_threshold=0.4, only_positive=False, sep=('_', '_'), ax_labels=True, transparency_by_score=True, adaptative_x_axis=False, width_by_score=True, figsize=(20, 10), arc_params={}, regions_params={}, gene_spacing=100000, fontsize_genes=10, track_width=0.1, track_spacing=0.15, name_padding=0.5, y_lim_top=-0.15)¶

Plot connections between regions in a chromosome window and gene positions.

Parameters:
  • connections (pd.DataFrame | anndata.AnnData) – DataFrame with columns [‘Peak1’, ‘Peak2’, ‘score’]. If an AnnData object is passed, the columns are inferred from the object. (varp slot with varp parameter as key)

  • genes (pd.DataFrame) –

    DataFrame with columns [

    ‘chromosome’, ‘start’, ‘end’, ‘genename’, ‘strand’]

  • chromosome (str) – Chromosome name.

  • start (int) – Start of the window.

  • end (int) – End of the window.

  • ax (matplotlib.axes.Axes) – Axes object.

  • legend (bool) – If True, a legend is added to the plot.

  • peak1_col (str) – Column name for the first peak.

  • peak2_col (str) – Column name for the second peak.

  • score_col (str) – Column name for the score.

  • varp (str) – Key to extract atac network if anndata object passed.

  • chromosome_col (str)

circe.draw.plot_genes(genes, chromosome, start, end, gene_spacing=100000, ax=None, fontsize=10, track_width=0.1, track_spacing=0.15, name_padding=0.5, y_lim_top=-0.15, chromosome_col=None, start_col=None, end_col=None, name_col=None, strand_col=None)¶

Plots gene positions on a genome track with minimal overlap.

Parameters: - genes: DataFrame with columns [

‘chromosome’, ‘start’, ‘end’, ‘genename’, ‘strand’]

  • chromosome: Chromosome name

  • start, end: Genomic coordinates defining the region of interest

  • gene_spacing: Minimum distance between genes

  • ax: Matplotlib axis object (optional, if integrating with other plots)

  • fontsize: Font size for gene names

  • track_width: Height of gene tracks

  • track_spacing: Vertical spacing between gene tracks

  • name_padding: Extra padding to avoid overlap

    between gene names and gene bodies

  • y_lim_top: Top limit for the y-axis

  • chromosome_col: Column name for the chromosome

  • start_col: Column name for the start position

  • end_col: Column name for the end position

  • name_col: Column name for the gene name

  • strand_col: Column name for the gene strand