Пример #1
0
 def test_from_full_sbtab(self):
     # Happens to be the order in this file.
     rxns, fluxes, keqs, bounds = SBtabTools.openMultipleSBtab(
         'pathways/test/EMP_glycolysis_full_SBtab.tsv')
     path = pathways.ParsedPathway.from_full_sbtab(rxns, fluxes, bounds,
                                                   keqs)
     path.print_reactions()
Пример #2
0
    def testFromSBtab(self):
        ds = SBtabTools.openMultipleSBtab('pathways/test/EMP_glycolysis_full_SBtab.tsv')
        bs = Bounds.from_sbtab(ds[-1])

        for key in bs.lower_bounds:
        	lb = bs.GetLowerBound(key)
        	ub = bs.GetUpperBound(key)
        	msg = 'bounds for %s lb = %.2g, ub = %.2g' % (key, lb, ub)
        	self.assertLessEqual(lb, ub, msg=msg)
Пример #3
0
    def from_sbtab(self, sbtab):
        """
            read the sbtab file (can be a filename or file handel)
            and use it to initialize the Pathway
        """
        if type(sbtab) == str:
            with open(sbtab, 'r') as sbtabfile:
                sbtabs = SBtabTools.openMultipleSBtabFromFile(sbtabfile)
        elif type(sbtab) == io.TextIOWrapper:
            sbtabs = SBtabTools.openMultipleSBtabFromFile(sbtab)
        tdict = dict([(t.getTableInformation()[1].upper(), t) for t in sbtabs])
        expected_tnames = [
            'REACTION', 'RELATIVEFLUX', 'CONCENTRATIONCONSTRAINT',
            'REACTIONCONSTANT'
        ]
        assert set(expected_tnames).issubset(tdict.keys())

        sbtabs = [tdict[n] for n in expected_tnames]
        return Pathway.from_separate_sbtabs(*sbtabs)
def read_sbtabs(f):
    """Return reactions, fluxes, keqs, bounds."""
    sbtabs = SBtabTools.openMultipleSBtabFromFile(f)
    tdict = dict([(t.getTableInformation()[1].upper(), t) for t in sbtabs])
    expected_tnames = [
        'REACTION', 'RELATIVEFLUX', 'REACTIONCONSTANT',
        'CONCENTRATIONCONSTRAINT'
    ]
    assert set(expected_tnames).issubset(tdict.keys())

    return [tdict[n] for n in expected_tnames]
Пример #5
0
 def testOpenMultipleSBtab(self):
     ds = SBtabTools.openMultipleSBtab(
         'tests/EMP_glycolysis_full_SBtab.tsv')
     self.assertEqual(4, len(ds))
Пример #6
0
 def testOpenMultipleSBtabFromFile(self):
     with open('tests/EMP_glycolysis_full_SBtab.tsv') as f:
         ds = SBtabTools.openMultipleSBtabFromFile(f)
         self.assertEqual(4, len(ds))
Пример #7
0
 def testOpenMultipleSBtab(self):
     ds = SBtabTools.openMultipleSBtab(
         'pathways/test/EMP_glycolysis_full_SBtab.tsv')
     self.assertEqual(3, len(ds))