Esempio n. 1
0
def parse_file(in_file_path):
    file = xlrd.open_workbook(in_file_path)
    sheet = file.sheet_by_index(0)
    system_list = []
    for cur_row in range(1, sheet.nrows):
        fs = [sheet.cell_value(cur_row, x) for x in [0, 1, 2, 5, 6, 7, 8, 9]]
        one_system = System(inventory=fs[0],
                            hostname=fs[1],
                            os_info=fs[2],
                            platform=fs[3],
                            cpu_num=fs[4],
                            memory=fs[5])
        system_list.append(one_system)
    return system_list
Esempio n. 2
0
from modules.System import *
from modules.Subsystem import *

# Create a System object to place the Subsystems in
cell = System('cell')

### Model reduction
# Create a Double Phosphorylation Subsystem object using SBML model
DP1 = cell.createSubsystem('models/DP.xml', '1')

# To set particular reactions as fast, use the following method.
# The following sets the reactions 1st, 2nd and 7th as Fast.
DP1.setFastReactions([1, 2, 7])
# DP1.setFastReactions(1)

# To get the list of reactions that are set as Fast in the Subsystem model
# the following method can be used with the Subsystem object.
fast_reactions = DP1.getFastReactions()
# Print the id of the fast reactions obtained above
for rxn in fast_reactions:
    print(rxn.getId())
# To reduce the model, the fast reactions are simulated separately for
# a fixed length of time and the species concerned with these reactions
# are fixed at their steady state in the reduced model. The fast reactions
# are removed from the reduced model. The timepointsForFast defined the timepoints
# for which the fast model will be simulated

timepointsForFast = np.linspace(0, 100, 10)

# Call the modelReduce method to reduce the given
# Subsystem model with the timepoints defined above
from modules.System import *
from modules.Subsystem import *
from modules.SimpleModel import *
from modules.NewReaction import *

# Create a System object to hold the Subsystem
cell = System('cell')

IFFL = cell.createNewSubsystem(3, 1)

# Create a Model object inside the Subsystem object
# Usage - self.createNewModel(modelID, modelTimeUnits, modelExtentUnits, modelSubstanceUnits)

model = IFFL.createNewModel('IFFLmodel', 'second', 'mole', 'count')

# Create the simpleModel of the SimpleModel class to use the functions helpful in creating the model from scratch easily
simpleModel = SimpleModel(model)

# Create a unit definition for rate constants
# Usage - self.createNewUnitDefinition(unitId, unitKind, unitExponent, unitScale, unitMultiplier)
# Returns a UnitDefinition object
per_second = simpleModel.createNewUnitDefinition('per_second',
                                                 UNIT_KIND_SECOND, -1, 0, 1)
count = simpleModel.createNewUnitDefinition('count', UNIT_KIND_DIMENSIONLESS,
                                            1, 0, 1)

# Create a compartment for the species
# Usage - self.createNewCompartment(Id, Name, Size, Units, isConstant)
# Returns a Compartment object
comp = simpleModel.createNewCompartment('cell', 'cell', 1, 'litre', True)
Esempio n. 4
0
import numpy as np
from libsbml import *
from modules.Subsystem import *
from modules.SimpleModel import *
from modules.System import *

# Create system
cell = System('cell')
cell.ListOfSharedResources = ['RNAP', 'Ribo', 'AGTP', 'CUTP', 'AA']

# Create subsystems from SBML model files inside the system
S1 = cell.createSubsystem('models/txtlsimMATLAB_S1.xml', 'S1')
S2 = cell.createSubsystem('models/txtlsimMATLAB_S2.xml', 'S2')

# sharing
shared_subsystem = cell.setSharedResources()
writeSBML(shared_subsystem.getSubsystemDoc(), 'models/txtl_shared.xml')

# combining
combined_subsystem = cell.createNewSubsystem(3, 1)
combined_subsystem.combineSubsystems([S1, S2], True)
writeSBML(combined_subsystem.getSubsystemDoc(), 'models/txtl_combined.xml')

# connecting
# user specifies how the systems interact by defining the following map
connection_logic = {}
# Use renameSName function to rename some species as desired
# S1.renameSName('protein deGFP','protein deGFP activated')
# S2.renameSName('RecBCD','activator')
# connection_logic['activator'] = 'protein deGFP activated'
# connected_subsystem = cell.createNewSubsystem(3,1)
Esempio n. 5
0
import numpy as np
from libsbml import *
from modules.Subsystem import *
from modules.SimpleModel import *
from modules.System import *
# Create a system. Example - A cell system which acts as a container for 
# all the different subsystems. Here, cell is an object of the System class.
 
cell = System('cell')

# The ListOfSharedResources is a list to name all the species that are shared
# in the cell system. Usually, we would have something as follows - 
# system.ListOfSharedResources = ['RNAP','Ribo','ATP']

# For our simple example of DP and IFFL subsystems, we use the following for a working demo
cell.ListOfSharedResources = ['inP','X:P']


# Now, create a subsystem inside the cell as follows - 
# Usage self.createSubsystem(filename, string)
# The string can be anything and is used to name the components of the subsystem
# An object of the Subsystem classs is returned 
# and a list of subsystems being added to the cell is recorded. Here, DP1.
DP1 = cell.createSubsystem('models/DP.xml','DP1')

# There are other optional steps -

# (Optional) Give a new string to suffix all components of the model. 
# By default, the names are suffixed by the keyword given to make the Subsystem object.
# Usage -  DP1_doc = DP1.suffixAllElementIds('DPx')
Esempio n. 6
0
from modules.System import *
from modules.Subsystem import *

cell = System('cell')
IFFL = cell.createSubsystem('models/IFFL.xml', '1')
IFFL.setFastReactions(1)
writeSBML(IFFL.getSubsystemDoc(), 'models/IFFLfast.xml')
timepointsFast = np.linspace(0, 10000, 10)
IFFLreduced = IFFL.modelReduce(timepointsFast)
writeSBML(IFFLreduced.getSubsystemDoc(), 'models/IFFLreduced.xml')
timepoints = np.linspace(0, 10, 1000)
plotSbmlWithBioscrape(['models/IFFLfast.xml', 'models/IFFLreduced.xml'], 0,
                      timepoints,
                      [['inp_IFFL', 'out_IFFL'], ['inp_IFFL', 'out_IFFL']])
Esempio n. 7
0
import numpy as np
from libsbml import *
from modules.Subsystem import *
from modules.System import *

cell = System('cell')
cell.ListOfSharedResources = ['RNAP', 'Ribo', 'ATP']

# A1 - promoter sig28 -tetO - utr1 - deGFP
# A1 - pLac - utr1 - sigma28 (constituitively expressed protein sigma28 - input plasmid)
A1 = cell.createSubsystem('models/A1.xml', 'A1')
# SBML model gets converted to Level 3 Version 1
writeSBML(A1.getSubsystemDoc(), 'models/A1converted.xml')
# Simulate using bioscrape
timepoints = np.linspace(0, 14 * 60 * 6000, 1000)

plotSbmlWithBioscrape('models/A1converted.xml', 0, timepoints,
                      ['protein deGFP*', 'protein sigma28'], 'Time',
                      'concentration (nM)', 14, 14)
Esempio n. 8
0
import numpy as np
from libsbml import *
from modules.Subsystem import *
from modules.System import *

cell = System('cell')
# cell.ListOfSharedResources = ['RNAP']
A0 = cell.createSubsystem('models/A0.xml', 'A0')
A1 = cell.createSubsystem('models/A1.xml', 'A1')
B0 = cell.createSubsystem('models/B0.xml', 'B0')
B1 = cell.createSubsystem('models/B1.xml', 'B1')

AnB = cell.createSubsystem('models/AnimplyB.xml', 'AnB')
writeSBML(AnB.getSubsystemDoc(), 'models/AnimplyB_mod.xml')
# combined00 = createNewSubsystem(3,1)
# combined00.combineSubsystems([A0, B0],True, 'virtual')
# writeSBML(combined00.getSubsystemDoc(),'models/combined00.xml')

# combined01 = createNewSubsystem(3,1)
# combined01.combineSubsystems([A0,B1],True, 'volume')
# writeSBML(combined01.getSubsystemDoc(),'models/combined01.xml')

# combined10 = createNewSubsystem(3,1)
# combined10.combineSubsystems([A1, B0],True, 'volume')
# writeSBML(combined10.getSubsystemDoc(),'models/combined10.xml')

combined11 = createNewSubsystem(3, 1)
combined11.combineSubsystems([A1, B1], True, 'virtual')
writeSBML(combined11.getSubsystemDoc(), 'models/combined11.xml')

# Simulate using bioscrape
Esempio n. 9
0
##### Creating a Double Phosphorylation SBML model ####

from modules.System import *
from modules.Subsystem import *
from modules.SimpleModel import *
from modules.NewReaction import *

# Create a System to hold the Subsystems
cell = System('cell')

# Create a new SBML Document to hold the subsystem model
DP = cell.createNewSubsystem(3, 1)

# Create a new model inside the document
model = DP.createNewModel('DP', 'second', 'mole', 'count')
# Creating the model object to use simple model creation commands that follow
simpleModel = SimpleModel(model)

# simpleModel.getModel() returns the libSBML model object and then all methods applicable
# for Model libsbml class can be used. Usage example -
# model = simpleModel.getModel()
# model.setLengthUnits('count')

# print(simpleModel.getModel().toSBML())
# Create a unit, arguments - id, unitKind, exponent, scale, multiplier
per_second = simpleModel.createNewUnitDefinition('per_second',
                                                 UNIT_KIND_SECOND, -1, 0, 1)
count = simpleModel.createNewUnitDefinition('count', UNIT_KIND_DIMENSIONLESS,
                                            1, 0, 1)

# createNewcompartment arguments - compartment ID, Name, Size, Units, isConstant
Esempio n. 10
0
import numpy as np
from libsbml import *
from modules.Subsystem import *
from modules.System import *

cell = System('cell')
# A0 - promoter sig28 -tetO - utr1 - deGFP
A0 = cell.createSubsystem('models/A0.xml', 'A0')
# SBML model gets converted to Level 3 Version 1
writeSBML(A0.getSubsystemDoc(), 'models/A0converted.xml')
# Simulate using bioscrape
timepoints = np.linspace(0, 14 * 60 * 60, 1000)

plotSbmlWithBioscrape('models/A0converted.xml', 0, timepoints,
                      ['protein deGFP*', 'protein sigma28'], 'Time',
                      'concentration (nM)', 14, 14)
Esempio n. 11
0
import numpy as np
from libsbml import *
from modules.Subsystem import *
from modules.System import *

cell = System('cell')

# B1 - promoter sigX - utr1 - tetR
# B1 - pLac - utr1 - sigmaX (constituitively expressed protein sigmaX - input plasmid)
B1 = cell.createSubsystem('models/B1.xml', 'B1')
# SBML model gets converted to Level 3 Version 1
writeSBML(B1.getSubsystemDoc(), 'models/B1converted.xml')
# Simulate using bioscrape
timepoints = np.linspace(0, 14 * 60 * 60000, 1000)

plotSbmlWithBioscrape('models/B1converted.xml', 0, timepoints,
                      ['protein tetRdimer', 'protein sigmaX'], 'Time',
                      'concentration (nM)', 14, 14)
Esempio n. 12
0
def index():
    _system = System()
    _system.update()
    args = dict(state.template_args, system=_system)
    return args
Esempio n. 13
0
import numpy as np
from libsbml import *
from modules.Subsystem import *
from modules.System import *

cell = System('cell')
# B0 - promoter sigX - utr1 - tetR
B0 = cell.createSubsystem('models/B0.xml', 'B0')
# SBML model gets converted to Level 3 Version 1
writeSBML(B0.getSubsystemDoc(), 'models/B0converted.xml')
# Simulate using bioscrape
timepoints = np.linspace(0, 14 * 60 * 60, 1000)

plotSbmlWithBioscrape('models/B0converted.xml', 0, timepoints,
                      ['protein tetRdimer'], 'Time', 'concentration (nM)', 14,
                      14)
Esempio n. 14
0
from modules.System import *
from modules.Subsystem import *

# Create a System object to place the Subsystems in
cell = System('cell')

## Reversible reactions

# Tutorial on how to get the list of reversible reactions in the model
# and how to set new reactions as reversible
DP2 = cell.createSubsystem('models/DP.xml', '2')

# To get the reactions that are set as reversible,
# the following method can be used on the Subsystem object
reversible_rxns = DP2.getReversibleReactions()
# Print the ids of the reactions that are reversible
# for rxn in reversible_rxns:
#     print(rxn.getId())

# Create the new parameters in the Subsystem model that will be introduced
# (if any) on changing the rate formula
model_obj = SimpleModel(DP2.getSubsystemDoc().getModel())
model_obj.createNewParameter('k2r', 1, True, 'per_second')
model_obj.createNewParameter('k2f', 1, True, 'per_second')

# Set the reactions indexes in the first argument as reversible
# and the new rate formula of the corresponding reactions given in the second argument
DP2_new = DP2.setReversibleReactions(
    2, 'k2f*' + model_obj.getSpeciesByName('inP:X').getId() + '- k2r*' +
    model_obj.getSpeciesByName('inP').getId() + '*' +
    model_obj.getSpeciesByName('X:P').getId())