Exemplo n.º 1
0
 def test_map00950(self):
     system = System()
     with open("KEGG/map00950.rea") as handle:
         for reaction in Map.parse(handle):
             system.add_reaction(reaction)
     rxs = system.reactions()
     self.assertEqual(len(rxs), 56)
     # sort the reaction output by the string names, so that the
     # output will be consistent between python versions
     rxs.sort(key=lambda x: str(x))
     self.assertEqual(
         str(rxs[0]),
         "(R)-N-Methylcoclaurine + (S)-Coclaurine + NADPH + O2 "
         "<=> 2'-Norberbamunine + 2 H2O + NADP")
     self.assertEqual(str(rxs[-1]), "Tyramine <=> Dopamine")
Exemplo n.º 2
0
 def test_map00950(self):
     system = System()
     with open("KEGG/map00950.rea") as handle:
         for reaction in Map.parse(handle):
             system.add_reaction(reaction)
     rxs = system.reactions()
     self.assertEqual(len(rxs), 56)
     # sort the reaction output by the string names, so that the
     # output will be consistent between python versions
     rxs.sort(key=lambda x: str(x))
     self.assertEqual(str(rxs[0]),
                      "(R)-N-Methylcoclaurine + (S)-Coclaurine + NADPH + O2 "
                      "<=> 2'-Norberbamunine + 2 H2O + NADP")
     self.assertEqual(str(rxs[-1]),
                      "Tyramine <=> Dopamine")
Exemplo n.º 3
0
def t_KEGG_Map(testfiles):
    """Tests Bio.KEGG.Map functionality."""
    for file in testfiles:
        fh = open(os.path.join("KEGG", file))
        print "Testing Bio.KEGG.Map on " + file + "\n\n"
        reactions = Map.parse(fh)
        system = System()
        for reaction in reactions:
            system.add_reaction(reaction)
        # sort the reaction output by the string names, so that the
        # output will be consistent between python versions
        def str_cmp(first, second):
            return cmp(str(first), str(second))
        rxs = system.reactions()
        rxs.sort(str_cmp)
        for x in rxs:
            print str(x)
Exemplo n.º 4
0
def t_KEGG_Map(testfiles):
    """Tests Bio.KEGG.Map functionality."""
    for file in testfiles:
        fh = open(os.path.join("KEGG", file))
        print "Testing Bio.KEGG.Map on " + file + "\n\n"
        reactions = Map.parse(fh)
        system = System()
        for reaction in reactions:
            system.add_reaction(reaction)
        # sort the reaction output by the string names, so that the
        # output will be consistent between python versions
        #def str_cmp(first, second):
        #    return cmp(str(first), str(second))
        rxs = system.reactions()
        #sort: key instead of compare function (for py3 support)
        #  The function str_cmp above can be removed if the
        #  solution below proves resilient
        rxs.sort(key=lambda x:str(x))
        for x in rxs:
            print str(x)
Exemplo n.º 5
0
def t_KEGG_Map(testfiles):
    """Tests Bio.KEGG.Map functionality."""
    for file in testfiles:
        fh = open(os.path.join("KEGG", file))
        print "Testing Bio.KEGG.Map on " + file + "\n\n"
        reactions = Map.parse(fh)
        system = System()
        for reaction in reactions:
            system.add_reaction(reaction)
        # sort the reaction output by the string names, so that the
        # output will be consistent between python versions
        #def str_cmp(first, second):
        #    return cmp(str(first), str(second))
        rxs = system.reactions()
        #sort: key instead of compare function (for py3 support)
        #  The function str_cmp above can be removed if the
        #  solution below proves resilient
        rxs.sort(key=lambda x:str(x))
        for x in rxs:
            print str(x)
        fh.close()