coalispr.bedgraph_analyze.bedgraph_plots

Matplotlib module to create a plot with bedgraph-traces for a chromosome.

Attributes

Functions

plot_chrset(chrnam, dflist, setname, refs, unsel, ...)

Plot bedgraphs for both strands of a chromosome in one figure.

Module Contents

coalispr.bedgraph_analyze.bedgraph_plots.logger
coalispr.bedgraph_analyze.bedgraph_plots.plot_chrset(chrnam, dflist, setname, refs, unsel, title, dowhat, scale, lim, ridx, sidepatcheslist)

Plot bedgraphs for both strands of a chromosome in one figure.

Plot in the range ridx to peak size lim for a list of samples represented each by two dataframes (one for each strand); choose a log2 or linear scale; a side panel with secondary legends can be included. This is called by show_chr functions in bedgraph_analyze.process_bedgraphs.

Output is a GUI window, when dowhat is ‘show’, which displays an interactive figure from which PNG, JPG, SVG etc. image files can be saved.

Alternatively the function writes directly such image files to disc as PNG (‘save’) or SVG (‘savesvg’).

Parameters:
  • chrnam (str) – Chromosome from list chroms() to display bedgraph traces for.

  • dflist ([dfs, dfa]) – List of dataframes describing PLUS (df1) or MINUS (df2) strands.

  • setname (str) – Description of data set, say no. of samples.

  • refs (bool) – Flag to indicate whether reference traces should be used.

  • unsel (str) – Flag indicating which unselected data to include (None, UNSPECIFIC).

  • title (str) – Title to display above the figure.

  • dowhat (str) – Give one of ‘show’, SVG, PDF, JPG, or ‘return’. Choice gives instruction to ‘show’ the figure, save it as PNG, JPG, or SVG or return it. When ‘show’, the figure can manually be saved from the window-menu with the plotted traces, including annotations and highlights.

  • scale (str) – Instruction how to scale the y-axis, linear or after log2 conversion.

  • lim (int) – Number to set another upper limit than configured in constant.py.

  • ridx (list) – List with lower and upper boundary of a region, e.g. [785005,790850]; when set to None, the whole chromosome will be shown. Zooming to such regions can be done manually from the window-menu.

  • sidepatcheslist (list) – List describing groups of samples to be shown under separate headings in the side panel.

Returns:

Only a figure is returned with dowhat-option ‘return’.

Return type:

None or matplotlib.figure.Figure