Skip to content

Commit

Permalink
Merge pull request #25 from EmoryUniversityTheoreticalBiophysics/develop
Browse files Browse the repository at this point in the history
Update master branch
  • Loading branch information
bcdaniels authored Jun 4, 2020
2 parents 14b40f5 + cdcca08 commit d10531e
Show file tree
Hide file tree
Showing 51 changed files with 12,421 additions and 1,442 deletions.
22 changes: 21 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,26 @@ stdout_stderr_*
*.txt
# but include the simple example data file
!simpleExample_data.txt
!requirements.txt

# other code
othercode/*
othercode/*

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

68 changes: 19 additions & 49 deletions Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,82 +8,51 @@ SirIsaac depends on the following packages:
- Python 2.6 or later (not Python 3)
- Scipy
- Matplotlib
- SloppyCell (http://sloppycell.sourceforge.net)
- SloppyCell (https://github.com/GutenkunstLab/SloppyCell)

There exist several relatively simple ways to install
the first three packages above at once, including

- Anaconda: http://store.continuum.io/cshop/anaconda/
- Anaconda: http://www.anaconda.com
- Sage: http://www.sagemath.org

These systems also have the added benefit of coming
prepackaged with other useful software such as
iPython and Jupyter.

### Install SloppyCell

As of 2018, SirIsaac depends on the latest
developer version of SloppyCell. This software is
available through a git repository.
We describe here one typical way to download and
install SloppyCell.
More information is available here:
http://sloppycell.sourceforge.net/
http://sourceforge.net/p/sloppycell/git/ci/master/tree/

Typically you will want to install SloppyCell in Python's
site-packages folder, usually found within a directory such as

* /lib/python2.7/site-packages/ for Linux
* /Library/Python/2.7/site-packages/ for Mac (using built-in Python)
* /sw/lib/python2.7/site-packages/ for Mac using Fink
* ~/anaconda/lib/python2.7/site-packages/ using Anaconda
* ~/sage-x.x/lib/python2.6/site-packages/ using Sage

In the simplest case, you can anonymously 'clone' the latest version
by changing to the above directory and running

git clone https://github.com/GutenkunstLab/SloppyCell.git

You should see a bunch of files being downloaded. Next,
build the Fortran libraries by changing into the new 'SloppyCell'
directory and running setup.py:
Note: As of June 2020, SirIsaac does not support Python 3 (we are working on it). Installing Python 2 using the above package managers is likely no longer the default option as it is now officially out of date.

cd SloppyCell
sudo python setup.py build install --install-lib=..
### Install SloppyCell

(prefacing by sudo if necessary for write privileges). (If you
do not build the Fortran libraries, you will
get the error 'No module named _daskr' when trying to
import SirIsaac.FittingProblem.) If this is successful, you'll
eventually see something like
SirIsaac depends on the latest
version of SloppyCell, available on GitHub.
In the simplest case, you can install with two steps. First download the git repository by running

Finished processing dependencies for SloppyCell==1.1.0.dev1
https://github.com/GutenkunstLab/SloppyCell.git

which will create a folder named `SloppyCell` in the current directory. Next, install SloppyCell by running setup.py. The easiest way to do this is using `pip`:

pip install -e SloppyCell/

## Install SirIsaac

SirIsaac is available as a git repository hosted on GitHub.
Typically you will want to install SirIsaac in the same Python
site-packages folder as SloppyCell.

GitHub offers many ways to download ("clone") software, including
GUI apps for Windows and Mac (perhaps easiest for those unfamiliar with git)
and command line access using git. To clone from
the command line, change to the site-packages folder and run
SirIsaac is similarly available as a git repository on GitHub. To install, first download by running

git clone https://github.com/EmoryUniversityTheoreticalBiophysics/SirIsaac.git

This will create a 'SirIsaac' directory in the current
location containing the SirIsaac software.
which will create a folder named `SirIsaac` in the current directory. Next, install SirIsaac by running setup.py. The easiest way to do this is using `pip`:

pip install -e SirIsaac/

## Test installation

A basic test of the SirIsaac and SloppyCell installation can be
run by descending into the SirIsaac directory and running
run by descending into the `SirIsaac/SirIsaac/` directory and running

python SloppyCellTest.py

More comprehensive tests are found in the `test` subfolder, and can be run using, e.g., `nosetests`.

To further help you get up and running,
code to fit and analyze a simple example dataset
using SirIsaac is provided in two formats:
Expand All @@ -100,3 +69,4 @@ To run the .py file in iPython at the command line, run:
ipython --pylab
%run simpleExample.py
show()

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ Scipy
Matplotlib
(One way to install the above is with Anaconda or Sage. See Installation.md.)

SloppyCell (http://sloppycell.sourceforge.net)
SloppyCell (https://github.com/GutenkunstLab/SloppyCell)


Optional dependencies
=====================

Pypar (for running on multiple processors)
mpi4py (for running on multiple processors)
SBML (systems biology markup language)
BioNetGen
Pygraphviz (for creating network diagrams)
Expand Down
2 changes: 0 additions & 2 deletions __init__.py → SirIsaac/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@
#
# This file makes SirIsaac importable as a Python package.
#

from FittingProblem import *
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# 5.10.2012
#

from FittingProblem import *
from fittingProblem import *
from plotMatrix import plotMatrix

# the general scheme for calculating over all fpds
Expand Down
68 changes: 32 additions & 36 deletions CTSNNetwork.py → SirIsaac/ctsnNetwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,100 +4,100 @@
# 7.29.2009
#
# A SloppyCell implementation of CTSNs (continuous-time sigmoidal networks).
#
# (modeled after PowerLawNetwork.py)
#
# (modeled after powerLawNetwork.py)


from SloppyCell.ReactionNetworks import *
from scipy import random, log
import copy
import GaussianPrior
import gaussianPrior

def CTSN_List(networkList,speciesNames=None, \
logParams=True,netid='CTSN',switchSigmoid=False,xiNegative=False):
"""
Defines a CTSN based on a connection list.
A SloppyCell implementation of CTSNs:
d X_i / d t =
d X_i / d t =
1/tau_i * ( -X_i + sum_j=1^n w_i_j xi(y_j+theta_j) )
tau is given the default value of 1, and xinit, theta, and w
parameters are by default 0.
Right now, inputs come into the sum as w_i_j*input_j.
(Not sure if this is "correct"...)
networkList : list of the form
[ [nodeType, { connectFrom: connectType, connectFrom: connectType, ...}], ... ]
nodeType : integer between 0 and 4 (the number of optimizable
nodeType : integer between 0 and 4 (the number of optimizable
parameters specifying the node's behavior; 0 for input node)
connectFrom : integer index of node to get connection from
connectType : integer, either 1 or 2 (the number of parameters specifying
the connection)
speciesNames : list of species names (length n+m). If None,
species are named X_i for i in range(n+m).
logParams : if True, the time constants tau are written
logParams : if True, the time constants tau are written
as log_tau (to facilitate parameter searches)
switchSigmoid : If True, use sigmoid(sum) instead of sum(sigmoid) in
each node's ODE rate rule. See notes 7.8.2013.
(The X_js beyond n (up to n+m) are constant inputs.)
"""

n = len(networkList)
#m = 0

# the order in which to add parameters
order = dict( zip(['xinit','wself','tau','theta'], range(5)) )
orderConnect = dict( zip(['w'], range(1)) )

net = Network(netid, name='CTSN')
net.addCompartment('Comp',name='Compartment')

net.addParameter('n', n, isOptimizable=False)
#net.addParameter('m', m, isOptimizable=False)

defaultParam = 0.
defaultLogParam = 1.
defaultW = 0.
#defaultExpParam = 0.

if speciesNames is None:
speciesNames = [ 'X_'+str(i) for i in range(n) ]

# add parameters
for i in range(n):

nodeType, connectionDict = networkList[i]

if nodeType != 0: # if it's not an input node

notLog = not logParams

net.addParameter('wself_'+str(i), defaultW, \
isOptimizable=order['wself']<nodeType)
net.addParameter('theta_'+str(i), defaultParam, \
isOptimizable=order['theta']<nodeType)
net.addParameter('tau_'+str(i), defaultLogParam, \
isOptimizable=(notLog and order['tau']<nodeType))

if logParams:
net.addParameter('log_tau_'+str(i), log(defaultLogParam), \
isOptimizable=order['tau']<nodeType,typicalValue=1.)
net.addAssignmentRule('tau_'+str(i),'exp(log_tau_'+str(i)+')')

# connect to others
for j in connectionDict.keys():
net.addParameter('w_'+str(i)+'_'+str(j), defaultW, \
isOptimizable=orderConnect['w']<connectionDict[j])

net.addParameter(speciesNames[i]+'_init', defaultParam, \
isOptimizable=order['xinit']<nodeType)

# add species
for i in range(n):
nodeType, connectionDict = networkList[i]
Expand All @@ -107,7 +107,7 @@ def CTSN_List(networkList,speciesNames=None,
# add as a parameter if it's not already there
if speciesNames[i] not in net.parameters.keys():
net.addParameter( speciesNames[i], 0., isOptimizable=False )

# reaction rate rules
for i in range(n):
nodeType, connectionDict = networkList[i]
Expand All @@ -122,7 +122,7 @@ def CTSN_List(networkList,speciesNames=None,
+' / (1. + exp('+speciesNames[i]+' + theta_'+str(i)+')) + '
for j in connectionDict.keys():
if networkList[j][0] != 0: # the connection is not from an input node
if xiNegative:
if xiNegative:
sum += 'w_'+str(i)+'_'+str(j) \
+' / (1. + exp(-'+speciesNames[j]+' - theta_'+str(j)+')) + '
else: # prior to 12.19.2013
Expand Down Expand Up @@ -154,8 +154,7 @@ def CTSN_List(networkList,speciesNames=None,

return net




def setRandomParameters(net,seed=None,randFunc=random.random):
"""
Sets parameters to random values given by the function randFunc (by
Expand All @@ -164,6 +163,3 @@ def setRandomParameters(net,seed=None,randFunc=random.random):
random.seed(seed)
net.setOptimizables( randFunc(len(net.GetParameters())) )
return net.GetParameters()



File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions fitAllParallel.py → SirIsaac/fitAllParallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

import scipy
import time, copy, os
from SirIsaac.simplePickle import load,save
from SirIsaac.SloppyCellTest import testCcompiling
from SirIsaac.FittingProblemMultipleCondition import *
from simplePickle import load,save
from sloppyCellTest import testCcompiling
from fittingProblemMultipleCondition import *

def directoryPrefix(fileNumString,conditioni,numTimepoints):
return fileNumString+'_fitProbs/N'+str(numTimepoints)+'/condition'+str(conditioni)+'/'
Expand Down
Loading

0 comments on commit d10531e

Please sign in to comment.