bionetgen.core.tools package
Submodules
bionetgen.core.tools.cli module
- class bionetgen.core.tools.cli.BNGCLI(inp_file, output, bngpath, suppress=False, log_file=None, timeout=None, app=None)[source]
Bases:
object
Command Line Interface class to run BNG2.pl on a given model.
Usage: BNGCLI(inp_file, output, bngpath)
Arguments
- inp_filestr
path to the the BNGL file to run
- outputstr
path to the output folder to run the model in
- bngpathstr
path to BioNetGen folder where BNG2.pl lives
Methods
- run()
runs the model in the given output folder
bionetgen.core.tools.gdiff module
- class bionetgen.core.tools.gdiff.BNGGdiff(inp1, inp2, out=None, out2=None, mode='matrix', colors={'g1': ['#dadbfd', '#e6e7fe', '#f3f3ff'], 'g2': ['#ff9e81', '#ffbfaa', '#ffdfd4'], 'intersect': ['#c4ed9e', '#d9f4be', '#ecf9df']}, app=None)[source]
Bases:
object
Class to compare two contact maps generated by
- Usage: BNGGdiff(inp1, inp2).run()
BNGGdiff(inp1, inp2, out1).run() BNGGdiff(inp1, inp2, out1, out2).run() BNGGdiff(inp1, inp2, out, mode=”matrix”).run()
Arguments
- inp1str
path to the first contact map graphml file
- inp2str
path to the second contact map graphml file
- out1str
(optional) path to the output file for inp1 - inp2 graph
- out2str
(optional) path to the second output file for inp2 - inp1 graph
- modestr
diff mode, currently available modes are “matrix” and “union”
- diff_graphs(g1, g2, colors={'g1': ['#dadbfd', '#e6e7fe', '#f3f3ff'], 'g2': ['#c4ed9e', '#d9f4be', '#ecf9df'], 'intersect': ['#c4ed9e', '#d9f4be', '#ecf9df']})[source]
Given two XML dictionaries (using xmltodict) of two graphml graphs, do the diff and return the difference graphml xml in dictionary format
The result is g1-g2. By default g1 only stuff are colored green g2 only nodes are colored red and common elements are colored blue. These can be changed by the colors kwarg which is a dictionary with keys g1, g2 and intersect and colors are given as hexcode strings.
- Usage: diff_graphs(g1_dict, g2_dict)
- diff_graphs(g1_dict, g2_dict,
- colors={“g1”: “#hexstr1”,
“g2”: “#hexstr2”, “intersect”: “#hexstr3”})
Arguments
- g1dict
input dictionary of the input XML file for the first contact map
- g2dict
second input dictionary of the second input XML file.
- colors (opt): dict
(optional) A dictionary with keys “g1”, “g2” and “intersect”. The values are color hex strings for the colors you want for graph 1, graph 2 and the color for common elements between the two graphs.
Returns
- diffdict
A dictionary of graphs each of which is a dictionary for the XML file of the difference graph. Can be converted back to an XML file using xmltodict function unparse. Each key in the dictionary returned by this function is the intended file name for that graph.
bionetgen.core.tools.info module
- class bionetgen.core.tools.info.BNGInfo(config, args=None, app=None)[source]
Bases:
object
Used by the Cement app to execute the info subcommand, which involves gathering, preparing, and printing relevant version and path information.
The gatherInfo() method finds and stores all necessary information. The messageGeneration() method prepares this information in a text string. The run() method simply outputs all the information.
Requires a configuration file. An additional set of arguments are optional.
bionetgen.core.tools.plot module
- class bionetgen.core.tools.plot.BNGPlotter(inp, out, app=None, **kwargs)[source]
Bases:
object
Class that does basic plotting for gdat/cdat files
Usage BNGPlotter(inp, out, kwargs)
Arguments
- inpstr
input file path, gdat/cdat/scan file
- outstr
output file path
- kwargsdict
keywords arguments for matplotlib. For details check bionetgen plot -h
Methods
- plot()
plots the data from the input file and saves it to output file the class is initialized with
bionetgen.core.tools.result module
- class bionetgen.core.tools.result.BNGResult(path=None, direct_path=None, app=None)[source]
Bases:
object
Class that loads in gdat/cdat/scan files
- Usage: BNGResult(path=”/path/to/folder”) OR
BNGResult(direct_path=”/path/to/file.gdat”)
Arguments
- pathstr
path that points to a folder containing files to be loaded by the class
- direct_pathstr
path that directly points to a file to load
Methods
- load(fpath)
loads in the direct path to the file and returns numpy.recarray
bionetgen.core.tools.visualize module
- class bionetgen.core.tools.visualize.BNGVisualize(input_file, output=None, vtype=None, bngpath=None, suppress=None, app=None)[source]
Bases:
object
Class that generates various grapsh in .graphml format for a model.
Usage: BNGVisualize(INPUT_FILE, output=OUTPATH, vtype=”contactmap”, bngpath=BNGPATH)
Arguments
- input_filestr
path to input .bngl file
- outputstr
path to output folder
- vtype: str
type of visualization. valid options are: “contactmap”, “ruleviz_pattern”, “ruleviz_operation”, “regulatory” and “all”
- bngpathstr
path to BNG2.pl
- suppressbool
suppresses any output from BNG2.pl calls
- appCement App
Cement framework app object if working with cement frame work
Methods
- runNone
runs the commands necessary to generate the graph files