Tuesday, 27 August 2013

creation of chemical equations from text in python

creation of chemical equations from text in python

The file that I am trying to manipulate is the "reactions" file found in
this webpage : http://wholecellkb.stanford.edu/export/Mgenitalium . I
downloaded it as an excel file. In the Reactions sheet, there is a column
called stoichiometry. The data in the cells which come under this column
is as follows:
{"coefficient": -1.0, "compartment": "c", "molecule": "ATP", "evidence":
[]} , where -ve coefficient means reactants and +ve coefficient means
products.
There is another column called 'Direction'. 'f' means forward and
direction 'r' means reverse. Now , I have to convert this data into this
format:
S1 + 2 S2 --> 2 P1 + 3 P2
S1 + 2 S2 <--> 2 P1 + 3 P2
It is like a typical chemical equation. I am using openpyxl to do the job.
we can also use xlrd. If someone is familiar with openpyxl and xlrd,
please give me an idea on how to convert it.
I started by using the iter_rows function to parse all the values.
I will update as and when i proceed further.

No comments:

Post a Comment