widget4.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:MMinte 作者: mendessoares 项目源码 文件源码
def addEXMets2SpeciesEX(reverseEXmodel,speciesModel):
    '''
    This function takes the model with exchange reactions where the metabolite is produced (output from function createReverseEXmodel) and a species model, and adds the metabolite from the reverse model to the exhange reactions of the species model. For instance:

    Reaction :  modelB_EX_cpd11588_e0 got the cpd11588_e0[u] added.
                'model_B_cpd11588_e0 <=> cpd11588_e0[u]'

    This way, when a compound is exported to the extracellular environment, it is automatically transformed into a form that is common to all members in the community.

    :param reverseEXmodel: cobrapy Model object containing only exchange reactions with the production of their respective metabolites
    :param speciesModel: Model object of a particular species.
    :return speciesModel: Model object of a particular species with updated exchange reactions are updated.
    '''

    cherrypy.log('Started function to add metabolites to the exchange reactions of the reverse exchange model') #not right

    for j in range(len(reverseEXmodel.reactions)):
        exRxn = str(reverseEXmodel.reactions[j])

        for i in range(len(speciesModel.reactions)):
            rxn = str(speciesModel.reactions[i])
            if rxn in exRxn:
                new_met = reverseEXmodel.reactions[j].metabolites 
                speciesModel.reactions[i].add_metabolites(new_met)
                speciesModel.reactions[i].lower_bound = -1000.000
                speciesModel.reactions[i].upper_bound = 1000.000

    cherrypy.log('Finished adding metabolites to the exchange reactions of the reverse exchange model')
    return speciesModel
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号