示例#1
0
 def test_writeSBML(self):
     rpsbml = rpSBML.rpSBML('test', None, os.path.abspath('../cache'))
     rpsbml.genericModel('RetroPath_heterologous_pathway', 'rp_model', compXref)
     rpsbml.modelName = 'test_writeSBML'
     rpsbml.writeSBML(os.path.abspath('test_models'))
     inModel = libsbml.readSBML(os.path.join(os.path.abspath('test_models'), 'test_writeSBML.sbml'))
     assert self.compareModels(inModel.getModel(), rpsbml.model)==True
示例#2
0
 def createFluxObj(self):
     rpsbml = rpSBML.rpSBML('test', None, '../cache')
     rpsbml.genericModel('RetroPath_heterologous_pathway', 'rp_model',
                         self.compXref)
     for meta in set([
             i for step in steps for lr in ['left', 'right']
             for i in step[lr]
     ]):
         try:
             inchi = rp_inchi[meta]
         except KeyError:
             inchi = None
         try:
             smiles = rp_smiles[meta]
         except KeyError:
             smiles = None
         rpsbml.createSpecies(meta, self.chemXref, None, inchi, smiles,
                              'MNXC3', 0, '')
     rpsbml.createPathway(path_id)
     step_id = 0
     for stepNum in range(len(steps)):
         rpsbml.createReaction('RP_' + str(stepNum), 'B_999999',
                               'B__999999', steps[stepNum],
                               reaction_smiles[stepNum], self.reacXref,
                               'testRid', 0.0, None, rpsbml.hetero_group,
                               None)
         step_id += 1
     rpsbml.createFluxObj('flux1', 'RP_1', 2.0, True)
     libsbml.writeSBML(rpsbml.document,
                       self.outputPath + 'test_createFluxObj.sbml')
示例#3
0
 def createMergeModels(self):
     rpsbml = rpSBML.rpSBML('test', None, '../cache')
     rpsbml.genericModel('RetroPath_heterologous_pathway', 'rp_model',
                         self.compXref)
     for meta in set([
             i for step in steps for lr in ['left', 'right']
             for i in step[lr]
     ]):
         try:
             inchi = rp_inchi[meta]
         except KeyError:
             inchi = None
         try:
             smiles = rp_smiles[meta]
         except KeyError:
             smiles = None
         rpsbml.createSpecies(meta, self.chemXref, None, inchi, smiles,
                              'MNXC3', 0, '')
     rp_pathway = rpsbml.createPathway(path_id)
     #reactions
     step_id = 0
     for stepNum in range(len(steps)):
         rpsbml.createReaction('RP_' + str(stepNum), 'B_999999',
                               'B__999999', steps[stepNum],
                               reaction_smiles[stepNum], self.reacXref,
                               'testRid', 0.0, None, rpsbml.hetero_group,
                               None)
         step_id += 1
     #other model
     document = libsbml.readSBML(self.outputPath +
                                 'bigg_iMM904.COBRA-sbml3.xml')
     model = document.getModel()
     rpsbml.mergeModels(model)
     libsbml.writeSBML(document, self.outputPath + 'test_mergeModels.sbml')
示例#4
0
def genSink(sbml_model, file_out, compartment_id='MNXC3'):
    ### open the cache ###
    dirname = os.path.dirname(os.path.abspath( __file__ ))
    smiles_inchi = pickle.load(gzip.open(dirname+'/cache/smiles_inchi.pickle.gz', 'rb'))
    rpsbml = rpSBML.rpSBML('tmp')
    rpsbml.readModel(sbml_model)
    cytoplasm_species = []
    for i in rpsbml.model.getListOfSpecies():
        if i.getCompartment()==compartment_id:
            cytoplasm_species.append(i)
    with open(file_out, mode='w') as f:
        writer = csv.writer(f, delimiter=',', quotechar='"', quoting=csv.QUOTE_NONNUMERIC)
        writer.writerow(['Name','InChI'])
        for i in cytoplasm_species:
            res = rpsbml.readAnnotation(i.getAnnotation())
            #extract the MNX id's
            try:
                mnx = res['metanetx.chemical'][0]
            except KeyError:
                continue
            #mnx = i.getId().split('__')[0]
            try:
                inchi = meta_inchi[mnx]
            except KeyError:
                inchi = None
            if mnx and inchi:
                writer.writerow([mnx,inchi])
示例#5
0
 def createUnit(self):
     rpsbml = rpSBML.rpSBML('test', None, '../cache')
     rpsbml.createModel('RetroPath_heterologous_pathway', 'rp_model')
     unitDef = rpsbml.createUnitDefinition('mmol_per_gDW_per_hr')
     rpsbml.createUnit(unitDef, libsbml.UNIT_KIND_MOLE, 1, -3, 1)
     rpsbml.createUnit(unitDef, libsbml.UNIT_KIND_GRAM, 1, 0, 1)
     rpsbml.createUnit(unitDef, libsbml.UNIT_KIND_SECOND, 1, 0, 3600)
     libsbml.writeSBML(rpsbml.document,
                       self.outputPath + 'test_createUnit.sbml')
示例#6
0
 def test_createUnit(self):
     rpsbml = rpSBML.rpSBML('test', None, os.path.abspath('../cache'))
     rpsbml.createModel('RetroPath_heterologous_pathway', 'rp_model')
     unitDef = rpsbml.createUnitDefinition('mmol_per_gDW_per_hr')
     rpsbml.createUnit(unitDef, libsbml.UNIT_KIND_MOLE, 1, -3, 1)
     rpsbml.createUnit(unitDef, libsbml.UNIT_KIND_GRAM, 1, 0, 1)
     rpsbml.createUnit(unitDef, libsbml.UNIT_KIND_SECOND, 1, 0, 3600)
     inModel = libsbml.readSBML(os.path.join(os.path.abspath('test_models'), 'test_createUnit.sbml'))
     assert self.compareModels(inModel.getModel(), rpsbml.model)==True
示例#7
0
def runSingleSBML(rpcofactors, member_name, rpsbml_string, path_id,
                  compartment_id):
    #open one of the rp SBML files
    rpsbml = rpSBML.rpSBML(member_name,
                           libsbml.readSBMLFromString(rpsbml_string))
    #rpcofactors = rpRanker.rpCofactors()
    if rpcofactors.addCofactors(rpsbml, compartment_id, path_id):
        return libsbml.writeSBMLToString(rpsbml.document).encode('utf-8')
    else:
        return ''
示例#8
0
 def test_runParsimoniousFBA(self):
     rpsbml = rpSBML.rpSBML('test', path=os.path.join('data', 'merged.xml'))
     rpfba = rpFBA.rpFBA(rpsbml)
     obj_value, status = rpfba.runParsimoniousFBA('RP1_sink')
     self.assertAlmostEqual(obj_value, 859.3846153846168)
     self.assertTrue(status)
     #make sure that the results are written to the file
     all_json = rpsbml.genJSON()
     self.assertAlmostEqual(
         all_json['pathway']['brsynth']['fba_obj_RP1_sink']['value'],
         859.3846153846168)
示例#9
0
def singleThermo(sbml_paths,
                 pathway_id,
                 tmpOutputFolder,
                 ph=7.0,
                 ionic_strength=200,
                 pMg=10.0,
                 temp_k=298.15,
                 stdev_factor=1.96):
    """Given a list of rpSBML input files, perform thermodynamics analysis. Less memory effecient than the _hdd method but faster

    :param sbml_paths: The list of rpSBML paths passed to calculate thermodynamics
    :param pathway_id: The id of the heterologous pathway of interest
    :param tmpOutputFolder: The path to the output folder to write the result rpSBML file
    :param ph: The pH of the host organism (Default: 7.0)
    :param ionic_strength: Ionic strenght of the host organism (Default: 200.0)
    :param pMg: The pMg of the host organism (Default: 10.0)
    :param temp_k: The temperature of the host organism in Kelvin (Default: 298.15)
    :param stdev_factor: The standard deviation factor to calculate MDF (Default: 1.96)

    :type sbml_paths: str
    :type pathway_id: str
    :type tmpOutputFolder: str
    :type ph: float
    :type ionic_strength: float
    :type pMg: float
    :type temp_k: float
    :type stdev_factor: float

    :rtype: bool
    :return: Success or failure of the function
    """
    rpequilibrator = rpEquilibrator.rpEquilibrator(
        ph=ph,
        ionic_strength=ionic_strength,
        pMg=pMg,
        temp_k=temp_k,
        stdev_factor=stdev_factor)
    for sbml_path in sbml_paths:
        logging.debug('Calculating the thermodynamics of the pathway ' +
                      str(pathway_id) + ' for the file: ' + str(sbml_path))
        file_name = sbml_path.split('/')[-1].replace('.sbml', '').replace(
            '.xml', '').replace('.rpsbml', '').replace('_rpsbml', '')
        rpsbml = rpSBML.rpSBML(file_name, path=sbml_path)
        rpequilibrator.rpsbml = rpsbml
        res = rpequilibrator.pathway(
            pathway_id, True)  #ignore the results because written in SBML file
        rpsbml.writeSBML(tmpOutputFolder)
        rpsbml = None
    return True
示例#10
0
 def test_createSpecies(self):
     rpsbml = rpSBML.rpSBML('test', None, os.path.abspath('../cache'))
     rpsbml.genericModel('RetroPath_heterologous_pathway', 'rp_model', compXref)
     for meta in set([i for step in steps for lr in ['left', 'right'] for i in step[lr]]):
         try:
             inchi = rp_inchi[meta]
         except KeyError:
             inchi = None
         try:
             smiles = rp_smiles[meta]
         except KeyError:
             smiles = None
         rpsbml.createSpecies(meta, chemXref, None, inchi, smiles, 'MNXC3', 0, '')
     inModel = libsbml.readSBML(os.path.join(os.path.abspath('test_models'), 'test_createSpecies.sbml'))
     assert self.compareModels(inModel.getModel(), rpsbml.model)==True
def runSingleSBML(member_name, rpsbml_string, inSBML, isMerge, path_id):
    #open one of the rp SBML files
    input_rpsbml = rpSBML.rpSBML('inputMergeModel',
                                 libsbml.readSBMLFromFile(inSBML))
    rpsbml = rpSBML.rpSBML(member_name,
                           libsbml.readSBMLFromString(rpsbml_string))
    #read the input GEM sbml model
    #input_rpsbml = rpSBML.rpSBML('inputMergeModel', libsbml.readSBMLFromString(inSBML_string))
    #print(input_rpsbml)
    #print(input_rpsbml.model)
    rpsbml.mergeModels(input_rpsbml.model)
    rpfba = rpFBA.rpFBA(input_rpsbml)
    rpfba.allObj(path_id)
    if isMerge:
        ##### pass FBA results to the original model ####
        groups = rpfba.rpsbml.model.getPlugin('groups')
        rp_pathway = groups.getGroup(path_id)
        for member in rp_pathway.getListOfMembers():
            reacFBA = rpfba.rpsbml.model.getReaction(member.getIdRef())
            reacIN = rpsbml.model.getReaction(member.getIdRef())
            reacIN.setAnnotation(reacFBA.getAnnotation())
        return libsbml.writeSBMLToString(rpsbml.document).encode('utf-8')
    else:
        return libsbml.writeSBMLToString(input_rpsbml.document).encode('utf-8')
示例#12
0
 def test_runFractionReaction(self):
     rpsbml = rpSBML.rpSBML('test', path=os.path.join('data', 'merged.xml'))
     rpfba = rpFBA.rpFBA(rpsbml)
     obj_value, status = rpfba.runFractionReaction('biomass', 1.0,
                                                   'RP1_sink', 1.0)
     self.assertAlmostEqual(obj_value, 2.3076923076923888)
     self.assertTrue(status)
     #make sure that the results are written to the file
     all_json = rpsbml.genJSON()
     self.assertAlmostEqual(
         all_json['pathway']['brsynth']
         ['fba_obj_RP1_sink__restricted_biomass']['value'],
         2.3076923076923888)
     self.assertAlmostEqual(
         all_json['pathway']['brsynth']['fba_obj_biomass']['value'],
         3.6794124272706443)
示例#13
0
    def _removeDeadEnd(self, sbml_path):
        """Remove dead end metabolites by running FVA

        :param sbml_path: The path to the SBML file

        :type sbml_path: str

        :rtype: None
        :return: None
        """
        self.cobra_model = cobra.io.read_sbml_model(sbml_path,
                                                    use_fbc_package=True)
        self._reduce_model()
        with tempfile.TemporaryDirectory() as tmpOutputFolder:
            cobra.io.write_sbml_model(self.cobra_model,
                                      tmpOutputFolder + '/tmp.xml')
            self.rpsbml = rpSBML.rpSBML('tmp')
            self.rpsbml.readSBML(tmpOutputFolder + '/tmp.xml')
示例#14
0
 def test_species_dfG_prime_o(self):
     #create a species inside an SBML model
     rpsbml = rpSBML.rpSBML('test', None, os.path.abspath('../cache'))
     rpsbml.genericModel('RetroPath_heterologous_pathway', 'rp_model', compXref)
     for meta in set([i for step in steps for lr in ['left', 'right'] for i in step[lr]]):
         try:
             inchi = rp_inchi[meta]
         except KeyError:
             inchi = None
         try:
             smiles = rp_smiles[meta]
         except KeyError:
             smiles = None
         rpsbml.createSpecies(meta, chemXref, None, inchi, smiles, 'MNXC3', 0, '')
     species_annot = rpsbml.model.getSpecies('MNXM10__64__MNXC3').getAnnotation()
     rpthermo = rpThermo.rpThermo()
     dfG_prime_o, X, G, physioParameter = rpthermo.species_dfG_prime_o(species_annot, 1)
     #TODO: calculate this
     assert dfG_prime_o==-1141.617003796832
示例#15
0
 def test_readIBISBAAnnotation(self):
     rpsbml = rpSBML.rpSBML('test', None, os.path.abspath('../cache'))
     rpsbml.genericModel('RetroPath_heterologous_pathway', 'rp_model', compXref)
     for meta in set([i for step in steps for lr in ['left', 'right'] for i in step[lr]]):
         try:
             inchi = rp_inchi[meta]
         except KeyError:
             inchi = None
         try:
             smiles = rp_smiles[meta]
         except KeyError:
             smiles = None
         rpsbml.createSpecies(meta, chemXref, None, inchi, smiles, 'MNXC3', 0, '')
     rpsbml.createPathway(path_id)
     #reactions
     step_id = 0
     for stepNum in range(len(steps)):
         rpsbml.createReaction('RP_'+str(stepNum), 'B_999999', 'B__999999', steps[stepNum], reaction_smiles[stepNum], reacXref, 'testRid', 0.0, None, rpsbml.hetero_group, None)
         step_id += 1
     assert rpsbml.readIBISBAAnnotation(rpsbml.model.getSpecies('MNXM1__64__MNXC3').getAnnotation())=={'smiles': '[H+]','inchi': 'InChI=1S','inchikey': '','dG_prime_o': {'units': 'kj_per_mol', 'value': ''},'dG_prime_m': {'units': 'kj_per_mol', 'value': ''},'dG_uncert': {'units': 'kj_per_mol', 'value': ''}}
示例#16
0
 def createSpecies(self):
     rpsbml = rpSBML.rpSBML('test', None, '../cache')
     rpsbml.genericModel('RetroPath_heterologous_pathway', 'rp_model',
                         self.compXref)
     for meta in set([
             i for step in steps for lr in ['left', 'right']
             for i in step[lr]
     ]):
         try:
             inchi = rp_inchi[meta]
         except KeyError:
             inchi = None
         try:
             smiles = rp_smiles[meta]
         except KeyError:
             smiles = None
         rpsbml.createSpecies(meta, self.chemXref, None, inchi, smiles,
                              'MNXC3', 0, '')
     libsbml.writeSBML(rpsbml.document,
                       self.outputPath + 'test_createSpecies.sbml')
示例#17
0
 def test_createFluxObj(self):
     rpsbml = rpSBML.rpSBML('test', None, os.path.abspath('../cache'))
     rpsbml.genericModel('RetroPath_heterologous_pathway', 'rp_model', compXref)
     for meta in set([i for step in steps for lr in ['left', 'right'] for i in step[lr]]):
         try:
             inchi = rp_inchi[meta]
         except KeyError:
             inchi = None
         try:
             smiles = rp_smiles[meta]
         except KeyError:
             smiles = None
         rpsbml.createSpecies(meta, chemXref, None, inchi, smiles, 'MNXC3', 0, '')
     rpsbml.createPathway(path_id)
     step_id = 0
     for stepNum in range(len(steps)):
         rpsbml.createReaction('RP_'+str(stepNum), 'B_999999', 'B__999999', steps[stepNum], reaction_smiles[stepNum], reacXref, 'testRid', 0.0, None, rpsbml.hetero_group, None)
         step_id += 1
     rpsbml.createFluxObj('flux1', 'RP_1', 2.0, True)
     inModel = libsbml.readSBML(os.path.join(os.path.abspath('test_models'), 'test_createFluxObj.sbml'))
     assert self.compareModels(inModel.getModel(), rpsbml.model)==True
示例#18
0
 def test_readAnnotation(self):
     rpsbml = rpSBML.rpSBML('test', None, os.path.abspath('../cache'))
     rpsbml.genericModel('RetroPath_heterologous_pathway', 'rp_model', compXref)
     for meta in set([i for step in steps for lr in ['left', 'right'] for i in step[lr]]):
         try:
             inchi = rp_inchi[meta]
         except KeyError:
             inchi = None
         try:
             smiles = rp_smiles[meta]
         except KeyError:
             smiles = None
         rpsbml.createSpecies(meta, chemXref, None, inchi, smiles, 'MNXC3', 0, '')
     annot = rpsbml.readAnnotation(rpsbml.model.getSpecies('MNXM1__64__MNXC3').getAnnotation())
     assert annot=={'bigg.metabolite': ['h', 'M_h'],
             'metanetx.chemical': ['MNXM1', 'MNXM145872', 'MNXM89553'], 
             'chebi': ['CHEBI:15378', 'CHEBI:10744', 'CHEBI:13357', 'CHEBI:5584'], 
             'hmdb': ['HMDB59597'], 
             'kegg.compound': ['C00080'], 
             'metacyc': ['PROTON'], 
             'reactome.compound': ['1132304', '113529', '1470067', '156540', '163953', '193465', '194688', '2000349', '2872447', '351626', '372511', '374900', '425969', '425978', '425999', '427899', '428040', '428548', '5668577', '70106', '74722'], 
             'seed.compound': ['39', 'cpd00067']}
示例#19
0
 def createModel(self):
     rpsbml = rpSBML.rpSBML('test', None, '../cache')
     rpsbml.createModel('RetroPath_heterologous_pathway', 'rp_model')
     libsbml.writeSBML(rpsbml.document,
                       self.outputPath + 'test_createModel.sbml')
示例#20
0
 def test_createCompartent(self):
     rpsbml = rpSBML.rpSBML('test', None, os.path.abspath('../cache'))
     rpsbml.createModel('RetroPath_heterologous_pathway', 'rp_model')
     rpsbml.createCompartment(1, 'MNXC3', 'cytoplasm', compXref)
     inModel = libsbml.readSBML(os.path.join(os.path.abspath('test_models'), 'test_createCompartment.sbml'))
     assert self.compareModels(inModel.getModel(), rpsbml.model)==True
示例#21
0
 def genericModel(self):
     rpsbml = rpSBML.rpSBML('test', None, '../cache')
     rpsbml.genericModel('RetroPath_heterologous_pathway', 'rp_model',
                         self.compXref)
     libsbml.writeSBML(rpsbml.document,
                       self.outputPath + 'test_genericModel.sbml')
示例#22
0
 def createCompartent(self):
     rpsbml = rpSBML.rpSBML('test', None, '../cache')
     rpsbml.createModel('RetroPath_heterologous_pathway', 'rp_model')
     rpsbml.createCompartment(1, 'MNXC3', 'cytoplasm', self.compXref)
     libsbml.writeSBML(rpsbml.document,
                       self.outputPath + 'test_createCompartent.sbml')
示例#23
0
 def createParameter(self):
     rpsbml = rpSBML.rpSBML('test', None, '../cache')
     rpsbml.createModel('RetroPath_heterologous_pathway', 'rp_model')
     upInfParam = rpsbml.createParameter('B_999999', 999999.0, 'kj_per_mol')
     libsbml.writeSBML(rpsbml.document,
                       self.outputPath + 'test_createParameter.sbml')
示例#24
0
 def test_readSBML(self):
     rpsbml = rpSBML.rpSBML('test', None, os.path.abspath('../cache'))
     rpsbml.readSBML(os.path.join(os.path.abspath('test_models'), 'test_createReaction.sbml')) 
     inModel = libsbml.readSBML(os.path.join(os.path.abspath('test_models'), 'test_createReaction.sbml'))
     assert self.compareModels(inModel.getModel(), rpsbml.model)==True
示例#25
0
 def createUnitDefinition(self):
     rpsbml = rpSBML.rpSBML('test', None, '../cache')
     rpsbml.createModel('RetroPath_heterologous_pathway', 'rp_model')
     unitDef = rpsbml.createUnitDefinition('mmol_per_gDW_per_hr')
     libsbml.writeSBML(rpsbml.document,
                       self.outputPath + 'test_createUnitDefinition.sbml')
示例#26
0
def main(args):
    """Usage: rpUnicity <dirname>
    """

    if len(args) != 2:
        print("\n" + "Usage: rpUnicity <dirname>" + "\n")
        return 1

    path = args[1]
    files = []

    # for f_or_d in os.listdir(path):
    #     if os.path.isfile(f_or_d) and '.xml' in f_or_d:
    #         files.append(os.path.join(r, file))

    # r=root, d=directories, f = files
    for r, d, f in os.walk(path):
        for file in f:
            if '.xml' in file:
                files.append(os.path.join(r, file))

    d_pathways = {}

    for filename in files:

        document = readSBML(filename)

        if document.getNumErrors() > 0:
            printLine("Encountered the following SBML errors:")
            document.printErrors()
            return 1

        level = document.getLevel()
        version = document.getVersion()

        model = document.getModel()

        if model is None:
            print("No model present.")
            return 1

        idString = "  id: "
        if level == 1:
            idString = "name: "
        id = "(empty)"
        if model.isSetId():
            id = model.getId()

            if PRINT:
                PrintInfos1(filename, level, version, idString, id, model)

        # Read RP Annotations
        groups = model.getPlugin('groups')
        rpsbml = rpSBML.rpSBML('test')

        # Get Reactions
        reactions = {}
        for member in groups.getGroup('rp_pathway').getListOfMembers():
            object = model.getReaction(member.getIdRef())
            reactions[member.getIdRef()] = rpsbml.readBRSYNTHAnnotation(
                object.getAnnotation())

        # Get Species
        species = {}
        for specie in model.getListOfSpecies():
            species[specie.getId()] = rpsbml.readBRSYNTHAnnotation(
                specie.getAnnotation())

        # print()
        # print("REACTIONS")
        # print(reactions)
        # print()
        # print("SPECIES")
        # print(species)
        # print()

        # Pathways dict
        d_reactions = {}

        # Select Reactions already loaded (w/o Sink one then)
        for reaction in reactions:

            d_reactions[reactions[reaction]['smiles']] = {}

            # Fill the reactants in a dedicated dict
            d_reactants = {}
            for reactant in model.getReaction(reaction).getListOfReactants(
            ):  #inchikey / inchi sinon miriam sinon IDs
                # Il faut enregistrer toutes les infos (inchi, miriam, ids)
                d_reactants[species[reactant.getSpecies()]
                            ['inchikey']] = reactant.getStoichiometry()
            # Put all reactants dicts in reactions dict for which smiles notations are the keys
            d_reactions[reactions[reaction]
                        ['smiles']]['Reactants'] = d_reactants

            # Fill the products in a dedicated dict
            d_products = {}
            for product in model.getReaction(reaction).getListOfProducts():
                d_products[species[product.getSpecies()]
                           ['inchikey']] = product.getStoichiometry()
            # Put all products dicts in reactions dict for which smiles notations are the keys
            d_reactions[reactions[reaction]['smiles']]['Products'] = d_products

            d_pathways[filename] = d_reactions

            if PRINT:
                PrintInfos2(reaction, d_reactions)

    unique_pathways = []
    unique_files = []

    for file, pathway in d_pathways.items():
        if pathway not in unique_pathways:
            unique_pathways += [pathway]
            unique_files += [file]

    # print(files)
    # print()
    print(unique_files)
    # print()
    # print(Diff(files,unique_files))

    return 0
示例#27
0
 def test_nameToSbmlId(self):
     rpsbml = rpSBML.rpSBML('test', None, os.path.abspath('../cache'))
     id_name = rpsbml._nameToSbmlId('###test_input-23####')
     assert id_name=='___test_input_23___'
示例#28
0
 def test_createUnitDefinition(self):
     rpsbml = rpSBML.rpSBML('test', None, os.path.abspath('../cache'))
     rpsbml.createModel('RetroPath_heterologous_pathway', 'rp_model')
     unitDef = rpsbml.createUnitDefinition('mmol_per_gDW_per_hr')
     inModel = libsbml.readSBML(os.path.join(os.path.abspath('test_models'), 'test_createUnitDefinition.sbml'))
     assert self.compareModels(inModel.getModel(), rpsbml.model)==True
示例#29
0
 def test_genMetaID(self):
     rpsbml = rpSBML.rpSBML('test', None, os.path.abspath('../cache'))
     id_name = rpsbml._genMetaID('###test_input-23####')
     assert id_name=='_5df40e51a5d358ecfdf0372317853a79'
示例#30
0
 def test_compareAnnotations(self):
     rpsbml = rpSBML.rpSBML('test', None, os.path.abspath('../cache'))
     document = libsbml.readSBML('test_models/test_createPathway.sbml')
     model = document.getModel()
     #assert rpsbml.compareAnnotations(model.getSpecies('MNXM1__64__MNXC3').getAnnotation(), model.getSpecies('MNXM15__64__MNXC3').getAnnotation())==False
     assert rpsbml.compareAnnotations(model.getSpecies('MNXM1__64__MNXC3').getAnnotation(), model.getSpecies('MNXM1__64__MNXC3').getAnnotation())==True