Skip to content

Commit

Permalink
Bug fixes in SimpleModel, SimpleReaction, Subsystem. New features add…
Browse files Browse the repository at this point in the history
…ed to Subsystems. (#9)

* setting up setuptools to install subsbml package (not yet working)

* core working branch

* tutorial.py working - share, combine, connect. Initial amount volume mode does not work

* volume mode problems fixed for shareSpecies. Need to carry forward changes to others. Also not working for species not in list of shared resources. Also setting size using system size in volume mode amounts

* tutorial.py and iptg_transport.py both are working now. share, combine, and connect all working. Need to fix the volume mode and make it consistent all over.

* iptg graph temp

* setup working. imports fixed. consistent and correct importing of modules.

* simulatemultiplevariable method modified, compartment option added. IPTG_transport graph generate for multiple inputs

* combine/share etc. all working and updated for normal combine, not working yet in the new framework for combinations inside a System

* changed back to l3v2, because fast attribute is mandatory with l3v1, and it has been removed from the code. tutorial.py is working but combineSubsystem is not. minor fixes needed

* problem with combinesubsystems

* shareSubsystem working with volume mode

* subsystem.py modified

* combine working. share, connect, combine, all 3 working in all of the modes. Volume mode also works perfectly, virtual mode works too. combine does not depend on share now. All valid SBML models generated in SBML l3v2.

* removing trash files

* all of the core features in subsbml are working, generating and converting to latest SBML level and version (l3v2). IPTG transport example working with this commit

* jupyter notebooks edited, all 3 working now

* removed useless files and removed model reduction example since fast attribute was used which is obsolete in SBML L3v2

* added createBasicSubsystem to create one Subsystem with a SBMLDocument, SBML Model inside, and make all the basic settings using a standard set of preassigned values. An important bug fix in createSimpleReaction in SimpleModel class, to allow for reactions which create or degrade a particular species into nothing (when product/reactant missing).

* modified SimpleReaction.py to fix bug for creating simple reaction with numbers in species names/ids

* modified SimpleReaction.py to fix bug for creating simple reaction with numbers in species names/ids (#3)

* modified iptg transport circuit. Improved membrane model. simulateVariableInputs method modified and multiple bugs fixed. Accepts lists for compartments, plotting options in a single plot or a matrix using subplots (not yet working).

* added varying alhl and varying gfp dna plots to guide experiment on their concentrations. fixed minor bug in simulate variable inputs for compartment species in else loop set to species id, replaced now with blank string, so optional keywords arguments should work. also added **kwargs to this function argument

* iptg transport working with modifications to variable input simulations

* bug in create unit definition in simple model fixed

* added gitignore to remove temp files to go to github repo, bug fixes in SimpleModel class

* Simple model (#5)

* modified SimpleReaction.py to fix bug for creating simple reaction with numbers in species names/ids

* bug in create unit definition in simple model fixed

* added gitignore to remove temp files to go to github repo, bug fixes in SimpleModel class

* Transport - setMembrane etc. fixed.  (#4)

* modified SimpleReaction.py to fix bug for creating simple reaction with numbers in species names/ids

* modified iptg transport circuit. Improved membrane model. simulateVariableInputs method modified and multiple bugs fixed. Accepts lists for compartments, plotting options in a single plot or a matrix using subplots (not yet working).

* added varying alhl and varying gfp dna plots to guide experiment on their concentrations. fixed minor bug in simulate variable inputs for compartment species in else loop set to species id, replaced now with blank string, so optional keywords arguments should work. also added **kwargs to this function argument

* iptg transport working with modifications to variable input simulations

* all examples and tutorials running with the latest code. Need to create unit tests so that further code developments have backward compatibility. IPTG transport example renamed to main_IPTG_transport for better visibility.
  • Loading branch information
ayush9pandey authored Feb 7, 2019
1 parent 9eb4591 commit d821027
Show file tree
Hide file tree
Showing 39 changed files with 37,228 additions and 455 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.ipynb_checkpoints
subsbml.egg-info/
build/
dist/
examples/.ipynb_checkpoints/
__pycache__/
*.pyc
*.orig
13 changes: 5 additions & 8 deletions examples/A nimply B/A0sim.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import numpy as np
from libsbml import *
from modules.Subsystem import *
from modules.System import *
from subsbml 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')
# SBML model gets converted to Level 3 Version 2
# libsbml.writeSBML(A0.getSBMLDocument(),'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)
A0.plotBioscrape(['protein deGFP*','protein sigma28'],timepoints, xlabel = 'Time',
ylabel = 'concentration (nM)',sizeOfXLabels = 14,sizeOfYLabels = 14)
10 changes: 3 additions & 7 deletions examples/A nimply B/A1sim.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import numpy as np
from libsbml import *
from modules.Subsystem import *
from modules.System import *
from subsbml import *

cell = System('cell')
cell.ListOfSharedResources = ['RNAP','Ribo','ATP']
Expand All @@ -10,10 +8,8 @@
# 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')
libsbml.writeSBML(A1.getSBMLDocument(),'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)
A1.plotBioscrape(['protein deGFP*','protein sigma28'],timepoints)
27 changes: 12 additions & 15 deletions examples/A nimply B/AnimplyB.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import numpy as np
from libsbml import *
from modules.Subsystem import *
from modules.System import *
from subsbml import *

cell = System('cell')
# cell.ListOfSharedResources = ['RNAP']
Expand All @@ -11,30 +9,30 @@
B1 = cell.createSubsystem('models/B1.xml','B1')

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

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

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


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

# Simulate using bioscrape
t_end = 14*60*60
points = 1200
timepoints = np.linspace(0, t_end, points)

# combined = createNewSubsystem(3,1)
# combined = createNewSubsystem()
# combined.combineSubsystems([A1, B1],True, 'virtual')

# ListOfInputs = ['DNA plac--utr1--sigma28','DNA plac--utr1--sigmaX']
Expand Down Expand Up @@ -62,5 +60,4 @@
# timepoints,['protein deGFP', 'protein sigma28', 'protein sigmaX', 'protein deGFP*', 'protein tetR', 'protein tetRdimer'],'Time',
# timepoints,['protein deGFP*', 'protein tetRdimer', 'protein sigmaX'],'Time',
# timepoints,['protein deGFP*', 'protein tetRdimer', 'protein sigma28'],'Time',
timepoints,['protein deGFP*','protein sigma28', 'protein sigmaX', 'protein tetRdimer', 'protein deGFP', 'protein tetR'],'Time',
'concentration (nM)')
timepoints,['protein deGFP*','protein sigma28', 'protein sigmaX', 'protein tetRdimer', 'protein deGFP', 'protein tetR'])
31 changes: 14 additions & 17 deletions examples/A nimply B/AnimplyB_withAHL.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import numpy as np
from libsbml import *
from modules.Subsystem import *
from modules.System import *
from subsbml import *

cell = System('cell')

Expand All @@ -21,41 +19,40 @@
check(plux_par.setValue(0), 'setting leaky parameter zero')
check(plas_par.setValue(0), 'setting leaky parameter zero')

connected = createNewSubsystem(3,1)
# connected.connectSubsystems([AnB_ss, Input], connection_logic, 'virtual', True)
connected.connectSubsystems([AnB_ss, Input], connection_logic, 'virtual', True)
writeSBML(connected.getSBMLDocument(), 'models/AnBconnected.xml')
connected = createNewSubsystem()
doc = connected.connectSubsystems([AnB_ss, Input], connection_logic, 'virtual', True)
libsbml.writeSBML(doc, 'models/AnBconnected00.xml')
# Simulate 00 case
timepoints = np.linspace(0,14*60*60,2000)
# plotSbmlWithBioscrape('models/AnBconnected.xml',0,timepoints,['protein tetRdimer', 'protein deGFP*', 'protein lasR', 'protein luxR'])
connected.plotBioscrape(['protein tetRdimer', 'protein deGFP*', 'protein lasR', 'protein luxR'], timepoints)

simpleModel = SimpleModel(connected.getSBMLDocument().getModel())
oc6 = simpleModel.getSpeciesByName('OC6HSL')
oc12 = simpleModel.getSpeciesByName('OC12HSL')
oc6 = simpleModel.getSpeciesByName('inputA')
oc12 = simpleModel.getSpeciesByName('inputB')

oc6.setInitialAmount(0)
oc12.setInitialAmount(500)

writeSBML(connected.getSBMLDocument(), 'models/AnBconnected01.xml')
libsbml.writeSBML(doc, 'models/AnBconnected01.xml')
# Simulate 01 case
timepoints = np.linspace(0,14*60*60,2000)
# plotSbmlWithBioscrape('models/AnBconnected01.xml',0,timepoints,['protein tetRdimer', 'protein deGFP*', 'protein lasR', 'protein luxR'])
connected.plotBioscrape(['protein tetRdimer', 'protein deGFP*', 'protein lasR', 'protein luxR'], timepoints)

oc6.setInitialAmount(500)
oc12.setInitialAmount(0)

writeSBML(connected.getSBMLDocument(), 'models/AnBconnected10.xml')
libsbml.writeSBML(doc, 'models/AnBconnected10.xml')
# Simulate 10 case
timepoints = np.linspace(0,14*60*60,500)
# plotSbmlWithBioscrape('models/AnBconnected10.xml',0,timepoints,['protein tetRdimer', 'protein deGFP*', 'protein lasR', 'protein luxR'])
connected.plotBioscrape(['protein tetRdimer', 'protein deGFP*', 'protein lasR', 'protein luxR'], timepoints)

oc6.setInitialAmount(500)
oc12.setInitialAmount(500)


writeSBML(connected.getSBMLDocument(), 'models/AnBconnected11.xml')
libsbml.writeSBML(doc, 'models/AnBconnected11.xml')
# Simulate 11 case
timepoints = np.linspace(0,14*60*60,100)
plotSbmlWithBioscrape('models/AnBconnected11.xml',0,timepoints,['protein tetRdimer', 'protein deGFP*', 'protein lasR', 'protein luxR'])

connected.plotBioscrape(['protein tetRdimer', 'protein deGFP*', 'protein lasR', 'protein luxR'],timepoints)

print('Successfully completed simulations. GFP expression should only be high for the 10 case (the third plot that was displayed)')
10 changes: 3 additions & 7 deletions examples/A nimply B/B0sim.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import numpy as np
from libsbml import *
from modules.Subsystem import *
from modules.System import *
from subsbml 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')
libsbml.writeSBML(B0.getSBMLDocument(),'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)
B0.plotBioscrape(['protein tetRdimer'],timepoints)
10 changes: 3 additions & 7 deletions examples/A nimply B/B1sim.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import numpy as np
from libsbml import *
from modules.Subsystem import *
from modules.System import *
from subsbml 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')
libsbml.writeSBML(B1.getSBMLDocument(),'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)
B1.plotBioscrape(['protein tetRdimer','protein sigmaX'],timepoints)
Loading

0 comments on commit d821027

Please sign in to comment.