我有一个来自Reactome的sbml模型,您可以从https://reactome.org/content/detail/R-HSA-156581下载它,然后单击sbml。对于<reaction>,其中一些具有<listOfModifiers>属性,我尝试使用libsbml或cobrapy来实现这一点。
我的代码读取sbml文件,但是如何获得<listOfModifiers>的属性
sbml_test_file = "./R-HSA-156581.sbml"
# Using the libSBML python API
# http://model.caltech.edu/software/libsbml/5.18.0/docs/formatted/python-api/libsbml-python-reading-files.html
reader = libsbml.SBMLReader()
document = reader.readSBML(sbml_test_file)
model = document.getModel()发布于 2021-01-22 05:25:13
libsbml旨在直接模拟SBML本身的结构。所以,一旦你有了模型,你就得到了模型的反应,一旦你有了反应,你就得到了反应的修饰符:
import libsbml
sbml_test_file = "R-HSA-156581.sbml"
reader = libsbml.SBMLReader()
document = reader.readSBML(sbml_test_file)
model = document.getModel()
for r in range(model.getNumReactions()):
rxn = model.getReaction(r)
for m in range(rxn.getNumModifiers()):
mod = rxn.getModifier(m)
print(mod.getId(), "in reaction", rxn.getId())https://stackoverflow.com/questions/65814346
复制相似问题