Skip to content

Commit

Permalink
Merge pull request #558 from sys-bio/develop
Browse files Browse the repository at this point in the history
Merge for new maintenance release.
  • Loading branch information
luciansmith authored Jul 1, 2022
2 parents 795e722 + f5cebd6 commit 3689a26
Show file tree
Hide file tree
Showing 12 changed files with 349 additions and 322 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ following the instructions on [this page](https://github.com/sys-bio/tellurium/w
We strongly suggest you to completely remove the older version of Tellurium Spyder IDE prior to installing one of the 2.1.0+ versions.

1. Download Tellurium Spyder for Windows:
* [Python 3.7](https://sourceforge.net/projects/pytellurium/files/Tellurium-2.3/2.3.3/Tellurium-2.3.3-Python-3.7-win64-setup.exe/download)
* [Python 3.8](https://sourceforge.net/projects/pytellurium/files/Tellurium-2.3/2.3.3/Tellurium-2.3.3-Python-3.8-win64-setup.exe/download)
* [Python 3.7](https://sourceforge.net/projects/pytellurium/files/Tellurium-2.3/2.3.5/Tellurium-2.3.5-Python-3.7-win64-setup.exe/download)
* [Python 3.8](https://sourceforge.net/projects/pytellurium/files/Tellurium-2.3/2.3.5/Tellurium-2.3.5-Python-3.8-win64-setup.exe/download)
2. Double-click the installer to start the installation
3. Follow the instructions

Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ scipy>=1.5.1
matplotlib>=2.0.2
pandas>=0.20.2
libroadrunner>=2.0.3
rrplugins>=2.0.3
phrasedml>=1.0.9
rrplugins>=2.0.3; platform_machine != "arm64"
phrasedml>=1.0.9; (python_version < '3.10' and platform_machine != "arm64")
antimony>=2.12.0
sbml2matlab>=0.9.1
sbml2matlab>=0.9.1; (python_version < '3.10' and platform_machine != "arm64")
python-libsbml>=5.18.0
python-libnuml>=1.0.0
python-libsedml>=2.0.17
Expand Down
14 changes: 10 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@
'pandas>=0.20.2',
# SBW-derived
'libroadrunner>=2.0.3',
'rrplugins>=2.0.3',
'phrasedml>=1.0.9',
'antimony>=2.12.0',
'sbml2matlab>=0.9.1',
# standards
'python-libsbml>=5.18.0',
'python-libnuml>=1.0.0',
Expand All @@ -69,5 +66,14 @@
'ipykernel>=4.6.1',
# testing
'pytest',
]
],
extras_require={
':(python_version < "3.10" and platform_machine != "arm64")': [
'phrasedml>=1.0.9',
'sbml2matlab>=0.9.1',
],
': platform_machine != "arm64"': [
'rrplugins>=2.0.3',
],
},
)
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
'pylab/inline/width': 6,
'pylab/inline/height': 4,
'pylab/inline/bbox_inches': True,
'startup/run_lines': 'import antimony; import sbml2matlab; import rrplugins; import numpy; import scipy; import matplotlib; import roadrunner; import tellurium as te',
'startup/run_lines': 'import antimony; import rrplugins; import numpy; import scipy; import matplotlib; import roadrunner; import tellurium as te',
'startup/use_run_file': False,
'startup/run_file': '',
'greedy_completer': False,
Expand Down
2 changes: 1 addition & 1 deletion tellurium/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.2.2.1
2.2.3
9 changes: 8 additions & 1 deletion tellurium/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,16 @@
# Converters
from .teconverters import (
antimonyConverter,
inlineOmex,
)

try:
#Might not exist if we don't have phrasedml.
from .teconverters import (
inlineOmex,
)
except:
pass

# Model import
from .tellurium import (
loadAntimonyModel,
Expand Down
2 changes: 1 addition & 1 deletion tellurium/analysis/parameterscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ def plot2DParameterScan(self):

if (i == len(self.p1Range) - 1):
axarr[i, j].set_xlabel('%s = %.2f' % (self.p2, k2))
if (j is 0):
if (j == 0):
axarr[i, j].set_ylabel('%s = %.2f' % (self.p1, k1))

f.show()
Expand Down
2 changes: 0 additions & 2 deletions tellurium/roadrunner/extended_roadrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ def __init__(self, *args, **kwargs):

'getConservedMoietyValues',
'getNumConservedMoieties',
'getNumDepFloatingSpecies',
'getNumIndFloatingSpecies',

'getReactionIds',
'getReactionRates',
Expand Down
7 changes: 5 additions & 2 deletions tellurium/teconverters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@

from .convert_omex import inlineOmexImporter, OmexFormatDetector

from .convert_phrasedml import phrasedmlImporter
try:
from .convert_phrasedml import phrasedmlImporter
from .inline_omex import inlineOmex, saveInlineOMEX
except:
pass

from .antimony_sbo import SBOError

from .inline_omex import inlineOmex, saveInlineOMEX
28 changes: 16 additions & 12 deletions tellurium/teconverters/convert_omex.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from __future__ import print_function, division, absolute_import
import os
import re
import shutil
import tempfile
import json
import getpass
Expand All @@ -16,8 +15,10 @@
except ImportError:
import tecombine as libcombine


from .convert_phrasedml import phrasedmlImporter
try:
from .convert_phrasedml import phrasedmlImporter
except:
pass
from .convert_antimony import antimonyConverter

class OmexFormatDetector:
Expand Down Expand Up @@ -146,8 +147,11 @@ def executeOmex(self):
:return:
"""
import phrasedml
phrasedml.clearReferencedSBML()
try:
import phrasedml
phrasedml.clearReferencedSBML()
except:
pass

workingDir = tempfile.mkdtemp(suffix="_sedml")
self.writeFiles(workingDir)
Expand All @@ -163,8 +167,11 @@ def exportToCombine(self, outfile):
""" Export Omex instance as combine archive.
:param outfile: A path to the output file"""
import phrasedml
phrasedml.clearReferencedSBML()
try:
import phrasedml
phrasedml.clearReferencedSBML()
except:
pass

archive = libcombine.CombineArchive()
description = libcombine.OmexDescription()
Expand Down Expand Up @@ -232,18 +239,14 @@ def fromFile(cls, path):
if not os.path.isfile(path):
raise IOError('No such file: {}'.format(path))

d = None
if not os.access(os.getcwd(), os.W_OK):
d = os.getcwd()
os.chdir(tempfile.gettempdir())

omex = libcombine.CombineArchive()
if not omex.initializeFromArchive(path):
raise IOError('Could not read COMBINE archive.')
importer = inlineOmexImporter(omex)

# if d is not None:
# os.chdir(d)
return importer

def __init__(self, omex):
Expand Down Expand Up @@ -445,13 +448,14 @@ def toInlineOmex(self, detailedErrors=True):
for entry in self.sedml_entries:
sedml_str = self.omex.extractEntryToString(entry.getLocation()).replace('BIOMD0000000012,xml',
'BIOMD0000000012.xml')
phrasedml_output = ""
try:
phrasedml_output = phrasedmlImporter.fromContent(
sedml_str,
self.makeSBMLResourceMap(self.fixSep(os.path.dirname(entry.getLocation())))
).toPhrasedml().rstrip().replace('compartment', 'compartment_')
except Exception as e:
errmsg = 'Could not read embedded SED-ML file {}.'.format(entry.getLocation())
errmsg = 'Could not read embedded SED-ML file or could not convert to phraSED-ML: {}.\n{}'.format(entry.getLocation(), e.what())
try:
try:
import libsedml
Expand Down
Loading

0 comments on commit 3689a26

Please sign in to comment.