我在 Python 中有以下列表:
[{"coefficient": -1.0, "compartment": "c", "molecule": "A", "evidence": []},
{"coefficient": -1.0, "compartment": "c", "molecule": "B", "evidence": []},
{"coefficient": -1.0, "compartment": "c", "molecule": "C", "evidence": []},
{"coefficient": 1.0, "compartment": "c", "molecule": "D", "evidence": []},
{"coefficient": 1.0, "compartment": "c", "molecule": "E", "evidence": []},
{"coefficient": 1.0, "compartment": "c", "molecule": "F", "evidence": []}]
我想将其转换为:
A + B + C --> D + E + F
在 python 中执行此操作的最简单方法是什么?
规则是:
- 如果系数为负,我想将相应的分子视为反应物。
- 如果系数为正,我想将相应的分子视为产品。
-->
反应物出现在标记的左侧。-->
产品位于标记的右侧。