I'm new to Python and Pandas, so I would be really glad if someone could help me in this matter. My question is the following:
If I have a .txt file with a set of reactions as strings (R1, R2...). Each reaction has compounds (A,B,C,D...) with their respective stoichiometric coefficients (1, 2, 3...) such as:
R1: A + 2B + C <=> D
R2: A + B <=> C
How can I create a data frame in python in the format of a stoichiometric matrix (compounds as rows X reactions as columns) like this:
R1 R2
A -1 -1
B -2 -1
C -1 1
D 1 0
Observation: Compounds on the left side of the equation should have negative stoichiometric values while the ones on the right should be positive
Thanks =D