bionetgen.tools package

Submodules

bionetgen.tools.cli module

class bionetgen.tools.cli.BNGCLI(inp_file, output, bngpath, suppress=False, log_file=None, timeout=None)[source]

Bases: object

Command Line Interface class to run BNG2.pl on a given model.

Usage: BNGCLI(inp_file, output, bngpath)

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

run()

runs the model in the given output folder

run()[source]

bionetgen.tools.gdiff module

class bionetgen.tools.gdiff.BNGGdiff(inp1, inp2, out=None, out2=None, mode='matrix')[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()

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”})

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.

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.

run() dict[source]

bionetgen.tools.info module

class bionetgen.tools.info.BNGInfo(config, args=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.

gatherInfo()[source]

Gathers information about relevant versions and paths into a dictionary.

messageGeneration()[source]

Takes the dictionary created by gatherInfo() and converts it to a string of text for printing.

run()[source]

Simply prints out the created information message.

bionetgen.tools.plot module

class bionetgen.tools.plot.BNGPlotter(inp, out, **kwargs)[source]

Bases: object

Class that does basic plotting for gdat/cdat files

Usage BNGPlotter(inp, out, kwargs)

inpstr

input file path, gdat/cdat/scan file

outstr

output file path

kwargsdict

keywords arguments for matplotlib. For details check bionetgen plot -h

plot()

plots the data from the input file and saves it to output file the class is initialized with

plot()[source]

bionetgen.tools.result module

class bionetgen.tools.result.BNGResult(path=None, direct_path=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”)

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

load(fpath)

loads in the direct path to the file and returns numpy.recarray

find_dat_files()[source]
load(fpath)[source]
load_results()[source]

bionetgen.tools.visualize module

class bionetgen.tools.visualize.BNGVisualize(input_file, output=None, vtype=None, bngpath=None, suppress=None)[source]

Bases: object

run() bionetgen.tools.visualize.VisResult[source]
class bionetgen.tools.visualize.VisResult(input_folder, name=None, vtype=None)[source]

Bases: object

Module contents