coalispr.bedgraph_analyze.bedgraph_plots

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

Attributes

Functions

show_chr(chrnam, setlist, tag[, refs, title, output, ...])

Plot all reads for both chromosome strands in one figure.

show_specific_chr(chrnam, setlist, tag[, refs, title, ...])

Plot specific reads for both chromosome strands in one figure.

show_unspecific_chr(chrnam, setlist, tag[, refs, ...])

Plot unspecific reads for both chromosome strands in one figure.

plot_chrset(chrnam, dflist, setname, tag, 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.show_chr(chrnam, setlist, tag, refs=False, title=PLOTALL, output='show', scale=None, lim=None, ridx=None, side=None)

Plot all reads for both chromosome strands in one figure.

These are interactive plots with all signals, i.e. unfiltered reads.

Parameters:
  • chrnam (str) – Name of chromosome to display bedgraph traces for.

  • setlist (list) – List of samples to display traces for.

  • setname (str) – Name of displayed sample set; will be part of figure title.

  • tag (str) – Flag to indicate kind of aligned-reads, TAGUNCOLL or TAGCOLL.

  • refs (bool) – Flag to include (when True) reference data.

  • title (str) – First section of figure title, set to PLOTALL.

  • output (str) – Instruction to ‘show’ (default), ‘save’ (as .png), ‘savesvg’ or ‘return’ the figure.

  • scale (str) – Set scale of y-axis to linear or log2

  • lim (int) – Set limit of y-axis

  • ridx (list) – List with boundaries for a region to be shown, if None, show the whole chromosome.

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

coalispr.bedgraph_analyze.bedgraph_plots.show_specific_chr(chrnam, setlist, tag, refs=False, title=PLOTSPEC, output='show', scale=None, lim=None, ridx=None, side=None)

Plot specific reads for both chromosome strands in one figure.

Interactive plots with all specific signals, i.e. filtered reads; without signals that overlap with negative-controls.

Parameters:
  • chrnam (str) – Name of chromosome to display bedgraph traces for.

  • setlist (list) – List of samples to display traces for.

  • setname (str) – Name of displayed sample set; will be part of figure title.

  • tag (str) – Flag to indicate kind of aligned-reads, TAGUNCOLL or TAGCOLL.

  • refs (bool) – Flag to include (when True) reference data.

  • title (str) – First section of figure title, set to PLOTSPEC.

  • output (str) – Instruction to ‘show’ (default), ‘save’ (as .png), ‘savesvg’ or ‘return’ the figure.

  • scale (str) – Set scale of y-axis to linear or log2

  • lim (int) – Set limit of y-axis

  • ridx (list) – List with boundaries for a region to be shown, if None, show the whole chromosome.

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

coalispr.bedgraph_analyze.bedgraph_plots.show_unspecific_chr(chrnam, setlist, tag, refs=False, title=PLOTUNSP, output='show', scale=None, lim=None, ridx=None, side=None)

Plot unspecific reads for both chromosome strands in one figure.

Interactive plots with all unspecific signals, i.e. negative control data and reads that overlap with negative-control signals but do not meet the thresholds. This will also contain reference info if that exists.

Parameters:
  • chrnam (str) – Name of chromosome to display bedgraph traces for.

  • setlist (list) – List of samples to display traces for.

  • setname (str) – Name of displayed sample set; will be part of figure title.

  • tag (str) – Flag to indicate kind of aligned-reads, TAGUNCOLL or TAGCOLL .

  • refs (bool) – Flag to include (when True) reference data.

  • unsel (bool) – Flag to include (when True) unselected data from negative control samples.

  • title (str) – First section of figure title, set to PLOTUNSP.

  • output (str) – Instruction to ‘show’ (default), ‘save’ (as .png), ‘savesvg’ or ‘return’ the figure.

  • scale (str) – Set scale of y-axis to linear or log2

  • lim (int) – Set limit of y-axis

  • ridx (list) – List with boundaries for a region to be shown, if None, show the whole chromosome.

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

coalispr.bedgraph_analyze.bedgraph_plots.plot_chrset(chrnam, dflist, setname, tag, refs, unsel, title, output, 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 output 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, SVG or another format.

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.

  • output (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.

  • tag (str) – Kind of data (TAGCOLL or TAGUNCOLL) to annotate.

Returns:

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

Return type:

None or matplotlib.figure.Figure