IMP logo
IMP Reference Guide  develop.d97d4ead1f,2024/11/21
The Integrative Modeling Platform
IMP.spatiotemporal.write_output Namespace Reference

Functions to write spatiotemporal graph information to files. More...

Detailed Description

Functions to write spatiotemporal graph information to files.

Functions

def draw_dag
 Function to render the DAG with heatmap information. More...
 
def draw_dag_in_graphviz
 Draw a DAG representation in graphviz and return the resulting Digraph. More...
 
def write_cdf
 Function to output the cumulative distribution function (cdf) More...
 
def write_final_npaths
 Function to output a file with all states for each of the n most likely paths. More...
 
def write_labeled_pdf
 Function to output the labeled probability distribution function (pdf) More...
 
def write_pdf
 Function to output the probability distribution function (pdf) More...
 

Function Documentation

def IMP.spatiotemporal.write_output.draw_dag (   dag_fn,
  nodes,
  paths,
  path_prob,
  keys,
  heatmap = True,
  colormap = 'Purples',
  penscale = 0.6,
  arrowsize = 1.2,
  fontname = 'Helvetica',
  fontsize = '18',
  height = '0.6',
  width = '0.6',
  draw_label = True 
)

Function to render the DAG with heatmap information.

Parameters
dag_fnstring, filename path
nodeslist of graphNode objects for which the graph will be drawn
pathslist of lists containing all paths visited by the graphNode objects
path_problist of probabilities for each path, (path_prob from score_graph())
keysstates visited in the graph (list of keys to the state_dict)
heatmapBoolean to determine whether or not to write the dag with a heatmap based on the probability of each state (default: True)
colormapstring, colormap used by the dag to represent probability. Chooses from those available in matplotlib (https://matplotlib.org/stable/users/explain/colors/colormaps.html) (default: "Purples").
penscalefloat, size of the pen used to draw arrows on the dag
arrowsizefloat, size of arrows connecting states on the dag
fontnamestring, font used for the labels on the dag
fontsizestring, font size used for the labels on the dag
heightstring, height of each node on the dag
widthstring, width of each node on the dag
draw_labelBoolean to determine whether or not to draw state labels on the dag
Note
This function is only available in Python.

Definition at line 169 of file write_output.py.

def IMP.spatiotemporal.write_output.draw_dag_in_graphviz (   nodes,
  coloring = None,
  draw_label = True,
  fontname = 'Helvetica',
  fontsize = '18',
  penscale = 0.6,
  arrowsize = 1.2,
  height = '0.6',
  width = '0.6' 
)

Draw a DAG representation in graphviz and return the resulting Digraph.

Takes a list of graphNodes and initializes the nodes and edges. Coloring is expected to be a list of RGBA strings specifying how to color each node. Expected to be same length as nodes.

Parameters
nodeslist of graphNode objects
coloringlist of RGBA strings to specify the color of each node. Expected to be the same length as nodes
draw_labelbool, whether or not to draw graph labels
fontnamestring, name of font for graph labels
fontsizestring, size of font for graph labels
penscalefloat, size of pen
arrowsizefloat, size of arrows
heightstring, height of nodes
widthstring, width of nodes
Returns
dot: Digraph object to be rendered
Note
This function is only available in Python.

Definition at line 110 of file write_output.py.

def IMP.spatiotemporal.write_output.write_cdf (   out_cdf,
  cdf_fn,
  graph_prob 
)

Function to output the cumulative distribution function (cdf)

Parameters
out_cdfbool, writes cdf if true
cdf_fnstr, filename of cdf
graph_problist of probabilities for each path, (path_prob from score_graph())
Note
This function is only available in Python.

Definition at line 23 of file write_output.py.

def IMP.spatiotemporal.write_output.write_final_npaths (   npaths,
  npath_fn,
  graph_scores,
  graph_prob 
)

Function to output a file with all states for each of the n most likely paths.

Parameters
npathsint, number of paths to output
npath_fnstr, name of the file for all paths
graph_scoreslist of tuples, where the first object is the path (list of graphNode objects for each state along the trajectory), and the second object is the score of the path, which can be used to calculate the probability. (path_scores from score_graph())
graph_problist of probabilities for each path, (path_prob from score_graph())
Note
This function is only available in Python.

Definition at line 78 of file write_output.py.

def IMP.spatiotemporal.write_output.write_labeled_pdf (   out_labeled_pdf,
  labeled_pdf_fn,
  graph,
  graph_prob 
)

Function to output the labeled probability distribution function (pdf)

Parameters
out_labeled_pdfbool, writes labeled_pdf if true
labeled_pdf_fnstr, filename of labeled_pdf
graphlist of graphNode objects visited for each path, (all_paths from score_graph())
graph_problist of probabilities for each path, (path_prob from score_graph())
Note
This function is only available in Python.

Definition at line 50 of file write_output.py.

def IMP.spatiotemporal.write_output.write_pdf (   out_pdf,
  pdf_fn,
  graph_prob 
)

Function to output the probability distribution function (pdf)

Parameters
out_pdfbool, writes pdf if true
pdf_fnstr, filename of pdf
graph_problist of probabilities for each path, (path_prob from score_graph())
Note
This function is only available in Python.

Definition at line 37 of file write_output.py.