deflex.DeflexGraph.write

DeflexGraph.write(filename, **kwargs)[source]

Write the graph into a .graphml file.

Parameters:filename (str) – Path of the output file e.g. /my/special/path/mygraph.graphml
Other Parameters:
 weight_exponent (int) – Shift the decimal point: weight = weight\cdot10^{weight\_exponent}

Examples

>>> import os
>>> from deflex import fetch_test_files
>>> from deflex import restore_results
>>> from deflex import DeflexGraph
>>> fn = fetch_test_files("de03_fictive.dflx")
>>> my_results = restore_results(fn)
>>> dflx_graph = DeflexGraph(my_results)
>>> fn_out = fn.replace(".dflx", "_graph.graphml")
>>> dflx_graph.write(fn_out, weight_exponent=-3)
>>> os.stat(fn_out).st_size > 0
True
>>> os.remove(fn_out)