forgi 2.0.0 documentation

«  forgi.visual package   ::   Contents   ::   forgi.visual.mplotlib module  »

forgi.visual.fornac module

forgi.visual.fornac.create_fornac_page_for_structure(bg, color_string)[source]

Create a fornac page dispalying this structure. The dotbracket string and sequence will automatically be extracted from the BulgeGraph.

Colors can be specified as a dictionary containing floating point values. These will be uniformly scaled according to the color scale passed in.

Parameters:color_string – The color string to be passed to fornac. e.g. “11-12: red 14-17: rgb(14,15,120)”
Returns:The html text of the resulting web page.
forgi.visual.fornac.element_to_nucleotide_colors(bg, element_colors)[source]

Convert a dictionary of per-element colors to a dictionary of per-nucleotide colors

Parameters:element_colors – A dictionary of element colors (e.g. {‘i0’: (255,0,0), ‘m1’: {255,255,255)}
Returns:A dictionary of nucleotide numbers: (e.g {1: (14,15,120), 2: (255,255,255)})
forgi.visual.fornac.nucleotide_colors_to_fornac_color_string(nucleotide_colors)[source]

Convert a dictionary of per nucleotide colors to a fornac color string.

Parameters:nucleotide_colors – A dictionary with nucleotide numbers as keys and colors as values. (e.g. {1: (255,0,0), 2: (255,255,0)})
Returns:A color string (e.g “1:rgb(255,0,0) 2:rgb(255,0,0)”)
forgi.visual.fornac.scale_colors(colors_dict, cmap=None, reverse=False)[source]

A dictionary with values containing scalars which need to be scaled according to some color map. The keys are irrelevant.

The color map will be normalized to the range of values within color_dict.

Parameters:
  • colors_dict – The dictionary containing the values to be color scaled.
  • cmap – A color map to be used to scale the colors.
  • reverse – Reverse the color map
Returns:

Another dictionary containing rgb triples as values.

«  forgi.visual package   ::   Contents   ::   forgi.visual.mplotlib module  »