bionetgen.atomizer package

Subpackages

Submodules

bionetgen.atomizer.atomizeTool module

class bionetgen.atomizer.atomizeTool.AtomizeTool(input_file=None, options_dict=None, parser_namespace=None)[source]

Bases: object

checkConfig(config)[source]
run()[source]

bionetgen.atomizer.biogrid module

bionetgen.atomizer.bngModel module

class bionetgen.atomizer.bngModel.ARule[source]

Bases: object

parse_raw(raw)[source]
class bionetgen.atomizer.bngModel.Compartment[source]

Bases: object

class bionetgen.atomizer.bngModel.Function[source]

Bases: object

adjust_func_def(fdef)[source]
extendFunction(function, subfunctionName, subfunction)[source]
renameLoc(pname, rind)[source]
replaceLoc(func_def, pdict)[source]
resolve_sbmlfuncs(defn)[source]
class bionetgen.atomizer.bngModel.Molecule[source]

Bases: object

parse_raw(raw)[source]
class bionetgen.atomizer.bngModel.Observable[source]

Bases: object

get_obs_name()[source]
parse_raw(raw)[source]
class bionetgen.atomizer.bngModel.Parameter[source]

Bases: object

class bionetgen.atomizer.bngModel.Rule[source]

Bases: object

parse_raw(raw)[source]
class bionetgen.atomizer.bngModel.Species[source]

Bases: object

parse_raw(raw)[source]
class bionetgen.atomizer.bngModel.bngModel[source]

Bases: object

Takes in atomizer stuff and turns everything into objects which can be used to print the final model

add_arule(arule)[source]
add_compartment(comp)[source]
add_function(func)[source]
add_molecule(molec)[source]
add_observable(obs)[source]
add_parameter(param)[source]
add_rule(rule)[source]
add_species(sspec)[source]
consolidate()[source]
consolidate_arules()[source]

this figures out what to do with particular assignment rules pulled from SBML. a) A non-constant parameter gets turned into

a function

  1. Any species in the system can be modified by an assignment rule. This turns the species into a function which also requires a modification of any reaction rules the species is associated with

  2. rate rules get turned into syn reactions

consolidate_compartments()[source]
consolidate_molecules()[source]
consolidate_observables()[source]
make_arule()[source]
make_compartment()[source]
make_function()[source]
make_molecule()[source]
make_observable()[source]
make_parameter()[source]
make_rule()[source]
make_species()[source]
remove_sympy_symbols(fdef)[source]
reorder_functions()[source]

this one is to make sure the functions are reordered correctly, should be ported from the original codebase

bionetgen.atomizer.contactMap module

bionetgen.atomizer.contextAnalyzer module

bionetgen.atomizer.libsbml2bngl module

Created on Fri Mar 1 16:14:42 2013

@author: proto

class bionetgen.atomizer.libsbml2bngl.AnalysisResults(rlength, slength, reval, reval2, clength, rdf, finalString, speciesDict, database, annotation)

Bases: tuple

property annotation

Alias for field number 9

property clength

Alias for field number 4

property database

Alias for field number 8

property finalString

Alias for field number 6

property rdf

Alias for field number 5

property reval

Alias for field number 2

property reval2

Alias for field number 3

property rlength

Alias for field number 0

property slength

Alias for field number 1

property speciesDict

Alias for field number 7

bionetgen.atomizer.libsbml2bngl.BNGL2XML()[source]
bionetgen.atomizer.libsbml2bngl.analyzeFile(bioNumber, reactionDefinitions, useID, namingConventions, outputFile, speciesEquivalence=None, atomize=False, bioGrid=False, pathwaycommons=False, ignore=False, noConversion=False, memoizedResolver=True, replaceLocParams=True, quietMode=False, logLevel='WARNING')[source]

one of the library’s main entry methods. Process data from a file

bionetgen.atomizer.libsbml2bngl.analyzeHelper(document, reactionDefinitions, useID, outputFile, speciesEquivalence, atomize, translator, database, bioGrid=False, replaceLocParams=True)[source]

taking the atomized dictionary and a series of data structure, this method does the actual string output.

bionetgen.atomizer.libsbml2bngl.bondPartners(species, bondNumber)[source]
bionetgen.atomizer.libsbml2bngl.changeDefs(functions, dictionary)[source]

changes the names of the functions (RHS) instead of the LHS

bionetgen.atomizer.libsbml2bngl.changeNames(functions, dictionary)[source]

changes instances of keys in dictionary appeareing in functions to their corresponding alternatives

bionetgen.atomizer.libsbml2bngl.changeRates(reactions, dictionary)[source]

changes instances of keys in dictionary appeareing in reaction rules to their corresponding alternatives

bionetgen.atomizer.libsbml2bngl.correctRulesWithParenthesis(rules, parameters)[source]

helper function. Goes through a list of rules and adds a parenthesis to the reaction rates of those functions whose rate is in list ‘parameters’.

bionetgen.atomizer.libsbml2bngl.detectCustomDefinitions(bioNumber)[source]

returns a speciesDefinition<bioNumber>.json fileName if it exist for the current bioModels. None otherwise

bionetgen.atomizer.libsbml2bngl.evaluation(numMolecules, translator)[source]
bionetgen.atomizer.libsbml2bngl.extractAtoms(species)[source]

given a list of structures, returns a list of individual molecules/compartment pairs appends a number for

bionetgen.atomizer.libsbml2bngl.extractCompartmentCoIncidence(species)[source]
bionetgen.atomizer.libsbml2bngl.extractCompartmentStatistics(bioNumber, useID, reactionDefinitions, speciesEquivalence)[source]

Iterate over the translated species and check which compartments are used together, and how.

bionetgen.atomizer.libsbml2bngl.flatStatusVector(statusVector)[source]
bionetgen.atomizer.libsbml2bngl.getAnnotations(annotation)[source]
bionetgen.atomizer.libsbml2bngl.getAnnotationsDict(annotation)[source]
bionetgen.atomizer.libsbml2bngl.getFiles(directory, extension)[source]

Gets a list of bngl files that could be correctly translated in a given ‘directory’

Keyword arguments: directory – The directory we will recurseviley get files from extension – A file extension filter

bionetgen.atomizer.libsbml2bngl.getMoleculeByName(species, atom)[source]

returns the state of molecule-component contained in atom

bionetgen.atomizer.libsbml2bngl.getRelationshipDegree(componentPair, statusQueryFunction, comparisonFunction, finalComparison)[source]
bionetgen.atomizer.libsbml2bngl.handler(signum, frame)[source]
bionetgen.atomizer.libsbml2bngl.isActivated(statusVector)[source]
bionetgen.atomizer.libsbml2bngl.listFiles(minReactions, directory)[source]

List of SBML files that meet a given condition

bionetgen.atomizer.libsbml2bngl.loadBioGrid()[source]
bionetgen.atomizer.libsbml2bngl.main()[source]
bionetgen.atomizer.libsbml2bngl.main2()[source]
bionetgen.atomizer.libsbml2bngl.postAnalysisHelper(outputFile, bngLocation, database)[source]
bionetgen.atomizer.libsbml2bngl.postAnalyzeFile(outputFile, bngLocation, database, replaceLocParams=True)[source]

Performs a postcreation file analysis based on context information

bionetgen.atomizer.libsbml2bngl.postAnalyzeString(outputFile, bngLocation, database)[source]
bionetgen.atomizer.libsbml2bngl.processDir(directory, atomize=True)[source]
bionetgen.atomizer.libsbml2bngl.processFile(translator, parser, outputFile)[source]
bionetgen.atomizer.libsbml2bngl.processFile2()[source]
bionetgen.atomizer.libsbml2bngl.processFile3(fileName, customDefinitions=None, atomize=True, bioGrid=False, output=None)[source]

processes a file. derp.

bionetgen.atomizer.libsbml2bngl.processFunctions(functions, sbmlfunctions, artificialObservables, tfunc)[source]

this method goes through the list of functions and removes all sbml elements that are extraneous to bngl

bionetgen.atomizer.libsbml2bngl.readFromString(inputString, reactionDefinitions, useID, speciesEquivalence=None, atomize=False, loggingStream=None, replaceLocParams=True)[source]

one of the library’s main entry methods. Process data from a string

bionetgen.atomizer.libsbml2bngl.recursiveSearch(dictionary, element, visitedFunctions=[])[source]
bionetgen.atomizer.libsbml2bngl.reorderFunctions(functions)[source]

Analyze a list of sbml functions and make sure there are no forward dependencies. Reorder if necessary

bionetgen.atomizer.libsbml2bngl.reorder_and_replace_arules(functions, parser)[source]
bionetgen.atomizer.libsbml2bngl.resolveDependencies(dictionary, key, idx)[source]
bionetgen.atomizer.libsbml2bngl.resource_path(relative_path)[source]

Get absolute path to resource, works for dev and for PyInstaller

bionetgen.atomizer.libsbml2bngl.selectReactionDefinitions(bioNumber)[source]

This method rrough the stats-biomodels database looking for the best reactionDefinitions definition available

bionetgen.atomizer.libsbml2bngl.unrollFunctions(functions)[source]
bionetgen.atomizer.libsbml2bngl.validateReactionUsage(reactant, reactions)[source]

bionetgen.atomizer.parseAnnotation module

bionetgen.atomizer.sbml2bngl module

Created on Tue Dec 6 17:42:31 2011

@author: proto

class bionetgen.atomizer.sbml2bngl.SBML2BNGL(model, useID=True, replaceLocParams=True)[source]

Bases: object

contains methods for extracting and formatting those sbml elements that are translatable into bngl

adjustInitialConditions(parameters, initialConditions, artificialObservables, observables, functions)[source]

assignment rules require further adjustment after parsed to their initial values.

analyzeReactionRate(math, compartmentList, reversible, rReactant, rProduct, reactionID, parameterFunctions, rModifier=[], sbmlFunctions={}, split_rxn=False)[source]

This functions attempts to obtain the left and right hand sides of a rate reaction function given a MathML tree. It also removes compartments and chemical factors from the function

Keyword arguments:

math – the MathML math object compartmentList – a list of all the compartments in the system reversible – a boolean indicated whether there’s should be a backward rate rReactant – a string list of the reactants. rProduct – a string list of the products. sbmlFunctions – a list of possible nested functiosn taht we need to remove

calculate_factor(react, prod, expr, removed)[source]

Calculates factors from reactants and products?

check_noCompartment(parameters=[])[source]
convertToName(rate)[source]
convertToStandardUnitString(parameterValue, unitDefinition)[source]
convertToStandardUnits(parameterValue, unitDefinition)[source]
extractModelAnnotation()[source]
find_all_symbols(math, reactionID)[source]
gather_terms(exp)[source]
getAssignmentRules(zparams, parameters, molecules, observablesDict, translator)[source]

this method obtains an SBML rate rules and assignment rules. They require special handling since rules are often both defined as rules and parameters initialized as 0, so they need to be removed from the parameters list

getCompartments()[source]

Returns an array of triples, where each triple is defined as (compartmentName,dimensions,size)

getFullAnnotation()[source]
getInitialAssignments(translator, param, zparam, molecules, initialConditions)[source]

process the get initial assignments section. This can be used to initialize parameters or species, so we have to account for both checking both arrays

getIsTreeNegative(math)[source]

walks through a series of * nodes and detects whether there’s a negative factor fixme: we should actually test if the number of negative factors is odd right now we are relying on the modelers not being malicious when writing their rates laws.

getMetaInformation(additionalNotes)[source]
getModelAnnotation()[source]
getParameters()[source]
getPrunnedTree(math, remainderPatterns, artificialObservables={})[source]

walks through a series of * nodes and removes the remainder reactant factors arg:remainderPatterns: argumetns to be removed from the tree it also changes references to time variables to the keyword ‘Time’

artificialObservables: species that are changed through an sbml assignment rule. their usage in bng requires special handling.

getRawSpecies(species, parameters=[], logEntries=True)[source]

species is the element whose SBML information we will extract this method gets information directly from an SBML related to a particular species. It returns id,initialConcentration,(bool)isconstant and isboundary, and the compartment It also accounts for the fact that sometimes ppl use the same name for molecules with different identifiers

getReactionCenter(reactant, product, translator)[source]
getReactions(translator={}, isCompartments=False, extraParameters={}, atomize=False, parameterFunctions={}, database=None)[source]

@returns: a triple containing the parameters,reactions,functions

getSBMLFunctions()[source]
getSpecies(translator={}, parameters=[])[source]

in sbml parameters and species have their own namespace. not so in bionetgen, so we need to rename things if they share the same name

getSpeciesAnnotation()[source]
getSpeciesInfo(name)[source]
getStandardName(name)[source]
getUnitDefinitions()[source]
isAmount(reactantName)[source]
isSameNameDifferentCompartment(name)[source]
preProcessStoichiometry(reactants)[source]

checks for reactants with the same name in the reactant list. This is mainly to account for reactants that dont have the stoichiometry flag properly set and instead appear repeated

reduceComponentSymmetryFactors(reaction, translator, functions)[source]

create symmetry factors for reactions with components and species with identical names. This checks for symmetry in the components names then.

removeFactorFromMath(math, reactants, products, artificialObservables)[source]

it also adds symmetry factors. this checks for symmetry in the species names

artificialObservables: species names that are changed through assignment rules. their use requires special care when calculating a rate

reset()[source]
setConversion(conversion)[source]
static_var(value)[source]
updateComponentCount(counterArray, reference, updateValue)[source]
updateFunctionReference(reaction, updatedReferences)[source]
writeLog(translator)[source]
bionetgen.atomizer.sbml2bngl.comb(x, y, exact=True)[source]
bionetgen.atomizer.sbml2bngl.factorial(x)[source]
bionetgen.atomizer.sbml2bngl.standardizeName(name)[source]

Remove stuff not used by bngl

class bionetgen.atomizer.sbml2bngl.sympyAnd(*args)[source]

Bases: sympy.core.function.Function

default_assumptions = {}
nargs = {2, 3, 4, 5}
class bionetgen.atomizer.sbml2bngl.sympyGEQ(*args)[source]

Bases: sympy.core.function.Function

default_assumptions = {}
nargs = {2}
class bionetgen.atomizer.sbml2bngl.sympyGT(*args)[source]

Bases: sympy.core.function.Function

default_assumptions = {}
nargs = {2}
class bionetgen.atomizer.sbml2bngl.sympyIF(*args)[source]

Bases: sympy.core.function.Function

default_assumptions = {}
nargs = {3}
class bionetgen.atomizer.sbml2bngl.sympyLEQ(*args)[source]

Bases: sympy.core.function.Function

default_assumptions = {}
nargs = {2}
class bionetgen.atomizer.sbml2bngl.sympyLT(*args)[source]

Bases: sympy.core.function.Function

default_assumptions = {}
nargs = {2}
class bionetgen.atomizer.sbml2bngl.sympyNot(*args)[source]

Bases: sympy.core.function.Function

default_assumptions = {}
nargs = {1}
class bionetgen.atomizer.sbml2bngl.sympyOr(*args)[source]

Bases: sympy.core.function.Function

default_assumptions = {}
nargs = {2, 3, 4, 5}
class bionetgen.atomizer.sbml2bngl.sympyPiece(*args)[source]

Bases: sympy.core.function.Function

default_assumptions = {}
nargs = {3, 4, 5}
bionetgen.atomizer.sbml2bngl.unrollSBMLFunction(function, sbmlFunctions)[source]

remove calls to functions inside functions

bionetgen.atomizer.sbml2json module

class bionetgen.atomizer.sbml2json.SBML2JSON(model)[source]

Bases: object

adjustParameters(stoichoimetry, rate, parameters)[source]

adds avogadros number and other adjusting factors to the reaction rates

getInstanceRate(math, compartmentList, reversible, rReactant, rProduct)[source]
getMolecules()[source]

species is the element whose SBML information we will extract this method gets information directly from an SBML related to a particular species. It returns id,initialConcentration,(bool)isconstant and isboundary, and the compartment

getOutsideInsideCompartment(compartmentList, compartment)[source]

Gets the containing compartment for this compartment

getParameters()[source]
getPrunnedTree(math, remainderPatterns)[source]

remove mass action factors

getReactions(sparameters)[source]

returns a list with reactant,product and fwdRate

getUnits()[source]
removeFactorFromMath(math, reactants, products)[source]
bionetgen.atomizer.sbml2json.comb(x, y, exact=True)[source]
bionetgen.atomizer.sbml2json.factorial(x)[source]
bionetgen.atomizer.sbml2json.main()[source]

bionetgen.atomizer.sbmlTranslator module

Module contents