Commit 0d5511a7 authored by Vincent Noël's avatar Vincent Noël
Browse files

Added PhysiBoSS addon

parent 7d6e60a5
......@@ -9,6 +9,31 @@ ifdef PHYSICELL_CPP
CC := $(PHYSICELL_CPP)
endif
### MaBoSS configuration
# MaBoSS max nodes
ifndef MABOSS_MAX_NODES
MABOSS_MAX_NODES = 64
endif
# MaBoSS directory
MABOSS_DIR = addons/PhysiBoSSa/MaBoSS-env-2.0/engine
CUR_DIR = $(shell pwd)
CUSTOM_DIR = custom_modules
ifneq ($(OS), Windows_NT)
LDL_FLAG = -ldl
endif
LIB := -L$(CUR_DIR)/$(MABOSS_DIR)/lib -lMaBoSS $(LDL_FLAG)
INC := -DADDON_PHYSIBOSS -I$(CUR_DIR)/$(MABOSS_DIR)/include -DMAXNODES=$(MABOSS_MAX_NODES)
# If max nodes > 64, change lib path
ifeq ($(shell expr $(MABOSS_MAX_NODES) '>' 64), 1)
LIB := -L$(CUR_DIR)/$(MABOSS_DIR)/lib -lMaBoSS_$(MABOSS_MAX_NODES)n $(LDL_FLAG)
endif
ARCH := native # best auto-tuning
# ARCH := core2 # a reasonably safe default for most CPUs since 2007
# ARCH := corei7
......@@ -44,6 +69,9 @@ PhysiCell_cell.o PhysiCell_custom.o PhysiCell_utilities.o PhysiCell_constants.o
PhysiCell_module_OBJECTS := PhysiCell_SVG.o PhysiCell_pathology.o PhysiCell_MultiCellDS.o PhysiCell_various_outputs.o \
PhysiCell_pugixml.o PhysiCell_settings.o
# PhysiBoSS objects
PhysiBoSSa_OBJECTS := maboss_network.o maboss_intracellular.o
# put your custom objects here (they should be in the custom_modules directory)
PhysiCell_custom_module_OBJECTS := custom.o submodel_data_structures.o internal_viral_dynamics.o internal_viral_response.o receptor_dynamics.o immune_submodels.o epithelium_submodel.o
......@@ -51,12 +79,12 @@ PhysiCell_custom_module_OBJECTS := custom.o submodel_data_structures.o internal_
pugixml_OBJECTS := pugixml.o
PhysiCell_OBJECTS := $(BioFVM_OBJECTS) $(pugixml_OBJECTS) $(PhysiCell_core_OBJECTS) $(PhysiCell_module_OBJECTS)
ALL_OBJECTS := $(PhysiCell_OBJECTS) $(PhysiCell_custom_module_OBJECTS)
ALL_OBJECTS := $(PhysiCell_OBJECTS) $(PhysiCell_custom_module_OBJECTS) $(PhysiBoSSa_OBJECTS)
# compile the project
all: main.cpp $(ALL_OBJECTS)
$(COMPILE_COMMAND) -o $(PROGRAM_NAME) $(ALL_OBJECTS) main.cpp
all: MaBoSS main.cpp $(ALL_OBJECTS)
$(COMPILE_COMMAND) -o $(PROGRAM_NAME) $(ALL_OBJECTS) main.cpp $(LIB)
# PhysiCell core components
......@@ -67,7 +95,7 @@ PhysiCell_digital_cell_line.o: ./core/PhysiCell_digital_cell_line.cpp
$(COMPILE_COMMAND) -c ./core/PhysiCell_digital_cell_line.cpp
PhysiCell_cell.o: ./core/PhysiCell_cell.cpp
$(COMPILE_COMMAND) -c ./core/PhysiCell_cell.cpp
$(COMPILE_COMMAND) $(INC) -c ./core/PhysiCell_cell.cpp
PhysiCell_cell_container.o: ./core/PhysiCell_cell_container.cpp
$(COMPILE_COMMAND) -c ./core/PhysiCell_cell_container.cpp
......@@ -136,6 +164,18 @@ PhysiCell_pugixml.o: ./modules/PhysiCell_pugixml.cpp
PhysiCell_settings.o: ./modules/PhysiCell_settings.cpp
$(COMPILE_COMMAND) -c ./modules/PhysiCell_settings.cpp
# MaBoSS objects
MaBoSS:
cd $(MABOSS_DIR)/src && make MAXNODES=$(MABOSS_MAX_NODES) install_alib
maboss_network.o: ./addons/PhysiBoSSa/src/maboss_network.cpp
$(COMPILE_COMMAND) $(INC) -c ./addons/PhysiBoSSa/src/maboss_network.cpp
maboss_intracellular.o: ./addons/PhysiBoSSa/src/maboss_intracellular.cpp
$(COMPILE_COMMAND) $(INC) -c ./addons/PhysiBoSSa/src/maboss_intracellular.cpp
# user-defined PhysiCell modules
custom.o: ./custom_modules/custom.cpp
......@@ -168,10 +208,14 @@ install:
distclean: clean
rm -f ../bin/$(PROGRAM_NAME)
clean:
MaBoSS-clean:
cd $(MABOSS_DIR)/src && make clean
clean: MaBoSS-clean
rm -f *.o
rm -f $(PROGRAM_NAME)*
data-cleanup:
rm -f *.mat
rm -f *.xml
......
BSD 3-Clause License (see https://opensource.org/licenses/BSD-3-Clause)
Copyright (c) 2011-2020 Institut Curie, 26 rue d'Ulm, Paris, France
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
# MaBoSS : Markovian Boolean Stochastic Simulator
MaBoSS is a C++ software for simulating continuous/discrete time Markov processes, applied on a Boolean network.
MaBoSS uses a specific language for associating transition rates to each node. Given some initial conditions, MaBoSS applies Monte-Carlo kinetic algorithm (or Gillespie algorithm) to the network to produce time trajectories. Time evolution of probabilities are estimated. In addition, global and semi-global characterizations of the whole system are computed.
### Contact
Institut Curie
26 rue d'Ulm 75248 PARIS CEDEX 05
Contact: [maboss.bkmc@gmail.com](mailto://maboss.bkmc@gmail.com)
Web Site: [https://maboss.curie.fr](https://maboss.curie.fr)
### License
The 3-Clause BSD License
### Copyright
BSD 3-Clause License (see https://opensource.org/licenses/BSD-3-Clause)
Copyright (c) 2011-2020 Institut Curie, 26 rue d'Ulm, Paris, France
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
MaBoSS version 2.0 - September 2016
Institut Curie
26 rue d'Ulm 75248 PARIS CEDEX 05
Contact: maboss.bkmc@gmail.com
Web Site: https://maboss.curie.fr
Tested platforms
----------------
- Linux Ubuntu (Ubuntu 4.3.2-1ubuntu11 and higher), RedHat
- MacOS X x86
- Windows with cygwin
Binary distribution
-------------------
To avoid installing compilation tools, we provide binary versions for linux x86, MacOS X x86 and Windows x86:
- linux : MaBoSS-2.0/binaries/linux-x86/MaBoSS
- MacOS X : MaBoSS-2.0/binaries/macos-x86/MaBoSS
- Windows : MaBoSS-2.0/binaries/win-x86/MaBoSS.exe
Important notes on the Windows version:
- to execute MaBoSS.exe, cygwin must be installed (http://www.cygwin.com/)
- because of the cygwin emulation, the windows version is very slow (about 4 times slower than the linux and Mac OS versions). We urge you to run MaBoSS on linux or Mac OS X if possible.
All these binary versions are provided "as is", they may not work on your OS. In such a case, you need to compile MaBoSS.
Compilation
-----------
Tools needed
- gcc: version 4.0.1 or higher
- bison: version 2.3 or higher
- flex: version 2.5.35 or higher
- cygwin needed on Windows
cd MaBoSS-2.0/src
make install
The executable file will be located in MaBoSS-2.0/pub and is named MaBoSS.
This compiled version supports up to 64 nodes per network.
If you need more nodes per network, you have to add an extra hint to the compilation command, for instance to compile a version supporting up to 100 nodes:
make MAXNODES=100 install
The executable file will also be located in MaBoSS-2.0/pub and will be named MaBoSS_100n.
Notes:
- if you manage only networks with up to 64 nodes, we recommend you to use the default compiled version as for networks with more than 64 nodes, the implementation is very different and will be slower.
- generally speaking, a version compiled with a given number of nodes will be slower and will use more memory than a version compiled with a lesser number of nodes.
Usage
-----
cd MaBoSS-2.0/pub
./MaBoSS --version
MaBoSS version 2.0 [networks up to 64 nodes]
./MaBoSS_100n --version
MaBoSS version 2.0 [networks up to 100 nodes]
The usage is described in the reference card MaBoSS-2.0/doc/MaBoSS-RefCard.pdf
Examples
--------
The directory MaBoSS-2.0/examples contains two examples:
- ToyModel
- p53_Mdm2
To test an example (for instance p53_Mdm2):
- change to the directory containing the model (MaBoSS-2.0/examples/p53_Mdm2)
- ../../pub/MaBoSS -c p53_Mdm2_runcfg.cfg -o p53_Mdm2_out p53_Mdm2.bnd
- the files p53_Mdm2_out_probtraj.csv and p53_Mdm2_out_statdist.csv will be created.
The description of these files can be found at https://maboss.curie.fr/pub/DescriptionOutputFile.pdf
License
-------
LGPL (GNU Lesser General Public License)
Copyright
---------
MaBoSS (Markov Boolean Stochastic Simulator)
Copyright (C) 2011-2015 Institut Curie, 26 rue d'Ulm, Paris, France
MaBoSS is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
MaBoSS 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
/*
#############################################################################
# #
# BSD 3-Clause License (see https://opensource.org/licenses/BSD-3-Clause) #
# #
# Copyright (c) 2011-2020 Institut Curie, 26 rue d'Ulm, Paris, France #
# All rights reserved. #
# #
# Redistribution and use in source and binary forms, with or without #
# modification, are permitted provided that the following conditions are #
# met: #
# #
# 1. Redistributions of source code must retain the above copyright notice, #
# this list of conditions and the following disclaimer. #
# #
# 2. Redistributions in binary form must reproduce the above copyright #
# notice, this list of conditions and the following disclaimer in the #
# documentation and/or other materials provided with the distribution. #
# #
# 3. Neither the name of the copyright holder nor the names of its #
# contributors may be used to endorse or promote products derived from this #
# software without specific prior written permission. #
# #
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS #
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED #
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A #
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER #
# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, #
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, #
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR #
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF #
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING #
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS #
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #
# #
#############################################################################
Module:
BooleanGrammar.h
Authors:
Eric Viara <viara@sysra.com>
Gautier Stoll <gautier.stoll@curie.fr>
Vincent Noël <vincent.noel@curie.fr>
Date:
January-March 2011
*/
#ifndef _BOOLEANGRAMMAR_H_
#define _BOOLEANGRAMMAR_H_
#include <vector>
#include "BooleanNetwork.h"
extern void set_current_network(Network* network);
extern Network* get_current_network();
class NodeDeclItem {
std::string identifier;
Expression* expr;
std::string str;
public:
NodeDeclItem(const std::string& identifier, Expression* expr) : identifier(identifier), expr(expr) { }
NodeDeclItem(const std::string& identifier, const std::string& str) : identifier(identifier), expr(NULL), str(str) { }
const std::string& getIdentifier() const {return identifier;}
Expression* getExpression() {return expr;}
const std::string& getString() const {return str;}
};
class NodeDecl {
public:
NodeDecl(const std::string& identifier, std::vector<NodeDeclItem*>* node_decl_item_list) {
Network* network = get_current_network();
bool reset = false;
if (network->isNodeDefined(identifier)) {
if (Node::isOverride()) {
reset = true;
} else if (!Node::isAugment()) {
throw BNException("node " + identifier + " already defined");
}
}
network->setNodeAsDefined(identifier);
Node* node = network->getOrMakeNode(identifier);
if (reset) {
node->reset();
}
if (NULL == node_decl_item_list) {
return;
}
size_t size = node_decl_item_list->size();
for (size_t nn = 0; nn < size; nn++) {
Expression* expr = (*node_decl_item_list)[nn]->getExpression();
if (NULL != expr) {
node->setAttributeExpression((*node_decl_item_list)[nn]->getIdentifier(), expr);
} else {
node->setAttributeString((*node_decl_item_list)[nn]->getIdentifier(), (*node_decl_item_list)[nn]->getString());
}
}
}
};
#endif
%{
/*
#############################################################################
# #
# BSD 3-Clause License (see https://opensource.org/licenses/BSD-3-Clause) #
# #
# Copyright (c) 2011-2020 Institut Curie, 26 rue d'Ulm, Paris, France #
# All rights reserved. #
# #
# Redistribution and use in source and binary forms, with or without #
# modification, are permitted provided that the following conditions are #
# met: #
# #
# 1. Redistributions of source code must retain the above copyright notice, #
# this list of conditions and the following disclaimer. #
# #
# 2. Redistributions in binary form must reproduce the above copyright #
# notice, this list of conditions and the following disclaimer in the #
# documentation and/or other materials provided with the distribution. #
# #
# 3. Neither the name of the copyright holder nor the names of its #
# contributors may be used to endorse or promote products derived from this #
# software without specific prior written permission. #
# #
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS #
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED #
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A #
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER #
# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, #
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, #
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR #
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF #
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING #
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS #
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #
# #
#############################################################################
Module:
BooleanGrammar.l
Authors:
Eric Viara <viara@sysra.com>
Gautier Stoll <gautier.stoll@curie.fr>
Vincent Noël <vincent.noel@curie.fr>
Date:
January-March 2011
*/
#include <math.h>
#include "Utils.h"
static char *yytokstr();
static unsigned int input_lineno = 1;
static void skip_comment(void);
%}
fracconst ([0-9]+\.[0-9]+)|([0-9]+\.)|(\.[0-9]+)
exppart [eE](\-|\+)?[0-9]+
%%
[\t\f\v\r ]+ { }
"\n" { input_lineno++; }
"/*" { skip_comment(); }
"//".* { }
[a-zA-Z_][a-zA-Z_0-9]* {
if (!strcasecmp(yytext, "NOT")) {
return LOGNOT;
}
if (!strcasecmp(yytext, "AND")) {
return LOGAND;
}
if (!strcasecmp(yytext, "OR")) {
return LOGOR;
}
if (!strcasecmp(yytext, "XOR")) {
return LOGXOR;
}
if (!strcasecmp(yytext, "NODE")) {
return NODE;
}
yylval.str = maboss_strdup(yytext);
return IDENTIFIER;
}
"$"[a-zA-Z_][a-zA-Z_0-9]* {
yylval.str = maboss_strdup(yytext);
return VARIABLE;
}
\" {
yylval.str = yytokstr();
return STRING;
}
"==" { return EQUAL; }
"!=" { return NOT_EQUAL; }
"<=" { return LTEQ; }
">=" { return GTEQ; }
"&&"|"&" { return LOGAND; }
"||"|"|" { return LOGOR; }
"!" { return LOGNOT; }
[0-9]+ { sscanf(yytext, "%lld", &yylval.l); return INTEGER; }
{fracconst}{exppart}? { yylval.d = atof(yytext); return DOUBLE; }
[0-9]+{exppart} { yylval.d = atof(yytext); return DOUBLE; }
. { return yytext[0]; }
%%
#define _ESC_(X, Y) case X: *p++ = Y; break
static void yypurgestring(unsigned char *s)
{
unsigned char c;
unsigned char *p = s;
while ((c = *s) != 0) {
if (c == '\\') {
c = *++s;
switch(c) {
_ESC_('a', '\a');
_ESC_('b', '\b');
_ESC_('f', '\f');
_ESC_('n', '\n');
_ESC_('r', '\r');
_ESC_('t', '\t');
_ESC_('v', '\v');
_ESC_('\'', '\'');
_ESC_('\"', '"');
_ESC_('\\', '\\');
default:
*p++ = '\\';
*p++ = c;
}
s++;
}
else
*p++ = *s++;
}
*p = 0;
}
static char *yytokstr()
{
int s_size;
unsigned char *s, c;
s_size = 32;
s = (unsigned char *)malloc(s_size);
int n, backslash;
for (n = 0, backslash = 0; (c = yyinput()) != 0 && c != 255; n++) {
if (c == '\n') {
input_lineno++;
}
else if (c == '\\') {
backslash = !backslash;
}
else if (c == '"' && !backslash) {
break;
}
else {
backslash = 0;
}
if (n >= s_size) {
s_size *= 2;
s = (unsigned char *)realloc(s, s_size);
}
s[n] = c;
}
if (n >= s_size) {
s_size += 4;
s = (unsigned char *)realloc(s, s_size);
}
s[n] = 0;
yypurgestring(s);
return (char *)s;
}
static void skip_comment(void)
{
int c1, c2;
c1 = yyinput();
c2 = yyinput();
while (c2 != EOF && !(c1 == '*' && c2 == '/')) {
if (c1 == '\n') {
++input_lineno;
}
c1 = c2;
c2 = yyinput();
}
}
int yywrap(void)
{
return 1;
}
static void yyerror(const char *)
{
char tok[32];
sprintf(tok, "%u", input_lineno);
throw BNException("BND syntax error at line #" + std::string(tok));
}