forgi 2.0.0 documentation

«  forgi.visual.fornac module   ::   Contents   ::   forgi.config module  »

forgi.visual.mplotlib module

forgi.visual.mplotlib.circles(x, y, s, c='b', ax=None, vmin=None, vmax=None, labels=[], **kwargs)[source]

Make a scatter of circles plot of x vs y, where x and y are sequence like objects of the same lengths. The size of circles are in data scale.

Parameters:
  • x,y – scalar or array_like, shape (n, ) Input data
  • s – scalar or array_like, shape (n, ) Radius of circle in data scale (ie. in data unit)
  • c – color or sequence of color, optional, default : ‘b’ c can be a single color format string, or a sequence of color specifications of length N, or a sequence of N numbers to be mapped to colors using the cmap and norm specified via kwargs. Note that c should not be a single numeric RGB or RGBA sequence because that is indistinguishable from an array of values to be colormapped. c can be a 2-D array in which the rows are RGB or RGBA, however.
  • ax – Axes object, optional, default: None Parent axes of the plot. It uses gca() if not specified.
  • vmax (vmin,) – scalar, optional, default: None vmin and vmax are used in conjunction with norm to normalize luminance data. If either are None, the min and max of the color array is used. (Note if you pass a norm instance, your settings for vmin and vmax will be ignored.)
  • kwargs~matplotlib.collections.Collection properties eg. alpha, edgecolors, facecolors, linewidths, linestyles, norm, cmap
Returns:

paths : ~matplotlib.collections.PathCollection

Examples

a = np.arange(11)
circles(a, a, a*0.2, c=a, alpha=0.5, edgecolor='none')

This code by ??? is under [The BSD 3-Clause License] (http://opensource.org/licenses/BSD-3-Clause)

forgi.visual.mplotlib.plot_pdb(filename, ax=None)[source]

Plot the secondary structure of an RNA in a PDB file using the Graph Layout from the ViennaRNA package and indicate long-range interations and RNA-protein interactions.

Interchain RNA-RNA interactions are shown as red lines. Proteins are shown as transparent gray circles with lines indicating the interacting residues. The circle radius corresponds to the number of interacting nucleotides.

Parameters:
  • structure – A Bio.PDB.Structure
  • ax – Optional. An matplotlib axis object
Returns:

An Axes object (ax)

forgi.visual.mplotlib.plot_rna(cg, ax=None, offset=(0, 0), text_kwargs={}, backbone_kwargs={}, basepair_kwargs={}, color=True, lighten=0, annotations={})[source]

Plot an RNA structure given a set of nucleotide coordinates

Note

This function calls set_axis_off on the axis. You can revert this by using ax.set_axis_on() if you like to see the axis.

Parameters:
  • cg – A forgi.threedee.model.coarse_grain.CoarseGrainRNA structure
  • ax – A matplotlib plotting area
  • offset – Offset the plot by these coordinates. If a simple True is passed in, then offset by the current width of the plot
  • text_kwargs – keyword arguments passed to matplotlib.pyplot.annotate for plotting of the sequence
  • backbone_kwargs – keyword arguments passed to matplotlib.pyplot.plot for plotting of the backbone links
  • basepair_kwargs – keyword arguments passed to matplotlib.pyplot.plot for plotting of the basepair links
  • lighten – Make circles lighter. A percent value where 1 makes everything white and 0 leaves the colors unchanged
  • annotations

    A dictionary {elem_name: string} or None. By default, the element names (e.g. “s0”) are plotted next to the element. This dictionary can be used to override the default element names by costum strings. To remove individual annotations, assign an empty string to the key. To remove all annotations, set this to None.

    Warning

    Annotations are not shown, if there is not enough space. Annotations not shown are logged with level INFO

Returns:

(ax, coords) The axes and the coordinates for each nucleotide

«  forgi.visual.fornac module   ::   Contents   ::   forgi.config module  »