Optenvelope

addEnv(origModel, biomass, desiredProduct, varargin)[source]

addEnv adds envelope to figure Algorithm is able to knock out genes as well as reactions to produce production envelope

USAGE

line = addEnv (origModel, biomass, desiredProduct, ‘KnockOuts’, knockouts, ‘colour’, colour, ‘prodMol’, prodMol, ‘subUptake’, subUptake, ‘molarSum’, molarSum)

INPUTS
  • origModel COBRA model structure [struct]

  • biomass Reaction name of biomass [char]

  • desiredProduct Reaction name of desired product [char]

OPTIONAL INPUTS
  • KnockOuts (opt) – {})

  • colour (opt) – ‘r’ (red))

  • prodMol (opt)

  • subUptake (opt)

  • molarSum (opt)

OUTPUTS

line Line data for plot function

NOTES

Sometimes last point of envelope drops to zero (might be rounding error) but this function connects last points of lines so the graph creates continuous line. This algorithm only adds graph. It does not change labels.

Example

line = addEnv(model, ‘BIOMASS_Ecoli’, ‘EX_ac_e’, {‘GHMT2r’,’GND’,’SUCCt2r’,’SUCD4’,’AKGt2r’,’GLUt2r’}, ‘m’)

AUTHORS

Created by Kristaps Berzins 31/10/2022 Modified by Kristaps Berzins 30/09/2024

milpOEReinserts(model, data, K, minP, numKO, toDel, timeLimit, printLevel)[source]

This function is creating and calculating MILP to get certain amount of knockouts to achieve best production envelope

USAGE

[knockouts] = milpOEReinserts (model, data, K, minP, numKO, toDel, timeLimit, printLevel)

INPUTS
  • model COBRA model structure in irreversible form [struct]

  • data Struct with information about

    • mainActive List of active reactions for main envelope [cell array]

  • K List of reactions that cannot be selected for knockout (reaction IDs)

  • minP Struct with information about biomass and desired product.

    • bioID ID of biomass [double]
      • proID ID of desired product[double]

  • numKO Number of knockouts to achieve [double]

OPTIONAL INPUTS
  • toDel Numeric variable that shows what to delete – 0: reactions 1: genes 2: enzymes

  • timeLimit Time limit for gurobi optimization (in seconds)

  • printLevel Print level for gurobi optimization [double]

OUTPUTS

knockouts List of reactions that when removed gives optimal envelope

AUTHORS

created by Kristaps Berzins 31/10/2022

Notes

This function is not designed for stand-alone use. Should be used by using optEnvelope.m with set numKO parameter

minActiveRxns(model, matchRev, K, minP, toDel, timeLimit, midPoints, printLevel)[source]

This function finds a set of minimum number of reactions needed to be active at a specific point on production envelope for best possible production envelope

USAGE

[data]=minActiveRxns (model, matchRev, K, minP, toDel, timeLimit, midPoints, printLevel)

INPUTS
  • model COBRA model structure in irreversible form [struct]

  • matchRev Matching of forward and backward reactions of a reversible – reaction [double array]

  • K List of reactions that cannot be selected for knockout (reaction IDs)

  • minP Struct with information about biomass and desired product.

    • bioID ID of biomass [double]

    • bioMin 1% of max value of biomass in wild-type [double]

    • bioMax max value of biomass in wild-type [double]

    • proID ID of desired product[double]

    • proMin 1% of max value of desired product in wild-type [double]

    • proMax max value of desired product in wild-type [double]

  • toDel Numeric variable that shows what to delete – 0: reactions 1: genes 2: enzymes

  • timeLimit Time limit for gurobi optimization (in seconds)

  • midPoints Number of mid points to calculate active reactions for (default – 0) [double]

  • printLevel Print level for gurobi optimization (default – 0) [double]

OUTPUTS

data Struct with information about

  • pro Minimal product for best envelope

  • bio Maximum biomass for best envelope

  • results results of MILP

  • mainModel model for main envelope

  • mainActive List of active reactions for main envelope

  • models models for all mid envelopes

  • active Lists for active reactions for mid envelopes

Note

This function is designed to be used with optEnvelope and was not designed as stand-alone function.

AUTHORS

created by Ehsan Motamedian 09/02/2022 modified by Kristaps Berzins 31/10/2022 modified by Kristaps Berzins 30/10/2024 Added calculation of active reactions for middle points

optEnvelope(model, desiredProduct, varargin)[source]

optEnvelope uses MILP to find minimum active reactions and then finds smallest set of reactions in the pool of inactive reactions that offers same production envelope. Algorith provides multiple ways to reinsert reactions - sequential, MILP, GA(under construction)

USAGE

[main, mid] = optEnvelope (model, desiredProduct, ‘protectedRxns’, protectedRxns, ‘numTries’, numTries, ‘numKO’, numKO, ‘prodMol’, prodMol, ‘midPoints’, midPoints, ‘timeLimit’, timeLimit, ‘printLevel’, printLevel, ‘drawEnvelope’, drawEnvelope)

INPUTS
  • model COBRA model structure [struct]

  • desiredProduct Reaction name of desired product [char]

OPTIONAL INPUTS
  • protectedRxns (opt) Aditional reactions to ignore (must be in irreversible form) – {})

  • numTries (opt) – [])

  • numKO (opt) Number of reactions to remove for final result (triggers MILP for reaction reinsertion) – [])

  • prodMol (opt) Molar mass of product for yield plot (g/mol) – [])

  • midPoints (opt) – 0)

  • timeLimit (opt) Time limit for gurobi optimization in seconds (also limits time for numTries) – inf)

  • printLevel (opt) – 0)

  • drawEnvelope (opt) – true)

  • delGenes (unfinished function)

  • delEnzymes (unfinished function)

  • GAon (unfinished function)

OUTPUTS
  • main Structure that contains information about reactions to remove for optimal envelope – Information about most probable point

  • mid Structure that contains information about reactions to remove for midpoint envelopes – Information about most probable points for midpoint envelopes

  • EXAMPLE – [mainKnockouts, midKnockouts] = optEnvelope(model, ‘EX_ac_e’, ‘timeLimit’, 600, ‘protectedRxns’, {‘H2Ot_f’,’H2Ot_b’}, ‘midPoints’, 15);

NOTES

It should be mentioned that a figure (desired product versus biomass) including plots for wild-type and opt enveople is presented after running optEnvelope Mid Envelopes currently work only for sequential (default) reinsertions

AUTHORS

created by Ehsan Motamedian 02/09/2022 modified by Kristaps Berzins 06/12/2022 modified by Ehsan Motamedian 25/01/2023 switch to middle points was added modified by Kristaps Berzins 30/09/2024 improved algorightms, fixed bugs, added functionality

seperateTransposeJoinOE(A, Ay, B, C, ySize, yMax, aSizeCol, highNum, zSize)[source]

Function to transpose and join arrays for milpOEReinserts.m function

Author(s): Kristaps Berzins

sequentialOEReinserts(modelOld, data, K, toDel, minP, midPoints, numTries, timeLimit)[source]

This function is going through inactive reactions sequentially and reinserting them one by one to get best possible set of knockouts while retaining optimal envelope. With numTries parameter this can be done multiple times by randomizing list of inactive reactions

USAGE

[mainKnockouts, finalMidKnockouts] = sequentialOEReinserts (modelOld, data, K, toDel, minP, midPoints, numTries, timeLimit)

INPUTS
  • modelOld COBRA model structure in irreversible form [struct]

  • data Struct with information about

    • mainModel model for main envelope [struct]

    • mainActive List of active reactions for main envelope [cell array]

    • models models for all mid envelopes [struct]

    • active Lists for active reactions for mid envelopes [cell array]

  • K List of reactions that cannot be selected for knockout (reaction IDs)

  • toDel Variable that shows what to delete – 0: reactions 1: genes 2: enzymes

  • minP Struct with information about

    • bioID ID of biomass [double]

    • proID ID of desired product [double]

  • midPoints Number of middle points to calculate mid envelopes for [double]

  • numTries Number of iterations for randomizing indexes of inactive reactions [double]

  • timeLimit Time limit for gurobi optimization (in seconds)

OUTPUTS
  • mainKnockouts List of reactions that when removed gives optimal envelope

  • finalMidKnockouts List of reactions that when removed gives optimal – envelopes for middle envelopes

Example

[mainKnockouts, finalMidKnockouts] = sequentialOEReinserts(model, data, K, 0, minP, 10, 10, 60)

AUTHORS

created by Kristaps Berzins 31/10/2022

Notes

This function is not designed for stand-alone use. Should be used by using optEnvelope.m