Skip to content

Commit 4658ce7

Browse files
committed
updated python verison numbers and numpy test
1 parent fbaa35e commit 4658ce7

File tree

3 files changed

+53
-54
lines changed

3 files changed

+53
-54
lines changed

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ authors = [
1111
{name = "T.R. Maarleveld", email = "tmd200@users.sourceforge.net"},
1212
]
1313
maintainers = [
14-
{name = "Brett Olivier", email = "tmd200@users.sourceforge.net"},
14+
{name = "Brett G. Olivier", email = "b.g.olivier@vu.nl"},
1515
]
1616
license = {text = "BSD License"}
1717
requires-python = ">=3.7"
@@ -24,11 +24,10 @@ classifiers = [
2424
"License :: OSI Approved :: BSD License",
2525
"Natural Language :: English",
2626
"Operating System :: OS Independent",
27-
"Programming Language :: Python :: 3.7",
28-
"Programming Language :: Python :: 3.8",
2927
"Programming Language :: Python :: 3.9",
3028
"Programming Language :: Python :: 3.10",
3129
"Programming Language :: Python :: 3.11",
30+
"Programming Language :: Python :: 3.12",
3231
"Topic :: Scientific/Engineering :: Bio-Informatics",
3332
]
3433
keywords = ["Bioinformatics", "Computational Systems Biology", "Modeling", "Simulation", "Stochastic Simulation Algorithms", "Stochastic"]

setup.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
keywords="Bioinformatics, Computational Systems Biology, Bioinformatics, Modeling, Simulation, Stochastic Simulation Algorithms, Stochastic",
4141
install_requires=install_requires_src,
4242
extras_require=extras_require_src,
43-
python_requires='>=3.7',
43+
python_requires='>=3.9',
4444
platforms=["Windows", "Linux", "Mac"], # "Solaris", "", "Unix"],
4545
classifiers=[
4646
'Development Status :: 5 - Production/Stable',
@@ -50,11 +50,10 @@
5050
'Intended Audience :: Science/Research',
5151
'Natural Language :: English',
5252
'Operating System :: OS Independent',
53-
'Programming Language :: Python :: 3.7',
54-
'Programming Language :: Python :: 3.8',
5553
'Programming Language :: Python :: 3.9',
5654
'Programming Language :: Python :: 3.10',
5755
'Programming Language :: Python :: 3.11',
56+
'Programming Language :: Python :: 3.12',
5857
'Topic :: Scientific/Engineering :: Bio-Informatics'
5958
],
6059
data_files=mydata_files

stochpy/__init__.py

Lines changed: 49 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@
99
VU University, Amsterdam, Netherlands
1010
1111
Permission to use, modify, and distribute this software is given under the
12-
terms of the StochPy (BSD style) license.
12+
terms of the StochPy (BSD style) license.
1313
1414
NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
1515
"""
1616
from __future__ import division, print_function, absolute_import
1717

18-
__doc__ = """
18+
__doc__ = """
1919
StochPy: Stochastic Modeling in Python
2020
=====================================
21-
21+
2222
StochPy (Stochastic modeling in Python) is a flexible software tool for stochastic simulation in cell biology. It provides various stochastic
2323
simulation algorithms, SBML support, analyses of the probability distributions of molecule copy numbers and event waiting times, analyses of stochastic time
2424
series, and a range of additional statistical functions and plotting facilities for stochastic simulations.
25-
25+
2626
Options:
2727
--------
2828
- Stochastic Simulations
@@ -37,12 +37,12 @@
3737
StochPy can be used in an interactive Python shell:
3838
3939
Usage
40-
-----
40+
-----
4141
>>> import stochpy
4242
>>> utils = stochpy.Utils()
4343
>>> utils.doExample1()
4444
>>> utils.doExample2()
45-
>>> smod = stochpy.SSA() # stochastic simulation algorithm module
45+
>>> smod = stochpy.SSA() # stochastic simulation algorithm module
4646
>>> help(smod)
4747
>>> help(stochpy.SSA) # (some windows versions)
4848
>>> stochpy?
@@ -55,7 +55,7 @@
5555

5656
from .core2.version import __version__
5757

58-
import os,shutil,sys
58+
import os, shutil, sys
5959

6060
try:
6161
import readline
@@ -64,7 +64,8 @@
6464
_IsReadline = False
6565

6666
try:
67-
from numpy.distutils.core import setup, Extension
67+
# from numpy.distutils.core import setup, Extension
68+
import numpy
6869
_IsNumPy = True
6970
except Exception as ex:
7071
_IsNumPy = False
@@ -74,32 +75,32 @@
7475
os.sys.exit(-1)
7576

7677
try:
77-
import matplotlib
78+
import matplotlib
7879
_IsMPL = True
7980
except:
8081
_IsMPL = False
8182
print("Warning: The Matplotlib module is not available, so plotting is not possible")
8283
print("Info: See http://matplotlib.sourceforge.net/ for more information about Matplotlib.")
8384

8485
_IsPlotting = False
85-
try:
86-
import matplotlib.pyplot as plt
86+
try:
87+
import matplotlib.pyplot as plt
8788
_IsPlotting = True
88-
except Exception as er:
89-
print(er)
89+
except Exception as er:
90+
print(er)
9091

9192
def InitiateModels(directory):
9293
"""
9394
Build several models written in PSC MDL and SBML
94-
95+
9596
Input:
9697
- *directory* (string)
97-
"""
98+
"""
9899
from .pscmodels import Burstmodel
99100
from .pscmodels import BirthDeath
100101
from .pscmodels import ImmigrationDeath
101102
from .pscmodels import DecayingDimerizing
102-
from .pscmodels import Autoreg
103+
from .pscmodels import Autoreg
103104
from .pscmodels import CellDivision as celldivision
104105
from .pscmodels import GeneDuplication
105106
from .pscmodels import dsmts_001_01
@@ -117,7 +118,7 @@ def InitiateModels(directory):
117118
from .pscmodels import TranscriptionIntermediate
118119
from .pscmodels import Schlogl
119120
from .pscmodels import SignalingTimeVaryingL
120-
from .pscmodels import Signaling3cCD
121+
from .pscmodels import Signaling3cCD
121122

122123
models = {}
123124
models['Signaling3cCD.psc'] = Signaling3cCD.model
@@ -128,46 +129,46 @@ def InitiateModels(directory):
128129
models['BirthDeath.psc'] = BirthDeath.model
129130
models['DecayingDimerizing.psc'] = DecayingDimerizing.model
130131
models['Autoreg.psc'] = Autoreg.model
131-
models['Autoreg.xml'] = Autoreg.xml_model
132+
models['Autoreg.xml'] = Autoreg.xml_model
132133
models['CellDivision.psc'] = celldivision.model
133134
models['GeneDuplication.psc'] = GeneDuplication.model
134135
models['Isomerization.psc'] = Isomerization.model
135136
models['Polymerase.psc'] = Polymerase.model
136137
models['TranscriptionIntermediate.psc'] = TranscriptionIntermediate.model
137138
models['dsmts-001-01.xml.psc'] = dsmts_001_01.model
138-
models['dsmts-001-01.xml'] = dsmts_001_01.xml_model
139+
models['dsmts-001-01.xml'] = dsmts_001_01.xml_model
139140
models['dsmts-001-11.xml.psc'] = dsmts_001_11.model
140-
models['dsmts-001-11.xml'] = dsmts_001_11.xml_model
141+
models['dsmts-001-11.xml'] = dsmts_001_11.xml_model
141142
models['dsmts-001-19.xml.psc'] = dsmts_001_19.model
142143
models['dsmts-001-19.xml'] = dsmts_001_19.xml_model
143144
models['dsmts-002-10.xml.psc'] = dsmts_002_10.model
144-
models['dsmts-002-10.xml'] = dsmts_002_10.xml_model
145+
models['dsmts-002-10.xml'] = dsmts_002_10.xml_model
145146
models['dsmts-003-03.xml.psc'] = dsmts_003_03.model
146-
models['dsmts-003-03.xml'] = dsmts_003_03.xml_model
147+
models['dsmts-003-03.xml'] = dsmts_003_03.xml_model
147148
models['dsmts-003-04.xml.psc'] = dsmts_003_04.model
148-
models['dsmts-003-04.xml'] = dsmts_003_04.xml_model
149+
models['dsmts-003-04.xml'] = dsmts_003_04.xml_model
149150
models['chain5.psc'] = chain5.model
150151
models['chain50.psc'] = chain50.model
151152
models['chain500.psc'] = chain500.model
152153
models['chain1500.psc'] = chain1500.model
153154

154155
model_names = list(models)
155156
dir_models = os.listdir(directory)
156-
for mod_name in model_names:
157-
if mod_name not in dir_models:
157+
for mod_name in model_names:
158+
if mod_name not in dir_models:
158159
print("Info: Model {0:s} copied to {1:s}".format(mod_name ,directory) )
159-
file_out = open(os.path.join(directory,mod_name),'w')
160-
file_out.write(models[mod_name])
160+
file_out = open(os.path.join(directory,mod_name),'w')
161+
file_out.write(models[mod_name])
161162
file_out.close()
162163

163-
164+
164165
output_dir = None
165166
model_dir = None
166167
if os.sys.platform != 'win32':
167168
if not os.path.exists(os.path.join(os.path.expanduser('~'),'Stochpy')):
168169
os.makedirs(os.path.join(os.path.expanduser('~'),'Stochpy'))
169170
if not os.path.exists(os.path.join(os.path.expanduser('~'),'Stochpy', 'pscmodels')):
170-
os.makedirs(os.path.join(os.path.expanduser('~'),'Stochpy','pscmodels'))
171+
os.makedirs(os.path.join(os.path.expanduser('~'),'Stochpy','pscmodels'))
171172
if not os.path.exists(os.path.join(os.path.expanduser('~'),'Stochpy', 'temp')):
172173
os.makedirs(os.path.join(os.path.expanduser('~'),'Stochpy','temp'))
173174

@@ -179,15 +180,15 @@ def InitiateModels(directory):
179180
if not os.path.exists(os.path.join(os.getenv('HOMEDRIVE')+os.path.sep,'Stochpy')):
180181
os.makedirs(os.path.join(os.getenv('HOMEDRIVE')+os.path.sep,'Stochpy'))
181182
if not os.path.exists(os.path.join(os.getenv('HOMEDRIVE')+os.path.sep,'Stochpy','pscmodels')):
182-
os.makedirs(os.path.join(os.getenv('HOMEDRIVE')+os.path.sep,'Stochpy','pscmodels'))
183+
os.makedirs(os.path.join(os.getenv('HOMEDRIVE')+os.path.sep,'Stochpy','pscmodels'))
183184
if not os.path.exists(os.path.join(os.getenv('HOMEDRIVE')+os.path.sep,'Stochpy','temp')):
184185
os.makedirs(os.path.join(os.getenv('HOMEDRIVE')+os.path.sep,'Stochpy','temp'))
185-
186+
186187
output_dir = os.path.join(os.getenv('HOMEDRIVE')+os.path.sep,'Stochpy',)
187188
model_dir = os.path.join(os.getenv('HOMEDRIVE')+os.path.sep,'Stochpy','pscmodels')
188189
temp_dir = os.path.join(os.getenv('HOMEDRIVE')+os.path.sep,'Stochpy','temp')
189190
InitiateModels(model_dir)
190-
191+
191192
from .modules.SBML2PSC import SBML2PSC
192193
from .modules.StochSim import SSA
193194
from .modules.StochPyUtils import Utils
@@ -204,7 +205,7 @@ def InitiateModels(directory):
204205
def DeletePreviousOutput(path,type):
205206
"""
206207
Delete output of earlier simulations
207-
208+
208209
Input:
209210
- *path* (string)
210211
- *type* (string)
@@ -213,23 +214,23 @@ def DeletePreviousOutput(path,type):
213214
if filename.endswith(type):
214215
filename_path = os.path.join(path,filename)
215216
os.remove(filename_path)
216-
217+
217218
def DeleteExistingData(path):
218219
"""
219220
Delete all existing StochKit simulation data
220-
221+
221222
Input:
222223
- *path* (string)
223224
"""
224225
if os.path.exists(path):
225226
for maps in os.listdir(path):
226227
dir2delete = os.path.join(path,maps)
227228
shutil.rmtree(dir2delete, ignore_errors=True)
228-
229-
def SaveInteractiveSession(filename='interactiveSession.py',path=output_dir):
229+
230+
def SaveInteractiveSession(filename='interactiveSession.py',path=output_dir):
230231
"""
231232
Save the interactive session
232-
233+
233234
Input:
234235
- *filename*: [default = interactiveSession.py'] (string)
235236
- *path*: (string)
@@ -238,29 +239,29 @@ def SaveInteractiveSession(filename='interactiveSession.py',path=output_dir):
238239
print("Error: install 'readline' first")
239240
elif _IsReadline:
240241
historyPath = os.path.join(path,filename)
241-
if not os.path.exists(path):
242-
os.makedirs(directory)
243-
242+
if not os.path.exists(path):
243+
os.makedirs(path)
244+
244245
readline.write_history_file(historyPath)
245246
file_in = open(historyPath,'r')
246247
history_list = file_in.readlines()
247248
n_import_statement = 0
248-
for command in history_list:
249+
for command in history_list:
249250
if 'import' in command and 'stochpy' in command:
250-
n_import_statement +=1
251-
251+
n_import_statement += 1
252+
252253
n=0
253254
file_out = open(historyPath,'w')
254255
for command in history_list:
255-
if 'import' in command and 'stochpy' in command:
256-
n+=1
257-
if n==n_import_statement:
256+
if 'import' in command and 'stochpy' in command:
257+
n+=1
258+
if n==n_import_statement:
258259
file_out.write(command)
259260
file_out.close()
260261
print("Info: Interactive session successfully saved at {0:s}".format(historyPath) )
261262
print("Info: use 'ipython {0:s} to restart modeling with this interactive session".format(filename) )
262263

263-
264+
264265
DeletePreviousOutput(temp_dir,'.dat')
265266
DeletePreviousOutput(temp_dir,'.xml')
266267
DeletePreviousOutput(temp_dir,'.txt')

0 commit comments

Comments
 (0)