示例#1
0
sys.path.append('../../Libs/Python')
from BiochemPy import Reactions

ReactionsHelper = Reactions()
Reactions_Dict = ReactionsHelper.loadReactions()

Update_Reactions = 0
status_file = open("Status_Changes.txt", 'w')
for rxn in sorted(Reactions_Dict.keys()):
    if (Reactions_Dict[rxn]["status"] == "EMPTY"):
        continue

    Rxn_Cpds_Array = ReactionsHelper.parseStoich(
        Reactions_Dict[rxn]["stoichiometry"])
    new_status = ReactionsHelper.balanceReaction(Rxn_Cpds_Array)
    old_status = Reactions_Dict[rxn]["status"]

    #Need to handle reactions with polymers
    if (new_status == "Duplicate reagents"):
        new_status = "NB"
        continue

    if (new_status != old_status and "CK" not in old_status):
        print("Changing Status for " + rxn + " from " + old_status + " to " +
              new_status)
        status_file.write(rxn + "\t" + old_status + "\t" + new_status + "\n")
        Reactions_Dict[rxn]["status"] = new_status
        Update_Reactions += 1

if (Update_Reactions > 0):
示例#2
0
        rxn_code = reactions_helper.generateCode(new_rxn_cpds_array)

        matched_rxn = None
        if (len(new_rxn_cpds_array) == 0):
            matched_rxn = Empty_Rxn_ID
        else:
            if (rxn_code in reactions_codes):
                matched_rxn = sorted(list(reactions_codes[rxn_code]))[0]

        #Because we adjust for water a posterior
        #We need to include water when matching codes, in case
        if (matched_rxn is None):

            #Find statuses that only have water imbalance
            new_status = reactions_helper.balanceReaction(new_rxn_cpds_array)
            if (new_status == "MI:H:2/O:1" or new_status == "MI:H:-2/O:-1"):
                Water_Adjustment = 1
                if ("-1" in new_status):
                    Water_Adjustment = -1

                #Adjust for water
                reactions_helper.adjustCompound(new_rxn_cpds_array, "cpd00001",
                                                float(Water_Adjustment))
                rxn_code = reactions_helper.generateCode(new_rxn_cpds_array)
                if (rxn_code in reactions_codes):
                    matched_rxn = sorted(list(reactions_codes[rxn_code]))[0]

        if (matched_rxn is not None):
            #Add Names, EC and Alias
            #Regardless of match-type, add new names