Back to index

python-biopython  1.60
Functions
Bio.KEGG.Map Namespace Reference

Functions

def parse

Function Documentation

def Bio.KEGG.Map.parse (   handle)

Definition at line 24 of file __init__.py.

00024 
00025 def parse(handle):
00026     for line in handle:
00027         data, catalysts, reaction = line.split(":")
00028         catalysts = [(catalysts,)]
00029         reactants = {}
00030         before, after = reaction.split("<=>")
00031         compounds = before.split(" + ")
00032         for compound in compounds:
00033             compound = compound.strip()
00034             try:
00035                number, compound = compound.split()
00036                number = -int(number)
00037             except ValueError:
00038                number = -1
00039             reactants[compound] = number
00040         compounds = after.split(" + ")
00041         for compound in compounds:
00042             compound = compound.strip()
00043             try:
00044                number, compound = compound.split()
00045                number = int(number)
00046             except ValueError:
00047                number = +1
00048             reactants[compound] = number
00049         yield Reaction(reactants, catalysts, True, data)