-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated smoldyn installer script and gitignore
- Loading branch information
1 parent
72cf98b
commit b424ba6
Showing
481 changed files
with
227,874 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,5 @@ __pycache__/ | |
dist/ | ||
.DS_Store | ||
*.egg-info/ | ||
refresh-env.sh | ||
install-with-smoldyn.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
# The following script serves as a utility for installing this repository with the Smoldyn requirement on a Silicon Mac | ||
|
||
set -e | ||
|
||
# set installation parameters | ||
dist_url=https://www.smoldyn.org/smoldyn-2.72-mac.tgz | ||
tarball_name=smoldyn-2.72-mac.tgz | ||
dist_dir=${tarball_name%.tgz} | ||
|
||
# uninstall existing version | ||
pip uninstall smoldyn || return | ||
|
||
# download the appropriate distribution from smoldyn | ||
wget $dist_url | ||
|
||
# extract the source from the tarball | ||
tar -xzvf $tarball_name | ||
|
||
# delete the tarball | ||
rm $tarball_name | ||
|
||
# install smoldyn from the source | ||
cd $dist_dir | ||
sudo -H ./install.sh | ||
|
||
# install the repo | ||
cd .. | ||
pip install -e . | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
This README file is for the Smoldyn distribution for Mac OS X. | ||
|
||
This distribution contains pre-compiled Smoldyn software for running on standard Macs. It assumes that you have an Intel Mac running OS 10.6 or higher, that your system is configured in a typical way, and that you want the default Smoldyn installation. | ||
|
||
To install Smoldyn, open your "Terminal" application, which is in your Applications/Utilities directory. Change directories to this download directory (probably type "cd Desktop/smoldyn-2.xx-mac", or something similar). Then type "sudo ./install.sh", and enter your computer password when prompted. If you get a warning about Python bindings not being installed, that's okay; just install pip at some point and re-run the install script. If you are asked whether you want the installer to update your environment PATH variable, you should generally say yes (enter 'y'). This will add the directory /usr/local/bin to the list of places where your computer will look for executable files, which means that it will find Smoldyn correctly. Next, test Smoldyn by typing "smoldyn examples/S1_intro/bounce3.txt". If it runs, congratulations, you have a successful Smoldyn installation! If not, see below. | ||
|
||
Particularly useful files in the download directory: | ||
SmoldynQuickGuide.pdf - a 2 page Smoldyn quick reference guide, in documentation directory | ||
SmoldynManual.pdf - the full Smoldyn User Manual, in documentation directory | ||
examples - a folder of Smoldyn configuration files | ||
|
||
|
||
-------- What installing does ------- | ||
|
||
Default Smoldyn installation installs the following files: | ||
- smoldyn executable to /usr/local/bin (this is the main Smoldyn software) | ||
- SmolCrowd executable to /usr/local/bin (utility program creates crowded volumes) | ||
- wrl2smol executable to /usr/local/bin (utility program converts VRML output to Smoldyn input) | ||
- libsmoldyn.h header file to /usr/local/include (for calling Smoldyn as a library) | ||
- smoldyn.h header file to /usr/local/include (for calling Smoldyn as a library) | ||
- smoldynconfigure.h header file to /usr/local/include (for calling Smoldyn as a library) | ||
- libsmoldyn_static.a static library to /usr/local/lib (for calling Smoldyn as a library) | ||
- libsmoldyn_shared.dylib dynamic library to /usr/local/lib (for calling Smoldyn as a library) | ||
- Minimal BioNetGen files in /usr/local/bin/BioNetGen | ||
- Python bindings for Smoldyn to standard place using pip utility | ||
|
||
|
||
--------------- Uninstalling Smoldyn ------------- | ||
|
||
To completely remove all of the Smoldyn files that the installer installed, run the uninstall.sh script. This is a very simple script that deletes the installed files. It also runs pip uninstall to remove the Python bindings. This will not delete the download package from your computer and it doesn't reset the environment PATH variable. | ||
|
||
|
||
-------- If installation failed ------ | ||
|
||
Did the code get installed to the correct place? Check by typing "ls /usr/local/bin" and looking for smoldyn. | ||
|
||
Does your computer know where to look for programs? Type "echo $PATH" to get a list of colon-separated places where the computer looks. If /usr/local/bin isn't in this list, then you'll need to add it to your profile file. See the Smoldyn documentation (or look on-line). | ||
|
||
Is your system allowing you to run the code? If you're told that permission was denied for running smoldyn, then your computer might not have realized that Smoldyn is an executable program. Enter "chmod +x /usr/local/bin/smoldyn" | ||
|
||
E-mail [email protected] for assistance. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,245 @@ | ||
#!/usr/bin/perl | ||
|
||
# BioNetGen : rule-based modeling language and simulation platform | ||
# | ||
# Copyright (C) 2006,2009,2012 by | ||
# | ||
# James R. Faeder (faeder at pitt dot edu) | ||
# Justin S. Hogg (justinshogg at gmail dot com) | ||
# Leonard A. Harris (lh64 at cornell dot com) | ||
# John A. P. Sekar (johnarul dot sekar at gmail dot com) | ||
# Jose Juan Tapia | ||
# Arshi Arora | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
# pragmas | ||
use strict; | ||
use warnings; | ||
|
||
# Perl Modules | ||
use Config; | ||
use File::Spec; | ||
use FindBin; | ||
use Getopt::Long; | ||
use IO::Handle; | ||
|
||
# get Perl2 Module directory: look for environment variables BNGPATH or BioNetGenRoot. | ||
# If neither are defined, use RealBin module | ||
use lib File::Spec->catdir( ( exists $ENV{'BNGPATH'} | ||
? $ENV{'BNGPATH'} | ||
: ( exists $ENV{'BioNetGenRoot'} | ||
? $ENV{'BioNetGenRoot'} | ||
: $FindBin::RealBin | ||
) | ||
), | ||
'Perl2' | ||
); | ||
# BNG Modules | ||
use BNGUtils; | ||
use BNGModel; | ||
use Console; | ||
|
||
|
||
# Set up Signal Handlers.. | ||
# Define global variable to store PID of child process. | ||
$::CHILD_PID = undef; | ||
# Get signal names | ||
my $i = 0; | ||
my %SIGNO=(); | ||
defined($Config{sig_name}) or die "No signals defined"; | ||
foreach my $signame ( split " ", $Config{sig_name} ) | ||
{ | ||
$SIGNO{$signame} = $i; | ||
$i++; | ||
} | ||
# TERM signal handler: make sure any child processes are shutdown before termination | ||
$SIG{'TERM'} = sub | ||
{ | ||
if (defined $::CHILD_PID) | ||
{ # kill off child process | ||
print "\n>>> relaying TERM signal to child with PID: ", $::CHILD_PID, " <<<\n"; | ||
kill $SIGNO{"TERM"}, $::CHILD_PID; | ||
} | ||
exit_error( sprintf "BioNetGen received TERM signal (%d)", $SIGNO{"TERM"} ); | ||
}; | ||
# INT signal handler: make sure any child processes are shutdown before termination | ||
$SIG{'INT'} = sub | ||
{ | ||
if (defined $::CHILD_PID) | ||
{ # kill off child process | ||
print "\n>>> relaying INT signal to child with PID: ", $::CHILD_PID, " <<<\n"; | ||
kill $SIGNO{"INT"}, $::CHILD_PID; | ||
} | ||
exit_error( sprintf "BioNetGen received TERM signal (%d)", $SIGNO{"INT"} ); | ||
}; | ||
|
||
|
||
|
||
# Defaults params for File mode | ||
my %default_args = ( 'write_xml' => 0, 'write_mfile' => 0, | ||
'write_SBML' => 0, 'generate_network' => 0, | ||
'skip_actions' => 0, 'action_skip_warn' => 1, | ||
'logging' => 0, 'no_exec' => 0, | ||
'allow_perl' => 0, 'no_nfsim' => 0, | ||
'output_dir' => File::Spec->curdir() | ||
); | ||
# Default params for Console mode | ||
my %default_args_console = ( 'write_xml' => 0, 'write_mfile' => 0, | ||
'write_SBML' => 0, 'generate_network' => 0, | ||
'skip_actions' => 1, 'action_skip_warn' => 1, | ||
'logging' => 0, 'no_exec' => 0, | ||
'allow_perl' => 0, 'no_nfsim' => 0, | ||
'output_dir' => File::Spec->curdir() | ||
); | ||
|
||
|
||
# variables to contain user args | ||
my $console = 0; | ||
my $findbin = ''; | ||
my $help = 0; | ||
my $version = 0; | ||
my %user_args = ( 'console' => \$console, | ||
'findbin' => \$findbin, | ||
'help' => \$help, | ||
'version' => \$version | ||
); | ||
|
||
# parse command line arguments | ||
GetOptions( \%user_args, | ||
'help|h', | ||
'version|v', | ||
'console', | ||
'findbin=s', | ||
'skip_actions|check', | ||
'no_nfsim|no-nfsim', | ||
'output_dir|outdir=s', | ||
'logging|log', | ||
'generate_network|netgen', | ||
'write_SBML|sbml', | ||
'write_mfile|mfile', | ||
'write_xml|xml' | ||
) | ||
or die "Error in command line arguments (try: BNG2.pl --help)"; | ||
|
||
# display help if requested | ||
if ($help) | ||
{ | ||
display_help(); | ||
exit(0); | ||
} | ||
|
||
# display version info | ||
if ($version) | ||
{ | ||
printf "BioNetGen version %s\n", BNGversion(); | ||
exit(0); | ||
} | ||
|
||
# try to find binary | ||
if (not( $findbin eq '')) | ||
{ | ||
# exit with value 0 if binary is found, 1 otherwise | ||
exit( BNGModel::findExec($findbin) ? 0 : 1 ); | ||
} | ||
|
||
|
||
|
||
if ( $console ) | ||
{ | ||
# get arguments | ||
my %args = (); | ||
while ( my ($opt,$val) = each %default_args_console ) | ||
{ | ||
$args{$opt} = exists $user_args{$opt} ? $user_args{$opt} : $val; | ||
} | ||
|
||
# check if output directory exists and is writable | ||
unless ( -d $args{output_dir} ) | ||
{ send_warning( sprintf "Default output directory '%s' is not a directory.", $args{output_dir}); } | ||
unless ( -w $args{output_dir} ) | ||
{ send_warning( sprintf "Not able to write to default output directory '%s'.", $args{output_dir}); } | ||
|
||
# start console | ||
my $err = BNGconsole( \%args ); | ||
exit_error($err) if ($err); | ||
} | ||
else | ||
{ | ||
unless (@ARGV) | ||
{ display_help(); } | ||
|
||
# get arguments | ||
my %args = (); | ||
while ( my ($opt,$val) = each %default_args ) | ||
{ | ||
$args{$opt} = exists $user_args{$opt} ? $user_args{$opt} : $val; | ||
} | ||
|
||
# check if output directory exists and is writable | ||
unless ( -d $args{output_dir} ) | ||
{ send_warning( sprintf "Default output directory '%s' is not a directory.", $args{output_dir}); } | ||
unless ( -w $args{output_dir} ) | ||
{ send_warning( sprintf "Not able to write to default output directory '%s'.", $args{output_dir}); } | ||
|
||
# Process any files | ||
while ( my $file = shift @ARGV ) | ||
{ | ||
# create BNGMOdel object | ||
my $model = BNGModel->new(); | ||
$model->initialize(); | ||
$BNGModel::GLOBAL_MODEL = $model; | ||
|
||
# set file argument | ||
$args{'file'} = $file; | ||
|
||
# read and process Model file | ||
my $err = $model->readFile( \%args ); | ||
exit_error($err) if ($err); | ||
|
||
# undefine model | ||
%$model = (); undef %$model; | ||
$BNGModel::GLOBAL_MODEL = undef; | ||
} | ||
} | ||
|
||
# all done! | ||
exit(0); | ||
|
||
|
||
|
||
|
||
# Display Help Menu | ||
sub display_help | ||
{ | ||
printf "\nBioNetGen version %s\n", BNGversion(); | ||
print "--------------------------------------------------/ HELP MENU /-----\n" | ||
." SYNOPSIS \n" | ||
." process MODEL: BNG2.pl [OPTION]... MODEL... \n" | ||
." start BNG console: BNG2.pl --console \n" | ||
." display help: BNG2.pl -h \n" | ||
." display version: BNG2.pl -v \n" | ||
." \n" | ||
." OPTIONS \n" | ||
." --log write log to file MODEL.log (default is STDOUT) \n" | ||
." --xml write XML output after processing MODEL \n" | ||
." --mfile write MATLAB M-file output after processing MODEL\n" | ||
." --sbml write SBML output after processing MODEL \n" | ||
." --check read MODEL, but do not execute actions \n" | ||
." --outdir PATH change default output path \n" | ||
." \n" | ||
." For more information, visit bionetgen.org \n" | ||
."--------------------------------------------------------------------\n"; | ||
} | ||
|
Oops, something went wrong.