Skip to content

Commit

Permalink
fixed unittests
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiaskoenig committed Oct 3, 2021
1 parent 3cf02e9 commit 9d1ec89
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 90 deletions.
3 changes: 2 additions & 1 deletion release-notes/0.5.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
Bugfix release.

## Fixes

- Fix #359, simplified dependecies, testing on mac, fixed mac install
- Fix #355, improved rendering of units
54 changes: 27 additions & 27 deletions src/sbmlutils/converters/xpp_example/results/PLoSCompBiol_Fig1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
<sbml xmlns="http://www.sbml.org/sbml/level3/version1/core" level="3" version="1">
<model>
<notes>
<body xmlns="http://www.w3.org/1999/xhtml" style="padding-top: 10px;line-height: 1.6;color: #333;background-color: white;font-family: Helvetica, arial, sans-serif;padding: 30px;font-size: 14px;padding-bottom: 10px;">
<code style="border: none;white-space: pre;border-radius: 3px;padding: 0;background: transparent;background-color: transparent;margin: 0;">
<pre style="font-size: 13px;background-color: #f8f8f8;line-height: 19px;overflow: auto;padding: 6px 10px;margin-top: 0 !important;border: 1px solid #cccccc;border-radius: 3px;margin: 15px 0;">&lt;body xmlns=&apos;http://www.w3.org/1999/xhtml&apos;&gt;
<body xmlns="http://www.w3.org/1999/xhtml" style="background-color: white;font-family: Helvetica, arial, sans-serif;padding-bottom: 10px;line-height: 1.6;padding-top: 10px;color: #333;font-size: 14px;padding: 30px;">
<code style="white-space: pre;background-color: transparent;border-radius: 3px;margin: 0;padding: 0;border: none;background: transparent;">
<pre style="border: 1px solid #cccccc;margin-top: 0 !important;margin: 15px 0;font-size: 13px;line-height: 19px;overflow: auto;border-radius: 3px;padding: 6px 10px;background-color: #f8f8f8;">&lt;body xmlns=&apos;http://www.w3.org/1999/xhtml&apos;&gt;
&lt;h1&gt;XPP model&lt;/h1&gt;
&lt;p&gt;This model was converted from XPP ode format to SBML using &lt;code&gt;sbmlutils&lt;/code&gt;.&lt;/p&gt;
&lt;pre&gt;# PLOS Computational Biology, Riz et al., 2013
</pre>
</code>
<h1 style="font-size: 28px;color: black;cursor: text;position: relative;margin: 20px 0 10px;-webkit-font-smoothing: antialiased;padding: 0;font-weight: bold;">human beta-cell model including SK-channels and Ca2+ dynamics</h1>
<h1 style="padding: 0;font-weight: bold;margin: 20px 0 10px;-webkit-font-smoothing: antialiased;font-size: 28px;position: relative;color: black;cursor: text;">Default parameters as in Fig. 1A</h1>
<h1 style="padding: 0;margin: 20px 0 10px;-webkit-font-smoothing: antialiased;color: black;font-weight: bold;cursor: text;position: relative;font-size: 28px;">Differential equations</h1>
<h1 style="position: relative;color: black;font-weight: bold;margin: 20px 0 10px;cursor: text;-webkit-font-smoothing: antialiased;font-size: 28px;padding: 0;">human beta-cell model including SK-channels and Ca2+ dynamics</h1>
<h1 style="padding: 0;cursor: text;-webkit-font-smoothing: antialiased;font-weight: bold;font-size: 28px;position: relative;margin: 20px 0 10px;color: black;">Default parameters as in Fig. 1A</h1>
<h1 style="font-weight: bold;position: relative;color: black;cursor: text;font-size: 28px;-webkit-font-smoothing: antialiased;margin: 20px 0 10px;padding: 0;">Differential equations</h1>
<p style="margin: 15px 0;">V&apos;= -(ISK + IBK + IKv + IHERG + INa + ICaL + ICaPQ + ICaT + IKatp*(1+sigma*q) + Ileak + Igabar)</p>
<h1 style="font-weight: bold;font-size: 28px;-webkit-font-smoothing: antialiased;position: relative;margin: 20px 0 10px;padding: 0;color: black;cursor: text;">use for stochastic simulation in Fig 1E</h1>
<h1 style="margin: 20px 0 10px;-webkit-font-smoothing: antialiased;font-size: 28px;position: relative;padding: 0;cursor: text;color: black;font-weight: bold;">use for stochastic simulation in Fig 1E</h1>
<p style="margin: 15px 0;">wiener q
par sigma=0</p>
<p style="margin: 15px 0;">mkv&apos;=(mkvinf-mkv)/taumkv
Expand All @@ -24,10 +24,10 @@ hCaL&apos;=(hCaLinf-hCaL)/tauhCaL
hCaT&apos;=(hCaTinf-hCaT)/tauhCaT
mHERG&apos;=(mHERGinf-mHERG)/taumHERG
hHERG&apos;=(hHERGinf-hHERG)/tauhHERG</p>
<h1 style="-webkit-font-smoothing: antialiased;font-weight: bold;padding: 0;font-size: 28px;color: black;position: relative;margin: 20px 0 10px;cursor: text;">Differential equations for Ca2+ dynamics</h1>
<h1 style="color: black;margin: 20px 0 10px;position: relative;font-size: 28px;-webkit-font-smoothing: antialiased;font-weight: bold;padding: 0;cursor: text;">Differential equations for Ca2+ dynamics</h1>
<p style="margin: 15px 0;">Cam&apos;=f*( (JCaL+JCaPQ+JCaT) - B*(Cam-Cac)/Volm<em>Volc - L/Volm</em>Volc )
Cac&apos;=f*(B*(Cam-Cac)-Jserca+Jleak)</p>
<h1 style="margin: 20px 0 10px;color: black;position: relative;cursor: text;font-size: 28px;font-weight: bold;-webkit-font-smoothing: antialiased;padding: 0;">Initial conditions</h1>
<h1 style="padding: 0;position: relative;font-size: 28px;color: black;font-weight: bold;margin: 20px 0 10px;-webkit-font-smoothing: antialiased;cursor: text;">Initial conditions</h1>
<p style="margin: 15px 0;">V(0)=-63
mkv(0)=0.02
mBK(0)=0.002
Expand All @@ -38,64 +38,64 @@ mHERG(0)=0.1
hHERG(0)=0.7
Cam(0)=0.30
Cac(0)=0.17</p>
<h2 style="-webkit-font-smoothing: antialiased;cursor: text;padding: 0;color: black;font-weight: bold;margin: 20px 0 10px;font-size: 24px;position: relative;border-bottom: 1px solid #cccccc;">Nernst voltages</h2>
<h2 style="font-size: 24px;position: relative;padding: 0;margin: 20px 0 10px;-webkit-font-smoothing: antialiased;font-weight: bold;border-bottom: 1px solid #cccccc;color: black;cursor: text;">Nernst voltages</h2>
<p style="margin: 15px 0;">par VNa=70
par VCa=65
par VK=-75
par VCl=-40</p>
<h2 style="font-size: 24px;font-weight: bold;border-bottom: 1px solid #cccccc;padding: 0;-webkit-font-smoothing: antialiased;color: black;position: relative;margin: 20px 0 10px;cursor: text;">Leak current</h2>
<h2 style="font-size: 24px;position: relative;margin: 20px 0 10px;padding: 0;cursor: text;color: black;font-weight: bold;border-bottom: 1px solid #cccccc;-webkit-font-smoothing: antialiased;">Leak current</h2>
<p style="margin: 15px 0;">par gleak=0.015
par vleak=-30</p>
<p style="margin: 15px 0;">Ileak=gleak*(V-vleak)
aux Ileak=Ileak</p>
<h2 style="color: black;margin: 20px 0 10px;-webkit-font-smoothing: antialiased;cursor: text;font-weight: bold;font-size: 24px;border-bottom: 1px solid #cccccc;position: relative;padding: 0;">IKv</h2>
<h2 style="-webkit-font-smoothing: antialiased;margin: 20px 0 10px;position: relative;padding: 0;font-size: 24px;cursor: text;font-weight: bold;color: black;border-bottom: 1px solid #cccccc;">IKv</h2>
<p style="margin: 15px 0;">par taumkv0=2, Vmkv=0, nmkv=-10, gkv=1</p>
<p style="margin: 15px 0;">mkvinf=1/(1+exp((V-Vmkv)/nmkv))
taumkv=taumkv0+10<em>exp(min(log(3),(-20-V)/6))
IKv=gkv</em>mkv*(V-VK)</p>
<h2 style="font-weight: bold;cursor: text;position: relative;color: black;padding: 0;margin: 20px 0 10px;border-bottom: 1px solid #cccccc;-webkit-font-smoothing: antialiased;font-size: 24px;">IBK</h2>
<h2 style="padding: 0;font-size: 24px;font-weight: bold;position: relative;border-bottom: 1px solid #cccccc;-webkit-font-smoothing: antialiased;cursor: text;color: black;margin: 20px 0 10px;">IBK</h2>
<p style="margin: 15px 0;">par taumBK=2, VmBK=0, nmBK=-10, BBK=20, gBK=0.02</p>
<p style="margin: 15px 0;">mBKinf=1/( 1+exp((V-VmBK)/nmBK))
IBK = gBK*(-ICa+BBK)<em>mBK</em>(V-VK)
aux ibk=IBK</p>
<h2 style="color: black;font-weight: bold;cursor: text;margin: 20px 0 10px;padding: 0;border-bottom: 1px solid #cccccc;font-size: 24px;-webkit-font-smoothing: antialiased;position: relative;">hERG channels</h2>
<h2 style="position: relative;color: black;font-size: 24px;padding: 0;-webkit-font-smoothing: antialiased;margin: 20px 0 10px;font-weight: bold;border-bottom: 1px solid #cccccc;cursor: text;">hERG channels</h2>
<p style="margin: 15px 0;">par VmHERG=-30, nmHERG=-10, taumHERG=100
par VhHERG=-42, nhHERG=17.5, tauhHERG=50
par gHERG=0</p>
<p style="margin: 15px 0;">mHERGinf=1/( 1+exp((V-VmHERG)/nmHERG) )
hHERGinf=1/( 1+exp((V-VhHERG)/nhHERG) )
IHERG = gHERG<em>mHERG</em>hHERG*(V-VK)</p>
<h2 style="color: black;font-weight: bold;border-bottom: 1px solid #cccccc;-webkit-font-smoothing: antialiased;cursor: text;margin: 20px 0 10px;padding: 0;position: relative;font-size: 24px;">Na current</h2>
<h2 style="cursor: text;-webkit-font-smoothing: antialiased;font-weight: bold;border-bottom: 1px solid #cccccc;font-size: 24px;position: relative;margin: 20px 0 10px;padding: 0;color: black;">Na current</h2>
<p style="margin: 15px 0;">par gNa=0.4, VmNa=-18, nmNa=-5, VhNa=-42, nhNa=6, tauhNa=2
hNainf=1/( 1+exp((V-VhNa)/nhNa) )
mNainf=1/( 1+exp((V-VmNa)/nmNa) )
INa=gNa<em>mNainf</em>hNa*(V-VNa)</p>
<h2 style="border-bottom: 1px solid #cccccc;font-size: 24px;margin: 20px 0 10px;font-weight: bold;cursor: text;position: relative;color: black;padding: 0;-webkit-font-smoothing: antialiased;">L-type Ca current</h2>
<h2 style="color: black;font-size: 24px;cursor: text;position: relative;padding: 0;margin: 20px 0 10px;font-weight: bold;border-bottom: 1px solid #cccccc;-webkit-font-smoothing: antialiased;">L-type Ca current</h2>
<p style="margin: 15px 0;">par gCaL=0.14, VmCaL=-25, nmCaL=-6, tauhCaL=20</p>
<p style="margin: 15px 0;">mCaLinf=1/( 1+exp((V-VmCaL)/nmCaL) )
hCaLinf=max(0,min(1,1+mCaLinf*(V-VCa)/57))
ICaL = gCaL<em>mCaLinf</em>hCaL*(V-VCa)</p>
<h2 style="position: relative;border-bottom: 1px solid #cccccc;font-size: 24px;font-weight: bold;cursor: text;padding: 0;color: black;margin: 20px 0 10px;-webkit-font-smoothing: antialiased;">PQ-type Ca current</h2>
<h2 style="border-bottom: 1px solid #cccccc;-webkit-font-smoothing: antialiased;margin: 20px 0 10px;padding: 0;cursor: text;position: relative;font-weight: bold;color: black;font-size: 24px;">PQ-type Ca current</h2>
<p style="margin: 15px 0;">par gCaPQ=0.17, VmCaPQ=-10, nmCaPQ=-6</p>
<p style="margin: 15px 0;">mCaPQinf=1/( 1+exp((V-VmCaPQ)/nmCaPQ) )
ICaPQ = gCaPQ<em>mCaPQinf</em>(V-VCa)</p>
<h2 style="margin: 20px 0 10px;padding: 0;color: black;border-bottom: 1px solid #cccccc;cursor: text;position: relative;-webkit-font-smoothing: antialiased;font-size: 24px;font-weight: bold;">T-type Ca current</h2>
<h2 style="border-bottom: 1px solid #cccccc;font-weight: bold;font-size: 24px;color: black;-webkit-font-smoothing: antialiased;margin: 20px 0 10px;cursor: text;padding: 0;position: relative;">T-type Ca current</h2>
<p style="margin: 15px 0;">par gCaT=0.05, VmCaT=-40, nmCaT=-4, VhCaT=-64, nhCaT=8, tauhCaT=7</p>
<p style="margin: 15px 0;">mCaTinf=1/( 1+exp((V-VmCaT)/nmCaT) )
hCaTinf=1/( 1+exp((V-VhCaT)/nhCaT) )
ICaT = gCaT<em>mCaTinf</em>hCaT*(V-VCa)
ICa=ICaL+ICaPQ+ICaT</p>
<h2 style="font-weight: bold;margin: 20px 0 10px;-webkit-font-smoothing: antialiased;font-size: 24px;padding: 0;border-bottom: 1px solid #cccccc;color: black;position: relative;cursor: text;">Katp current</h2>
<h2 style="cursor: text;position: relative;font-size: 24px;padding: 0;margin: 20px 0 10px;color: black;border-bottom: 1px solid #cccccc;-webkit-font-smoothing: antialiased;font-weight: bold;">Katp current</h2>
<p style="margin: 15px 0;">IKatp=gkatp*(V-VK)</p>
<p style="margin: 15px 0;">par gkatp=0.01</p>
<h2 style="position: relative;-webkit-font-smoothing: antialiased;font-size: 24px;font-weight: bold;color: black;border-bottom: 1px solid #cccccc;margin: 20px 0 10px;padding: 0;cursor: text;">Gabar current</h2>
<h2 style="position: relative;font-size: 24px;padding: 0;border-bottom: 1px solid #cccccc;cursor: text;font-weight: bold;margin: 20px 0 10px;-webkit-font-smoothing: antialiased;color: black;">Gabar current</h2>
<p style="margin: 15px 0;">Igabar=ggabar*(V-VCl)</p>
<p style="margin: 15px 0;">par ggabar=0</p>
<h2 style="margin: 20px 0 10px;font-size: 24px;border-bottom: 1px solid #cccccc;padding: 0;font-weight: bold;position: relative;-webkit-font-smoothing: antialiased;color: black;cursor: text;">ISK current</h2>
<h2 style="border-bottom: 1px solid #cccccc;padding: 0;margin: 20px 0 10px;font-weight: bold;-webkit-font-smoothing: antialiased;color: black;font-size: 24px;cursor: text;position: relative;">ISK current</h2>
<p style="margin: 15px 0;">par gSK=0.1, kSK=0.57, nSK=5.2</p>
<p style="margin: 15px 0;">ISK = gSK*(Cam^nSK/( kSK^nSK+Cam^nSK) )*(V-VK)
#aux ISK=ISK</p>
<h2 style="padding: 0;color: black;cursor: text;border-bottom: 1px solid #cccccc;-webkit-font-smoothing: antialiased;font-weight: bold;margin: 20px 0 10px;position: relative;font-size: 24px;">Ca diffusion</h2>
<h2 style="position: relative;cursor: text;font-weight: bold;border-bottom: 1px solid #cccccc;padding: 0;font-size: 24px;color: black;margin: 20px 0 10px;-webkit-font-smoothing: antialiased;">Ca diffusion</h2>
<p style="margin: 15px 0;">#definition of fluxes
par Cm=10</p>
<p style="margin: 15px 0;">JCaL=-alpha<em>ICaL</em>Cm/Volm
Expand All @@ -105,13 +105,13 @@ Jserca=Jsercamax<em>Cac^2/(Kserca^2 + Cac^2)
Jpmca=Jpmcamax</em>Cam/(Kpmca + Cam)
Jncx=Jncx0*(Cam)
L=Jpmca+Jncx</p>
<h1 style="margin: 20px 0 10px;font-size: 28px;color: black;position: relative;-webkit-font-smoothing: antialiased;padding: 0;font-weight: bold;cursor: text;">Calcium dynamics parameters</h1>
<h1 style="font-size: 28px;color: black;padding: 0;cursor: text;position: relative;font-weight: bold;margin: 20px 0 10px;-webkit-font-smoothing: antialiased;">Calcium dynamics parameters</h1>
<p style="margin: 15px 0;">par f=0.01
par B=0.1
par Volc=1.15e-12, Volm=1e-13</p>
<h1 style="padding: 0;margin: 20px 0 10px;position: relative;cursor: text;-webkit-font-smoothing: antialiased;font-weight: bold;font-size: 28px;color: black;">conversion to fluxes</h1>
<h1 style="-webkit-font-smoothing: antialiased;cursor: text;color: black;margin: 20px 0 10px;padding: 0;font-size: 28px;position: relative;font-weight: bold;">conversion to fluxes</h1>
<p style="margin: 15px 0;">par alpha=5.18e-15</p>
<h1 style="padding: 0;position: relative;font-weight: bold;font-size: 28px;margin: 20px 0 10px;-webkit-font-smoothing: antialiased;color: black;cursor: text;">other fluxes</h1>
<h1 style="font-size: 28px;color: black;font-weight: bold;margin: 20px 0 10px;cursor: text;position: relative;-webkit-font-smoothing: antialiased;padding: 0;">other fluxes</h1>
<p style="margin: 15px 0;">par Jsercamax=0.06, Kserca=0.27, Jpmcamax=0.021, Kpmca=0.5, Jleak=0.94e-3, Jncx0=0.01867</p>
<p style="margin: 15px 0;">@ meth=cvode, toler=1.0e-10, atoler=1.0e-10, dt=.01, total=3000,
@ maxstor=2000000,bounds=10000000000000000000, xp=t, yp=v
Expand All @@ -122,8 +122,8 @@ par Volc=1.15e-12, Volm=1e-13</p>
<a href="https://github.com/matthiaskoenig/sbmlutils/" style="text-decoration: none;color: #4183C4;" target="_blank" title="sbmlutils">sbmlutils</a>.
</div>
<p style="margin: 15px 0;"/>
<code style="border-radius: 3px;white-space: pre;padding: 0;background-color: transparent;margin: 0;background: transparent;border: none;">
<pre style="overflow: auto;line-height: 19px;font-size: 13px;margin: 15px 0;border: 1px solid #cccccc;padding: 6px 10px;border-radius: 3px;margin-bottom: 0 !important;background-color: #f8f8f8;">&lt;h2&gt;Terms of use&lt;/h2&gt;
<code style="padding: 0;border-radius: 3px;border: none;white-space: pre;background-color: transparent;background: transparent;margin: 0;">
<pre style="background-color: #f8f8f8;border-radius: 3px;padding: 6px 10px;margin: 15px 0;border: 1px solid #cccccc;font-size: 13px;overflow: auto;line-height: 19px;margin-bottom: 0 !important;">&lt;h2&gt;Terms of use&lt;/h2&gt;
&lt;div class=&quot;dc:rightsHolder&quot;&gt;Copyright © 2017 Matthias Koenig&lt;/div&gt;
&lt;div class=&quot;dc:license&quot;&gt;
&lt;p&gt;Redistribution and use of any part of this model, with or without modification, are permitted provided that
Expand Down
3 changes: 3 additions & 0 deletions src/sbmlutils/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -3046,6 +3046,9 @@ def create_model(
raise TypeError("create_model() missing 1 required argument: 'output_dir'")

# preprocess
if isinstance(models, Model):
models = [models]

model = Model.merge_models(models)
doc: libsbml.SBMLDocument = Document(
model=model,
Expand Down
Loading

0 comments on commit 9d1ec89

Please sign in to comment.