lib5c.plotters.splines module

Module for visualizing spline surfaces fit to 5C counts data.

lib5c.plotters.splines.visualize_spline(counts_list, primermap, bias_factor, spline, grid_points=10, sample_rate=100, log=True, asymmetric=False)[source]

Open an interactive pyplot window showing a visualization of a spline surface, overlayed over representative 5C counts data.

Parameters
  • counts_list (List[Dict[str, np.ndarray]]) – A list of counts dicts to use as data points to be compared to the spline surface.

  • primermap (Dict[str, List[Dict[str, Any]]]) – The primermap corresponding to the counts dicts in counts_list.

  • bias_factor (str) – The bias factor being plotted. This string must match metadata keys in primermap. That is to say, if bias_list is ['length'] then we expect primermap[region][i]['length'] to be a number representing the length of the i th fragment in the region specified by region.

  • spline (scipy.interpolate.BivariateSpline) – The spline object to visualize.

  • grid_points (int) – The number of grid points to use when constructing the wireframe of the surface represented by spline.

  • sample_rate (int) – Only every sample_rate th real-data point will be included in the visualization to reduce computational load.

  • log (bool) – Pass True to show counts on a log-scale axis.

  • asymmetric (bool) – Pass True to iterate only over the upper-triangular elements of the counts matrices, which can lead to asymmetric visualizations. By default, the algorithm iterates over all elements of the counts matrices, enforcing symmetry in thevisualizations but incurring some redundancy in the actual counts information.

Notes

The spline will be displayed in an interactive window via plt.show(). If your default matplotlib backend is not interactive, this function will try to set your backend to TkAgg. If you prefer to use a different interactive backend, set the MPLBACKEND environment variable before invoking Python.