aevol-5.0/0000755000175000017500000000000012735464421007475 500000000000000aevol-5.0/ChangeLog0000644000175000017500000000000112421166362011151 00000000000000 aevol-5.0/aclocal.m40000644000175000017500000012254512735464143011267 00000000000000# generated automatically by aclocal 1.15 -*- Autoconf -*- # Copyright (C) 1996-2014 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # Copyright (C) 2002-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.15' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.15], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.15])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each '.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_CC_C_O # --------------- # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i]) if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([m4/ax_boost_base.m4]) m4_include([m4/ax_boost_filesystem.m4]) m4_include([m4/ax_boost_system.m4]) m4_include([m4/ax_cxx_compile_stdcxx_11.m4]) m4_include([m4/ax_cxx_compile_stdcxx_14.m4]) aevol-5.0/INSTALL0000644000175000017500000003661012724051151010442 00000000000000Installation Instructions ************************* Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind. Basic Installation ================== Briefly, the shell command `./configure && make && make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. Some packages provide this `INSTALL' file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in *note Makefile Conventions: (standards)Makefile Conventions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package, generally using the just-built uninstalled binaries. 4. Type `make install' to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular user, and only the `make install' phase executed with root privileges. 5. Optionally, type `make installcheck' to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a regular user, particularly if the prior `make install' required root privileges, verifies that the installation completed correctly. 6. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 7. Often, you can also type `make uninstall' to remove the installed files again. In practice, not all packages have tested that uninstallation works correctly, even though it is required by the GNU Coding Standards. 8. Some packages, particularly those that use Automake, provide `make distcheck', which can by used by developers to test that all other targets like `make install' and `make uninstall' work correctly. This target is generally not run by end users. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. This is known as a "VPATH" build. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX', where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. In general, the default for these options is expressed in terms of `${prefix}', so that specifying just `--prefix' will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the correct locations to `configure'; however, many packages provide one or both of the following shortcuts of passing variable assignments to the `make install' command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each affected directory. For example, `make install prefix=/alternate/directory' will choose an alternate location for all directory configuration variables that were expressed in terms of `${prefix}'. Any directories that were specified during `configure', but not in terms of `${prefix}', must each be overridden at install time for the entire installation to be relocated. The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool. The second method involves providing the `DESTDIR' variable. For example, `make install DESTDIR=/alternate/directory' will prepend `/alternate/directory' before all installation names. The approach of `DESTDIR' overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of `${prefix}' at `configure' time. Optional Features ================= If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Some packages offer the ability to configure how verbose the execution of `make' will be. For these packages, running `./configure --enable-silent-rules' sets the default to minimal output, which can be overridden with `make V=1'; while running `./configure --disable-silent-rules' sets the default to verbose, which can be overridden with `make V=0'. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. HP-UX `make' updates targets which have the same time stamps as their prerequisites, which makes it generally unusable when shipped generated files such as `configure' are involved. Use GNU `make' instead. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" On Solaris, don't put `/usr/ucb' early in your `PATH'. This directory contains several dysfunctional programs; working variants of these programs are available in `/usr/bin'. So, if you need `/usr/ucb' in your `PATH', put it _after_ `/usr/bin'. On Haiku, software installed for all users goes in `/boot/common', not `/usr/local'. It is recommended to use the following options: ./configure --prefix=/boot/common Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf limitation. Until the limitation is lifted, you can use this workaround: CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. aevol-5.0/COPYING0000644000175000017500000010451312421166362010447 00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . aevol-5.0/doc/0000755000175000017500000000000012735464421010242 500000000000000aevol-5.0/doc/aevol_create.10000644000175000017500000000216112735456367012707 00000000000000./"test with man -l .TH AEVOL "1" "July 2016" "aevol 5.0" "User Manual" .SH NAME Aevol \- an in silico experimental evolution platform .SH SYNOPSIS .B aevol_create \-h or .B \-\-help .br .B aevol_create \-V or .B \-\-version .br .B aevol_create \fR[\fB\-f\fI PARAM_FILE\fR] \fR[\fB\-C\fI CHROM_FILE\fR] \fR[\fB\-p\fI PLASMID_FILE\fR] .SH DESCRIPTION .B Aevol is a simulation platform that allows one to let populations of digital organisms evolve in different conditions and study experimentally the mechanisms responsible for the structuration of the genome and the transcriptome. .TP .B aevol_create create an experiment with setup as specified in .I PARAM_FILE .SH OPTIONS .TP .B \-h, \-\-help print help, then exit .TP .B \-V, \-\-version print version number, then exit .HP .B \-f, \-\-file .I PARAM_FILE .br specify parameter file (default: param.in) .HP .HP .B \-C, \-\-chromosome .I CHROM_FILE .br load chromosome from given text file instead of generating it .HP .B \-P, \-\-plasmid .I PLASMID_FILE .br load plasmid from given text file instead of generating it .SH "SEE ALSO" .B aevol_run, aevol_modify, aevol_propagate aevol-5.0/doc/aevol_misc_extract.10000644000175000017500000000261412735456367014134 00000000000000./"test with man -l .TH AEVOL "1" "July 2016" "aevol 5.0" "User Manual" .SH NAME Aevol \- an in silico experimental evolution platform .SH SYNOPSIS .B aevol_misc_extract \-h | .B \-\-help .br .B aevol_misc_extract \-V | .B \-\-version .br .B aevol_misc_extract \fR[\fB\-t\fI TIMESTEP\fR] \fR[\fB\-S\fI SEQ_FILE\fR] \fR[\fB\-T\fI TRIANGLE_FILE\fR] \fR[\fB\-U\fI NUM_GU\fR] \fR[\fB\-a\fR] .SH DESCRIPTION .B Aevol is a simulation platform that allows one to let populations of digital organisms evolve in different conditions and study experimentally the mechanisms responsible for the structuration of the genome and the transcriptome. .TP .B aevol_misc_extract extracts the genotype and/or data about the phenotype of individuals in the provided population and write them into text files easy to parse with e.g. matlab. .SH OPTIONS .TP .B \-h, \-\-help print help, then exit .TP .B \-V, \-\-version print version number, then exit .HP .B \-t .I TIMESTEP .br specify timestep of the individual(s) of interest .HP .B \-S .I SEQ_FILE .br extract sequences into file SEQ_FILE .HP .B \-T .I TRIANGLE_FILE .br extract phenotypic data into file TRIANGLE_FILE .HP .B \-U .I NUM_GU .br only treat genetic unit #NUM_GU .br default: treat all genetic units .HP .B \-a .br treat all the individuals .br default: treat only the best .SH "SEE ALSO" .B ae_misc_lineage, aevol_create, aevol_modify, aevol_propagate, aevol_run aevol-5.0/doc/aevol.conf0000755000175000017500000017760712421166362012157 00000000000000# Doxyfile 1.6.2 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = aevol # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = . # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 2 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = YES # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it parses. # With this tag you can assign which parser to use for a given extension. # Doxygen has a built-in mapping, but you can override or extend it using this tag. # The format is ext=language, where ext is a file extension, and language is one of # the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, # Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat # .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), # use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. EXTENSION_MAPPING = # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter # and setter methods for a property. Setting this option to YES (the default) # will make doxygen to replace the get and set methods by a property in the # documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # The SYMBOL_CACHE_SIZE determines the size of the internal cache use to # determine which symbols to keep in memory and which to flush to disk. # When the cache is full, less often used symbols will be written to disk. # For small to medium size projects (<1000 input files) the default value is # probably good enough. For larger projects a too small cache size can cause # doxygen to be busy swapping symbols to and from disk most of the time # causing a significant performance penality. # If the system has enough physical memory increasing the cache will improve the # performance by keeping more symbols in memory. Note that the value works on # a logarithmic scale so increasing the size by one will rougly double the # memory usage. The cache size is given by this formula: # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols SYMBOL_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = YES # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespace are hidden. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen # will list include files with double quotes in the documentation # rather than with sharp brackets. FORCE_LOCAL_INCLUDES = NO # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # If the sources in your project are distributed over multiple directories # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = NO # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. # This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by # doxygen. The layout file controls the global structure of the generated output files # in an output format independent way. The create the layout file that represents # doxygen's defaults, run doxygen with the -l option. You can optionally specify a # file name after the option, if omitted DoxygenLayout.xml will be used as the name # of the layout file. LAYOUT_FILE = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be abled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = ../src # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 FILE_PATTERNS = # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. # If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. # Doxygen will compare the file name with each pattern and apply the # filter if there is a match. # The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. # Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = NO # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting # this to NO can help when comparing the output of multiple runs. HTML_TIMESTAMP = NO # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. For this to work a browser that supports # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). HTML_DYNAMIC_SECTIONS = NO # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER # are set, an additional index file will be generated that can be used as input for # Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated # HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. # For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's # filter section matches. # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files # will be generated, which together with the HTML files, form an Eclipse help # plugin. To install this plugin and make it available under the help contents # menu in Eclipse, the contents of the directory containing the HTML and XML # files needs to be copied into the plugins directory of eclipse. The name of # the directory within the plugins directory should be the same as # the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before the help appears. GENERATE_ECLIPSEHELP = NO # A unique identifier for the eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have # this name. ECLIPSE_DOC_ID = org.doxygen.Project # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value is set to YES, a side panel will be generated # containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). # Windows users are probably better off using the HTML help feature. GENERATE_TREEVIEW = NO # By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, # and Class Hierarchy pages using a tree view instead of an ordered list. USE_INLINE_TREES = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 # When the SEARCHENGINE tag is enabled doxygen will generate a search box for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) there is already a search function so this one should # typically be disabled. For large projects the javascript based search engine # can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be implemented using a PHP enabled web server instead of at the web client using Javascript. Doxygen will generate the search PHP script and index # file to put on the web server. The advantage of the server based approach is that it scales better to large projects and allows full text search. The disadvances is that it is more difficult to setup # and does not have live searching capabilities. SERVER_BASED_SEARCH = NO #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. # Note that when enabling USE_PDFLATEX this option is only used for # generating bitmaps for formulas in the HTML output, but not in the # Makefile that is written to the output directory. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO # If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER. LATEX_SOURCE_CODE = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. # This is useful # if you want to understand what is going on. # On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = __X11 # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse # the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option is superseded by the HAVE_DOT option below. This is only a # fallback. It is recommended to install and use dot, since it yields more # powerful graphs. CLASS_DIAGRAMS = YES # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = YES # By default doxygen will write a font called FreeSans.ttf to the output # directory and reference it in all dot files that doxygen generates. This # font does not include all possible unicode characters however, so when you need # these (or just want a differently looking font) you can specify the font name # using DOT_FONTNAME. You need need to make sure dot is able to find the font, # which can be done by putting it in a standard location or by setting the # DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory # containing the font. DOT_FONTNAME = FreeSans # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the output directory to look for the # FreeSans.ttf font (which doxygen will put there itself). If you specify a # different font using DOT_FONTNAME you can set the path where dot # can find it using this tag. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. Warning: Depending on the platform used, # enabling this option may lead to badly anti-aliased labels on the edges of # a graph (i.e. they become hard to read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = NO # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES aevol-5.0/doc/Makefile.am0000644000175000017500000000146412724051151012211 00000000000000 # Set default behaviour depending on configure options if WANT_DOXYGEN all: doxygen else all: endif # Man pages dist_man1_MANS = aevol_create.1 aevol_run.1 aevol_modify.1 aevol_propagate.1 dist_man1_MANS += aevol_misc_lineage.1 aevol_misc_ancestor_stats.1 dist_man1_MANS += aevol_misc_robustness.1 aevol_misc_compute_pop_stats.1 dist_man1_MANS += aevol_misc_view.1 aevol_misc_create_eps.1 dist_man1_MANS += aevol_misc_extract.1 dist_man1_MANS += aevol_misc_gene_families.1 # How to build the devel doc doxygen: ../src/*.cpp ../src/libaevol/*.h ../src/libaevol/*.cpp ../src/post_treatments/*.cpp doxygen aevol.conf ; echo "document generated\n" > doxygen # Cleaning rules CLEANFILES = index.html clean-local: rm -rf html doxygen # Extra files to include in releases (dist) EXTRA_DIST = README.txt aevol.conf aevol-5.0/doc/aevol_misc_gene_families.10000644000175000017500000000175612735456367015257 00000000000000./"test with man -l .TH AEVOL "1" "July 2016" "aevol 5.0" "User Manual" .SH NAME aevol \- an in silico experimental evolution platform .SH SYNOPSIS .B aevol_misc_gene_families \-h | .B \-\-help .br .B aevol_misc_gene_families \-V | .B \-\-version .br .B aevol_misc_gene_families \fB\-f\fI LINEAGE_FILE .SH DESCRIPTION .B Aevol is a simulation platform that allows one to let populations of digital organisms evolve in different conditions and study experimentally the mechanisms responsible for the structuration of the genome and the transcriptome. .TP .B aevol_misc_gene_families issues the detailed history of each gene family on the lineage of a given individual .SH OPTIONS .TP .B \-h, \-\-help print help, then exit .TP .B \-V, \-\-version print version number, then exit .HP .B \-f, \-\-file .I LINEAGE_FILE .br specify which lineage file to use. Lineage files are created by the ae_misc_lineage tool .SH "SEE ALSO" .B ae_misc_lineage, aevol_create, aevol_modify, aevol_propagate, aevol_run aevol-5.0/doc/aevol_run.10000644000175000017500000000256512735456367012260 00000000000000./"test with man -l .TH AEVOL "1" "July 2016" "aevol 5.0" "User Manual" .SH NAME Aevol \- an in silico experimental evolution platform .SH SYNOPSIS .B aevol_run \-h | .B \-\-help .br .B aevol_run \-V | .B \-\-version .br .B aevol_run \fR[\fB\-b\fI TIMESTEP\fR] \fR[\fB\-e\fI TIMESTEP\fR | \fB\-n\fI NB_TIMESTEP\fR] \fR[\fB\-p\fI NB_THREADS\fR] \fR[\fB\-vwx\fR] .SH DESCRIPTION .B Aevol is a simulation platform that allows one to let populations of digital organisms evolve in different conditions and study experimentally the mechanisms responsible for the structuration of the genome and the transcriptome. .TP .B aevol_run run an aevol simulation. .SH OPTIONS .TP .B \-h, \-\-help print help, then exit .TP .B \-V, \-\-version print version number, then exit .HP .B \-b, \-\-begin .I TIMESTEP .br specify time t0 to resume simulation at (default read in last_gener.txt) .HP .B \-e, \-\-end .I TIMESTEP .br specify time of the end of the simulation .HP .B \-n, \-\-nb-timesteps .I NB_TIMESTEPS .br specify number of timesteps to be simulated (default 1000) .TP .B \-p, \-\-parallel .I NB_THREADS run on NB_THREADS threads (use -1 for system default) .TP .B \-v, \-\-verbose be verbose .TP .B \-w, \-\-wait pause after loading .TP .B \-x, \-\-noX don't display X outputs upon start .br send SIGUSR1 to switch X output on/off .SH "SEE ALSO" .B aevol_create, aevol_modify, aevol_propagate aevol-5.0/doc/aevol_misc_lineage.10000644000175000017500000000266412735456367014073 00000000000000./"test with man -l .TH AEVOL "1" "July 2016" "aevol 5.0" "User Manual" .SH NAME Aevol \- an in silico experimental evolution platform .SH SYNOPSIS .B aevol_misc_lineage \-h | .B \-\-help .br .B aevol_misc_lineage \-V | .B \-\-version .br .B aevol_misc_lineage \fR[\fB\-b\fI TIMESTEP\fR] \fR[\fB\-e\fI TIMESTEP\fR] \fR[\fB\-I\fI INDEX\fR | \fB\-R\fI RANK\fR] \fR[\fB\-F\fR] \fR[\fB\-v\fR] .SH DESCRIPTION .B Aevol is a simulation platform that allows one to let populations of digital organisms evolve in different conditions and study experimentally the mechanisms responsible for the structuration of the genome and the transcriptome. .TP .B aevol_misc_lineage reconstruct the lineage of a given individual from the tree files .SH OPTIONS .TP .B \-h, \-\-help print help, then exit .TP .B \-V, \-\-version print version number, then exit .HP .B \-b, \-\-begin .I TIMESTEP .br specify time t0 up to which to reconstruct the lineage .HP .B \-e, \-\-end .I TIMESTEP .br specify time t_end of the indiv whose lineage is to be reconstructed .HP .B \-I, \-\-index .I INDEX .br specify the index of the indiv whose lineage is to be reconstructed .HP .B \-R, \-\-rank .I RANK .br specify the rank of the indiv whose lineage is to be reconstructed default: best individual .HP .B \-F, \-\-full-check .br perform genome checks whenever possible .HP .B \-v, \-\-verbose .br be verbose .SH "SEE ALSO" .B aevol_create, aevol_modify, aevol_propagate, aevol_run aevol-5.0/doc/aevol_misc_ancestor_stats.10000644000175000017500000000204012735456367015507 00000000000000./"test with man -l .TH AEVOL "1" "July 2016" "aevol 5.0" "User Manual" .SH NAME Aevol \- an in silico experimental evolution platform .SH SYNOPSIS .B aevol_misc_ancestor_stats \-h | .B \-\-help .br .B aevol_misc_ancestor_stats \-V | .B \-\-version .br .B aevol_misc_ancestor_stats \fILINEAGE_FILE \fR[\fB\-FMv\fR] .SH DESCRIPTION .B Aevol is a simulation platform that allows one to let populations of digital organisms evolve in different conditions and study experimentally the mechanisms responsible for the structuration of the genome and the transcriptome. .TP .B aevol_misc_ancestor_stats issues statistics for the line of descent described in LINEAGE_FILE. .SH OPTIONS .TP .B \-h, \-\-help print help, then exit .TP .B \-V, \-\-version print version number, then exit .TP .B \-F, \-\-full-check perform genome checks whenever possible .TP .B \-M, \-\-trace-mutations outputs the fixed mutations (in a separate file) .TP .B \-v, \-\-verbose be verbose .SH "SEE ALSO" .B ae_misc_lineage, aevol_create, aevol_modify, aevol_propagate, aevol_run aevol-5.0/doc/aevol_misc_create_eps.10000644000175000017500000000243312735456367014573 00000000000000./"test with man -l .TH AEVOL "1" "July 2016" "aevol 5.0" "User Manual" .SH NAME Aevol \- an in silico experimental evolution platform .SH SYNOPSIS .B aevol_misc_create_eps \-h | .B \-\-help .br .B aevol_misc_create_eps \-V | .B \-\-version .br .B aevol_misc_create_eps \fR[\fB\-t\fI TIMESTEP\fR] \fR[\fB\-I\fI INDEX\fR | \fB\-R\fI RANK\fR] \fR[\fB\-v\fR] .SH DESCRIPTION .B Aevol is a simulation platform that allows one to let populations of digital organisms evolve in different conditions and study experimentally the mechanisms responsible for the structuration of the genome and the transcriptome. .TP .B aevol_misc_create_eps creates EPS files with the triangles, the positive and negative profiles, the phenotype, the CDS and the mRNAs of the individual of interest. .SH OPTIONS .TP .B \-h, \-\-help print help, then exit .TP .B \-V, \-\-version print version number, then exit .HP .B \-t, \-\-timestep .I TIMESTEP .br specify timestep of the individual of interest .br default: that contained in file last_gener.txt, if any .HP .B \-I, \-\-index .I INDEX .br specify the index of the individual of interest .HP .B \-R, \-\-rank .I RANK .br specify the rank of the individual of interest .br default: best individual .SH "SEE ALSO" .B aevol_create, aevol_modify, aevol_propagate, aevol_run aevol-5.0/doc/aevol_misc_view.10000644000175000017500000000161212735456367013431 00000000000000./"test with man -l .TH AEVOL "1" "July 2016" "aevol 5.0" "User Manual" .SH NAME Aevol \- an in silico experimental evolution platform .SH SYNOPSIS .B aevol_misc_view \-h | .B \-\-help .br .B aevol_misc_view \-V | .B \-\-version .br .B aevol_misc_view \fB\-t\fI TIMESTEP .SH DESCRIPTION .B Aevol is a simulation platform that allows one to let populations of digital organisms evolve in different conditions and study experimentally the mechanisms responsible for the structuration of the genome and the transcriptome. .TP .B aevol_misc_view view the simulation at the provided timestep .SH OPTIONS .TP .B \-h, \-\-help print help, then exit .TP .B \-V, \-\-version print version number, then exit .HP .B \-t, \-\-timestep .I TIMESTEP .br specify timestep to display .br default: that contained in file last_gener.txt, if any .SH "SEE ALSO" .B aevol_create, aevol_modify, aevol_propagate, aevol_run aevol-5.0/doc/aevol_misc_robustness.10000644000175000017500000000374112735456367014673 00000000000000./"test with man -l .TH AEVOL "1" "July 2016" "aevol 5.0" "User Manual" .SH NAME Aevol \- an in silico experimental evolution platform .SH SYNOPSIS .B aevol_misc_robustness \-h \fR|\fB \-\-help .br .B aevol_misc_robustness \-V \fR|\fB \-\-version .br .B aevol_misc_robustness \fR[\fB\-t\fI TIMESTEP\fR] \fR[\fB\-I\fI INDEX\fR | \fB\-R\fI RANK\fR] [\fB\-n\fI NB_MUTANTS] .SH DESCRIPTION .B Aevol is a simulation platform that allows one to let populations of digital organisms evolve in different conditions and study experimentally the mechanisms responsible for the structuration of the genome and the transcriptome. .TP .B aevol_misc_robustness computes the replication statistics of all the individuals of a given generation, like the proportion of neutral, beneficial, deleterious offsprings. This is done by simulating NBCHILDREN replications for each individual (1000 replications by default), with its mutation, rearrangement and transfer rates. Depending on those rates and genome size, there can be several mutations per replication. Those global statistics are written in stat/robustness_GENER.out, with one line per individual in the specified generation. The program also outputs detailed statistics for one of the individuals (the best one by default). The detailed statistics for this individual are written in stats/replication_GENER.out, with one line per simulated child of this particular individual. .SH OPTIONS .TP .B \-h, \-\-help print help, then exit .TP .B \-V, \-\-version print version number, then exit .HP .B \-t, \-\-timestep .I TIMESTEP .br specify timestep of the individual of interest .HP .B \-I, \-\-index .I INDEX .br specify the index of the individual of interest .HP .B \-R, \-\-rank .I RANK .br specify the rank of the individual of interest default: best individual .HP .B \-n, \-\-nb\-mutants .I NB_MUTANTS .br specify the number of mutants to be generated .SH "SEE ALSO" .B aevol_create, aevol_modify, aevol_propagate, aevol_run, aevol_misc_ancestor_robustness aevol-5.0/doc/aevol_modify.10000644000175000017500000000165112735456367012736 00000000000000./"test with man -l .TH AEVOL "1" "July 2016" "aevol 5.0" "User Manual" .SH NAME Aevol \- an in silico experimental evolution platform .SH SYNOPSIS .B aevol_modify \-h or .B \-\-help .br .B aevol_modify \-V or .B \-\-version .br .B aevol_modify \fR[\fB\-T\fI TIMESTEP\fR] \fR[\fB\-F\fI PARAM_FILE\fR] .SH DESCRIPTION .B Aevol is a simulation platform that allows one to let populations of digital organisms evolve in different conditions and study experimentally the mechanisms responsible for the structuration of the genome and the transcriptome. .TP .B aevol_modify modify an experiment as specified in .I PARAM_FILE .SH OPTIONS .TP .B \-h, \-\-help print help, then exit .TP .B \-V, \-\-version print version number, then exit .HP .B \-t, \-\-timestep .I TIMESTEP .br specify timestep .HP .B \-f, \-\-file .I PARAM_FILE .br specify parameter file (default: param.in) .SH "SEE ALSO" .B aevol_create, aevol_run, aevol_propagate aevol-5.0/doc/Makefile.in0000644000175000017500000003675512735464143012250 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = doc ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \ $(top_srcdir)/m4/ax_boost_filesystem.m4 \ $(top_srcdir)/m4/ax_boost_system.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx_14.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } man1dir = $(mandir)/man1 am__installdirs = "$(DESTDIR)$(man1dir)" NROFF = nroff MANS = $(dist_man1_MANS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(dist_man1_MANS) $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AEVOLCPPFLAGS = @AEVOLCPPFLAGS@ AEVOLCXXFLAGS = @AEVOLCXXFLAGS@ AEVOLLDFLAGS = @AEVOLLDFLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@ BOOST_LDFLAGS = @BOOST_LDFLAGS@ BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ HAVE_CXX11 = @HAVE_CXX11@ HAVE_CXX14 = @HAVE_CXX14@ HAVE_DOXYGEN = @HAVE_DOXYGEN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ XMKMF = @XMKMF@ X_CFLAGS = @X_CFLAGS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_LIBS = @X_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # Man pages dist_man1_MANS = aevol_create.1 aevol_run.1 aevol_modify.1 \ aevol_propagate.1 aevol_misc_lineage.1 \ aevol_misc_ancestor_stats.1 aevol_misc_robustness.1 \ aevol_misc_compute_pop_stats.1 aevol_misc_view.1 \ aevol_misc_create_eps.1 aevol_misc_extract.1 \ aevol_misc_gene_families.1 # Cleaning rules CLEANFILES = index.html # Extra files to include in releases (dist) EXTRA_DIST = README.txt aevol.conf all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-man1: $(dist_man1_MANS) @$(NORMAL_INSTALL) @list1='$(dist_man1_MANS)'; \ list2=''; \ test -n "$(man1dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.1[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list='$(dist_man1_MANS)'; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(MANS) installdirs: for dir in "$(DESTDIR)$(man1dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-local mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-man install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man1 install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-man uninstall-man: uninstall-man1 .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-local \ cscopelist-am ctags-am distclean distclean-generic distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-man1 \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic pdf pdf-am ps ps-am tags-am uninstall \ uninstall-am uninstall-man uninstall-man1 .PRECIOUS: Makefile # Set default behaviour depending on configure options @WANT_DOXYGEN_TRUE@all: doxygen @WANT_DOXYGEN_FALSE@all: # How to build the devel doc doxygen: ../src/*.cpp ../src/libaevol/*.h ../src/libaevol/*.cpp ../src/post_treatments/*.cpp doxygen aevol.conf ; echo "document generated\n" > doxygen clean-local: rm -rf html doxygen # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: aevol-5.0/doc/aevol_misc_compute_pop_stats.10000644000175000017500000000276612735456367016242 00000000000000./"test with man -l .TH AEVOL "1" "July 2016" "aevol 5.0" "User Manual" .SH NAME aevol \- an in silico experimental evolution platform .SH SYNOPSIS .B aevol_misc_compute_pop_stats \-h | .B \-\-help .br .B aevol_misc_compute_pop_stats \-V | .B \-\-version .br .B aevol_misc_compute_pop_stats \fR[\fB\-i\fI INDEX\fR | \fB\-r\fI RANK\fR] \fR[\fB\-b\fI GENER1\fR] \fB\-e\fI GENER2 .SH DESCRIPTION .B Aevol is a simulation platform that allows one to let populations of digital organisms evolve in different conditions and study experimentally the mechanisms responsible for the structuration of the genome and the transcriptome. .TP .B aevol_misc_compute_pop_stats issues population and replication statistics for each available backup from GENER1 to GENER2. These statistics are written in files global_pop_stats.out and stats/pop_stats/*. .SH OPTIONS .TP .B \-h, \-\-help print help, then exit .TP .B \-V, \-\-version print version number, then exit .HP .B \-i, \-\-index .I INDEX .br specify the index (ID in current generation) of the individual whose replication statistics should be outputted .HP .B \-r, \-\-rank .I RANK .br specify the rank of the individual whose replication statistics should be outputted .HP .B \-b, \-\-begin .I GENER .br specify the first generation for which the statistics should be computed .HP .B \-e, \-\-end .I GENER .br specify the last generation for which the statistics should be computed .SH "SEE ALSO" .B ae_misc_lineage, aevol_create, aevol_modify, aevol_propagate, aevol_run aevol-5.0/doc/README.txt0000644000175000017500000000015212421166362011651 00000000000000The documentation being quite heavy, it is not included in basic distributions. Please visit www.aevol.fr aevol-5.0/doc/aevol_propagate.10000644000175000017500000000226312735456367013431 00000000000000./"test with man -l .TH AEVOL "1" "July 2016" "aevol 5.0" "User Manual" .SH NAME Aevol \- an in silico experimental evolution platform .SH SYNOPSIS .B aevol_propagate \-h or .B \-\-help .br .B aevol_propagate \-V or .B \-\-version .br .B aevol_propagate \fR[\fB\-t\fI TIMESTEP\fR] \fR[\fB\-K\fR] \fR[\fB\-o\fI OUTDIR\fR] \fR[\fB\-v\fR] .SH DESCRIPTION .B Aevol is a simulation platform that allows one to let populations of digital organisms evolve in different conditions and study experimentally the mechanisms responsible for the structuration of the genome and the transcriptome. .TP .B aevol_propagate creates a fresh copy of the experiment as it was at the given timestep. The timestep of the copy will be reset to 0. .SH OPTIONS .TP .B \-h, \-\-help print help, then exit .TP .B \-V, \-\-version print version number, then exit .HP .B \-t, \-\-timestep .I TIMESTEP .br specify timestep to propagate .br default: that contained in file last_gener.txt, if any .TP .B \-K, \-\-keep-prng-st .br do not alter prng states .HP .B \-o, \-\-out .I OUTDIR .br specify output directory .br default "./output" .TP .B \-v, \-\-verbose be verbose .SH "SEE ALSO" .B aevol_create, aevol_run, aevol_modify aevol-5.0/configure.ac0000644000175000017500000003277312735463330011715 00000000000000# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. # Require version 2.65 (or newer) of the autotools AC_PREREQ([2.65]) # Provide FULL-PACKAGE-NAME, VERSION and BUG-REPORT-ADDRESS AC_INIT([AEVOL], [5.0], [aevol-bugs@lists.gforge.inria.fr], , [www.aevol.fr]) # Set C++ as the main language AC_LANG([C++]) # Change default value for CXXFLAGS test_CXXFLAGS=${CXXFLAGS+set} if test "$test_CXXFLAGS" != set; then CXXFLAGS="" fi # Specify the location of additional local Autoconf macros AC_CONFIG_MACRO_DIR([m4]) # We want to use automake AM_INIT_AUTOMAKE # Select compiler AC_PROG_CXX([clang-omp++ clang++ g++ icc]) # Detect C++11 or C++14 AX_CXX_COMPILE_STDCXX_14([noext],[optional]) AX_CXX_COMPILE_STDCXX_11([noext]) #if test -z "$HAVE_CXX14"; #fi # Check the existance of an arbitrary source file AC_CONFIG_SRCDIR([src/aevol_run.cpp]) # Build config.h using config.h.in as a template #AC_CONFIG_HEADERS([config.h:config.h.in]) # Checks for programs AC_PROG_INSTALL AC_PROG_RANLIB AC_OPENMP AM_PROG_CC_C_O # Print warning if openmp not found AC_CHECK_HEADER([omp.h], , [AC_MSG_WARN([openmp not found - continuing without openmp support])]) # Check for boost AX_BOOST_BASE([1.55],, [AC_MSG_ERROR([boost not found, please check that you have boost installed on your system and retry])]) AX_BOOST_SYSTEM AX_BOOST_FILESYSTEM # Initialize configure-time defined flags AC_SUBST(AEVOLCPPFLAGS, "") # C PreProcessor flags AC_SUBST(AEVOLCXXFLAGS, "$OPENMP_CXXFLAGS") # C++ Compile flags AC_SUBST(AEVOLLDFLAGS, "$OPENMP_CXXFLAGS") # Linker flags # Checks for libraries. AC_CHECK_LIB([m], [cos], , [AC_MSG_ERROR([PACKAGE_NAME requires the math library, please install it.])]) AC_CHECK_LIB([z], [gzread], , [AC_MSG_ERROR([PACKAGE_NAME requires the zlib development library, please install it.])]) # Checks for header files. AC_CHECK_HEADERS([inttypes.h limits.h stdint.h stdlib.h string.h unistd.h]) # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL AC_C_INLINE AC_TYPE_INT16_T AC_TYPE_INT32_T AC_TYPE_INT8_T AC_TYPE_SIZE_T AC_TYPE_UINT32_T AC_TYPE_UINT8_T # Checks for library functions. AC_CHECK_FUNCS([floor memset mkdir pow rint sqrt gzread]) # **************************************************************************** # OPTIONS # # Supported options [default]: # --with-x [yes] # --enable-optim [enabled] # --enable-normalized-fitness [disabled] # --enable-mtperiod=period [disabled] # --enable-trivialjumps=jumpsize [disabled] # --enable-devel [disabled] # --enable-debug [disabled] # --enable-profiling [disabled] # # **************************************************************************** # ************************ --without-x option ********************* # # When this option is set, running make will produce aevol and # most post-treatment programs without visualization capabilities # This is useful if we want to run computations on a cluster where the # X libraries are not present. AC_MSG_CHECKING([whether to enable graphical outputs]) AC_ARG_WITH(x, [ --without-x to disable graphical output], , with_x=yes) AC_MSG_RESULT($with_x) AM_CONDITIONAL(WITH_X, test x"$with_x" != xno) if test "x$with_x" != xno ; then AC_DEFINE(__X11) AC_PATH_XTRA # AC_PATH_XTRA updates X_LIBS and X_CFLAGS but not CPPFLAGS, CXXFLAGS or LDFLAGS. # Thus we need to add X_CFLAGS to AEVOLCPPFLAGS, and X_LIBS to AEVOLLDFLAGS. # Moreover, on MacOS, AC_CHECK_LIB needs correct CPPFLAGS to find X11. But CPPFLAGS is normally a user # variable, which we should not change. Thus we save its previous value to restore it after AC_CHECK_LIB. ac_cppflags_save="$CPPFLAGS" CPPFLAGS+=" $X_CFLAGS" AEVOLCPPFLAGS+=" $X_CFLAGS" AEVOLLDFLAGS+=" $X_LIBS" AC_CHECK_LIB(X11, XOpenDisplay, , [AC_MSG_ERROR([the X11 library could not be found on your system. Please install it or re-run with the --without-x option])],$X_LIBS) AC_CHECK_HEADERS([X11/Xlib.h X11/Xutil.h X11/keysym.h X11/Xatom.h X11/cursorfont.h]) CPPFLAGS="$ac_cppflags_save" else AC_DEFINE(__NO_X) fi # ******************* --enable-optim option *************************** # # With this option, the programs are compiled with the # optimization options (-O3 - fexpensive-optimizations...). # AC_MSG_CHECKING([whether to use compile time optimization]) AC_ARG_ENABLE(optim, [ --disable-optim turn off compile time optimization], , enable_optim=yes) AC_MSG_RESULT($enable_optim) AM_CONDITIONAL(WITH_OPTIM, test x"$enable_optim" != xno) if test "x$enable_optim" = "xyes" ; then AEVOLCXXFLAGS+=" -O3 -ffast-math -pipe -fexpensive-optimizations" else AEVOLCXXFLAGS+=" -O0" fi # ******************* --enable-normalized-fitness option *************************** # # With this option, the NORMALIZED_FITNESS flag is defined, # allowing a different fitness calculation AC_MSG_CHECKING([whether to use normalized fitness]) AC_ARG_ENABLE(normalized-fitness, [ --enable-normalized-fitness to enable fitness normalization], , enable_normalized_fitness=no) AC_MSG_RESULT($enable_normalized_fitness) AM_CONDITIONAL(WITH_NORMALIZED_FITNESS, test x"$enable_normalized_fitness" != xno) if test "x$enable_normalized_fitness" = "xyes" ; then AC_DEFINE(NORMALIZED_FITNESS) fi # ************************* --enable-mtperiod=period option ******************************* # # This option sets a particular period for the Mersenne Twister. # Default is --enable-mtperiod=607 corresponding to a period of 2^607. # Possible values are 607, 1279, 2281, 4253, 11213, 19937, 44497, 86243, 132049 and 216091 # AC_MSG_CHECKING([whether to use a particular period for the Mersenne Twister]) AC_ARG_ENABLE(mtperiod, [ --enable-mtperiod=period Set the Mersenne Twister period to 2^period (default is 2^607). Possible values are 607, 1279, 2281, 4253, 11213, 19937, 44497, 86243, 132049 and 216091 Consider using in conjunction with --enable-trivialjumps for large periods ], period=$enableval, period=607) if test $period != 607 && test $period != 1279 && test $period != 2281 && test $period != 4253 && test $period != 11213 && test $period != 19937 && test $period != 44497 && test $period != 86243 && test $period != 132049 && test $period != 216091 ; then AC_MSG_RESULT([FAIL]) AC_MSG_ERROR([$period is not a valid Mersenne Twister period]) fi AC_MSG_RESULT($period) AC_DEFINE_UNQUOTED([SFMT_MEXP], [$period]) # ************************* --enable-trivialjumps=jumpsize option ******************************* # # When this option is set, a trivial jump algorithm will be used instead of the polynomial-based method. # This is recommended for large Mersenne Twister periods when huge jumps are not needed since # the polynomial-based method takes more time in that case. # # For the standard MT (period 2^19937), it takes approx. the same time to draw a few million numbers # than it does to make the same jump using the polynomial-based method. # # The jumpsize argument allows to set the desired jump size. The default value is 1000 which is enough to # avoid overlaps in most cases. # AC_MSG_CHECKING([whether to use trivial Mersenne Twister jumps]) AC_ARG_ENABLE(trivialjumps, [ --enable-trivialjumps=jumpsize When this option is set, a trivial jump algorithm will be used instead of the polynomial-based method. This is recommended for large Mersenne Twister periods when huge jumps are not needed since the polynomial-based method takes more time in that case. For the standard MT (period 2^19937), it takes approx. the same time to draw a few million numbers than it does to make the same jump using the polynomial-based method. The jumpsize argument allows to set the desired jump size. The default value is 1000 which is enough to avoid overlaps in most cases. ], trivialjumps=$enableval, trivialjumps=no) if test "x$trivialjumps" != "xyes" && test "x$trivialjumps" != "xno" ; then AC_MSG_RESULT([yes ($trivialjumps)]) else AC_MSG_RESULT([$trivialjumps]) fi AM_CONDITIONAL(ENABLE_FORCEPJ, test x"$trivialjumps" != xno) if test "x$trivialjumps" = "xyes" ; then AC_DEFINE([TRIVIAL_METHOD_JUMP_SIZE], [1000]) elif test "x$trivialjumps" != "xno" ; then AC_DEFINE_UNQUOTED([TRIVIAL_METHOD_JUMP_SIZE], [$trivialjumps]) fi # ******************* --enable-devel option *************************** # # This enables developers' features: # adds a call to make clean at the end of the configure script. # enables doxygen if available # AC_MSG_CHECKING([whether to use devel features]) AC_ARG_ENABLE(devel, [ --enable-devel turn on development features], , enable_devel=no) AC_MSG_RESULT($enable_devel) AM_CONDITIONAL(ENABLE_DEVEL, test x"$enable_devel" != xno) if test "x$enable_devel" = "xyes" ; then # Make clean at the end of the configuration process # (usefull when several configurations are done consecutively, typically during development) AC_CONFIG_COMMANDS(make, [make clean]) # Check for Doxygen AC_CHECK_PROGS([HAVE_DOXYGEN], [doxygen]) if test -z "$HAVE_DOXYGEN"; then AC_MSG_WARN([Doxygen not found - continuing without Doxygen support]) fi else # Output a warning message about multi-configuration and make clean AC_CONFIG_COMMANDS([user_warning], [AC_MSG_NOTICE([Consider using make clean if you are re-configuring.])]) fi AM_CONDITIONAL([WANT_DOXYGEN], [test -n "$HAVE_DOXYGEN"]) # ******************* --enable-debug option *************************** # # With this option, the DEBUG flag is defined, and the programs are # compiled with debugging options (-g -Wall). # AC_MSG_CHECKING([whether to use debugging features]) AC_ARG_ENABLE(debug, [ --enable-debug to enable degugging features], , enable_debug=no) AC_MSG_RESULT($enable_debug) AM_CONDITIONAL(WITH_DEBUG, test x"$enable_debug" != xno) if test "x$enable_debug" = "xyes" ; then AC_DEFINE(DEBUG) AEVOLCXXFLAGS+=" -g -Wall" else AC_DEFINE(NDEBUG) fi # ******************* --enable-profiling option *************************** # # With this option, the -pg flag is defined. # AC_MSG_CHECKING([whether to enable profiling]) AC_ARG_ENABLE(profiling, [ --enable-profiling to enable profiling], , enable_profiling=no) AC_MSG_RESULT($enable_profiling) AM_CONDITIONAL(WITH_PROFILING, test x"$enable_profiling" != xno) if test "x$enable_profiling" = "xyes" ; then AEVOLCXXFLAGS+=" -pg" AEVOLLDFLAGS+=" -pg" fi # ************************* --with-raevol option ******************************* # # With this option, regulation is enabled (RAevol) and the __REGUL flag is defined # AC_MSG_CHECKING([whether to use raevol]) AC_ARG_WITH(raevol, [--with-raevol to enable regulation], raevol=$withval, raevol=no) AC_MSG_RESULT($raevol) AM_CONDITIONAL(WITH_RAEVOL, test x"$raevol" != xno) if test "x$raevol" = "xyes" ; then AC_DEFINE(__REGUL) AM_INIT_AUTOMAKE([subdir-objects]) fi # ************************* --with-blas option ******************************* # # With this option, BLAS matrix/vector manipulation is enabled, __BLAS__ flag is defined and -lopenblas added # AC_MSG_CHECKING([whether to use BLAS library]) AC_ARG_WITH(blas, [--with-blas to the use of BLAS library], blas=$withval, blas=no) AC_MSG_RESULT($blas) AM_CONDITIONAL(WITH_BLAS, test x"$blas" != xno) if test "x$blas" = "xyes" ; then AC_DEFINE(__BLAS__) LIBS+=" -lopenblas" fi # ************************* --with-mkl option ******************************* # # With this option, MKL library is enabled, __BLAS__ flag is defined and -lmkl.. added # AC_MSG_CHECKING([whether to use MKL library]) AC_ARG_WITH(mkl, [--with-mkl to the use of MKL library], mkl=$withval, mkl=no) AC_MSG_RESULT($mkl) AM_CONDITIONAL(WITH_MKL, test x"$mkl" != xno) if test "x$mkl" = "xyes" ; then AC_DEFINE(__BLAS__) LIBS+=" -lmkl_intel_ilp64 -lmkl_core -lmkl_sequential" fi # ************************* --with-atlas option ******************************* # # With this option, ATLAS library is enabled, __BLAS__ flag is defined and -latlas added # AC_MSG_CHECKING([whether to use ATLAS library]) AC_ARG_WITH(atlas, [--with-atlas to the use of ATLAS library], atlas=$withval, atlas=no) AC_MSG_RESULT($atlas) AM_CONDITIONAL(WITH_ATLAS, test x"$atlas" != xno) if test "x$atlas" = "xyes" ; then AC_DEFINE(__BLAS__) LIBS+=" -lcblas -latlas" fi # ************************* --with-tbb option ******************************* # # With this option, Intel TBB local parallelization is enabled, __TBB flag is defined and -ltbb added # AC_MSG_CHECKING([whether to use TBB library]) AC_ARG_WITH(tbb, [--with-tbb to the use of TBB library], tbb=$withval, tbb=no) AC_MSG_RESULT($tbb) AM_CONDITIONAL(WITH_TBB, test x"$tbb" != xno) if test "x$tbb" = "xyes" ; then AC_DEFINE(__TBB) LIBS+=" -ltbb" fi # ************************* --with-tracing option ******************************* # # With this option, tracing is enabled and the __TRACING__ flag is defined # AC_MSG_CHECKING([whether to use tracing]) AC_ARG_WITH(tracing, [--with-tracing to enable tracing], tracing=$withval, tracing=no) AC_MSG_RESULT($tracing) AM_CONDITIONAL(WITH_TRACING, test x"$tracing" != xno) if test "x$tracing" = "xyes" ; then AC_DEFINE(__TRACING__) fi # ************************* back to GENERAL stuff ******************************* AC_CONFIG_FILES([Makefile src/Makefile src/libaevol/Makefile src/libaevol/SFMT-src-1.4/Makefile src/post_treatments/Makefile doc/Makefile]) AC_OUTPUT aevol-5.0/config.guess0000755000175000017500000012355012724051151011731 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2014 Free Software Foundation, Inc. timestamp='2014-03-23' # This file 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 . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # # Please send patches with a ChangeLog entry to config-patches@gnu.org. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "${UNAME_SYSTEM}" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval $set_cc_for_build cat <<-EOF > $dummy.c #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` ;; esac # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; *:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="gnulibc1" ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-${LIBC} exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-${LIBC} exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-${LIBC} exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval $set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub # that puts up a graphical alert prompting to install # developer tools. Any system running Mac OS X 10.7 or # later (Darwin 11 and later) is required to have a 64-bit # processor. This is not true of the ARM version of Darwin # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: aevol-5.0/NEWS0000644000175000017500000004143112725543021010110 00000000000000New in 5.0: [TO BE CONTINUED] * Grid * Command-line options * Post-treatments refactoring * New color map in X outputs for fitness visualization. The scale now ranges from green (good) to red (bad). New in 4.4: * aevol_create now gives a name to the created strain. It can be defined using the STRAIN_NAME keyword in the param file. If this keyword is not present, a default one will be generated. * New option -o or --out in aevol_create Allows one to create the experiment in any location. * aevol_propagate can now reset the PRNGs (random generators) with the new general option -S (affecting all random processes) or the new more specific options -m, -s, -t, -e and -n (each affects a single random process, see man page). * The environmental target can be defined by a list of custom points using the ENV_ADD_POINT keyword in the parameter file. This is an alternative to the usual way, where it is defined as a sum of gaussians. Note, however, that environmental variation is possible only for the "gaussian" way. * The aevol_misc_fixed_mutations program now outputs the number of genes affected by each mutation. More precisely, three new columns are produced: - the number of coding RNAs possibly disrupted by a switch, a small indel or a rearrangement breakpoint, - the number of coding RNAs entirely included in a rearranged segment, - in the case of a transfer by replacement, the number of genes that were entirely included in the replaced segment. This program does not work yet if plasmids are allowed. * The programs aevol_misc_lineage, aevol_misc_ancstats, aevol_misc_fixed_mutations, aevol_misc_gene_families now work when the environment was changed at some point by aevol_modify. * The fitness proportionate selection scheme now works with spatial structure * In aevol_modify, it is now possible to replace a population by clones of the best individual. To do so, add the line CLONE_BEST_NO_TREE or CLONE_BEST_AND_CHANGE_TREE in the parameter file you supply to aevol_modify. Use CLONE_BEST_AND_CHANGE_TREE if your simulation campaign uses the genealogical trees, that is to say if you set RECORD_TREE to true. Otherwise, use CLONE_BEST_NO_TREE. * Manual pages were added for aevol_misc_lineage, aevol_misc_ancstats, aevol_misc_fixed_mutations, aevol_misc_gene_families, aevol_misc_create_eps, aevol_misc_view_generation. * New option (-c and -p) in aevol_create. Allows one to load a chromosome (and possibly plasmid) from a text file. If -p is used, ALLOW_PLASMIDS must be set to true and -c must also be used. If -c is used and ALLOW_PLASMIDS is set to true, -p must also be used. * Add a script (src/misc/movies.py) to produce a movie from an aevol simulation with dumps activated. run ./src/misc/movies.py -h for help. Needs ffmpeg in path. * The aevol_misc_gene_families program issues the detailed history of each gene family on the lineage of a given individual (providing its lineage file). A gene family is defined here as a set of coding sequences that arised by duplications of a single original gene. The original gene, called the root of the family, can either be one of the genes in the initial ancestor, or a new gene created from scratch (for example by a local mutation that transformed a non-coding RNA into a coding RNA). The history of gene duplications, gene losses and gene mutations in each gene family is represented by a binary tree. The program starts by loading the initial genome at the beginning of the lineage and by tagging each gene in this initial genome. Each of these initial genes is marked as the root of a gene family. Then, each mutation recorded in the lineage file is replayed and the fate of all tagged genes is followed and recorded in their respective families. When a gene is duplicated, the corresponding node in one of the gene trees becomes an internal node, and two children nodes are added to it, representing the two gene copies. When a gene sequence is modified, the mutation is recorded in its corresponding node in one of the gene trees. When a gene is lost, the corresponding node in one of the gene trees is labelled as lost. When a new gene appears from scratch, i.e. not by gene duplication, it becomes the root of a new gene tree. Environmental variations are also replayed exactly as they occured during the main run. When all mutations have been replayed, several output files are written in a directory called gene_trees. Two general text files are produced. The file called gene_tree_statistics.txt contains general data on each gene family, like its creation date, its extinction date, or how many nodes it contained. The file called nodeattr_tabular.txt contains information about each node of each gene tree, like when it was duplicated or lost or how many mutations occurred on its branch. In addition, for each gene tree, two text files are generated: a file called genetree******-topology.tre contains the topology of the gene tree in the Newick format, and a file called genetree******-nodeattr.txt that contains the detailed list of events that happened to each node in the tree file, before it was either duplicated or lost. Usage: ae_misc_gene_families [-c | -n] [-t tolerance] -f lineage_file Changes in 4.4: * In the input file containing the parameters for aevol_create, the SELECTION_SCHEME and SELECTION_PRESSURE keywords have been merged. Only the SELECTION_SCHEME keyword is allowed, it sets both the selection scheme itself and the selection pressure (if any). e.g. SELECTION_SCHEME fitness SELECTION_PRESSURE 750 becomes SELECTION_SCHEME fitness 750 * The default value of duplication_rate, deletion_rate, translocation_rate and inversion_rate is now 1e-5 (instead of 5e-5 before). * The name of binaries no longer depend on configure-time options. e.g. aevol_run is no longer called aevol_run_X11 when x output is enabled. WARNING: If you build several times with different options enabled, you will need to make clean after reconfiguring. * Changed the way the min/max total genome size and the min/max genetic unit size are handled. If you do not use plasmids (ALLOW_PLASMIDS not set, or equal to false), replace INITIAL_GENOME_LENGTH by CHROMOSOME_INITIAL_LENGTH in param.in, and everything will work as it did before. If you do use plasmids, you can now define values for the PLASMID_INITIAL_LENGTH, the PLASMID_MINIMAL_LENGTH, the PLASMID_MAXIMAL_LENGTH, the CHROMOSOME_MINIMAL_LENGTH and the CHROMOSOME_MAXIMAL_LENGTH. In all cases, MIN_GENOME_LENGTH and MAX_GENOME_LENGTH now control the total genome size (i.e., chromosome + plasmids) instead of just controlling the chomosome size. * In aevol_misc_create_eps and aevol_misc_robustness, option -e or --end is now -g or --gener for consistency reasons. * In aevol_modify, the transfer rates are now stored in the mutation parameters of each individual, they are not global parameters anymore. * Removed the historical dependencies to libXi and libXmu, and modified the way compilation flags are handled according to GNU best practices. * Updated post-treatment template and added it to the compiled sources (so that one can make a new post-treatment with no need for autotools). Bugs fixed in 4.4: * Ctrl-Q was not quitting anymore, it does now. Similarly, switching display on/off wasn't working any more, this is now fixed. * Specific "chromosome" and "plasmids" stat files were issued regardless of whether plasmids were allowed or not. Now they are issued only when plasmids are allowed. * When recording stats for each genetic unit, total metabolic fitness and metabolic error were reported instead of "by-genetic-unit" metabolic fitness and metabolic error. This is now corrected. * Translocations between different genetic units were not reported in logs when tree recording was disabled. This is now fixed. * In aevol_create, init_method always set to at least ONE_GOOD_GENE | CLONE, regardless of what was written in the parameter file. This is now fixed. * In aevol_misc_lineage, there was a segmentation fault when the population was spatially structured. This is now corrected. * In aevol_misc_create_eps, there was a systematic segmentation fault since version 4.0. This is now fixed. This program also produces better scaled figures for the triangles. * In aevol_misc_fixed_mutations, the fitness impact of some mutations was wrong if there was some environmental variation. This is now corrected. * In aevol_modify, correction of a segmentation fault on change of population size. * In aevol_propagate, the input directory option (-i) is now working. This program does not write stats anymore, as it should... * The method ae_list::get_object() returned a type T* instead of T&. The bugged version of this method was never used, hence the behavior of the simulations is unaffected. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ New in 4.3 * The post-treatment view_generation is now functional for aevol (with or without space), but not for R-aevol yet. This post-treatment is available if X was enabled at the "configure" step, which is the case by default. * Lateral transfer by replacement can now be constrained to replace a segment of roughly the same size and sequence as the one given by the donor, to simulate allelic recombination. To use this kind of transfer by replacement rather than the usual one (where the donor and replaced segments only have similar sequences at their extremities), add the line "REPL_TRANSFER_WITH_CLOSE_POINTS true" in the param.in file. Specifically, a small region of high similarity is searched for between the donor chromosome and the receiving chromosome. Then this initial alignment is extended until there is no sequence similarity anymore or until a random event stops the extension -- at each extension step, there is a probability called REPL_TRANSFER_DETACH_RATE to stop the extension even if there is some sequence similarity. Below is an example of how to write the param.in file to try for a lateral transfer by replacement in 50% of the reproductions, with the constraint that the replaced segment must have roughly the same size and sequence as the donor segment (the last six parameters are for the alignment search): WITH_TRANSFER true TRANSFER_REPL_RATE 0.5 REPL_TRANSFER_WITH_CLOSE_POINTS true REPL_TRANSFER_DETACH_RATE 0.3 NEIGHBOURHOOD_RATE 1e-1 ALIGN_FUNCTION SIGMOID 0 40 ALIGN_W_ZONE_H_LEN 50 ALIGN_MAX_SHIFT 20 ALIGN_MATCH_BONUS 1 ALIGN_MISMATCH_COST 2 * Lateral transfer events by insertion or replacement can be logged during the main evolutionary run by adding the line "LOG TRANSFER" in the param.in file. They will be written in an output file called log_transfer.out. * Post-treatments lineage and ancstats can replay lateral transfer events. To simplify the post-treatments, lateral transfer events are treated as mutations and rearrangements. They are managed in ae_dna and ae_mutation and no more in ae_selection. If RECORD_TREE is set to true and if TREE_MODE is set to normal in param.in, the transfer events will be saved in the tree files with the transferred sequence. * Examples are now provided in the "examples" dir. Changes in 4.3 * Replaced most of the --with-xxxxx configure script options with --enable-xxxxx. Supported options for the configure script are now [default value in brackets]: --with-x [yes] --enable-optim [enabled] --enable-raevol [disabled] --enable-normalized-fitness [disabled] --enable-mtperiod=period [disabled] --enable-trivialjumps=jumpsize [disabled] --enable-devel [disabled] --enable-debug [disabled] --enable-in2p3 [disabled] * Post-treatment executables are installed into ${prefix}/bin rather than ${prefix}/libexec (we realized it wasn't a good idea after all...). Bugs fixed in 4.3: * Bug #289: Missing lines in the header of stats_bp_best.out * Bug #293: Initialisation with a clonal population: Individuals in the first generation had a rank equal to -1. * Bug #294: Problems in constructor and copy method of ae_vis_a_vis * Bug #300: Missing length data in the tree files for the rearrangements (NORMAL tree mode). * aevol_create produced a segmentation fault if param.in did not contain a line specifying ENV_AXIS_FEATURES. Now this parameter can be omitted, in which case the default value would be METABOLISM for the whole x-axis. * Correction of the default value for the initialisation method, which was 0 instead of "ONE_GOOD_GENE | CLONE". * Correction of memory leaks in the constructor of ae_stats and in the destructor of ae_mutation for some mutations. * Correction of a bug in the lineage post-treatment, which would fail after ~1.000 tree files were loaded because the files were never closed. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ New in 4.2 * Post-treatment executables are now prefixed with aevol_misc_ and are installed into ${prefix}/libexec rather than ${prefix}/bin Bugs fixed in 4.2 * Bugs #281 and #282: Bug in gene position This bug happenned whenever a promoter at the end of the genome on the LEADING strand transcribed a gene that was at the beginning of the genome (or a promoter at the beginning on the LAGGING strand transcribed a gene that was at the end of the genome) The position of the protein was then out of the genome bound (> genome len when LEADING or < 0 when LAGGING) If this gene was also transcribed on another rna that didn't satisfy the above constraint, it wasn't recognized as the same gene. Either bugs had no effect whatsoever on the fitness and hence on the outcome of evolution. It could however lead to erroneous statistics regarding the number of RNAs a gene is transcribed onto. * Bug #284: Undefined behavior when there is no terminator in the genome After a big deletion, it can happen that a genetic unit does not contain any teminator anymore. There can however be a promoter somewhere. The behavior of the program was different depending on the strand where the promoter was. If it was on the lagging strand, the RNA was supposed to be as long as the whole genetic unit, and could carry coding sequences. If the promoter was on the leading strand, the length of the RNA was left as is, that is, either to -1 for generation 0, or to the length inherited from the parent, which made no sense anymore once the terminator has disappeared. We decided that it is best that no RNA is produced in this case (no terminator = incomplete gene, assumed to be non-functional). * Bug #285: "Barrier" events logged twice When a deletion would cause the genetic unit to be smaller than the size of a promoter, the mutation was not performed and (if the BARRIER option was chosen in the logs), and the event was logged twice. This kind of mutations is now performed normally (and hence no log entry should be issued) as long as it doesn't make the genetic unit smaller than the minimum length specified (which is independent of the promoter size). * Bug #286: Log files incorrectly regenerated when resuming a run When resuming a run, log files are regenerated by copying the header of the former log file and its entries until the generation chosen to resume the run. During this copy, (1) the first entry was skipped, and (2) the entries for the resuming generation were copied, and thus ended up duplicated. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ New in 4.1 * Ported the "extract" post-treatment from version 3. This programs can extract from a backup the sequence and the list of all proteins for every individual in an easily parsable text-based format. * aevol_modify allows to modify the axis features and segmentation as well as secretion properties * Added man pages for the 4 main executables Bugs fixed in 4.1 * Supressed memory leaks * Introduced in 4.0: Major bias in the spatial competition caused by a bad update. * In aevol_modify, changing environment gaussians was causing a segfault when NOT using environmental variations. * Bug #279: make install no longer fails with error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ New in 4.0 * The main aevol executable has been split into 4: - aevol_create: create an experiment with setup as specified in param_file - aevol_run: run a simulation - aevol_modify: modify an experiment as specified in param_file - aevol_propagate: create a fresh copy of the experiment aevol-5.0/Makefile.am0000644000175000017500000000034712730777745011470 00000000000000 # Specify the location of additional local Autoconf macros ACLOCAL_AMFLAGS = -I m4 SUBDIRS = src doc EXTRA_DIST = examples/basic/param.in EXTRA_DIST += examples/workflow/wild_type/param.in EXTRA_DIST += examples/workflow/README aevol-5.0/AUTHORS0000644000175000017500000000076712724051151010465 00000000000000Original authors: Guillaume Beslon Carole Knibbe David P. Parsons Major Contributors: Bérénice Batut Antoine Frénoy Vincent Liard Dusan Misevic Virginie Mathivet Yolanda Sanchez-Dehesa Other Contributors: Guillaume Debras Renaud Dessales Stephan Fischer Yann Hourdel Charles Rocabert Elie Rotenberg Florian Thoni Note: Aevol is distributed with SFMT (SIMD oriented Fast Mersenne Twister) but they are considered a separate package, not part of Aevol proper. aevol-5.0/config.sub0000755000175000017500000010577512724051151011405 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2014 Free Software Foundation, Inc. timestamp='2014-09-11' # This file 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 . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches with a ChangeLog entry to config-patches@gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i686-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; moxiebox) basic_machine=moxie-unknown os=-moxiebox ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; c8051-*) os=-elf ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: aevol-5.0/README0000644000175000017500000000431112732772533010277 00000000000000############################################################################### # # Aevol - An in silico experimental evolution platform # ############################################################################### # # Aevol is a digital genetics model: populations of digital organisms are # subjected to a process of selection and variation, which creates a # Darwinian dynamics. # . # By modifying the characteristics of selection (e.g. population size, # type of environment, environmental variations) or variation (e.g. # mutation rates, chromosomal rearrangement rates, types of # rearrangements, horizontal transfer), one can study experimentally the # impact of these parameters on the structure of the evolved organisms. # In particular, since Aevol integrates a precise and realistic model of # the genome, it allows for the study of structural variations of the # genome (e.g. number of genes, synteny, proportion of coding sequences). # . # The simulation platform comes along with a set of tools for analysing # phylogenies and measuring many characteristics of the organisms and # populations along evolution. # ############################################################################### The complete documentation being quite heavy, it is not included in basic distributions. Please visit www.aevol.fr To take a quick tour, please take the following steps: 1) install aevol cd into aevol main dir ./configure make sudo make install (see INSTALL in the main dir or run ./configure --help for more information) NOTE: If you don't have sudo rights or simply don't want to install aevol just yet, skip the "sudo make install" step and run the executables "locally" with ../../src/aevol_create and ../../src/aevol_run 2) To run an example, cd into it then run: aevol_create aevol_run The first command will create an experiment with the parameters contained in the "param.in" file The second command will launch the simulation for 1000 generations (use --nb-timesteps XXX or -n XXX to run for XXX generations) For more information, please see the manpages (e.g. man aevol_create), run any executable with the -h option (e.g. aevol_create -h) and ultimately visit www.aevol.fr aevol-5.0/compile0000755000175000017500000001624512724051151010771 00000000000000#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2012-10-14.11; # UTC # Copyright (C) 1999-2013 Free Software Foundation, Inc. # Written by Tom Tromey . # # 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 2, 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 . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: aevol-5.0/m4/0000755000175000017500000000000012735464421010015 500000000000000aevol-5.0/m4/ax_boost_filesystem.m40000644000175000017500000001043712724051151014254 00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_boost_filesystem.html # =========================================================================== # # SYNOPSIS # # AX_BOOST_FILESYSTEM # # DESCRIPTION # # Test for Filesystem library from the Boost C++ libraries. The macro # requires a preceding call to AX_BOOST_BASE. Further documentation is # available at . # # This macro calls: # # AC_SUBST(BOOST_FILESYSTEM_LIB) # # And sets: # # HAVE_BOOST_FILESYSTEM # # LICENSE # # Copyright (c) 2009 Thomas Porschberg # Copyright (c) 2009 Michael Tindal # Copyright (c) 2009 Roman Rybalko # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 26 AC_DEFUN([AX_BOOST_FILESYSTEM], [ AC_ARG_WITH([boost-filesystem], AS_HELP_STRING([--with-boost-filesystem@<:@=special-lib@:>@], [use the Filesystem library from boost - it is possible to specify a certain library for the linker e.g. --with-boost-filesystem=boost_filesystem-gcc-mt ]), [ if test "$withval" = "no"; then want_boost="no" elif test "$withval" = "yes"; then want_boost="yes" ax_boost_user_filesystem_lib="" else want_boost="yes" ax_boost_user_filesystem_lib="$withval" fi ], [want_boost="yes"] ) if test "x$want_boost" = "xyes"; then AC_REQUIRE([AC_PROG_CC]) CPPFLAGS_SAVED="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" export CPPFLAGS LDFLAGS_SAVED="$LDFLAGS" LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" export LDFLAGS LIBS_SAVED=$LIBS LIBS="$LIBS $BOOST_SYSTEM_LIB" export LIBS AC_CACHE_CHECK(whether the Boost::Filesystem library is available, ax_cv_boost_filesystem, [AC_LANG_PUSH([C++]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], [[using namespace boost::filesystem; path my_path( "foo/bar/data.txt" ); return 0;]])], ax_cv_boost_filesystem=yes, ax_cv_boost_filesystem=no) AC_LANG_POP([C++]) ]) if test "x$ax_cv_boost_filesystem" = "xyes"; then AC_DEFINE(HAVE_BOOST_FILESYSTEM,,[define if the Boost::Filesystem library is available]) BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` if test "x$ax_boost_user_filesystem_lib" = "x"; then for libextension in `ls -r $BOOSTLIBDIR/libboost_filesystem* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'` ; do ax_lib=${libextension} AC_CHECK_LIB($ax_lib, exit, [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break], [link_filesystem="no"]) done if test "x$link_filesystem" != "xyes"; then for libextension in `ls -r $BOOSTLIBDIR/boost_filesystem* 2>/dev/null | sed 's,.*/,,' | sed -e 's,\..*,,'` ; do ax_lib=${libextension} AC_CHECK_LIB($ax_lib, exit, [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break], [link_filesystem="no"]) done fi else for ax_lib in $ax_boost_user_filesystem_lib boost_filesystem-$ax_boost_user_filesystem_lib; do AC_CHECK_LIB($ax_lib, exit, [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break], [link_filesystem="no"]) done fi if test "x$ax_lib" = "x"; then AC_MSG_ERROR(Could not find a version of the library!) fi if test "x$link_filesystem" != "xyes"; then AC_MSG_ERROR(Could not link against $ax_lib !) fi fi CPPFLAGS="$CPPFLAGS_SAVED" LDFLAGS="$LDFLAGS_SAVED" LIBS="$LIBS_SAVED" fi ]) aevol-5.0/m4/ax_boost_system.m40000644000175000017500000001012612724051151013407 00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_boost_system.html # =========================================================================== # # SYNOPSIS # # AX_BOOST_SYSTEM # # DESCRIPTION # # Test for System library from the Boost C++ libraries. The macro requires # a preceding call to AX_BOOST_BASE. Further documentation is available at # . # # This macro calls: # # AC_SUBST(BOOST_SYSTEM_LIB) # # And sets: # # HAVE_BOOST_SYSTEM # # LICENSE # # Copyright (c) 2008 Thomas Porschberg # Copyright (c) 2008 Michael Tindal # Copyright (c) 2008 Daniel Casimiro # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 18 AC_DEFUN([AX_BOOST_SYSTEM], [ AC_ARG_WITH([boost-system], AS_HELP_STRING([--with-boost-system@<:@=special-lib@:>@], [use the System library from boost - it is possible to specify a certain library for the linker e.g. --with-boost-system=boost_system-gcc-mt ]), [ if test "$withval" = "no"; then want_boost="no" elif test "$withval" = "yes"; then want_boost="yes" ax_boost_user_system_lib="" else want_boost="yes" ax_boost_user_system_lib="$withval" fi ], [want_boost="yes"] ) if test "x$want_boost" = "xyes"; then AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_BUILD]) CPPFLAGS_SAVED="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" export CPPFLAGS LDFLAGS_SAVED="$LDFLAGS" LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" export LDFLAGS AC_CACHE_CHECK(whether the Boost::System library is available, ax_cv_boost_system, [AC_LANG_PUSH([C++]) CXXFLAGS_SAVE=$CXXFLAGS CXXFLAGS= AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], [[boost::system::error_category *a = 0;]])], ax_cv_boost_system=yes, ax_cv_boost_system=no) CXXFLAGS=$CXXFLAGS_SAVE AC_LANG_POP([C++]) ]) if test "x$ax_cv_boost_system" = "xyes"; then AC_SUBST(BOOST_CPPFLAGS) AC_DEFINE(HAVE_BOOST_SYSTEM,,[define if the Boost::System library is available]) BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` LDFLAGS_SAVE=$LDFLAGS if test "x$ax_boost_user_system_lib" = "x"; then for libextension in `ls -r $BOOSTLIBDIR/libboost_system* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'` ; do ax_lib=${libextension} AC_CHECK_LIB($ax_lib, exit, [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break], [link_system="no"]) done if test "x$link_system" != "xyes"; then for libextension in `ls -r $BOOSTLIBDIR/boost_system* 2>/dev/null | sed 's,.*/,,' | sed -e 's,\..*,,'` ; do ax_lib=${libextension} AC_CHECK_LIB($ax_lib, exit, [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break], [link_system="no"]) done fi else for ax_lib in $ax_boost_user_system_lib boost_system-$ax_boost_user_system_lib; do AC_CHECK_LIB($ax_lib, exit, [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break], [link_system="no"]) done fi if test "x$ax_lib" = "x"; then AC_MSG_ERROR(Could not find a version of the library!) fi if test "x$link_system" = "xno"; then AC_MSG_ERROR(Could not link against $ax_lib !) fi fi CPPFLAGS="$CPPFLAGS_SAVED" LDFLAGS="$LDFLAGS_SAVED" fi ]) aevol-5.0/m4/ax_cxx_compile_stdcxx_14.m40000644000175000017500000001127512724051151015076 00000000000000# ============================================================================ # http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_14.html # ============================================================================ # # SYNOPSIS # # AX_CXX_COMPILE_STDCXX_14([ext|noext],[mandatory|optional]) # # DESCRIPTION # # Check for baseline language coverage in the compiler for the C++14 # standard; if necessary, add switches to CXXFLAGS to enable support. # # The first argument, if specified, indicates whether you insist on an # extended mode (e.g. -std=gnu++14) or a strict conformance mode (e.g. # -std=c++14). If neither is specified, you get whatever works, with # preference for an extended mode. # # The second argument, if specified 'mandatory' or if left unspecified, # indicates that baseline C++14 support is required and that the macro # should error out if no mode with that support is found. If specified # 'optional', then configuration proceeds regardless, after defining # HAVE_CXX14 if and only if a supporting mode is found. # # LICENSE # # Copyright (c) 2008 Benjamin Kosnik # Copyright (c) 2012 Zack Weinberg # Copyright (c) 2013 Roy Stogner # Copyright (c) 2014 Alexey Sokolov # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 4 m4_define([_AX_CXX_COMPILE_STDCXX_14_testbody], [[ template struct check { static_assert(sizeof(int) <= sizeof(T), "not big enough"); }; struct Base { virtual void f() {} }; struct Child : public Base { virtual void f() override {} }; typedef check> right_angle_brackets; int a; decltype(a) b; typedef check check_type; check_type c; check_type&& cr = static_cast(c); auto d = a; auto l = [](){}; ]]) AC_DEFUN([AX_CXX_COMPILE_STDCXX_14], [dnl m4_if([$1], [], [], [$1], [ext], [], [$1], [noext], [], [m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_14])])dnl m4_if([$2], [], [ax_cxx_compile_cxx14_required=true], [$2], [mandatory], [ax_cxx_compile_cxx14_required=true], [$2], [optional], [ax_cxx_compile_cxx14_required=false], [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_14])]) AC_LANG_PUSH([C++])dnl ac_success=no AC_CACHE_CHECK(whether $CXX supports C++14 features by default, ax_cv_cxx_compile_cxx14, [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_14_testbody])], [ax_cv_cxx_compile_cxx14=yes], [ax_cv_cxx_compile_cxx14=no])]) if test x$ax_cv_cxx_compile_cxx14 = xyes; then ac_success=yes fi m4_if([$1], [noext], [], [dnl if test x$ac_success = xno; then for switch in -std=gnu++14 -std=gnu++1y; do cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx14_$switch]) AC_CACHE_CHECK(whether $CXX supports C++14 features with $switch, $cachevar, [ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS $switch" AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_14_testbody])], [eval $cachevar=yes], [eval $cachevar=no]) CXXFLAGS="$ac_save_CXXFLAGS"]) if eval test x\$$cachevar = xyes; then CXXFLAGS="$CXXFLAGS $switch" ac_success=yes break fi done fi]) m4_if([$1], [ext], [], [dnl if test x$ac_success = xno; then for switch in -std=c++14 -std=c++1y; do cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx14_$switch]) AC_CACHE_CHECK(whether $CXX supports C++14 features with $switch, $cachevar, [ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS $switch" AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_14_testbody])], [eval $cachevar=yes], [eval $cachevar=no]) CXXFLAGS="$ac_save_CXXFLAGS"]) if eval test x\$$cachevar = xyes; then CXXFLAGS="$CXXFLAGS $switch" ac_success=yes break fi done fi]) AC_LANG_POP([C++]) if test x$ax_cxx_compile_cxx14_required = xtrue; then if test x$ac_success = xno; then AC_MSG_ERROR([*** A compiler with support for C++14 language features is required.]) fi else if test x$ac_success = xno; then HAVE_CXX14=0 AC_MSG_NOTICE([No compiler with C++14 support was found]) else HAVE_CXX14=1 AC_DEFINE(HAVE_CXX14,1, [define if the compiler supports basic C++14 syntax]) fi AC_SUBST(HAVE_CXX14) fi ]) aevol-5.0/m4/ax_boost_base.m40000644000175000017500000002576712724051151013016 00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_boost_base.html # =========================================================================== # # SYNOPSIS # # AX_BOOST_BASE([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # DESCRIPTION # # Test for the Boost C++ libraries of a particular version (or newer) # # If no path to the installed boost library is given the macro searchs # under /usr, /usr/local, /opt and /opt/local and evaluates the # $BOOST_ROOT environment variable. Further documentation is available at # . # # This macro calls: # # AC_SUBST(BOOST_CPPFLAGS) / AC_SUBST(BOOST_LDFLAGS) # # And sets: # # HAVE_BOOST # # LICENSE # # Copyright (c) 2008 Thomas Porschberg # Copyright (c) 2009 Peter Adolphs # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 26 AC_DEFUN([AX_BOOST_BASE], [ AC_ARG_WITH([boost], [AS_HELP_STRING([--with-boost@<:@=ARG@:>@], [use Boost library from a standard location (ARG=yes), from the specified location (ARG=), or disable it (ARG=no) @<:@ARG=yes@:>@ ])], [ if test "$withval" = "no"; then want_boost="no" elif test "$withval" = "yes"; then want_boost="yes" ac_boost_path="" else want_boost="yes" ac_boost_path="$withval" fi ], [want_boost="yes"]) AC_ARG_WITH([boost-libdir], AS_HELP_STRING([--with-boost-libdir=LIB_DIR], [Force given directory for boost libraries. Note that this will override library path detection, so use this parameter only if default library detection fails and you know exactly where your boost libraries are located.]), [ if test -d "$withval" then ac_boost_lib_path="$withval" else AC_MSG_ERROR(--with-boost-libdir expected directory name) fi ], [ac_boost_lib_path=""] ) if test "x$want_boost" = "xyes"; then boost_lib_version_req=ifelse([$1], ,1.20.0,$1) boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'` boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'` boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'` boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` if test "x$boost_lib_version_req_sub_minor" = "x" ; then boost_lib_version_req_sub_minor="0" fi WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+ $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor` AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req) succeeded=no dnl On 64-bit systems check for system libraries in both lib64 and lib. dnl The former is specified by FHS, but e.g. Debian does not adhere to dnl this (as it rises problems for generic multi-arch support). dnl The last entry in the list is chosen by default when no libraries dnl are found, e.g. when only header-only libraries are installed! libsubdirs="lib" ax_arch=`uname -m` case $ax_arch in x86_64) libsubdirs="lib64 libx32 lib lib64" ;; ppc64|s390x|sparc64|aarch64|ppc64le) libsubdirs="lib64 lib lib64 ppc64le" ;; esac dnl allow for real multi-arch paths e.g. /usr/lib/x86_64-linux-gnu. Give dnl them priority over the other paths since, if libs are found there, they dnl are almost assuredly the ones desired. AC_REQUIRE([AC_CANONICAL_HOST]) libsubdirs="lib/${host_cpu}-${host_os} $libsubdirs" case ${host_cpu} in i?86) libsubdirs="lib/i386-${host_os} $libsubdirs" ;; esac dnl first we check the system location for boost libraries dnl this location ist chosen if boost libraries are installed with the --layout=system option dnl or if you install boost with RPM if test "$ac_boost_path" != ""; then BOOST_CPPFLAGS="-I$ac_boost_path/include" for ac_boost_path_tmp in $libsubdirs; do if test -d "$ac_boost_path"/"$ac_boost_path_tmp" ; then BOOST_LDFLAGS="-L$ac_boost_path/$ac_boost_path_tmp" break fi done elif test "$cross_compiling" != yes; then for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then for libsubdir in $libsubdirs ; do if ls "$ac_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi done BOOST_LDFLAGS="-L$ac_boost_path_tmp/$libsubdir" BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include" break; fi done fi dnl overwrite ld flags if we have required special directory with dnl --with-boost-libdir parameter if test "$ac_boost_lib_path" != ""; then BOOST_LDFLAGS="-L$ac_boost_lib_path" fi CPPFLAGS_SAVED="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" export CPPFLAGS LDFLAGS_SAVED="$LDFLAGS" LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" export LDFLAGS AC_REQUIRE([AC_PROG_CXX]) AC_LANG_PUSH(C++) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ @%:@include ]], [[ #if BOOST_VERSION >= $WANT_BOOST_VERSION // Everything is okay #else # error Boost version is too old #endif ]])],[ AC_MSG_RESULT(yes) succeeded=yes found_system=yes ],[ ]) AC_LANG_POP([C++]) dnl if we found no boost with system layout we search for boost libraries dnl built and installed without the --layout=system option or for a staged(not installed) version if test "x$succeeded" != "xyes"; then CPPFLAGS="$CPPFLAGS_SAVED" LDFLAGS="$LDFLAGS_SAVED" BOOST_CPPFLAGS= BOOST_LDFLAGS= _version=0 if test "$ac_boost_path" != ""; then if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'` V_CHECK=`expr $_version_tmp \> $_version` if test "$V_CHECK" = "1" ; then _version=$_version_tmp fi VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE" done dnl if nothing found search for layout used in Windows distributions if test -z "$BOOST_CPPFLAGS"; then if test -d "$ac_boost_path/boost" && test -r "$ac_boost_path/boost"; then BOOST_CPPFLAGS="-I$ac_boost_path" fi fi fi else if test "$cross_compiling" != yes; then for ac_boost_path in /usr /usr/local /opt /opt/local ; do if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'` V_CHECK=`expr $_version_tmp \> $_version` if test "$V_CHECK" = "1" ; then _version=$_version_tmp best_path=$ac_boost_path fi done fi done VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE" if test "$ac_boost_lib_path" = ""; then for libsubdir in $libsubdirs ; do if ls "$best_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi done BOOST_LDFLAGS="-L$best_path/$libsubdir" fi fi if test "x$BOOST_ROOT" != "x"; then for libsubdir in $libsubdirs ; do if ls "$BOOST_ROOT/stage/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi done if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/$libsubdir" && test -r "$BOOST_ROOT/stage/$libsubdir"; then version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'` stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'` stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'` V_CHECK=`expr $stage_version_shorten \>\= $_version` if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT) BOOST_CPPFLAGS="-I$BOOST_ROOT" BOOST_LDFLAGS="-L$BOOST_ROOT/stage/$libsubdir" fi fi fi fi CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" export CPPFLAGS LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" export LDFLAGS AC_LANG_PUSH(C++) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ @%:@include ]], [[ #if BOOST_VERSION >= $WANT_BOOST_VERSION // Everything is okay #else # error Boost version is too old #endif ]])],[ AC_MSG_RESULT(yes) succeeded=yes found_system=yes ],[ ]) AC_LANG_POP([C++]) fi if test "$succeeded" != "yes" ; then if test "$_version" = "0" ; then AC_MSG_NOTICE([[We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in . See http://randspringer.de/boost for more documentation.]]) else AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).]) fi # execute ACTION-IF-NOT-FOUND (if present): ifelse([$3], , :, [$3]) else AC_SUBST(BOOST_CPPFLAGS) AC_SUBST(BOOST_LDFLAGS) AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available]) # execute ACTION-IF-FOUND (if present): ifelse([$2], , :, [$2]) fi CPPFLAGS="$CPPFLAGS_SAVED" LDFLAGS="$LDFLAGS_SAVED" fi ]) aevol-5.0/m4/ax_cxx_compile_stdcxx_11.m40000644000175000017500000001127512724051151015073 00000000000000# ============================================================================ # http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html # ============================================================================ # # SYNOPSIS # # AX_CXX_COMPILE_STDCXX_11([ext|noext],[mandatory|optional]) # # DESCRIPTION # # Check for baseline language coverage in the compiler for the C++11 # standard; if necessary, add switches to CXXFLAGS to enable support. # # The first argument, if specified, indicates whether you insist on an # extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. # -std=c++11). If neither is specified, you get whatever works, with # preference for an extended mode. # # The second argument, if specified 'mandatory' or if left unspecified, # indicates that baseline C++11 support is required and that the macro # should error out if no mode with that support is found. If specified # 'optional', then configuration proceeds regardless, after defining # HAVE_CXX11 if and only if a supporting mode is found. # # LICENSE # # Copyright (c) 2008 Benjamin Kosnik # Copyright (c) 2012 Zack Weinberg # Copyright (c) 2013 Roy Stogner # Copyright (c) 2014 Alexey Sokolov # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 4 m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [[ template struct check { static_assert(sizeof(int) <= sizeof(T), "not big enough"); }; struct Base { virtual void f() {} }; struct Child : public Base { virtual void f() override {} }; typedef check> right_angle_brackets; int a; decltype(a) b; typedef check check_type; check_type c; check_type&& cr = static_cast(c); auto d = a; auto l = [](){}; ]]) AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl m4_if([$1], [], [], [$1], [ext], [], [$1], [noext], [], [m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl m4_if([$2], [], [ax_cxx_compile_cxx11_required=true], [$2], [mandatory], [ax_cxx_compile_cxx11_required=true], [$2], [optional], [ax_cxx_compile_cxx11_required=false], [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_11])]) AC_LANG_PUSH([C++])dnl ac_success=no AC_CACHE_CHECK(whether $CXX supports C++11 features by default, ax_cv_cxx_compile_cxx11, [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], [ax_cv_cxx_compile_cxx11=yes], [ax_cv_cxx_compile_cxx11=no])]) if test x$ax_cv_cxx_compile_cxx11 = xyes; then ac_success=yes fi m4_if([$1], [noext], [], [dnl if test x$ac_success = xno; then for switch in -std=gnu++11 -std=gnu++1y; do cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch]) AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch, $cachevar, [ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS $switch" AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], [eval $cachevar=yes], [eval $cachevar=no]) CXXFLAGS="$ac_save_CXXFLAGS"]) if eval test x\$$cachevar = xyes; then CXXFLAGS="$CXXFLAGS $switch" ac_success=yes break fi done fi]) m4_if([$1], [ext], [], [dnl if test x$ac_success = xno; then for switch in -std=c++11 -std=c++1y; do cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch]) AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch, $cachevar, [ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS $switch" AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], [eval $cachevar=yes], [eval $cachevar=no]) CXXFLAGS="$ac_save_CXXFLAGS"]) if eval test x\$$cachevar = xyes; then CXXFLAGS="$CXXFLAGS $switch" ac_success=yes break fi done fi]) AC_LANG_POP([C++]) if test x$ax_cxx_compile_cxx11_required = xtrue; then if test x$ac_success = xno; then AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.]) fi else if test x$ac_success = xno; then HAVE_CXX11=0 AC_MSG_NOTICE([No compiler with C++11 support was found]) else HAVE_CXX11=1 AC_DEFINE(HAVE_CXX11,1, [define if the compiler supports basic C++11 syntax]) fi AC_SUBST(HAVE_CXX11) fi ]) aevol-5.0/missing0000755000175000017500000001533012724051151011004 00000000000000#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2013-10-28.13; # UTC # Copyright (C) 1996-2013 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # 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 2, 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 . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=http://www.perl.org/ flex_URL=http://flex.sourceforge.net/ gnu_software_URL=http://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: aevol-5.0/depcomp0000755000175000017500000005601612724051151010770 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2013-05-30.07; # UTC # Copyright (C) 1999-2013 Free Software Foundation, Inc. # 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 2, 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 . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: aevol-5.0/configure0000755000175000017500000106336412735464143011342 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for AEVOL 5.0. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and $0: aevol-bugs@lists.gforge.inria.fr about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='AEVOL' PACKAGE_TARNAME='aevol' PACKAGE_VERSION='5.0' PACKAGE_STRING='AEVOL 5.0' PACKAGE_BUGREPORT='aevol-bugs@lists.gforge.inria.fr' PACKAGE_URL='www.aevol.fr' ac_unique_file="src/aevol_run.cpp" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS WITH_TRACING_FALSE WITH_TRACING_TRUE WITH_TBB_FALSE WITH_TBB_TRUE WITH_ATLAS_FALSE WITH_ATLAS_TRUE WITH_MKL_FALSE WITH_MKL_TRUE WITH_BLAS_FALSE WITH_BLAS_TRUE WITH_RAEVOL_FALSE WITH_RAEVOL_TRUE WITH_PROFILING_FALSE WITH_PROFILING_TRUE WITH_DEBUG_FALSE WITH_DEBUG_TRUE WANT_DOXYGEN_FALSE WANT_DOXYGEN_TRUE HAVE_DOXYGEN ENABLE_DEVEL_FALSE ENABLE_DEVEL_TRUE ENABLE_FORCEPJ_FALSE ENABLE_FORCEPJ_TRUE WITH_NORMALIZED_FITNESS_FALSE WITH_NORMALIZED_FITNESS_TRUE WITH_OPTIM_FALSE WITH_OPTIM_TRUE X_EXTRA_LIBS X_LIBS X_PRE_LIBS X_CFLAGS XMKMF WITH_X_FALSE WITH_X_TRUE AEVOLLDFLAGS AEVOLCXXFLAGS AEVOLCPPFLAGS BOOST_FILESYSTEM_LIB BOOST_SYSTEM_LIB BOOST_LDFLAGS BOOST_CPPFLAGS host_os host_vendor host_cpu host build_os build_vendor build_cpu build EGREP GREP CXXCPP am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE ac_ct_CC CFLAGS CC OPENMP_CXXFLAGS RANLIB HAVE_CXX11 HAVE_CXX14 am__fastdepCXX_FALSE am__fastdepCXX_TRUE CXXDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CXX CPPFLAGS LDFLAGS CXXFLAGS CXX AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir runstatedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_dependency_tracking enable_openmp with_boost with_boost_libdir with_boost_system with_boost_filesystem with_x enable_optim enable_normalized_fitness enable_mtperiod enable_trivialjumps enable_devel enable_debug enable_profiling with_raevol with_blas with_mkl with_atlas with_tbb with_tracing ' ac_precious_vars='build_alias host_alias target_alias CXX CXXFLAGS LDFLAGS LIBS CPPFLAGS CCC CC CFLAGS CXXCPP XMKMF' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures AEVOL 5.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/aevol] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names X features: --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of AEVOL 5.0:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --disable-openmp do not use OpenMP --disable-optim turn off compile time optimization --enable-normalized-fitness to enable fitness normalization --enable-mtperiod=period Set the Mersenne Twister period to 2^period (default is 2^607). Possible values are 607, 1279, 2281, 4253, 11213, 19937, 44497, 86243, 132049 and 216091 Consider using in conjunction with --enable-trivialjumps for large periods --enable-trivialjumps=jumpsize When this option is set, a trivial jump algorithm will be used instead of the polynomial-based method. This is recommended for large Mersenne Twister periods when huge jumps are not needed since the polynomial-based method takes more time in that case. For the standard MT (period 2^19937), it takes approx. the same time to draw a few million numbers than it does to make the same jump using the polynomial-based method. The jumpsize argument allows to set the desired jump size. The default value is 1000 which is enough to avoid overlaps in most cases. --enable-devel turn on development features --enable-debug to enable degugging features --enable-profiling to enable profiling Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-boost[=ARG] use Boost library from a standard location (ARG=yes), from the specified location (ARG=), or disable it (ARG=no) [ARG=yes] --with-boost-libdir=LIB_DIR Force given directory for boost libraries. Note that this will override library path detection, so use this parameter only if default library detection fails and you know exactly where your boost libraries are located. --with-boost-system[=special-lib] use the System library from boost - it is possible to specify a certain library for the linker e.g. --with-boost-system=boost_system-gcc-mt --with-boost-filesystem[=special-lib] use the Filesystem library from boost - it is possible to specify a certain library for the linker e.g. --with-boost-filesystem=boost_filesystem-gcc-mt --without-x to disable graphical output --with-x use the X Window System --with-raevol to enable regulation --with-blas to the use of BLAS library --with-mkl to the use of MKL library --with-atlas to the use of ATLAS library --with-tbb to the use of TBB library --with-tracing to enable tracing Some influential environment variables: CXX C++ compiler command CXXFLAGS C++ compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CC C compiler command CFLAGS C compiler flags CXXCPP C++ preprocessor XMKMF Path to xmkmf, Makefile generator for X Window System Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . AEVOL home page: . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF AEVOL configure 5.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_cxx_try_compile LINENO # ---------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_compile # ac_fn_cxx_try_link LINENO # ------------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_link # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_cxx_try_cpp LINENO # ------------------------ # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_cpp # ac_fn_cxx_check_header_mongrel LINENO HEADER VAR INCLUDES # --------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_cxx_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## ----------------------------------------------- ## ## Report this to aevol-bugs@lists.gforge.inria.fr ## ## ----------------------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_cxx_check_header_mongrel # ac_fn_cxx_try_run LINENO # ------------------------ # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_cxx_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_run # ac_fn_cxx_check_header_compile LINENO HEADER VAR INCLUDES # --------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_cxx_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_cxx_check_header_compile # ac_fn_cxx_check_type LINENO TYPE VAR INCLUDES # --------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_cxx_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_cxx_check_type # ac_fn_c_find_intX_t LINENO BITS VAR # ----------------------------------- # Finds a signed integer type with width BITS, setting cache variable VAR # accordingly. ac_fn_c_find_intX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 $as_echo_n "checking for int$2_t... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. for ac_type in int$2_t 'int' 'long int' \ 'long long int' 'short int' 'signed char'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default enum { N = $2 / 2 - 1 }; int main () { static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default enum { N = $2 / 2 - 1 }; int main () { static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1) < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : else case $ac_type in #( int$2_t) : eval "$3=yes" ;; #( *) : eval "$3=\$ac_type" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if eval test \"x\$"$3"\" = x"no"; then : else break fi done fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_find_intX_t # ac_fn_c_find_uintX_t LINENO BITS VAR # ------------------------------------ # Finds an unsigned integer type with width BITS, setting cache variable VAR # accordingly. ac_fn_c_find_uintX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 $as_echo_n "checking for uint$2_t... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ 'unsigned long long int' 'unsigned short int' 'unsigned char'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : case $ac_type in #( uint$2_t) : eval "$3=yes" ;; #( *) : eval "$3=\$ac_type" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if eval test \"x\$"$3"\" = x"no"; then : else break fi done fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_find_uintX_t # ac_fn_cxx_check_func LINENO FUNC VAR # ------------------------------------ # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_cxx_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_cxx_check_func cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by AEVOL $as_me 5.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Set C++ as the main language ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu # Change default value for CXXFLAGS test_CXXFLAGS=${CXXFLAGS+set} if test "$test_CXXFLAGS" != set; then CXXFLAGS="" fi # Specify the location of additional local Autoconf macros # We want to use automake am__api_version='1.15' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='aevol' VERSION='5.0' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi fi # Select compiler ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in clang-omp++ clang++ g++ icc do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 $as_echo "$CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in clang-omp++ clang++ g++ icc do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 $as_echo "$ac_ct_CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler works" >&5 $as_echo_n "checking whether the C++ compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C++ compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler default output file name" >&5 $as_echo_n "checking for C++ compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C++ compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } if ${ac_cv_cxx_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 $as_echo "$ac_cv_cxx_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 $as_echo_n "checking whether $CXX accepts -g... " >&6; } if ${ac_cv_prog_cxx_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes else CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : else ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 $as_echo "$ac_cv_prog_cxx_g" >&6; } if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CXX" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CXX_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 $as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= fi # Detect C++11 or C++14 ax_cxx_compile_cxx14_required=false ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ac_success=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++14 features by default" >&5 $as_echo_n "checking whether $CXX supports C++14 features by default... " >&6; } if ${ax_cv_cxx_compile_cxx14+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ template struct check { static_assert(sizeof(int) <= sizeof(T), "not big enough"); }; struct Base { virtual void f() {} }; struct Child : public Base { virtual void f() override {} }; typedef check> right_angle_brackets; int a; decltype(a) b; typedef check check_type; check_type c; check_type&& cr = static_cast(c); auto d = a; auto l = [](){}; _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ax_cv_cxx_compile_cxx14=yes else ax_cv_cxx_compile_cxx14=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_cxx_compile_cxx14" >&5 $as_echo "$ax_cv_cxx_compile_cxx14" >&6; } if test x$ax_cv_cxx_compile_cxx14 = xyes; then ac_success=yes fi if test x$ac_success = xno; then for switch in -std=c++14 -std=c++1y; do cachevar=`$as_echo "ax_cv_cxx_compile_cxx14_$switch" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++14 features with $switch" >&5 $as_echo_n "checking whether $CXX supports C++14 features with $switch... " >&6; } if eval \${$cachevar+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS $switch" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ template struct check { static_assert(sizeof(int) <= sizeof(T), "not big enough"); }; struct Base { virtual void f() {} }; struct Child : public Base { virtual void f() override {} }; typedef check> right_angle_brackets; int a; decltype(a) b; typedef check check_type; check_type c; check_type&& cr = static_cast(c); auto d = a; auto l = [](){}; _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval $cachevar=yes else eval $cachevar=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS="$ac_save_CXXFLAGS" fi eval ac_res=\$$cachevar { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test x\$$cachevar = xyes; then CXXFLAGS="$CXXFLAGS $switch" ac_success=yes break fi done fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test x$ax_cxx_compile_cxx14_required = xtrue; then if test x$ac_success = xno; then as_fn_error $? "*** A compiler with support for C++14 language features is required." "$LINENO" 5 fi else if test x$ac_success = xno; then HAVE_CXX14=0 { $as_echo "$as_me:${as_lineno-$LINENO}: No compiler with C++14 support was found" >&5 $as_echo "$as_me: No compiler with C++14 support was found" >&6;} else HAVE_CXX14=1 $as_echo "#define HAVE_CXX14 1" >>confdefs.h fi fi ax_cxx_compile_cxx11_required=true ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ac_success=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features by default" >&5 $as_echo_n "checking whether $CXX supports C++11 features by default... " >&6; } if ${ax_cv_cxx_compile_cxx11+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ template struct check { static_assert(sizeof(int) <= sizeof(T), "not big enough"); }; struct Base { virtual void f() {} }; struct Child : public Base { virtual void f() override {} }; typedef check> right_angle_brackets; int a; decltype(a) b; typedef check check_type; check_type c; check_type&& cr = static_cast(c); auto d = a; auto l = [](){}; _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ax_cv_cxx_compile_cxx11=yes else ax_cv_cxx_compile_cxx11=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_cxx_compile_cxx11" >&5 $as_echo "$ax_cv_cxx_compile_cxx11" >&6; } if test x$ax_cv_cxx_compile_cxx11 = xyes; then ac_success=yes fi if test x$ac_success = xno; then for switch in -std=c++11 -std=c++1y; do cachevar=`$as_echo "ax_cv_cxx_compile_cxx11_$switch" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features with $switch" >&5 $as_echo_n "checking whether $CXX supports C++11 features with $switch... " >&6; } if eval \${$cachevar+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS $switch" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ template struct check { static_assert(sizeof(int) <= sizeof(T), "not big enough"); }; struct Base { virtual void f() {} }; struct Child : public Base { virtual void f() override {} }; typedef check> right_angle_brackets; int a; decltype(a) b; typedef check check_type; check_type c; check_type&& cr = static_cast(c); auto d = a; auto l = [](){}; _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval $cachevar=yes else eval $cachevar=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS="$ac_save_CXXFLAGS" fi eval ac_res=\$$cachevar { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test x\$$cachevar = xyes; then CXXFLAGS="$CXXFLAGS $switch" ac_success=yes break fi done fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test x$ax_cxx_compile_cxx11_required = xtrue; then if test x$ac_success = xno; then as_fn_error $? "*** A compiler with support for C++11 language features is required." "$LINENO" 5 fi else if test x$ac_success = xno; then HAVE_CXX11=0 { $as_echo "$as_me:${as_lineno-$LINENO}: No compiler with C++11 support was found" >&5 $as_echo "$as_me: No compiler with C++11 support was found" >&6;} else HAVE_CXX11=1 $as_echo "#define HAVE_CXX11 1" >>confdefs.h fi fi #if test -z "$HAVE_CXX14"; #fi # Check the existance of an arbitrary source file # Build config.h using config.h.in as a template #AC_CONFIG_HEADERS([config.h:config.h.in]) # Checks for programs if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi OPENMP_CXXFLAGS= # Check whether --enable-openmp was given. if test "${enable_openmp+set}" = set; then : enableval=$enable_openmp; fi if test "$enable_openmp" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CXX option to support OpenMP" >&5 $as_echo_n "checking for $CXX option to support OpenMP... " >&6; } if ${ac_cv_prog_cxx_openmp+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef _OPENMP choke me #endif #include int main () { return omp_get_num_threads (); } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : ac_cv_prog_cxx_openmp='none needed' else ac_cv_prog_cxx_openmp='unsupported' for ac_option in -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp -homp \ -Popenmp --openmp; do ac_save_CXXFLAGS=$CXXFLAGS CXXFLAGS="$CXXFLAGS $ac_option" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef _OPENMP choke me #endif #include int main () { return omp_get_num_threads (); } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : ac_cv_prog_cxx_openmp=$ac_option fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CXXFLAGS=$ac_save_CXXFLAGS if test "$ac_cv_prog_cxx_openmp" != unsupported; then break fi done fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_openmp" >&5 $as_echo "$ac_cv_prog_cxx_openmp" >&6; } case $ac_cv_prog_cxx_openmp in #( "none needed" | unsupported) ;; #( *) OPENMP_CXXFLAGS=$ac_cv_prog_cxx_openmp ;; esac fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 $as_echo "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi # Print warning if openmp not found ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 $as_echo_n "checking how to run the C++ preprocessor... " >&6; } if test -z "$CXXCPP"; then if ${ac_cv_prog_CXXCPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CXXCPP needs to be expanded for CXXCPP in "$CXX -E" "/lib/cpp" do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CXXCPP=$CXXCPP fi CXXCPP=$ac_cv_prog_CXXCPP else ac_cv_prog_CXXCPP=$CXXCPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 $as_echo "$CXXCPP" >&6; } ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_cxx_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_cxx_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ac_fn_cxx_check_header_mongrel "$LINENO" "omp.h" "ac_cv_header_omp_h" "$ac_includes_default" if test "x$ac_cv_header_omp_h" = xyes; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: openmp not found - continuing without openmp support" >&5 $as_echo "$as_me: WARNING: openmp not found - continuing without openmp support" >&2;} fi # Check for boost # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac # Check whether --with-boost was given. if test "${with_boost+set}" = set; then : withval=$with_boost; if test "$withval" = "no"; then want_boost="no" elif test "$withval" = "yes"; then want_boost="yes" ac_boost_path="" else want_boost="yes" ac_boost_path="$withval" fi else want_boost="yes" fi # Check whether --with-boost-libdir was given. if test "${with_boost_libdir+set}" = set; then : withval=$with_boost_libdir; if test -d "$withval" then ac_boost_lib_path="$withval" else as_fn_error $? "--with-boost-libdir expected directory name" "$LINENO" 5 fi else ac_boost_lib_path="" fi if test "x$want_boost" = "xyes"; then boost_lib_version_req=1.55 boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([0-9]*\.[0-9]*\)'` boost_lib_version_req_major=`expr $boost_lib_version_req : '\([0-9]*\)'` boost_lib_version_req_minor=`expr $boost_lib_version_req : '[0-9]*\.\([0-9]*\)'` boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[0-9]*\.[0-9]*\.\([0-9]*\)'` if test "x$boost_lib_version_req_sub_minor" = "x" ; then boost_lib_version_req_sub_minor="0" fi WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+ $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for boostlib >= $boost_lib_version_req" >&5 $as_echo_n "checking for boostlib >= $boost_lib_version_req... " >&6; } succeeded=no libsubdirs="lib" ax_arch=`uname -m` case $ax_arch in x86_64) libsubdirs="lib64 libx32 lib lib64" ;; ppc64|s390x|sparc64|aarch64|ppc64le) libsubdirs="lib64 lib lib64 ppc64le" ;; esac libsubdirs="lib/${host_cpu}-${host_os} $libsubdirs" case ${host_cpu} in i?86) libsubdirs="lib/i386-${host_os} $libsubdirs" ;; esac if test "$ac_boost_path" != ""; then BOOST_CPPFLAGS="-I$ac_boost_path/include" for ac_boost_path_tmp in $libsubdirs; do if test -d "$ac_boost_path"/"$ac_boost_path_tmp" ; then BOOST_LDFLAGS="-L$ac_boost_path/$ac_boost_path_tmp" break fi done elif test "$cross_compiling" != yes; then for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then for libsubdir in $libsubdirs ; do if ls "$ac_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi done BOOST_LDFLAGS="-L$ac_boost_path_tmp/$libsubdir" BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include" break; fi done fi if test "$ac_boost_lib_path" != ""; then BOOST_LDFLAGS="-L$ac_boost_lib_path" fi CPPFLAGS_SAVED="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" export CPPFLAGS LDFLAGS_SAVED="$LDFLAGS" LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" export LDFLAGS ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #if BOOST_VERSION >= $WANT_BOOST_VERSION // Everything is okay #else # error Boost version is too old #endif ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } succeeded=yes found_system=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test "x$succeeded" != "xyes"; then CPPFLAGS="$CPPFLAGS_SAVED" LDFLAGS="$LDFLAGS_SAVED" BOOST_CPPFLAGS= BOOST_LDFLAGS= _version=0 if test "$ac_boost_path" != ""; then if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'` V_CHECK=`expr $_version_tmp \> $_version` if test "$V_CHECK" = "1" ; then _version=$_version_tmp fi VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE" done if test -z "$BOOST_CPPFLAGS"; then if test -d "$ac_boost_path/boost" && test -r "$ac_boost_path/boost"; then BOOST_CPPFLAGS="-I$ac_boost_path" fi fi fi else if test "$cross_compiling" != yes; then for ac_boost_path in /usr /usr/local /opt /opt/local ; do if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'` V_CHECK=`expr $_version_tmp \> $_version` if test "$V_CHECK" = "1" ; then _version=$_version_tmp best_path=$ac_boost_path fi done fi done VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE" if test "$ac_boost_lib_path" = ""; then for libsubdir in $libsubdirs ; do if ls "$best_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi done BOOST_LDFLAGS="-L$best_path/$libsubdir" fi fi if test "x$BOOST_ROOT" != "x"; then for libsubdir in $libsubdirs ; do if ls "$BOOST_ROOT/stage/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi done if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/$libsubdir" && test -r "$BOOST_ROOT/stage/$libsubdir"; then version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'` stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'` stage_version_shorten=`expr $stage_version : '\([0-9]*\.[0-9]*\)'` V_CHECK=`expr $stage_version_shorten \>\= $_version` if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: We will use a staged boost library from $BOOST_ROOT" >&5 $as_echo "$as_me: We will use a staged boost library from $BOOST_ROOT" >&6;} BOOST_CPPFLAGS="-I$BOOST_ROOT" BOOST_LDFLAGS="-L$BOOST_ROOT/stage/$libsubdir" fi fi fi fi CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" export CPPFLAGS LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" export LDFLAGS ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #if BOOST_VERSION >= $WANT_BOOST_VERSION // Everything is okay #else # error Boost version is too old #endif ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } succeeded=yes found_system=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu fi if test "$succeeded" != "yes" ; then if test "$_version" = "0" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in . See http://randspringer.de/boost for more documentation." >&5 $as_echo "$as_me: We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in . See http://randspringer.de/boost for more documentation." >&6;} else { $as_echo "$as_me:${as_lineno-$LINENO}: Your boost libraries seems to old (version $_version)." >&5 $as_echo "$as_me: Your boost libraries seems to old (version $_version)." >&6;} fi # execute ACTION-IF-NOT-FOUND (if present): as_fn_error $? "boost not found, please check that you have boost installed on your system and retry" "$LINENO" 5 else $as_echo "#define HAVE_BOOST /**/" >>confdefs.h # execute ACTION-IF-FOUND (if present): : fi CPPFLAGS="$CPPFLAGS_SAVED" LDFLAGS="$LDFLAGS_SAVED" fi # Check whether --with-boost-system was given. if test "${with_boost_system+set}" = set; then : withval=$with_boost_system; if test "$withval" = "no"; then want_boost="no" elif test "$withval" = "yes"; then want_boost="yes" ax_boost_user_system_lib="" else want_boost="yes" ax_boost_user_system_lib="$withval" fi else want_boost="yes" fi if test "x$want_boost" = "xyes"; then CPPFLAGS_SAVED="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" export CPPFLAGS LDFLAGS_SAVED="$LDFLAGS" LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" export LDFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the Boost::System library is available" >&5 $as_echo_n "checking whether the Boost::System library is available... " >&6; } if ${ax_cv_boost_system+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu CXXFLAGS_SAVE=$CXXFLAGS CXXFLAGS= cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { boost::system::error_category *a = 0; ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ax_cv_boost_system=yes else ax_cv_boost_system=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$CXXFLAGS_SAVE ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_boost_system" >&5 $as_echo "$ax_cv_boost_system" >&6; } if test "x$ax_cv_boost_system" = "xyes"; then $as_echo "#define HAVE_BOOST_SYSTEM /**/" >>confdefs.h BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/[^\/]*//'` LDFLAGS_SAVE=$LDFLAGS if test "x$ax_boost_user_system_lib" = "x"; then for libextension in `ls -r $BOOSTLIBDIR/libboost_system* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'` ; do ax_lib=${libextension} as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5 $as_echo_n "checking for exit in -l$ax_lib... " >&6; } if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-l$ax_lib $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char exit (); int main () { return exit (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : eval "$as_ac_Lib=yes" else eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : BOOST_SYSTEM_LIB="-l$ax_lib"; link_system="yes"; break else link_system="no" fi done if test "x$link_system" != "xyes"; then for libextension in `ls -r $BOOSTLIBDIR/boost_system* 2>/dev/null | sed 's,.*/,,' | sed -e 's,\..*,,'` ; do ax_lib=${libextension} as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5 $as_echo_n "checking for exit in -l$ax_lib... " >&6; } if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-l$ax_lib $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char exit (); int main () { return exit (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : eval "$as_ac_Lib=yes" else eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : BOOST_SYSTEM_LIB="-l$ax_lib"; link_system="yes"; break else link_system="no" fi done fi else for ax_lib in $ax_boost_user_system_lib boost_system-$ax_boost_user_system_lib; do as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5 $as_echo_n "checking for exit in -l$ax_lib... " >&6; } if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-l$ax_lib $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char exit (); int main () { return exit (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : eval "$as_ac_Lib=yes" else eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : BOOST_SYSTEM_LIB="-l$ax_lib"; link_system="yes"; break else link_system="no" fi done fi if test "x$ax_lib" = "x"; then as_fn_error $? "Could not find a version of the library!" "$LINENO" 5 fi if test "x$link_system" = "xno"; then as_fn_error $? "Could not link against $ax_lib !" "$LINENO" 5 fi fi CPPFLAGS="$CPPFLAGS_SAVED" LDFLAGS="$LDFLAGS_SAVED" fi # Check whether --with-boost-filesystem was given. if test "${with_boost_filesystem+set}" = set; then : withval=$with_boost_filesystem; if test "$withval" = "no"; then want_boost="no" elif test "$withval" = "yes"; then want_boost="yes" ax_boost_user_filesystem_lib="" else want_boost="yes" ax_boost_user_filesystem_lib="$withval" fi else want_boost="yes" fi if test "x$want_boost" = "xyes"; then CPPFLAGS_SAVED="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" export CPPFLAGS LDFLAGS_SAVED="$LDFLAGS" LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" export LDFLAGS LIBS_SAVED=$LIBS LIBS="$LIBS $BOOST_SYSTEM_LIB" export LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the Boost::Filesystem library is available" >&5 $as_echo_n "checking whether the Boost::Filesystem library is available... " >&6; } if ${ax_cv_boost_filesystem+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { using namespace boost::filesystem; path my_path( "foo/bar/data.txt" ); return 0; ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ax_cv_boost_filesystem=yes else ax_cv_boost_filesystem=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_boost_filesystem" >&5 $as_echo "$ax_cv_boost_filesystem" >&6; } if test "x$ax_cv_boost_filesystem" = "xyes"; then $as_echo "#define HAVE_BOOST_FILESYSTEM /**/" >>confdefs.h BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/[^\/]*//'` if test "x$ax_boost_user_filesystem_lib" = "x"; then for libextension in `ls -r $BOOSTLIBDIR/libboost_filesystem* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'` ; do ax_lib=${libextension} as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5 $as_echo_n "checking for exit in -l$ax_lib... " >&6; } if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-l$ax_lib $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char exit (); int main () { return exit (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : eval "$as_ac_Lib=yes" else eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : BOOST_FILESYSTEM_LIB="-l$ax_lib"; link_filesystem="yes"; break else link_filesystem="no" fi done if test "x$link_filesystem" != "xyes"; then for libextension in `ls -r $BOOSTLIBDIR/boost_filesystem* 2>/dev/null | sed 's,.*/,,' | sed -e 's,\..*,,'` ; do ax_lib=${libextension} as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5 $as_echo_n "checking for exit in -l$ax_lib... " >&6; } if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-l$ax_lib $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char exit (); int main () { return exit (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : eval "$as_ac_Lib=yes" else eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : BOOST_FILESYSTEM_LIB="-l$ax_lib"; link_filesystem="yes"; break else link_filesystem="no" fi done fi else for ax_lib in $ax_boost_user_filesystem_lib boost_filesystem-$ax_boost_user_filesystem_lib; do as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5 $as_echo_n "checking for exit in -l$ax_lib... " >&6; } if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-l$ax_lib $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char exit (); int main () { return exit (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : eval "$as_ac_Lib=yes" else eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : BOOST_FILESYSTEM_LIB="-l$ax_lib"; link_filesystem="yes"; break else link_filesystem="no" fi done fi if test "x$ax_lib" = "x"; then as_fn_error $? "Could not find a version of the library!" "$LINENO" 5 fi if test "x$link_filesystem" != "xyes"; then as_fn_error $? "Could not link against $ax_lib !" "$LINENO" 5 fi fi CPPFLAGS="$CPPFLAGS_SAVED" LDFLAGS="$LDFLAGS_SAVED" LIBS="$LIBS_SAVED" fi # Initialize configure-time defined flags AEVOLCPPFLAGS="" # C PreProcessor flags AEVOLCXXFLAGS="$OPENMP_CXXFLAGS" # C++ Compile flags AEVOLLDFLAGS="$OPENMP_CXXFLAGS" # Linker flags # Checks for libraries. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5 $as_echo_n "checking for cos in -lm... " >&6; } if ${ac_cv_lib_m_cos+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char cos (); int main () { return cos (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : ac_cv_lib_m_cos=yes else ac_cv_lib_m_cos=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5 $as_echo "$ac_cv_lib_m_cos" >&6; } if test "x$ac_cv_lib_m_cos" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBM 1 _ACEOF LIBS="-lm $LIBS" else as_fn_error $? "PACKAGE_NAME requires the math library, please install it." "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gzread in -lz" >&5 $as_echo_n "checking for gzread in -lz... " >&6; } if ${ac_cv_lib_z_gzread+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gzread (); int main () { return gzread (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : ac_cv_lib_z_gzread=yes else ac_cv_lib_z_gzread=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_gzread" >&5 $as_echo "$ac_cv_lib_z_gzread" >&6; } if test "x$ac_cv_lib_z_gzread" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBZ 1 _ACEOF LIBS="-lz $LIBS" else as_fn_error $? "PACKAGE_NAME requires the zlib development library, please install it." "$LINENO" 5 fi # Checks for header files. for ac_header in inttypes.h limits.h stdint.h stdlib.h string.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_cxx_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # Checks for typedefs, structures, and compiler characteristics. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 $as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } if ${ac_cv_header_stdbool_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifndef bool "error: bool is not defined" #endif #ifndef false "error: false is not defined" #endif #if false "error: false is not 0" #endif #ifndef true "error: true is not defined" #endif #if true != 1 "error: true is not 1" #endif #ifndef __bool_true_false_are_defined "error: __bool_true_false_are_defined is not defined" #endif struct s { _Bool s: 1; _Bool t; } s; char a[true == 1 ? 1 : -1]; char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; char d[(bool) 0.5 == true ? 1 : -1]; /* See body of main program for 'e'. */ char f[(_Bool) 0.0 == false ? 1 : -1]; char g[true]; char h[sizeof (_Bool)]; char i[sizeof s.t]; enum { j = false, k = true, l = false * true, m = true * 256 }; /* The following fails for HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ _Bool n[m]; char o[sizeof n == m * sizeof n[0] ? 1 : -1]; char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; /* Catch a bug in an HP-UX C compiler. See http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html */ _Bool q = true; _Bool *pq = &q; int main () { bool e = &s; *pq |= q; *pq |= ! q; /* Refer to every declared value, to avoid compiler optimizations. */ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + !m + !n + !o + !p + !q + !pq); ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_header_stdbool_h=yes else ac_cv_header_stdbool_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5 $as_echo "$ac_cv_header_stdbool_h" >&6; } ac_fn_cxx_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" if test "x$ac_cv_type__Bool" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE__BOOL 1 _ACEOF fi if test $ac_cv_header_stdbool_h = yes; then $as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } if ${ac_cv_c_inline+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_c_inline=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 $as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac ac_fn_c_find_intX_t "$LINENO" "16" "ac_cv_c_int16_t" case $ac_cv_c_int16_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define int16_t $ac_cv_c_int16_t _ACEOF ;; esac ac_fn_c_find_intX_t "$LINENO" "32" "ac_cv_c_int32_t" case $ac_cv_c_int32_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define int32_t $ac_cv_c_int32_t _ACEOF ;; esac ac_fn_c_find_intX_t "$LINENO" "8" "ac_cv_c_int8_t" case $ac_cv_c_int8_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define int8_t $ac_cv_c_int8_t _ACEOF ;; esac ac_fn_cxx_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t" case $ac_cv_c_uint32_t in #( no|yes) ;; #( *) $as_echo "#define _UINT32_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF #define uint32_t $ac_cv_c_uint32_t _ACEOF ;; esac ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t" case $ac_cv_c_uint8_t in #( no|yes) ;; #( *) $as_echo "#define _UINT8_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF #define uint8_t $ac_cv_c_uint8_t _ACEOF ;; esac # Checks for library functions. for ac_func in floor memset mkdir pow rint sqrt gzread do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done # **************************************************************************** # OPTIONS # # Supported options [default]: # --with-x [yes] # --enable-optim [enabled] # --enable-normalized-fitness [disabled] # --enable-mtperiod=period [disabled] # --enable-trivialjumps=jumpsize [disabled] # --enable-devel [disabled] # --enable-debug [disabled] # --enable-profiling [disabled] # # **************************************************************************** # ************************ --without-x option ********************* # # When this option is set, running make will produce aevol and # most post-treatment programs without visualization capabilities # This is useful if we want to run computations on a cluster where the # X libraries are not present. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable graphical outputs" >&5 $as_echo_n "checking whether to enable graphical outputs... " >&6; } # Check whether --with-x was given. if test "${with_x+set}" = set; then : withval=$with_x; else with_x=yes fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_x" >&5 $as_echo "$with_x" >&6; } if test x"$with_x" != xno; then WITH_X_TRUE= WITH_X_FALSE='#' else WITH_X_TRUE='#' WITH_X_FALSE= fi if test "x$with_x" != xno ; then $as_echo "#define __X11 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking for X" >&5 $as_echo_n "checking for X... " >&6; } # Check whether --with-x was given. if test "${with_x+set}" = set; then : withval=$with_x; fi # $have_x is `yes', `no', `disabled', or empty when we do not yet know. if test "x$with_x" = xno; then # The user explicitly disabled X. have_x=disabled else case $x_includes,$x_libraries in #( *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5;; #( *,NONE | NONE,*) if ${ac_cv_have_x+:} false; then : $as_echo_n "(cached) " >&6 else # One or both of the vars are not set, and there is no cached value. ac_x_includes=no ac_x_libraries=no rm -f -r conftest.dir if mkdir conftest.dir; then cd conftest.dir cat >Imakefile <<'_ACEOF' incroot: @echo incroot='${INCROOT}' usrlibdir: @echo usrlibdir='${USRLIBDIR}' libdir: @echo libdir='${LIBDIR}' _ACEOF if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. for ac_var in incroot usrlibdir libdir; do eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`" done # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. for ac_extension in a so sl dylib la dll; do if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" && test -f "$ac_im_libdir/libX11.$ac_extension"; then ac_im_usrlibdir=$ac_im_libdir; break fi done # Screen out bogus values from the imake configuration. They are # bogus both because they are the default anyway, and because # using them would break gcc on systems where it needs fixed includes. case $ac_im_incroot in /usr/include) ac_x_includes= ;; *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; esac case $ac_im_usrlibdir in /usr/lib | /usr/lib64 | /lib | /lib64) ;; *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; esac fi cd .. rm -f -r conftest.dir fi # Standard set of common directories for X headers. # Check X11 before X11Rn because it is often a symlink to the current release. ac_x_header_dirs=' /usr/X11/include /usr/X11R7/include /usr/X11R6/include /usr/X11R5/include /usr/X11R4/include /usr/include/X11 /usr/include/X11R7 /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 /usr/local/X11/include /usr/local/X11R7/include /usr/local/X11R6/include /usr/local/X11R5/include /usr/local/X11R4/include /usr/local/include/X11 /usr/local/include/X11R7 /usr/local/include/X11R6 /usr/local/include/X11R5 /usr/local/include/X11R4 /usr/X386/include /usr/x386/include /usr/XFree86/include/X11 /usr/include /usr/local/include /usr/unsupported/include /usr/athena/include /usr/local/x11r5/include /usr/lpp/Xamples/include /usr/openwin/include /usr/openwin/share/include' if test "$ac_x_includes" = no; then # Guess where to find include files, by looking for Xlib.h. # First, try using that file with no special directory specified. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : # We can compile using X headers with no special include directory. ac_x_includes= else for ac_dir in $ac_x_header_dirs; do if test -r "$ac_dir/X11/Xlib.h"; then ac_x_includes=$ac_dir break fi done fi rm -f conftest.err conftest.i conftest.$ac_ext fi # $ac_x_includes = no if test "$ac_x_libraries" = no; then # Check for the libraries. # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS=$LIBS LIBS="-lX11 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { XrmInitialize () ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : LIBS=$ac_save_LIBS # We can link X programs with no special library path. ac_x_libraries= else LIBS=$ac_save_LIBS for ac_dir in `$as_echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` do # Don't even attempt the hair of trying to link an X program! for ac_extension in a so sl dylib la dll; do if test -r "$ac_dir/libX11.$ac_extension"; then ac_x_libraries=$ac_dir break 2 fi done done fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi # $ac_x_libraries = no case $ac_x_includes,$ac_x_libraries in #( no,* | *,no | *\'*) # Didn't find X, or a directory has "'" in its name. ac_cv_have_x="have_x=no";; #( *) # Record where we found X for the cache. ac_cv_have_x="have_x=yes\ ac_x_includes='$ac_x_includes'\ ac_x_libraries='$ac_x_libraries'" esac fi ;; #( *) have_x=yes;; esac eval "$ac_cv_have_x" fi # $with_x != no if test "$have_x" != yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_x" >&5 $as_echo "$have_x" >&6; } no_x=yes else # If each of the values was on the command line, it overrides each guess. test "x$x_includes" = xNONE && x_includes=$ac_x_includes test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries # Update the cache value to reflect the command line values. ac_cv_have_x="have_x=yes\ ac_x_includes='$x_includes'\ ac_x_libraries='$x_libraries'" { $as_echo "$as_me:${as_lineno-$LINENO}: result: libraries $x_libraries, headers $x_includes" >&5 $as_echo "libraries $x_libraries, headers $x_includes" >&6; } fi if test "$no_x" = yes; then # Not all programs may use this symbol, but it does not hurt to define it. $as_echo "#define X_DISPLAY_MISSING 1" >>confdefs.h X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= else if test -n "$x_includes"; then X_CFLAGS="$X_CFLAGS -I$x_includes" fi # It would also be nice to do this for all -L options, not just this one. if test -n "$x_libraries"; then X_LIBS="$X_LIBS -L$x_libraries" # For Solaris; some versions of Sun CC require a space after -R and # others require no space. Words are not sufficient . . . . { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -R must be followed by a space" >&5 $as_echo_n "checking whether -R must be followed by a space... " >&6; } ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries" ac_xsave_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } X_LIBS="$X_LIBS -R$x_libraries" else LIBS="$ac_xsave_LIBS -R $x_libraries" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } X_LIBS="$X_LIBS -R $x_libraries" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: neither works" >&5 $as_echo "neither works" >&6; } fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_cxx_werror_flag=$ac_xsave_cxx_werror_flag LIBS=$ac_xsave_LIBS fi # Check for system-dependent libraries X programs must link with. # Do this before checking for the system-independent R6 libraries # (-lICE), since we may need -lsocket or whatever for X linking. if test "$ISC" = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" else # Martyn Johnson says this is needed for Ultrix, if the X # libraries were built with DECnet support. And Karl Berry says # the Alpha needs dnet_stub (dnet does not exist). ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char XOpenDisplay (); int main () { return XOpenDisplay (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet" >&5 $as_echo_n "checking for dnet_ntoa in -ldnet... " >&6; } if ${ac_cv_lib_dnet_dnet_ntoa+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dnet_ntoa (); int main () { return dnet_ntoa (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : ac_cv_lib_dnet_dnet_ntoa=yes else ac_cv_lib_dnet_dnet_ntoa=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 $as_echo "$ac_cv_lib_dnet_dnet_ntoa" >&6; } if test "x$ac_cv_lib_dnet_dnet_ntoa" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet_stub" >&5 $as_echo_n "checking for dnet_ntoa in -ldnet_stub... " >&6; } if ${ac_cv_lib_dnet_stub_dnet_ntoa+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet_stub $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dnet_ntoa (); int main () { return dnet_ntoa (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : ac_cv_lib_dnet_stub_dnet_ntoa=yes else ac_cv_lib_dnet_stub_dnet_ntoa=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 $as_echo "$ac_cv_lib_dnet_stub_dnet_ntoa" >&6; } if test "x$ac_cv_lib_dnet_stub_dnet_ntoa" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" fi fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$ac_xsave_LIBS" # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, # to get the SysV transport functions. # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4) # needs -lnsl. # The nsl library prevents programs from opening the X display # on Irix 5.2, according to T.E. Dickey. # The functions gethostbyname, getservbyname, and inet_addr are # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking. ac_fn_cxx_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" if test "x$ac_cv_func_gethostbyname" = xyes; then : fi if test $ac_cv_func_gethostbyname = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5 $as_echo_n "checking for gethostbyname in -lnsl... " >&6; } if ${ac_cv_lib_nsl_gethostbyname+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gethostbyname (); int main () { return gethostbyname (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : ac_cv_lib_nsl_gethostbyname=yes else ac_cv_lib_nsl_gethostbyname=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5 $as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; } if test "x$ac_cv_lib_nsl_gethostbyname" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" fi if test $ac_cv_lib_nsl_gethostbyname = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lbsd" >&5 $as_echo_n "checking for gethostbyname in -lbsd... " >&6; } if ${ac_cv_lib_bsd_gethostbyname+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbsd $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gethostbyname (); int main () { return gethostbyname (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : ac_cv_lib_bsd_gethostbyname=yes else ac_cv_lib_bsd_gethostbyname=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_gethostbyname" >&5 $as_echo "$ac_cv_lib_bsd_gethostbyname" >&6; } if test "x$ac_cv_lib_bsd_gethostbyname" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd" fi fi fi # lieder@skyler.mavd.honeywell.com says without -lsocket, # socket/setsockopt and other routines are undefined under SCO ODT # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary # on later versions), says Simon Leinen: it contains gethostby* # variants that don't use the name server (or something). -lsocket # must be given before -lnsl if both are needed. We assume that # if connect needs -lnsl, so does gethostbyname. ac_fn_cxx_check_func "$LINENO" "connect" "ac_cv_func_connect" if test "x$ac_cv_func_connect" = xyes; then : fi if test $ac_cv_func_connect = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for connect in -lsocket" >&5 $as_echo_n "checking for connect in -lsocket... " >&6; } if ${ac_cv_lib_socket_connect+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char connect (); int main () { return connect (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : ac_cv_lib_socket_connect=yes else ac_cv_lib_socket_connect=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_connect" >&5 $as_echo "$ac_cv_lib_socket_connect" >&6; } if test "x$ac_cv_lib_socket_connect" = xyes; then : X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" fi fi # Guillermo Gomez says -lposix is necessary on A/UX. ac_fn_cxx_check_func "$LINENO" "remove" "ac_cv_func_remove" if test "x$ac_cv_func_remove" = xyes; then : fi if test $ac_cv_func_remove = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for remove in -lposix" >&5 $as_echo_n "checking for remove in -lposix... " >&6; } if ${ac_cv_lib_posix_remove+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lposix $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char remove (); int main () { return remove (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : ac_cv_lib_posix_remove=yes else ac_cv_lib_posix_remove=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix_remove" >&5 $as_echo "$ac_cv_lib_posix_remove" >&6; } if test "x$ac_cv_lib_posix_remove" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" fi fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. ac_fn_cxx_check_func "$LINENO" "shmat" "ac_cv_func_shmat" if test "x$ac_cv_func_shmat" = xyes; then : fi if test $ac_cv_func_shmat = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shmat in -lipc" >&5 $as_echo_n "checking for shmat in -lipc... " >&6; } if ${ac_cv_lib_ipc_shmat+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lipc $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shmat (); int main () { return shmat (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : ac_cv_lib_ipc_shmat=yes else ac_cv_lib_ipc_shmat=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ipc_shmat" >&5 $as_echo "$ac_cv_lib_ipc_shmat" >&6; } if test "x$ac_cv_lib_ipc_shmat" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" fi fi fi # Check for libraries that X11R6 Xt/Xaw programs need. ac_save_LDFLAGS=$LDFLAGS test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to # check for ICE first), but we must link in the order -lSM -lICE or # we get undefined symbols. So assume we have SM if we have ICE. # These have to be linked with before -lX11, unlike the other # libraries we check for below, so use a different variable. # John Interrante, Karl Berry { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IceConnectionNumber in -lICE" >&5 $as_echo_n "checking for IceConnectionNumber in -lICE... " >&6; } if ${ac_cv_lib_ICE_IceConnectionNumber+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char IceConnectionNumber (); int main () { return IceConnectionNumber (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : ac_cv_lib_ICE_IceConnectionNumber=yes else ac_cv_lib_ICE_IceConnectionNumber=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 $as_echo "$ac_cv_lib_ICE_IceConnectionNumber" >&6; } if test "x$ac_cv_lib_ICE_IceConnectionNumber" = xyes; then : X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" fi LDFLAGS=$ac_save_LDFLAGS fi # AC_PATH_XTRA updates X_LIBS and X_CFLAGS but not CPPFLAGS, CXXFLAGS or LDFLAGS. # Thus we need to add X_CFLAGS to AEVOLCPPFLAGS, and X_LIBS to AEVOLLDFLAGS. # Moreover, on MacOS, AC_CHECK_LIB needs correct CPPFLAGS to find X11. But CPPFLAGS is normally a user # variable, which we should not change. Thus we save its previous value to restore it after AC_CHECK_LIB. ac_cppflags_save="$CPPFLAGS" CPPFLAGS+=" $X_CFLAGS" AEVOLCPPFLAGS+=" $X_CFLAGS" AEVOLLDFLAGS+=" $X_LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XOpenDisplay in -lX11" >&5 $as_echo_n "checking for XOpenDisplay in -lX11... " >&6; } if ${ac_cv_lib_X11_XOpenDisplay+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lX11 $X_LIBS $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char XOpenDisplay (); int main () { return XOpenDisplay (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : ac_cv_lib_X11_XOpenDisplay=yes else ac_cv_lib_X11_XOpenDisplay=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_X11_XOpenDisplay" >&5 $as_echo "$ac_cv_lib_X11_XOpenDisplay" >&6; } if test "x$ac_cv_lib_X11_XOpenDisplay" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBX11 1 _ACEOF LIBS="-lX11 $LIBS" else as_fn_error $? "the X11 library could not be found on your system. Please install it or re-run with the --without-x option" "$LINENO" 5 fi for ac_header in X11/Xlib.h X11/Xutil.h X11/keysym.h X11/Xatom.h X11/cursorfont.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_cxx_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done CPPFLAGS="$ac_cppflags_save" else $as_echo "#define __NO_X 1" >>confdefs.h fi # ******************* --enable-optim option *************************** # # With this option, the programs are compiled with the # optimization options (-O3 - fexpensive-optimizations...). # { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use compile time optimization" >&5 $as_echo_n "checking whether to use compile time optimization... " >&6; } # Check whether --enable-optim was given. if test "${enable_optim+set}" = set; then : enableval=$enable_optim; else enable_optim=yes fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_optim" >&5 $as_echo "$enable_optim" >&6; } if test x"$enable_optim" != xno; then WITH_OPTIM_TRUE= WITH_OPTIM_FALSE='#' else WITH_OPTIM_TRUE='#' WITH_OPTIM_FALSE= fi if test "x$enable_optim" = "xyes" ; then AEVOLCXXFLAGS+=" -O3 -ffast-math -pipe -fexpensive-optimizations" else AEVOLCXXFLAGS+=" -O0" fi # ******************* --enable-normalized-fitness option *************************** # # With this option, the NORMALIZED_FITNESS flag is defined, # allowing a different fitness calculation { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use normalized fitness" >&5 $as_echo_n "checking whether to use normalized fitness... " >&6; } # Check whether --enable-normalized-fitness was given. if test "${enable_normalized_fitness+set}" = set; then : enableval=$enable_normalized_fitness; else enable_normalized_fitness=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_normalized_fitness" >&5 $as_echo "$enable_normalized_fitness" >&6; } if test x"$enable_normalized_fitness" != xno; then WITH_NORMALIZED_FITNESS_TRUE= WITH_NORMALIZED_FITNESS_FALSE='#' else WITH_NORMALIZED_FITNESS_TRUE='#' WITH_NORMALIZED_FITNESS_FALSE= fi if test "x$enable_normalized_fitness" = "xyes" ; then $as_echo "#define NORMALIZED_FITNESS 1" >>confdefs.h fi # ************************* --enable-mtperiod=period option ******************************* # # This option sets a particular period for the Mersenne Twister. # Default is --enable-mtperiod=607 corresponding to a period of 2^607. # Possible values are 607, 1279, 2281, 4253, 11213, 19937, 44497, 86243, 132049 and 216091 # { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use a particular period for the Mersenne Twister" >&5 $as_echo_n "checking whether to use a particular period for the Mersenne Twister... " >&6; } # Check whether --enable-mtperiod was given. if test "${enable_mtperiod+set}" = set; then : enableval=$enable_mtperiod; period=$enableval else period=607 fi if test $period != 607 && test $period != 1279 && test $period != 2281 && test $period != 4253 && test $period != 11213 && test $period != 19937 && test $period != 44497 && test $period != 86243 && test $period != 132049 && test $period != 216091 ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: FAIL" >&5 $as_echo "FAIL" >&6; } as_fn_error $? "$period is not a valid Mersenne Twister period" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $period" >&5 $as_echo "$period" >&6; } cat >>confdefs.h <<_ACEOF #define SFMT_MEXP $period _ACEOF # ************************* --enable-trivialjumps=jumpsize option ******************************* # # When this option is set, a trivial jump algorithm will be used instead of the polynomial-based method. # This is recommended for large Mersenne Twister periods when huge jumps are not needed since # the polynomial-based method takes more time in that case. # # For the standard MT (period 2^19937), it takes approx. the same time to draw a few million numbers # than it does to make the same jump using the polynomial-based method. # # The jumpsize argument allows to set the desired jump size. The default value is 1000 which is enough to # avoid overlaps in most cases. # { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use trivial Mersenne Twister jumps" >&5 $as_echo_n "checking whether to use trivial Mersenne Twister jumps... " >&6; } # Check whether --enable-trivialjumps was given. if test "${enable_trivialjumps+set}" = set; then : enableval=$enable_trivialjumps; trivialjumps=$enableval else trivialjumps=no fi if test "x$trivialjumps" != "xyes" && test "x$trivialjumps" != "xno" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes ($trivialjumps)" >&5 $as_echo "yes ($trivialjumps)" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: $trivialjumps" >&5 $as_echo "$trivialjumps" >&6; } fi if test x"$trivialjumps" != xno; then ENABLE_FORCEPJ_TRUE= ENABLE_FORCEPJ_FALSE='#' else ENABLE_FORCEPJ_TRUE='#' ENABLE_FORCEPJ_FALSE= fi if test "x$trivialjumps" = "xyes" ; then $as_echo "#define TRIVIAL_METHOD_JUMP_SIZE 1000" >>confdefs.h elif test "x$trivialjumps" != "xno" ; then cat >>confdefs.h <<_ACEOF #define TRIVIAL_METHOD_JUMP_SIZE $trivialjumps _ACEOF fi # ******************* --enable-devel option *************************** # # This enables developers' features: # adds a call to make clean at the end of the configure script. # enables doxygen if available # { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use devel features" >&5 $as_echo_n "checking whether to use devel features... " >&6; } # Check whether --enable-devel was given. if test "${enable_devel+set}" = set; then : enableval=$enable_devel; else enable_devel=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_devel" >&5 $as_echo "$enable_devel" >&6; } if test x"$enable_devel" != xno; then ENABLE_DEVEL_TRUE= ENABLE_DEVEL_FALSE='#' else ENABLE_DEVEL_TRUE='#' ENABLE_DEVEL_FALSE= fi if test "x$enable_devel" = "xyes" ; then # Make clean at the end of the configuration process # (usefull when several configurations are done consecutively, typically during development) ac_config_commands="$ac_config_commands make" # Check for Doxygen for ac_prog in doxygen do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_HAVE_DOXYGEN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$HAVE_DOXYGEN"; then ac_cv_prog_HAVE_DOXYGEN="$HAVE_DOXYGEN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_HAVE_DOXYGEN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi HAVE_DOXYGEN=$ac_cv_prog_HAVE_DOXYGEN if test -n "$HAVE_DOXYGEN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_DOXYGEN" >&5 $as_echo "$HAVE_DOXYGEN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$HAVE_DOXYGEN" && break done if test -z "$HAVE_DOXYGEN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Doxygen not found - continuing without Doxygen support" >&5 $as_echo "$as_me: WARNING: Doxygen not found - continuing without Doxygen support" >&2;} fi else # Output a warning message about multi-configuration and make clean ac_config_commands="$ac_config_commands user_warning" fi if test -n "$HAVE_DOXYGEN"; then WANT_DOXYGEN_TRUE= WANT_DOXYGEN_FALSE='#' else WANT_DOXYGEN_TRUE='#' WANT_DOXYGEN_FALSE= fi # ******************* --enable-debug option *************************** # # With this option, the DEBUG flag is defined, and the programs are # compiled with debugging options (-g -Wall). # { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use debugging features" >&5 $as_echo_n "checking whether to use debugging features... " >&6; } # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then : enableval=$enable_debug; else enable_debug=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_debug" >&5 $as_echo "$enable_debug" >&6; } if test x"$enable_debug" != xno; then WITH_DEBUG_TRUE= WITH_DEBUG_FALSE='#' else WITH_DEBUG_TRUE='#' WITH_DEBUG_FALSE= fi if test "x$enable_debug" = "xyes" ; then $as_echo "#define DEBUG 1" >>confdefs.h AEVOLCXXFLAGS+=" -g -Wall" else $as_echo "#define NDEBUG 1" >>confdefs.h fi # ******************* --enable-profiling option *************************** # # With this option, the -pg flag is defined. # { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable profiling" >&5 $as_echo_n "checking whether to enable profiling... " >&6; } # Check whether --enable-profiling was given. if test "${enable_profiling+set}" = set; then : enableval=$enable_profiling; else enable_profiling=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_profiling" >&5 $as_echo "$enable_profiling" >&6; } if test x"$enable_profiling" != xno; then WITH_PROFILING_TRUE= WITH_PROFILING_FALSE='#' else WITH_PROFILING_TRUE='#' WITH_PROFILING_FALSE= fi if test "x$enable_profiling" = "xyes" ; then AEVOLCXXFLAGS+=" -pg" AEVOLLDFLAGS+=" -pg" fi # ************************* --with-raevol option ******************************* # # With this option, regulation is enabled (RAevol) and the __REGUL flag is defined # { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use raevol" >&5 $as_echo_n "checking whether to use raevol... " >&6; } # Check whether --with-raevol was given. if test "${with_raevol+set}" = set; then : withval=$with_raevol; raevol=$withval else raevol=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $raevol" >&5 $as_echo "$raevol" >&6; } if test x"$raevol" != xno; then WITH_RAEVOL_TRUE= WITH_RAEVOL_FALSE='#' else WITH_RAEVOL_TRUE='#' WITH_RAEVOL_FALSE= fi if test "x$raevol" = "xyes" ; then $as_echo "#define __REGUL 1" >>confdefs.h if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='aevol' VERSION='5.0' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi depcc="$CXX" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CXX_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 $as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= fi # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi fi fi # ************************* --with-blas option ******************************* # # With this option, BLAS matrix/vector manipulation is enabled, __BLAS__ flag is defined and -lopenblas added # { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use BLAS library" >&5 $as_echo_n "checking whether to use BLAS library... " >&6; } # Check whether --with-blas was given. if test "${with_blas+set}" = set; then : withval=$with_blas; blas=$withval else blas=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $blas" >&5 $as_echo "$blas" >&6; } if test x"$blas" != xno; then WITH_BLAS_TRUE= WITH_BLAS_FALSE='#' else WITH_BLAS_TRUE='#' WITH_BLAS_FALSE= fi if test "x$blas" = "xyes" ; then $as_echo "#define __BLAS__ 1" >>confdefs.h LIBS+=" -lopenblas" fi # ************************* --with-mkl option ******************************* # # With this option, MKL library is enabled, __BLAS__ flag is defined and -lmkl.. added # { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use MKL library" >&5 $as_echo_n "checking whether to use MKL library... " >&6; } # Check whether --with-mkl was given. if test "${with_mkl+set}" = set; then : withval=$with_mkl; mkl=$withval else mkl=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mkl" >&5 $as_echo "$mkl" >&6; } if test x"$mkl" != xno; then WITH_MKL_TRUE= WITH_MKL_FALSE='#' else WITH_MKL_TRUE='#' WITH_MKL_FALSE= fi if test "x$mkl" = "xyes" ; then $as_echo "#define __BLAS__ 1" >>confdefs.h LIBS+=" -lmkl_intel_ilp64 -lmkl_core -lmkl_sequential" fi # ************************* --with-atlas option ******************************* # # With this option, ATLAS library is enabled, __BLAS__ flag is defined and -latlas added # { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use ATLAS library" >&5 $as_echo_n "checking whether to use ATLAS library... " >&6; } # Check whether --with-atlas was given. if test "${with_atlas+set}" = set; then : withval=$with_atlas; atlas=$withval else atlas=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $atlas" >&5 $as_echo "$atlas" >&6; } if test x"$atlas" != xno; then WITH_ATLAS_TRUE= WITH_ATLAS_FALSE='#' else WITH_ATLAS_TRUE='#' WITH_ATLAS_FALSE= fi if test "x$atlas" = "xyes" ; then $as_echo "#define __BLAS__ 1" >>confdefs.h LIBS+=" -lcblas -latlas" fi # ************************* --with-tbb option ******************************* # # With this option, Intel TBB local parallelization is enabled, __TBB flag is defined and -ltbb added # { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use TBB library" >&5 $as_echo_n "checking whether to use TBB library... " >&6; } # Check whether --with-tbb was given. if test "${with_tbb+set}" = set; then : withval=$with_tbb; tbb=$withval else tbb=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tbb" >&5 $as_echo "$tbb" >&6; } if test x"$tbb" != xno; then WITH_TBB_TRUE= WITH_TBB_FALSE='#' else WITH_TBB_TRUE='#' WITH_TBB_FALSE= fi if test "x$tbb" = "xyes" ; then $as_echo "#define __TBB 1" >>confdefs.h LIBS+=" -ltbb" fi # ************************* --with-tracing option ******************************* # # With this option, tracing is enabled and the __TRACING__ flag is defined # { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use tracing" >&5 $as_echo_n "checking whether to use tracing... " >&6; } # Check whether --with-tracing was given. if test "${with_tracing+set}" = set; then : withval=$with_tracing; tracing=$withval else tracing=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tracing" >&5 $as_echo "$tracing" >&6; } if test x"$tracing" != xno; then WITH_TRACING_TRUE= WITH_TRACING_FALSE='#' else WITH_TRACING_TRUE='#' WITH_TRACING_FALSE= fi if test "x$tracing" = "xyes" ; then $as_echo "#define __TRACING__ 1" >>confdefs.h fi # ************************* back to GENERAL stuff ******************************* ac_config_files="$ac_config_files Makefile src/Makefile src/libaevol/Makefile src/libaevol/SFMT-src-1.4/Makefile src/post_treatments/Makefile doc/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' :mline /\\$/{ N s,\\\n,, b mline } t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${WITH_X_TRUE}" && test -z "${WITH_X_FALSE}"; then as_fn_error $? "conditional \"WITH_X\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${WITH_OPTIM_TRUE}" && test -z "${WITH_OPTIM_FALSE}"; then as_fn_error $? "conditional \"WITH_OPTIM\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${WITH_NORMALIZED_FITNESS_TRUE}" && test -z "${WITH_NORMALIZED_FITNESS_FALSE}"; then as_fn_error $? "conditional \"WITH_NORMALIZED_FITNESS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_FORCEPJ_TRUE}" && test -z "${ENABLE_FORCEPJ_FALSE}"; then as_fn_error $? "conditional \"ENABLE_FORCEPJ\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_DEVEL_TRUE}" && test -z "${ENABLE_DEVEL_FALSE}"; then as_fn_error $? "conditional \"ENABLE_DEVEL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${WANT_DOXYGEN_TRUE}" && test -z "${WANT_DOXYGEN_FALSE}"; then as_fn_error $? "conditional \"WANT_DOXYGEN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${WITH_DEBUG_TRUE}" && test -z "${WITH_DEBUG_FALSE}"; then as_fn_error $? "conditional \"WITH_DEBUG\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${WITH_PROFILING_TRUE}" && test -z "${WITH_PROFILING_FALSE}"; then as_fn_error $? "conditional \"WITH_PROFILING\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${WITH_RAEVOL_TRUE}" && test -z "${WITH_RAEVOL_FALSE}"; then as_fn_error $? "conditional \"WITH_RAEVOL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${WITH_BLAS_TRUE}" && test -z "${WITH_BLAS_FALSE}"; then as_fn_error $? "conditional \"WITH_BLAS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${WITH_MKL_TRUE}" && test -z "${WITH_MKL_FALSE}"; then as_fn_error $? "conditional \"WITH_MKL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${WITH_ATLAS_TRUE}" && test -z "${WITH_ATLAS_FALSE}"; then as_fn_error $? "conditional \"WITH_ATLAS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${WITH_TBB_TRUE}" && test -z "${WITH_TBB_FALSE}"; then as_fn_error $? "conditional \"WITH_TBB\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${WITH_TRACING_TRUE}" && test -z "${WITH_TRACING_FALSE}"; then as_fn_error $? "conditional \"WITH_TRACING\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by AEVOL $as_me 5.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Configuration commands: $config_commands Report bugs to . AEVOL home page: ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ AEVOL config.status 5.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "make") CONFIG_COMMANDS="$CONFIG_COMMANDS make" ;; "user_warning") CONFIG_COMMANDS="$CONFIG_COMMANDS user_warning" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "src/libaevol/Makefile") CONFIG_FILES="$CONFIG_FILES src/libaevol/Makefile" ;; "src/libaevol/SFMT-src-1.4/Makefile") CONFIG_FILES="$CONFIG_FILES src/libaevol/SFMT-src-1.4/Makefile" ;; "src/post_treatments/Makefile") CONFIG_FILES="$CONFIG_FILES src/post_treatments/Makefile" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" eval set X " :F $CONFIG_FILES :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; "make":C) make clean ;; "user_warning":C) { $as_echo "$as_me:${as_lineno-$LINENO}: Consider using make clean if you are re-configuring." >&5 $as_echo "$as_me: Consider using make clean if you are re-configuring." >&6;} ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi aevol-5.0/src/0000755000175000017500000000000012735464421010264 500000000000000aevol-5.0/src/aevol_propagate.cpp0000644000175000017500000002142612724051151014053 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** const char* DEFAULT_PARAM_FILE_NAME = "param.in"; // ============================================================================ // Includes // ============================================================================ #include #include #include #include #include #include #include #include // TODO(dpa) will be merged into C++17, remove dependency when possible #include #if __cplusplus == 201103L #include "make_unique.h" #endif #ifdef __X11 #include "ExpManager_X11.h" #else #include "ExpManager.h" #endif #include "ParamLoader.h" using namespace aevol; // Helper functions void print_help(char* prog_path); void interpret_cmd_line_options(int argc, char* argv[]); // Command-line option variables static int64_t timestep = -1; static char* input_dir = nullptr; static char* output_dir = nullptr; static bool keep_prng_states = false; static bool verbose = false; int main(int argc, char* argv[]) { interpret_cmd_line_options(argc, argv); // If output directory doesn't exist, create it struct stat stat_buf; if ((stat(output_dir, &stat_buf) == -1) && (errno == ENOENT)) { if (not boost::filesystem::create_directories(output_dir)) { err(EXIT_FAILURE, output_dir, errno); } } // ================================================================= // Load the model experiment // ================================================================= #ifndef __NO_X ExpManager* exp_manager = new ExpManager_X11(); #else ExpManager* exp_manager = new ExpManager(); #endif exp_manager->load(input_dir, timestep, verbose, false); if (not keep_prng_states) { auto max = std::numeric_limits::max(); #if __cplusplus == 201103L auto prng = make_unique(time(nullptr)); exp_manager->sel()->set_prng( make_unique(prng->random(max))); exp_manager->world()->set_prng( make_unique(prng->random(max))); #else auto prng = std::make_unique(time(nullptr)); exp_manager->sel()->set_prng( std::make_unique(prng->random(max))); exp_manager->world()->set_prng( std::make_unique(prng->random(max))); #endif exp_manager->world()->set_mut_prng( std::make_shared(prng->random(max))); exp_manager->world()->set_stoch_prng( std::make_shared(prng->random(max))); for (int16_t x = 0; x < exp_manager->world()->width(); x++) { for (int16_t y = 0; y < exp_manager->world()->height(); y++) { exp_manager->world()->grid(x, y)->set_mut_prng( std::make_shared( exp_manager->world()->mut_prng()->random(max))); exp_manager->world()->grid(x, y)->individual()->set_mut_prng( exp_manager->world()->grid(x, y)->mut_prng()); exp_manager->world()->grid(x, y)->set_stoch_prng( std::make_shared( exp_manager->world()->stoch_prng()->random(max))); exp_manager->world()->grid(x, y)->individual()->set_stoch_prng( exp_manager->world()->grid(x, y)->stoch_prng()); } } exp_manager->world()->set_phen_target_prngs( std::make_shared(prng->random(max)), std::make_shared(prng->random(max))); } exp_manager->Propagate(output_dir); } /*! \brief print help and exist */ void print_help(char* prog_path) { // Get the program file-name in prog_name (strip prog_path of the path) char* prog_name; // No new, it will point to somewhere inside prog_path if ((prog_name = strrchr(prog_path, '/'))) { prog_name++; } else { prog_name = prog_path; } printf("******************************************************************************\n"); printf("* *\n"); printf("* aevol - Artificial Evolution *\n"); printf("* *\n"); printf("* Aevol is a simulation platform that allows one to let populations of *\n"); printf("* digital organisms evolve in different conditions and study experimentally *\n"); printf("* the mechanisms responsible for the structuration of the genome and the *\n"); printf("* transcriptome. *\n"); printf("* *\n"); printf("******************************************************************************\n"); printf("\n"); printf("%s:\n", prog_name); printf("\tCreate a fresh copy of the experiment as it was at the given timestep.\n"); printf("\tThe timestep number of the copy will be reset to 0.\n"); printf("\n"); printf("Usage : %s -h or --help\n", prog_name); printf(" or : %s -V or --version\n", prog_name); printf(" or : %s [-t TIMESTEP] [-K] [-o OUTDIR] [-v]\n", prog_name); printf("\nOptions\n"); printf(" -h, --help\n\tprint this help, then exit\n"); printf(" -V, --version\n\tprint version number, then exit\n"); printf(" -t, --timestep TIMESTEP\n"); printf("\tspecify timestep to propagate\n"); printf(" -K, --keep-prng-st\n\tdo not alter prng states\n"); // printf(" -i, --in INDIR\n" // "\tspecify input directory (default \".\")\n"); printf(" -o, --out OUTDIR\n" "\tspecify output directory (default \"./output\")\n"); printf(" -v, --verbose\n\tbe verbose\n"); } void interpret_cmd_line_options(int argc, char* argv[]) { // Define allowed options const char* options_list = "hVt:o:v"; static struct option long_options_list[] = { {"help", no_argument, nullptr, 'h'}, {"version", no_argument, nullptr, 'V'}, {"timestep", required_argument, nullptr, 't'}, {"keep-prng-st", no_argument, nullptr, 'K'}, // {"in", required_argument, nullptr, 'i'}, {"out", required_argument, nullptr, 'o'}, {"verbose", no_argument, nullptr, 'v'}, {0, 0, 0, 0} }; // Get actual values of the CLI options int option; while ((option = getopt_long(argc, argv, options_list, long_options_list, nullptr)) != -1) { switch (option) { case 'h' : { print_help(argv[0]); exit(EXIT_SUCCESS); } case 'V' : { Utils::PrintAevolVersion(); exit(EXIT_SUCCESS); } case 't' : { timestep = atoi(optarg); break; } case 'K' : { keep_prng_states = true; break; } // case 'i' : { // input_dir = new char[strlen(optarg) + 1]; // strcpy(input_dir, optarg); // break; // } case 'o' : { output_dir = new char[strlen(optarg) + 1]; strcpy(output_dir, optarg); break; } case 'v' : { verbose = true; break; } default : { // An error message is printed in getopt_long, we just need to exit exit(EXIT_FAILURE); } } } // If input directory wasn't provided, use default if (input_dir == nullptr) { input_dir = new char[255]; sprintf(input_dir, "%s", "."); } // If output directory wasn't provided, use default if (output_dir == nullptr) { output_dir = new char[255]; sprintf(output_dir, "%s", "output"); } // If timestep wasn't provided, use default if (timestep == -1) { timestep = OutputManager::last_gener(); } } aevol-5.0/src/aevol_create.cpp0000644000175000017500000002110512732772533013343 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** const char* DEFAULT_PARAM_FILE_NAME = "param.in"; // ============================================================================ // Includes // ============================================================================ #include #include #include #include #ifdef __X11 #include "ExpManager_X11.h" #else #include "ExpManager.h" #endif #include "ExpManager.h" #include "ParamLoader.h" using namespace aevol; // Helper functions void print_help(char* prog_path); void interpret_cmd_line_options(int argc, char* argv[]); // Command-line option variables static char* param_file_name = nullptr; static char* chromosome_file_name = nullptr; static char* plasmid_file_name = nullptr; int main(int argc, char* argv[]) { interpret_cmd_line_options(argc, argv); // Create a param loader for the parameter file ParamLoader* my_param_loader = new ParamLoader(param_file_name); delete[] param_file_name; // Initialize the experiment manager ExpManager* exp_manager = new ExpManager(); // Initialize the simulation from the parameter file int32_t lchromosome = -1; char* chromosome; if (chromosome_file_name != nullptr) { const int max_input_chrom_size = 1000000; char raw_chromosome[max_input_chrom_size]; FILE* chromosome_file = fopen(chromosome_file_name, "r"); if (chromosome_file == nullptr) { printf("ERROR: failed to open source chromosome file %s\n", chromosome_file_name); exit(EXIT_FAILURE); } if (fgets(raw_chromosome, max_input_chrom_size, chromosome_file) == nullptr) { printf("ERROR: failed to read from chromosome file %s\n", chromosome_file_name); exit(EXIT_FAILURE); } lchromosome = strlen(raw_chromosome) - 1; chromosome = new char[lchromosome]; // Warning: will become the DNA of the // first individual created -> do not // delete, will be freed in Dna strncpy(chromosome, raw_chromosome, lchromosome); printf("Loading chromosome from text file %s (%" PRId32 " base pairs) \n", chromosome_file_name, lchromosome); fclose(chromosome_file); } int32_t lplasmid = -1; char* plasmid; if (plasmid_file_name != nullptr) { const int max_input_plasmid_size = 1000000; char raw_plasmid[max_input_plasmid_size]; FILE* plasmid_file = fopen(plasmid_file_name, "r"); if (plasmid_file == nullptr) { printf("ERROR: failed to open source chromosome file %s\n", plasmid_file_name); exit(EXIT_FAILURE); } if (fgets(raw_plasmid, max_input_plasmid_size, plasmid_file) == nullptr) { printf("ERROR: failed to read from chromosome file %s\n", chromosome_file_name); exit(EXIT_FAILURE); } lplasmid = strlen(raw_plasmid) - 1; plasmid = new char[lplasmid]; // Warning: will become the DNA of the first // individual created -> no not delete, // will be freed in Dna strncpy(plasmid, raw_plasmid, lplasmid); printf("Loading plasmid from text file %s (%" PRId32 " base pairs) \n", plasmid_file_name, lplasmid); fclose(plasmid_file); } if (lchromosome > -1) { if (lplasmid > -1) { my_param_loader->load(exp_manager, true, chromosome, lchromosome, plasmid, lplasmid); } else { my_param_loader->load(exp_manager, true, chromosome, lchromosome); } } else { my_param_loader->load(exp_manager, true); } delete my_param_loader; //~ ((ExpManager_X11*)exp_manager)->toggle_display_on_off(); //~ exp_manager->display(); //~ getchar(); // 8) Save the experiment exp_manager->Save(); delete exp_manager; } /*! \brief */ void print_help(char* prog_path) { // Get the program file-name in prog_name (strip prog_path of the path) char* prog_name; // No new, it will point to somewhere inside prog_path if ((prog_name = strrchr(prog_path, '/'))) { prog_name++; } else { prog_name = prog_path; } printf("******************************************************************************\n"); printf("* *\n"); printf("* aevol - Artificial Evolution *\n"); printf("* *\n"); printf("* Aevol is a simulation platform that allows one to let populations of *\n"); printf("* digital organisms evolve in different conditions and study experimentally *\n"); printf("* the mechanisms responsible for the structuration of the genome and the *\n"); printf("* transcriptome. *\n"); printf("* *\n"); printf("******************************************************************************\n"); printf("\n"); printf("%s: create an experiment with setup as specified in PARAM_FILE.\n", prog_name); printf("\n"); printf("Usage : %s -h or --help\n", prog_name); printf(" or : %s -V or --version\n", prog_name); printf(" or : %s [-f PARAM_FILE] [-C CHROM_FILE] [-P PLASMID_FILE]\n", prog_name); printf("\nOptions\n"); printf(" -h, --help\n\tprint this help, then exit\n"); printf(" -V, --version\n\tprint version number, then exit\n"); printf(" -f, --file PARAM_FILE\n"); printf("\tspecify parameter file (default: param.in)\n"); printf(" -C, --chromosome CHROM_FILE\n"); printf("\tload chromosome from given text file instead of generating it\n"); printf(" -P, --plasmid PLASMID_FILE\n"); printf("\tload plasmid from given text file instead of generating it\n"); } void interpret_cmd_line_options(int argc, char* argv[]) { // Define allowed options const char* options_list = "hVf:C:P:"; static struct option long_options_list[] = { {"help", no_argument, nullptr, 'h'}, {"version", no_argument, nullptr, 'V'}, {"file", required_argument, nullptr, 'f'}, {"chromosome", required_argument, nullptr, 'C'}, {"plasmid", required_argument, nullptr, 'P'}, {0, 0, 0, 0} }; // Get actual values of the CLI options int option; while ((option = getopt_long(argc, argv, options_list, long_options_list, nullptr)) != -1) { switch (option) { case 'h' : { print_help(argv[0]); exit(EXIT_SUCCESS); } case 'V' : { Utils::PrintAevolVersion(); exit(EXIT_SUCCESS); } case 'f' : { param_file_name = new char[strlen(optarg) + 1]; strcpy(param_file_name, optarg); break; } case 'C': { chromosome_file_name = new char[strlen(optarg) + 1]; strcpy(chromosome_file_name, optarg); break; } case 'P': { plasmid_file_name = new char[strlen(optarg) + 1]; strcpy(plasmid_file_name, optarg); break; } default : { // An error message is printed in getopt_long, we just need to exit exit(EXIT_FAILURE); } } } // Set undefined command line parameters to default values if (param_file_name == nullptr) { param_file_name = new char[strlen(DEFAULT_PARAM_FILE_NAME) + 1]; sprintf(param_file_name, "%s", DEFAULT_PARAM_FILE_NAME); } } aevol-5.0/src/libaevol/0000755000175000017500000000000012735464421012061 500000000000000aevol-5.0/src/libaevol/Individual_X11.cpp0000644000175000017500000007363412724051151015231 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ================================================================= // Libraries // ================================================================= #include #include // ================================================================= // Project Files // ================================================================= #include "Individual_X11.h" #include "ExpManager.h" #include "ExpSetup.h" #include "Utils.h" namespace aevol { //############################################################################## // # // Class Individual_X11 # // # //############################################################################## // ================================================================= // Definition of static attributes // ================================================================= // ================================================================= // Constructors // ================================================================= Individual_X11::Individual_X11(ExpManager * exp_manager, gzFile backup_file) : Individual(exp_manager, backup_file) { init_occupied_sectors(); } Individual_X11::Individual_X11(const Individual_X11 &model) : Individual(model) { init_occupied_sectors(); } Individual_X11::Individual_X11(Individual_X11 * const parent, int32_t id, std::shared_ptr mut_prng, std::shared_ptr stoch_prng) : Individual(parent, id, mut_prng, stoch_prng) { init_occupied_sectors(); } Individual_X11::Individual_X11(ExpManager * exp_m, std::shared_ptr mut_prng, std::shared_ptr stoch_prng, std::shared_ptr param_mut, double w_max, int32_t min_genome_length, int32_t max_genome_length, bool allow_plasmids, int32_t id, const char* strain_name, int32_t age) : Individual(exp_m,mut_prng,stoch_prng,param_mut,w_max,min_genome_length, max_genome_length,allow_plasmids,id,strain_name,age) { init_occupied_sectors(); } /*Individual_X11::Individual_X11(char* genome, int32_t genome_size) : Individual(genome, genome_size) { init_occupied_sectors(); }*/ // ================================================================= // Destructors // ================================================================= Individual_X11::~Individual_X11() { for (int16_t layer = 0 ; layer < outmost_layer_ ; layer++) { delete [] occupied_sectors_[LEADING][layer]; delete [] occupied_sectors_[LAGGING][layer]; } } // ================================================================= // Public Methods // ================================================================= void Individual_X11::display() { } void Individual_X11::display_cdss(X11Window * win) { // Retreive the genetic unit corresponding to the main chromosome GeneticUnit* gen_unit = &genetic_unit_list_.front(); int32_t genome_length = gen_unit->dna()->length(); // Display the number of CDSs char display_string[40]; sprintf(display_string, "Main chromosome size : %" PRId32 "bp", genome_length); win->draw_string(15, 25, display_string); sprintf(display_string, "Leading : %" PRId32 " CDSs", static_cast(gen_unit->protein_list(LEADING).size())); win->draw_string(15, 40, display_string); sprintf(display_string, "Lagging : %" PRId32 " CDSs", static_cast(gen_unit->protein_list(LAGGING).size())); win->draw_string(15, 55, display_string); // Compute display diameter according to genome length and window size int16_t canvas_width; if (allow_plasmids_) canvas_width = win->width() / 2; else canvas_width = win->width(); int16_t canvas_height = win->height(); int16_t canvas_size = Utils::min(canvas_width, canvas_height); int16_t diam = round(canvas_size * log((double)genome_length) / 16); // Prevent diameter from getting greater than 2/3 of the window size if (diam > 2 * canvas_size / 3) { diam = 2 * canvas_size / 3; } // Compute coordinates of the upper-left corner of the containing square int16_t pos_x = (canvas_width - diam) / 2; int16_t pos_y = (canvas_height - diam) / 2; // Draw main circle win->draw_circle(pos_x, pos_y, diam); // Sector occupation management reset_sectors(); // --------------- // Draw each CDS // --------------- // NB : As we want OriC to be at the "top" of the circle and the orientation // to be clockwise, the drawing angle (theta) will be given as // (90 - alpha), alpha being the "classical" trigonometric angle int16_t alpha_first, alpha_last; // Angles of first and last transcribed bases from OriC (degrees) int16_t theta_first; //, theta_last; // Transposed angles on the trigonometric circle (degrees) int16_t nb_sect; // Same as above with precision = 1/64 degree int16_t alpha_first_64, alpha_last_64; int16_t theta_first_64; //, theta_last_64; int16_t nb_sect_64; // ---------------- // LEADING strand // ---------------- for (const auto& cds: gen_unit->protein_list(LEADING)) { // Alpha : angles from OriC (in degrees) // Theta : angles on the trigonometric circle (in degrees) // nb_sect : "length" in degrees of the arc to be drawn alpha_first = (int16_t) round(360 * ((double)cds.first_translated_pos() / (double)genome_length)); alpha_last = (int16_t) round(360 * ((double)cds.last_translated_pos() / (double)genome_length)); theta_first = Utils::mod(90 - alpha_first, 360); // theta_last = Utils::mod(90 - alpha_last, 360); nb_sect = Utils::mod(alpha_last - alpha_first + 1, 360); // These are the same as above but with a higher precision (1/64 degrees) alpha_first_64 = (int16_t) round(64 * 360 * ((double)cds.first_translated_pos() / (double)genome_length)); alpha_last_64 = (int16_t) round(64 * 360 * ((double)cds.last_translated_pos() / (double)genome_length)); theta_first_64 = Utils::mod(64 * 90 - alpha_first_64, 64 * 360); // theta_last_64 = Utils::mod(64 * 90 - alpha_last_64, 64 * 360); nb_sect_64 = Utils::mod(alpha_last_64 - alpha_first_64 + 1, 64 * 360); // Look for the inmost layer that has all the sectors between // theta_first and theta_last free int16_t layer = 0; bool sectors_free = false; while (! sectors_free) { sectors_free = true; for (int16_t rho = 0 ; rho < nb_sect ; rho++) { if (occupied_sectors_[LEADING][layer][Utils::mod(theta_first-rho, 360)]) { sectors_free = false; break; } } if (sectors_free) { break; // All the needed sectors are free on the current layer } else { layer++; if (layer >= outmost_layer_) { add_layer(); break; // An added layer is necessarily free, no need to look further } } } // Mark sectors to be drawn as occupied for (int16_t rho = 0 ; rho < nb_sect ; rho++) { occupied_sectors_[LEADING][layer][Utils::mod(theta_first-rho, 360)] = true; } // Mark flanking sectors as occupied occupied_sectors_[LEADING][layer][Utils::mod(theta_first+1, 360)] = true; occupied_sectors_[LEADING][layer][Utils::mod(theta_first-nb_sect, 360)] = true; // Draw const int8_t cds_layer_spacing = 5; // TODO : param? layer++; // index starting at 0 but needed to start at 1 int16_t diam2 = diam + (layer * 2 * cds_layer_spacing); pos_x = (int16_t) round((double)(canvas_width - diam2) / 2.0); pos_y = (int16_t) round((double)(canvas_height - diam2) / 2.0); char* color = X11Window::color(cds.mean()); win->draw_arc_64(pos_x, pos_y, diam2, theta_first_64 - nb_sect_64, nb_sect_64, color); delete [] color; } // ---------------- // LAGGING strand // ---------------- for (const auto& cds: gen_unit->protein_list(LAGGING)) { // Alpha : angles from OriC (in degrees) // Theta : angles on the trigonometric circle (in degrees) // nb_sect : "length" in degrees of the arc to be drawn alpha_first = (int16_t) round(360 * ((double)cds.first_translated_pos() / (double)genome_length)); alpha_last = (int16_t) round(360 * ((double)cds.last_translated_pos() / (double)genome_length)); theta_first = Utils::mod(90 - alpha_first, 360); // theta_last = Utils::mod(90 - alpha_last, 360); nb_sect = Utils::mod(alpha_first - alpha_last + 1, 360); // These are the same as above but with a higher precision (1/64 degrees) alpha_first_64 = (int16_t) round(64 * 360 * ((double)cds.first_translated_pos() / (double)genome_length)); alpha_last_64 = (int16_t) round(64 * 360 * ((double)cds.last_translated_pos() / (double)genome_length)); theta_first_64 = Utils::mod(64 * 90 - alpha_first_64, 64 * 360); // theta_last_64 = Utils::mod(64 * 90 - alpha_last_64, 64 * 360); nb_sect_64 = Utils::mod(alpha_first_64 - alpha_last_64 + 1, 64 * 360); // Look for the inmost layer that has all the sectors between // theta_first and theta_last free int16_t layer = 0; bool sectors_free = false; while (! sectors_free) { sectors_free = true; for (int16_t rho = 0 ; rho < nb_sect ; rho++) { if (occupied_sectors_[LAGGING][layer][Utils::mod(theta_first+rho, 360)]) { sectors_free = false; break; } } if (sectors_free) { break; // All the needed sectors are free on the current layer } else { layer++; if (layer >= outmost_layer_) { add_layer(); break; // An added layer is necessarily free, no need to look further } } } // Mark sectors to be drawn as occupied for (int16_t rho = 0 ; rho < nb_sect ; rho++) { occupied_sectors_[LAGGING][layer][Utils::mod(theta_first+rho, 360)] = true; } // Mark flanking sectors as occupied occupied_sectors_[LAGGING][layer][Utils::mod(theta_first-1, 360)] = true; occupied_sectors_[LAGGING][layer][Utils::mod(theta_first+nb_sect, 360)] = true; // Draw const int8_t cds_layer_spacing = 5; // TODO : param? layer++; // index starting at 0 but needed to start at 1 int16_t diam2 = diam - (layer * 2 * cds_layer_spacing); pos_x = (int16_t) round((double)(canvas_width - diam2) / 2.0); pos_y = (int16_t) round((double)(canvas_height - diam2) / 2.0); char* color = X11Window::color(cds.mean()); win->draw_arc_64(pos_x, pos_y, diam2, theta_first_64, nb_sect_64, color); delete [] color; } // --------------------------------------------------------------------------This is temporary, it is a big copy-paste of what's above. if (allow_plasmids_) { // Retreive the genetic unit corresponding to the plasmid (i.e. index 1 in genetic_unit_list_) GeneticUnit* gen_unit = &*std::next(genetic_unit_list_.begin()); if (gen_unit == NULL) return; int32_t genome_length = gen_unit->dna()->length(); // Compute display diameter according to genome length and window size int16_t canvas_width; int16_t canvas_height; int16_t canvas_size ; if (allow_plasmids_) { canvas_width = win->width() / 2; canvas_size = canvas_width; } else { canvas_width = win->width(); canvas_size = Utils::min(canvas_width, canvas_width); } canvas_height = win->height(); int16_t diam = round(canvas_size * log((double)genome_length) / 16); // Prevent diameter from getting greater than 2/3 of the window size if (diam > 2 * canvas_size / 3) { diam = 2 * canvas_size / 3; } // Compute coordinates of the upper-left corner of the containing square int16_t pos_x = canvas_width + (canvas_width - diam) / 2; int16_t pos_y = (canvas_height - diam) / 2; // Draw main circle win->draw_circle(pos_x, pos_y, diam); // Sector occupation management reset_sectors(); // --------------- // Draw each CDS // --------------- // NB : As we want OriC to be at the "top" of the circle and the orientation // to be clockwise, the drawing angle (theta) will be given as // (90 - alpha), alpha being the "classical" trigonometric angle int16_t alpha_first, alpha_last; // Angles of first and last transcribed bases from OriC (degrees) int16_t theta_first; //, theta_last; // Transposed angles on the trigonometric circle (degrees) int16_t nb_sect; // Same as above with precision = 1/64 degree int16_t alpha_first_64, alpha_last_64; int16_t theta_first_64; //, theta_last_64; int16_t nb_sect_64; // ---------------- // LEADING strand // ---------------- for (const auto& cds: gen_unit->protein_list(LEADING)) { // Alpha : angles from OriC (in degrees) // Theta : angles on the trigonometric circle (in degrees) // nb_sect : "length" in degrees of the arc to be drawn alpha_first = (int16_t) round(360 * ((double)cds.first_translated_pos() / (double)genome_length)); alpha_last = (int16_t) round(360 * ((double)cds.last_translated_pos() / (double)genome_length)); theta_first = Utils::mod(90 - alpha_first, 360); // theta_last = Utils::mod(90 - alpha_last, 360); nb_sect = Utils::mod(alpha_last - alpha_first + 1, 360); // These are the same as above but with a higher precision (1/64 degrees) alpha_first_64 = (int16_t) round(64 * 360 * ((double)cds.first_translated_pos() / (double)genome_length)); alpha_last_64 = (int16_t) round(64 * 360 * ((double)cds.last_translated_pos() / (double)genome_length)); theta_first_64 = Utils::mod(64 * 90 - alpha_first_64, 64 * 360); // theta_last_64 = Utils::mod(64 * 90 - alpha_last_64, 64 * 360); nb_sect_64 = Utils::mod(alpha_last_64 - alpha_first_64 + 1, 64 * 360); // Look for the inmost layer that has all the sectors between // theta_first and theta_last free int16_t layer = 0; bool sectors_free = false; while (! sectors_free) { sectors_free = true; for (int16_t rho = 0 ; rho < nb_sect ; rho++) { if (occupied_sectors_[LEADING][layer][Utils::mod(theta_first-rho, 360)]) { sectors_free = false; break; } } if (sectors_free) { break; // All the needed sectors are free on the current layer } else { layer++; if (layer >= outmost_layer_) { add_layer(); break; // An added layer is necessarily free, no need to look further } } } // Mark sectors to be drawn as occupied for (int16_t rho = 0 ; rho < nb_sect ; rho++) { occupied_sectors_[LEADING][layer][Utils::mod(theta_first-rho, 360)] = true; } // Mark flanking sectors as occupied occupied_sectors_[LEADING][layer][Utils::mod(theta_first+1, 360)] = true; occupied_sectors_[LEADING][layer][Utils::mod(theta_first-nb_sect, 360)] = true; // Draw const int8_t cds_layer_spacing = 5; // TODO : param? layer++; // index starting at 0 but needed to start at 1 int16_t diam2 = diam + (layer * 2 * cds_layer_spacing); pos_x = canvas_width + (int16_t) round((double)(canvas_width - diam2) / 2.0); pos_y = (int16_t) round((double)(canvas_height - diam2) / 2.0); char* color = X11Window::color(cds.mean()); win->draw_arc_64(pos_x, pos_y, diam2, theta_first_64 - nb_sect_64, nb_sect_64, color); delete [] color; } // ---------------- // LAGGING strand // ---------------- for (const auto& cds: gen_unit->protein_list(LAGGING)) { // Alpha : angles from OriC (in degrees) // Theta : angles on the trigonometric circle (in degrees) // nb_sect : "length" in degrees of the arc to be drawn alpha_first = (int16_t) round(360 * ((double)cds.first_translated_pos() / (double)genome_length)); alpha_last = (int16_t) round(360 * ((double)cds.last_translated_pos() / (double)genome_length)); theta_first = Utils::mod(90 - alpha_first, 360); // theta_last = Utils::mod(90 - alpha_last, 360); nb_sect = Utils::mod(alpha_first - alpha_last + 1, 360); // These are the same as above but with a higher precision (1/64 degrees) alpha_first_64 = (int16_t) round(64 * 360 * ((double)cds.first_translated_pos() / (double)genome_length)); alpha_last_64 = (int16_t) round(64 * 360 * ((double)cds.last_translated_pos() / (double)genome_length)); theta_first_64 = Utils::mod(64 * 90 - alpha_first_64, 64 * 360); // theta_last_64 = Utils::mod(64 * 90 - alpha_last_64, 64 * 360); nb_sect_64 = Utils::mod(alpha_first_64 - alpha_last_64 + 1, 64 * 360); // Look for the inmost layer that has all the sectors between // theta_first and theta_last free int16_t layer = 0; bool sectors_free = false; while (! sectors_free) { sectors_free = true; for (int16_t rho = 0 ; rho < nb_sect ; rho++) { if (occupied_sectors_[LAGGING][layer][Utils::mod(theta_first+rho, 360)]) { sectors_free = false; break; } } if (sectors_free) { break; // All the needed sectors are free on the current layer } else { layer++; if (layer >= outmost_layer_) { add_layer(); break; // An added layer is necessarily free, no need to look further } } } // Mark sectors to be drawn as occupied for (int16_t rho = 0 ; rho < nb_sect ; rho++) { occupied_sectors_[LAGGING][layer][Utils::mod(theta_first+rho, 360)] = true; } // Mark flanking sectors as occupied occupied_sectors_[LAGGING][layer][Utils::mod(theta_first-1, 360)] = true; occupied_sectors_[LAGGING][layer][Utils::mod(theta_first+nb_sect, 360)] = true; // Draw const int8_t cds_layer_spacing = 5; // TODO : param? layer++; // index starting at 0 but needed to start at 1 int16_t diam2 = diam - (layer * 2 * cds_layer_spacing); pos_x = canvas_width + (int16_t) round((double)(canvas_width - diam2) / 2.0); pos_y = (int16_t) round((double)(canvas_height - diam2) / 2.0); char* color = X11Window::color(cds.mean()); win->draw_arc_64(pos_x, pos_y, diam2, theta_first_64, nb_sect_64, color); delete [] color; } } } void Individual_X11::display_rnas(X11Window * win) { // Retreive the genetic unit corresponding to the main chromosome const GeneticUnit* gen_unit = &genetic_unit_list_.front(); int32_t genome_length = gen_unit->dna()->length(); // Display the number of RNAs char nb_rna[40]; sprintf(nb_rna, "Leading : %" PRId32 " RNAs", static_cast(gen_unit->rna_list()[LEADING].size())); win->draw_string(15, 15, nb_rna); sprintf(nb_rna, "Lagging : %" PRId32 " RNAs", static_cast(gen_unit->rna_list()[LAGGING].size())); win->draw_string(15, 30, nb_rna); // Compute display diameter according to genome length and window size int16_t win_size = Utils::min(win->width(), win->height()); int16_t diam = round(win_size * log((double)genome_length) / 16); // Prevent diameter from getting greater than 2/3 of the window size if (diam > 2 * win_size / 3) { diam = 2 * win_size / 3; } // Compute coordinates of the upper-left corner of the containing square int16_t pos_x = (win->width() - diam) / 2; int16_t pos_y = (win->height() - diam) / 2; // Draw main circle win->draw_circle(pos_x, pos_y, diam); // Sector occupation management reset_sectors(); // --------------- // Draw each RNA // --------------- // NB : As we want OriC to be at the "top" of the circle and the orientation // to be clockwise, the drawing angle (theta) will be given as // (90 - alpha), alpha being the "classical" trigonometric angle int16_t alpha_first, alpha_last; // Angles of first and last transcribed bases from OriC (degrees) int16_t theta_first, theta_last; // Transposed angles on the trigonometric circle (degrees) int16_t nb_sect; // Same as above with precision = 1/64 degree int16_t alpha_first_64, alpha_last_64; int16_t theta_first_64, theta_last_64; int16_t nb_sect_64; // ---------------- // LEADING strand // ---------------- const auto& rna_lists = gen_unit->rna_list(); for (const auto& rna: rna_lists[LEADING]) { // Alpha : angles from OriC (in degrees) // Theta : angles on the trigonometric circle (in degrees) // nb_sect : "length" in degrees of the arc to be drawn alpha_first = (int16_t) round(360 * ((double)rna.first_transcribed_pos() / (double)genome_length)); alpha_last = (int16_t) round(360 * ((double)rna.last_transcribed_pos() / (double)genome_length)); theta_first = Utils::mod(90 - alpha_first, 360); theta_last = Utils::mod(90 - alpha_last, 360); nb_sect = Utils::mod(alpha_last - alpha_first + 1, 360); // These are the same as above but with a higher precision (1/64 degrees) alpha_first_64 = (int16_t) round(64 * 360 * ((double)rna.first_transcribed_pos() / (double)genome_length)); alpha_last_64 = (int16_t) round(64 * 360 * ((double)rna.last_transcribed_pos() / (double)genome_length)); theta_first_64 = Utils::mod(64 * 90 - alpha_first_64, 64 * 360); theta_last_64 = Utils::mod(64 * 90 - alpha_last_64, 64 * 360); nb_sect_64 = Utils::mod(alpha_last_64 - alpha_first_64 + 1, 64 * 360); //~ printf(" LEADING RNA %"PRId32" => %"PRId32" :: %"PRId16" %"PRId16"\n", rna->first_transcribed_pos(), rna->last_transcribed_pos(), theta_first, theta_last); // Look for the inmost layer that has all the sectors between // theta_first and theta_last free int16_t layer = 0; bool sectors_free = false; while (! sectors_free) { sectors_free = true; for (int16_t rho = 0 ; rho < nb_sect ; rho++) { if (occupied_sectors_[LEADING][layer][Utils::mod(theta_first-rho, 360)]) { sectors_free = false; break; } } if (sectors_free) { break; // All the needed sectors are free on the current layer } else { layer++; if (layer >= outmost_layer_) { add_layer(); break; // An added layer is necessarily free, no need to look further } } } // Mark sectors to be drawn as occupied for (int16_t rho = 0 ; rho < nb_sect ; rho++) { occupied_sectors_[LEADING][layer][Utils::mod(theta_first-rho, 360)] = true; } // Mark flanking sectors as occupied occupied_sectors_[LEADING][layer][Utils::mod(theta_first+1, 360)] = true; occupied_sectors_[LEADING][layer][Utils::mod(theta_first-nb_sect, 360)] = true; // Determine drawing color char* color; if (rna.is_coding()) { color = X11Window::color(rna.basal_level()); } else { color = new char[8]; strcpy(color, "#FFFFFF"); } // Draw arrow body const int8_t rna_layer_spacing = 5; // TODO : param? layer++; // index starting at 0 but needed to start at 1 int16_t diam2 = diam + (layer * 2 * rna_layer_spacing); pos_x = (int16_t) round((double)(win->width() - diam2) / 2.0); pos_y = (int16_t) round((double)(win->height() - diam2) / 2.0); win->draw_arc_64(pos_x, pos_y, diam2, theta_first_64 - nb_sect_64, nb_sect_64, color); // Draw arrow head int8_t arrow_thick = 6; // Must be an even value pos_x = (win->width() / 2.0) + (cos((theta_first_64 - nb_sect_64)/(64*180.0)*M_PI) * diam2 / 2.0) - (arrow_thick / 2.0); pos_y = (win->height() / 2.0) - (sin((theta_first_64 - nb_sect_64)/(64*180.0)*M_PI) * diam2 / 2.0) - (arrow_thick / 2.0); win->fill_arc(pos_x, pos_y, arrow_thick, Utils::mod(180+theta_last, 360), 180, color); delete [] color; } // ---------------- // LAGGING strand // ---------------- for (const auto& rna: rna_lists[LAGGING]) { // Alpha : angles from OriC (in degrees) // Theta : angles on the trigonometric circle (in degrees) // nb_sect : "length" in degrees of the arc to be drawn alpha_first = (int16_t) round(360 * ((double)rna.first_transcribed_pos() / (double)genome_length)); alpha_last = (int16_t) round(360 * ((double)rna.last_transcribed_pos() / (double)genome_length)); theta_first = Utils::mod(90 - alpha_first, 360); theta_last = Utils::mod(90 - alpha_last, 360); nb_sect = Utils::mod(alpha_first - alpha_last + 1, 360); // These are the same as above but with a higher precision (1/64 degrees) alpha_first_64 = (int16_t) round(64 * 360 * ((double)rna.first_transcribed_pos() / (double)genome_length)); alpha_last_64 = (int16_t) round(64 * 360 * ((double)rna.last_transcribed_pos() / (double)genome_length)); theta_first_64 = Utils::mod(64 * 90 - alpha_first_64, 64 * 360); theta_last_64 = Utils::mod(64 * 90 - alpha_last_64, 64 * 360); nb_sect_64 = Utils::mod(alpha_first_64 - alpha_last_64 + 1, 64 * 360); //~ printf(" LAGGING RNA %"PRId32" => %"PRId32" :: %"PRId16" %"PRId16"\n", rna->first_transcribed_pos(), rna->last_transcribed_pos(), theta_first, theta_last); // Look for the inmost layer that has all the sectors between // theta_first and theta_last free int16_t layer = 0; bool sectors_free = false; while (! sectors_free) { sectors_free = true; for (int16_t rho = 0 ; rho < nb_sect ; rho++) { if (occupied_sectors_[LAGGING][layer][Utils::mod(theta_first+rho, 360)]) { sectors_free = false; break; } } if (sectors_free) { break; // All the needed sectors are free on the current layer } else { layer++; if (layer >= outmost_layer_) { add_layer(); break; // An added layer is necessarily free, no need to look further } } } // Mark sectors to be drawn as occupied for (int16_t rho = 0 ; rho < nb_sect ; rho++) { occupied_sectors_[LAGGING][layer][Utils::mod(theta_first+rho, 360)] = true; } // Mark flanking sectors as occupied occupied_sectors_[LAGGING][layer][Utils::mod(theta_first-1, 360)] = true; occupied_sectors_[LAGGING][layer][Utils::mod(theta_first+nb_sect, 360)] = true; // Determine drawing color char* color; if (rna.is_coding()) { color = X11Window::color(rna.basal_level()); } else { color = new char[8]; strcpy(color, "#FFFFFF"); } // Draw arrow body const int8_t rna_layer_spacing = 5; // TODO : param? layer++; // index starting at 0 but needed to start at 1 int16_t diam2 = diam - (layer * 2 * rna_layer_spacing); pos_x = (int16_t) round((double)(win->width() - diam2) / 2.0); pos_y = (int16_t) round((double)(win->height() - diam2) / 2.0); win->draw_arc_64(pos_x, pos_y, diam2, theta_first_64, nb_sect_64, color); // Draw arrow head int8_t arrow_thick = 6; // Must be an even value pos_x = (win->width() / 2.0) + (cos((theta_last_64+1)/(64*180.0)*M_PI) * diam2 / 2.0) - (arrow_thick / 2.0); pos_y = (win->height() / 2.0) - (sin((theta_last_64+1)/(64*180.0)*M_PI) * diam2 / 2.0) - (arrow_thick / 2.0); win->fill_arc(pos_x, pos_y, arrow_thick, theta_last, 180, color); delete [] color; } } // ================================================================= // Protected Methods // ================================================================= void Individual_X11::add_layer() { occupied_sectors_[LEADING][outmost_layer_] = new bool[360]; occupied_sectors_[LAGGING][outmost_layer_] = new bool[360]; for (int16_t angle = 0 ; angle < 360 ; angle++) { occupied_sectors_[LEADING][outmost_layer_][angle] = false; occupied_sectors_[LAGGING][outmost_layer_][angle] = false; } outmost_layer_++; } void Individual_X11::init_occupied_sectors() { outmost_layer_ = 1; for (int16_t layer = 0 ; layer < outmost_layer_ ; layer++) { occupied_sectors_[LEADING][layer] = new bool[360]; occupied_sectors_[LAGGING][layer] = new bool[360]; } } void Individual_X11::reset_sectors() { for (int16_t layer = 0 ; layer < outmost_layer_ ; layer++) { for (int16_t angle = 0 ; angle < 360 ; angle++) { occupied_sectors_[LEADING][layer][angle] = false; occupied_sectors_[LAGGING][layer][angle] = false; } } } } // namespace aevol aevol-5.0/src/libaevol/InsertionHT.cpp0000644000175000017500000000703012724051151014701 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ============================================================================ // Includes // ============================================================================ #include "InsertionHT.h" namespace aevol { // ============================================================================ // Definition of static attributes // ============================================================================ // ============================================================================ // Constructors // ============================================================================ InsertionHT::InsertionHT(VisAVis& donor_donor_align, VisAVis& exo_recv_align, int32_t length, char* seq, int32_t donor_id) : donor_donor_align_(donor_donor_align), exo_recv_align_(exo_recv_align), length_(length), donor_id_(donor_id) { assert(donor_donor_align_.sense() == DIRECT); seq_ = new char[length_ + 1]; memcpy(seq_, seq, length_ + 1); } // ============================================================================ // Destructor // ============================================================================ InsertionHT::~InsertionHT() noexcept { delete seq_; } // ============================================================================ // Methods // ============================================================================ void InsertionHT::save(gzFile backup_file) const { Utils::ExitWithDevMsg("Not implemented yet", __FILE__, __LINE__); } void InsertionHT::load(gzFile backup_file) { Utils::ExitWithDevMsg("Not implemented yet", __FILE__, __LINE__); } void InsertionHT::generic_description_string(char* str) const { sprintf(str, "%" PRId8 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId8 " %" PRId16 " %" PRId16 " %" PRId32 " %" PRId32, mut_type(), donor_pos1(), donor_pos2(), exogenote_pos(), receiver_pos(), sense(), donor_donor_align_.score(), exo_recv_align_.score(), length_, (int32_t) -1); } // ============================================================================ // Non inline accessors // ============================================================================ } // namespace aevol aevol-5.0/src/libaevol/ParamLoader.cpp0000644000175000017500000021236512732772533014710 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ============================================================================ // Includes // ============================================================================ #include #include #include #include #include #include #include #include "ParamLoader.h" #include "FuzzyFactory.h" #if __cplusplus == 201103L #include "make_unique.h" #endif #include "ExpManager.h" #include "ExpSetup.h" #include "OutputManager.h" #include "Individual.h" #include "IndividualFactory.h" #include "ExpManager.h" #ifdef __REGUL #include "raevol/Individual_R.h" #endif #include "JumpingMT.h" #include "Gaussian.h" #include "PhenotypicSegment.h" #include "Point.h" #include "Alignment.h" #include "World.h" namespace aevol { //############################################################################## // # // Class ParamLoader # // # //############################################################################## // ================================================================= // Definition of static attributes // ================================================================= static const int8_t STRAIN_NAME_DEFAULT_SIZE = 20; static const int8_t STRAIN_NAME_LOGIN_SIZE = 10; #ifndef LOGIN_NAME_MAX #define LOGIN_NAME_MAX 256 #endif const char kTabChar = 0x09; // ================================================================= // Constructors // ================================================================= ParamLoader::ParamLoader(const char* file_name) { // Give default values to parameters // ----------------------------------------- PseudoRandom Number Generators seed_ = 0; mut_seed_ = 0; stoch_seed_ = 0; env_var_seed_ = 0; env_noise_seed_ = 0; // ------------------------------------------------------------ Constraints min_genome_length_ = 10; max_genome_length_ = 10000000; w_max_ = 0.033333333; // ----------------------------------------------------- Initial conditions chromosome_initial_length_ = 5000; init_method_ = ONE_GOOD_GENE | CLONE; init_pop_size_ = 1024; strain_name_ = new char[STRAIN_NAME_DEFAULT_SIZE + 1]; // ------------------------------------------------------------- Strain name char* login_name = new char[LOGIN_NAME_MAX+1]; // Try get user login. If fail, replace by default value if(getlogin_r(login_name, LOGIN_NAME_MAX) != 0) strcpy(login_name, "anon"); // Copy login into strain name with at most STRAIN_NAME_LOGIN_SIZE + 1 characters strncpy(strain_name_, login_name, STRAIN_NAME_LOGIN_SIZE + 1); delete [] login_name; // Null-terminate the c-string if the max number of characters were copied if (strain_name_[STRAIN_NAME_LOGIN_SIZE] != 0) strain_name_[STRAIN_NAME_LOGIN_SIZE + 1] = 0; // Append with a hyphen and a series of random digits int strain_name_len = strlen(strain_name_); strain_name_[strain_name_len++] = '-'; srand(std::time(nullptr)); while (strain_name_len < STRAIN_NAME_DEFAULT_SIZE) { // Don't care for uniform distrib, using simple and ugly rand() % X strain_name_[strain_name_len++] = '0' + rand() % 10; } // -------------------------------------------------------- Phenotypic target env_sampling_ = 300; // ------------------------------------ Phenotypic target x-axis segmentation env_axis_nb_segments_ = 1; env_axis_segment_boundaries_ = NULL; env_axis_features_ = NULL; env_axis_separate_segments_ = false; // ---------------------------------------------- Phenotypic target variation env_var_method_ = NO_VAR; env_var_sigma_ = 0; env_var_tau_ = 0; // -------------------------------------------------- Phenotypic target noise env_noise_method_ = NO_NOISE; env_noise_alpha_ = 0; env_noise_sigma_ = 0; env_noise_prob_ = 0; env_noise_sampling_log_ = 0; // --------------------------------------------------------- Mutation rates point_mutation_rate_ = 1e-5; small_insertion_rate_ = 1e-5; small_deletion_rate_ = 1e-5; max_indel_size_ = 6; // -------------------------------------------- Rearrangements and Transfer with_4pts_trans_ = true; with_alignments_ = false; with_HT_ = false; repl_HT_with_close_points_ = false; HT_ins_rate_ = 0.0; HT_repl_rate_ = 0.0; repl_HT_detach_rate_ = 0.0; // ------------------------------ Rearrangement rates (without alignements) duplication_rate_ = 1e-5; deletion_rate_ = 1e-5; translocation_rate_ = 1e-5; inversion_rate_ = 1e-5; // --------------------------------- Rearrangement rates (with alignements) neighbourhood_rate_ = 5e-5; duplication_proportion_ = 0.3; deletion_proportion_ = 0.3; translocation_proportion_ = 0.3; inversion_proportion_ = 0.3; // ------------------------------------------------------------ Alignements align_fun_shape_ = SIGMOID; align_sigm_lambda_ = 4; align_sigm_mean_ = 50; align_lin_min_ = 0; align_lin_max_ = 100; align_max_shift_ = 20; align_w_zone_h_len_ = 50; align_match_bonus_ = 1; align_mismatch_cost_ = 2; // ----------------------------------------------- Phenotypic Stochasticity with_stochasticity_ = false; // -------------------------------------------------------------- Selection selection_scheme_ = RANK_EXPONENTIAL; selection_pressure_ = 0.998; // -------------------------------------------------------------- Secretion with_secretion_ = false; secretion_contrib_to_fitness_ = 0; secretion_diffusion_prop_ = 0; secretion_degradation_prop_ = 0; secretion_cost_ = 0; secretion_init_ = 0; // --------------------------------------------------------------- Plasmids allow_plasmids_ = false; plasmid_initial_length_ = -1; plasmid_initial_gene_ = 0; plasmid_minimal_length_ = -1; plasmid_maximal_length_ = -1; chromosome_minimal_length_ = -1; chromosome_maximal_length_ = -1; prob_plasmid_HT_ = 0; tune_donor_ability_ = 0; tune_recipient_ability_ = 0; donor_cost_ = 0; recipient_cost_ = 0; compute_phen_contrib_by_GU_ = false; swap_GUs_ = false; // ------------------------------------------------------- Translation cost translation_cost_ = 0; // ---------------------------------------------------------------- Outputs stats_ = 0; delete_old_stats_ = false; // Backups backup_step_ = 500; big_backup_step_ = 10000; // Tree record_tree_ = false; tree_step_ = 100; // Dumps make_dumps_ = false; dump_step_ = 1000; // Logs logs_ = 0; // Other more_stats_ = false; _fuzzy_flavor = 0; #ifdef __REGUL // ------------------------------------------------------- Binding matrix _binding_zeros_percentage = 75; _protein_presence_limit = 1e-2; _degradation_rate = 1; _nb_degradation_step = 10; _nb_indiv_age = 20; _with_heredity = false; _hill_shape_n = 4; _hill_shape_theta = 0.5; _hill_shape = std::pow( _hill_shape_theta, _hill_shape_n ); _list_eval_step.insert(_nb_indiv_age); _env_switch_probability = 0.1; #endif first_regul_ = true; // Read parameter file param_file_name_ = strdup(file_name); param_file_ = fopen(param_file_name_, "r"); if (param_file_ == NULL) { printf("ERROR : couldn't open file %s\n", file_name); exit(EXIT_FAILURE); } assert(param_file_); read_file(); } // ================================================================= // Destructor // ================================================================= ParamLoader::~ParamLoader() { free(param_file_name_); fclose(param_file_); delete [] env_axis_segment_boundaries_; delete [] env_axis_features_; delete [] strain_name_; } // ================================================================= // Public Methods // ================================================================= void ParamLoader::interpret_line(ParameterLine * line, int32_t cur_line) { if (strcmp(line->words[0], "STRAIN_NAME") == 0) { delete [] strain_name_; strain_name_ = new char[strlen(line->words[1])+1]; strcpy(strain_name_, line->words[1]); } else if (strcmp(line->words[0], "MIN_TRIANGLE_WIDTH") == 0) { printf("ERROR in param file \"%s\" on line %" PRId32 ": %s is no longer a valid option, " "its value is fixed to 0.\n", param_file_name_, cur_line, line->words[0]); exit(EXIT_FAILURE); } else if (strcmp(line->words[0], "MAX_TRIANGLE_WIDTH") == 0) { w_max_ = atof(line->words[1]); } else if (strcmp(line->words[0], "ENV_AXIS_FEATURES") == 0) { // Set general segmentation data env_axis_nb_segments_ = line->nb_words / 2; // Set segmentation boundaries env_axis_segment_boundaries_ = new double [env_axis_nb_segments_ + 1]; env_axis_segment_boundaries_[0] = X_MIN; for (int16_t i = 1 ; i < env_axis_nb_segments_ ; i++) { env_axis_segment_boundaries_[i] = atof(line->words[2*i]); } env_axis_segment_boundaries_[env_axis_nb_segments_] = X_MAX; // Set segment features env_axis_features_ = new PhenotypicFeature[env_axis_nb_segments_]; for (int16_t i = 0 ; i < env_axis_nb_segments_ ; i++) { if (strcmp(line->words[2*i+1], "NEUTRAL") == 0) { env_axis_features_[i] = NEUTRAL; } else if (strcmp(line->words[2*i+1], "METABOLISM") == 0) { env_axis_features_[i] = METABOLISM; } else if (strcmp(line->words[2*i+1], "SECRETION") == 0) { with_secretion_ = true; env_axis_features_[i] = SECRETION; } else if (strcmp(line->words[2*i+1], "DONOR") == 0) { env_axis_features_[i] = DONOR; } else if (strcmp(line->words[2*i+1], "RECIPIENT") == 0) { env_axis_features_[i] = RECIPIENT; } else { printf("ERROR in param file \"%s\" on line %" PRId32 ": unknown axis feature \"%s\".\n", param_file_name_, cur_line, line->words[2*i+1]); exit(EXIT_FAILURE); } } } else if (strcmp(line->words[0], "ENV_SEPARATE_SEGMENTS") == 0) { env_axis_separate_segments_ = true; } else if (strcmp(line->words[0], "RECORD_TREE") == 0) { if (strncmp(line->words[1], "true", 4) == 0) { record_tree_ = true; } else if (strncmp(line->words[1], "false", 5) == 0) { record_tree_ = false; } else { printf("ERROR in param file \"%s\" on line %" PRId32 ": unknown tree recording option (use true/false).\n", param_file_name_, cur_line); exit(EXIT_FAILURE); } } else if (strcmp(line->words[0], "TREE_MODE") == 0) { printf("ERROR in param file \"%s\" on line %" PRId32 ": " "Tree mode management has been removed.\n", param_file_name_, cur_line); exit(EXIT_FAILURE); } else if (strcmp(line->words[0], "MORE_STATS") == 0) { if (strncmp(line->words[1], "true", 4) == 0) { more_stats_ = true; } else if (strncmp(line->words[1], "false", 5) == 0) { more_stats_ = false; } else { printf("ERROR in param file \"%s\" on line %" PRId32 ": unknown more stats option (use true/false).\n", param_file_name_, cur_line); exit(EXIT_FAILURE); } } else if (strcmp(line->words[0], "DUMP_PERIOD") == 0) { printf("ERROR in param file \"%s\" on line %" PRId32 ": %s is no longer a valid option, " "use DUMP_STEP instead.\n", param_file_name_, cur_line, line->words[0]); exit(EXIT_FAILURE); } else if (strcmp(line->words[0], "DUMP_STEP") == 0) { dump_step_ = atol(line->words[1]); if (dump_step_>0) make_dumps_ = true; } else if (strcmp(line->words[0], "BACKUP_STEP") == 0) { backup_step_ = atol(line->words[1]); } else if (strcmp(line->words[0], "BIG_BACKUP_STEP") == 0) { big_backup_step_ = atol(line->words[1]); } else if (strcmp(line->words[0], "TREE_STEP") == 0) { tree_step_ = atol(line->words[1]); } else if (strcmp(line->words[0], "NB_GENER") == 0) { printf("ERROR in param file \"%s\" on line %" PRId32 ": %s is no longer a valid option, " "use command line arguments of aevol_run instead.\n", param_file_name_, cur_line, line->words[0]); exit(EXIT_FAILURE); } else if (strcmp(line->words[0], "INITIAL_GENOME_LENGTH") == 0) { printf("ERROR in param file \"%s\" on line %" PRId32 ": %s is no longer a valid option, " "use CHROMOSOME_INITIAL_LENGTH (and optionally " "PLASMID_INITIAL_LENGTH) instead.\n", param_file_name_, cur_line, line->words[0]); exit(EXIT_FAILURE); } else if (strcmp(line->words[0], "CHROMOSOME_INITIAL_LENGTH") == 0) { chromosome_initial_length_ = atol(line->words[1]); } else if (strcmp(line->words[0], "MIN_GENOME_LENGTH") == 0) { if (strncmp(line->words[1], "NONE", 4) == 0) { min_genome_length_ = 1; // Must not be 0 } else { min_genome_length_ = atol(line->words[1]); if (min_genome_length_ == 0) { printf("ERROR in param file \"%s\" on line %" PRId32 " : MIN_GENOME_LENGTH must be > 0.\n", param_file_name_, cur_line); exit(EXIT_FAILURE); } } } else if (strcmp(line->words[0], "MAX_GENOME_LENGTH") == 0) { if (strncmp(line->words[1], "NONE", 4) == 0) { max_genome_length_ = INT32_MAX; } else { max_genome_length_ = atol(line->words[1]); } } else if (strcmp(line->words[0], "INIT_POP_SIZE") == 0) { init_pop_size_ = atol(line->words[1]); } else if (strcmp(line->words[0], "WORLD_SIZE") == 0) { grid_width_ = atoi(line->words[1]); grid_height_ = atoi(line->words[2]); } else if (strcmp(line->words[0], "POP_STRUCTURE") == 0) { printf("ERROR in param file \"%s\" on line %" PRId32 ": %s is no longer a valid option, " "use WORLD_SIZE instead.\n", param_file_name_, cur_line, line->words[0]); exit(EXIT_FAILURE); } else if (strcmp(line->words[0], "MIGRATION_NUMBER") == 0) { printf("ERROR in param file \"%s\" on line %" PRId32 ": %s is no longer a valid option, " "use INDIV_MIXING instead.\n", param_file_name_, cur_line, line->words[0]); printf("usage: INDIV_MIXING WELL_MIXED|NONE|PARTIAL \n"); exit(EXIT_FAILURE); } else if (strcmp(line->words[0], "INDIV_MIXING") == 0) { if (strcmp(line->words[1], "WELL_MIXED") == 0) well_mixed = true; else if (strcmp(line->words[1], "NONE") == 0) well_mixed = false; else if (strcmp(line->words[1], "PARTIAL") == 0) partial_mix_nb_permutations = atol(line->words[2]); else { printf("ERROR in param file \"%s\" on line %" PRId32 ": unknown mixing option.\n", param_file_name_, cur_line); printf("usage: INDIV_MIXING WELL_MIXED|NONE|PARTIAL \n"); exit(EXIT_FAILURE); } } else if (strcmp(line->words[0], "INIT_METHOD") == 0) { for (int8_t i = 1 ; i < line->nb_words ; i++) { if (strcmp(line->words[i], "ONE_GOOD_GENE") == 0) { init_method_ |= ONE_GOOD_GENE; } else if (strcmp(line->words[i], "CLONE") == 0) { init_method_ |= CLONE; } else if (strcmp(line->words[i], "WITH_INS_SEQ") == 0) { init_method_ |= WITH_INS_SEQ; } else { printf("ERROR in param file \"%s\" on line %" PRId32 ": unknown initialization method %s.\n", param_file_name_, cur_line, line->words[1]); exit(EXIT_FAILURE); } } } else if (strcmp(line->words[0], "POINT_MUTATION_RATE") == 0) { point_mutation_rate_ = atof(line->words[1]); } else if (strcmp(line->words[0], "SMALL_INSERTION_RATE") == 0) { small_insertion_rate_ = atof(line->words[1]); } else if (strcmp(line->words[0], "SMALL_DELETION_RATE") == 0) { small_deletion_rate_ = atof(line->words[1]); } else if (strcmp(line->words[0], "MAX_INDEL_SIZE") == 0) { max_indel_size_ = atol(line->words[1]); } else if (strcmp(line->words[0], "DUPLICATION_RATE") == 0) { duplication_rate_ = atof(line->words[1]); } else if (strcmp(line->words[0], "DELETION_RATE") == 0) { deletion_rate_ = atof(line->words[1]); } else if (strcmp(line->words[0], "TRANSLOCATION_RATE") == 0) { translocation_rate_ = atof(line->words[1]); } else if (strcmp(line->words[0], "INVERSION_RATE") == 0) { inversion_rate_ = atof(line->words[1]); } else if (strcmp(line->words[0], "NEIGHBOURHOOD_RATE") == 0) { neighbourhood_rate_ = atof(line->words[1]); } else if (strcmp(line->words[0], "DUPLICATION_PROPORTION") == 0) { duplication_proportion_ = atof(line->words[1]); } else if (strcmp(line->words[0], "DELETION_PROPORTION") == 0) { deletion_proportion_ = atof(line->words[1]); } else if (strcmp(line->words[0], "TRANSLOCATION_PROPORTION") == 0) { translocation_proportion_ = atof(line->words[1]); } else if (strcmp(line->words[0], "INVERSION_PROPORTION") == 0) { inversion_proportion_ = atof(line->words[1]); } else if (strcmp(line->words[0], "ALIGN_FUNCTION") == 0) { if (line->nb_words != 2 && line->nb_words != 4) { printf("ERROR in param file \"%s\" on line %" PRId32 ": incorrect number of parameters for keyword \"%s\".\n", param_file_name_, cur_line, line->words[0]); exit(EXIT_FAILURE); } if (strcmp(line->words[1], "LINEAR") == 0) { align_fun_shape_ = LINEAR; if (line->nb_words == 4) { align_lin_min_ = atol(line->words[2]); align_lin_max_ = atol(line->words[3]); } } else if (strcmp(line->words[1], "SIGMOID") == 0) { align_fun_shape_ = SIGMOID; if (line->nb_words == 4) { align_sigm_lambda_ = atol(line->words[2]); align_sigm_mean_ = atol(line->words[3]); } } else { printf("ERROR in param file \"%s\" on line %" PRId32 ": unknown align function shape \"%s\".\n", param_file_name_, cur_line, line->words[1]); exit(EXIT_FAILURE); } } else if (strcmp(line->words[0], "ALIGN_MAX_SHIFT") == 0) { align_max_shift_ = atol(line->words[1]); } else if (strcmp(line->words[0], "ALIGN_W_ZONE_H_LEN") == 0) { align_w_zone_h_len_ = atol(line->words[1]); } else if (strcmp(line->words[0], "ALIGN_MATCH_BONUS") == 0) { align_match_bonus_ = atol(line->words[1]); } else if (strcmp(line->words[0], "ALIGN_MISMATCH_COST") == 0) { align_mismatch_cost_ = atol(line->words[1]); } else if (strcmp(line->words[0], "STOCHASTICITY") == 0) { if (strncmp(line->words[1], "true", 4) == 0) { with_stochasticity_ = true; } } else if (strcmp(line->words[0], "SELECTION_SCHEME") == 0) { if (strncmp(line->words[1], "lin", 3) == 0) { if (line->nb_words != 3) { printf("ERROR in param file \"%s\" on line %" PRId32 ": selection pressure parameter is missing.\n", param_file_name_, cur_line); exit(EXIT_FAILURE); } selection_scheme_ = RANK_LINEAR; selection_pressure_ = atof(line->words[2]); } else if (strncmp(line->words[1], "exp", 3) == 0) { if (line->nb_words != 3) { printf("ERROR in param file \"%s\" on line %" PRId32 ": selection pressure parameter is missing.\n", param_file_name_, cur_line); exit(EXIT_FAILURE); } selection_scheme_ = RANK_EXPONENTIAL; selection_pressure_ = atof(line->words[2]); } else if (strncmp(line->words[1], "fitness", 7) == 0) { if (line->nb_words != 3) { printf("ERROR in param file \"%s\" on line %" PRId32 ": selection pressure parameter is missing.\n", param_file_name_, cur_line); exit(EXIT_FAILURE); } selection_scheme_ = FITNESS_PROPORTIONATE; selection_pressure_ = atof(line->words[2]); } else if (strcmp(line->words[1], "fittest") == 0) { selection_scheme_ = FITTEST; } else { printf("ERROR in param file \"%s\" on line %" PRId32 ": unknown selection scheme \"%s\".\n", param_file_name_, cur_line, line->words[1]); exit(EXIT_FAILURE); } } else if (strcmp(line->words[0], "SEED") == 0) { static bool seed_already_set = false; if (seed_already_set) { printf("ERROR in param file \"%s\" on line %" PRId32 ": duplicate entry for SEED.\n", param_file_name_, cur_line); exit(EXIT_FAILURE); } seed_ = atol(line->words[1]); seed_already_set = true; } else if (strcmp(line->words[0], "MUT_SEED") == 0) { static bool mut_seed_already_set = false; if (mut_seed_already_set) { printf("ERROR in param file \"%s\" on line %" PRId32 ": duplicate entry for MUT_SEED.\n", param_file_name_, cur_line); exit(EXIT_FAILURE); } mut_seed_ = atol(line->words[1]); mut_seed_already_set = true; } else if (strcmp(line->words[0], "STOCH_SEED") == 0) { static bool stoch_seed_already_set = false; if (stoch_seed_already_set) { printf("ERROR in param file \"%s\" on line %" PRId32 ": duplicate entry for STOCH_SEED.\n", param_file_name_, cur_line); exit(EXIT_FAILURE); } stoch_seed_ = atol(line->words[1]); stoch_seed_already_set = true; } else if (strcmp(line->words[0], "WITH_4PTS_TRANS") == 0) { if (strncmp(line->words[1], "true", 4) == 0) { with_4pts_trans_ = true; } else if (strncmp(line->words[1], "false", 5) == 0) { printf("ERROR: 3 points_ translocation hasn't been implemented yet\n"); exit(EXIT_FAILURE); } else { printf("ERROR in param file \"%s\" on line %" PRId32 ": unknown 4pts_trans option (use true/false).\n", param_file_name_, cur_line); exit(EXIT_FAILURE); } } else if (strcmp(line->words[0], "WITH_ALIGNMENTS") == 0) { if (strncmp(line->words[1], "true", 4) == 0) { with_alignments_ = true; } else if (strncmp(line->words[1], "false", 5) == 0) { with_alignments_ = false; } else { printf("ERROR in param file \"%s\" on line %" PRId32 ": unknown alignement option (use true/false).\n", param_file_name_, cur_line); exit(EXIT_FAILURE); } } else if (strcmp(line->words[0], "WITH_TRANSFER") == 0) { if (strncmp(line->words[1], "true", 4) == 0) { with_HT_ = true; } else if (strncmp(line->words[1], "false", 5) == 0) { with_HT_ = false; } else { printf("ERROR in param file \"%s\" on line %" PRId32 ": unknown transfer option (use true/false).\n", param_file_name_, cur_line); exit(EXIT_FAILURE); } } else if (strcmp(line->words[0], "REPL_TRANSFER_WITH_CLOSE_POINTS") == 0) { if (strncmp(line->words[1], "true", 4) == 0) { repl_HT_with_close_points_ = true; } else if (strncmp(line->words[1], "false", 5) == 0) { repl_HT_with_close_points_ = false; } else { printf("ERROR in param file \"%s\" on line %" PRId32 ": unknown transfer option (use true/false).\n", param_file_name_, cur_line); exit(EXIT_FAILURE); } } else if (strcmp(line->words[0], "SWAP_GUS") == 0) { if (strncmp(line->words[1], "true", 4) == 0) { swap_GUs_ = true; } else if (strncmp(line->words[1], "false", 5) == 0) { swap_GUs_ = false; } else { printf("ERROR in param file \"%s\" on line %" PRId32 ": unknown swap option (use true/false).\n", param_file_name_, cur_line); exit(EXIT_FAILURE); } } else if (strcmp(line->words[0], "TRANSFER_INS_RATE") == 0) { HT_ins_rate_ = atof(line->words[1]); } else if (strcmp(line->words[0], "TRANSFER_REPL_RATE") == 0) { HT_repl_rate_ = atof(line->words[1]); } else if (strcmp(line->words[0], "REPL_TRANSFER_DETACH_RATE") == 0) { repl_HT_detach_rate_ = atof(line->words[1]); } else if (strcmp(line->words[0], "TRANSLATION_COST") == 0) { translation_cost_ = atof(line->words[1]); } else if (strcmp(line->words[0], "ENV_ADD_POINT") == 0) { // custom_points printf("ERROR in param file \"%s\" on line %" PRId32 ": Custom points management has been removed.\n", param_file_name_, cur_line); exit(EXIT_FAILURE); } else if ((strcmp(line->words[0], "ENV_ADD_GAUSSIAN") == 0) || (strcmp(line->words[0], "ENV_GAUSSIAN") == 0)) { #ifdef __REGUL // le premier chiffre est l'indice d'environment en convention humaine ( le premier a 1) // On vérifie que cet indice n'est pas trop élevé ni négatif pour éviter les crash if ( atoi(line->words[1]) - 1 < _env_gaussians_list.size() && atoi(line->words[1]) > 0) { (_env_gaussians_list.at( atoi(line->words[1]) - 1)).push_back ( Gaussian( atof( line->words[2] ), atof( line->words[3] ), atof( line->words[4] ) ) ); } else { printf( " ERROR in param file \"%s\" on line %" PRId32 " : There is only %ld environment.\n", param_file_name_, cur_line, _env_gaussians_list.size() ); exit( EXIT_FAILURE ); } #else std_env_gaussians.push_back( Gaussian(atof(line->words[1]), atof(line->words[2]), atof(line->words[3]))); #endif } else if (strcmp(line->words[0], "ENV_SAMPLING") == 0) { env_sampling_ = atoi(line->words[1]); } else if (strcmp(line->words[0], "ENV_VARIATION") == 0) { static bool env_var_already_set = false; if (env_var_already_set) { printf("ERROR in param file \"%s\" on line %" PRId32 " : " "duplicate entry for %s.\n", param_file_name_, cur_line, line->words[0]); exit(EXIT_FAILURE); } env_var_already_set = true; if (strcmp(line->words[1], "none") == 0) { if (line->nb_words != 2) { printf("ERROR in param file \"%s\" on line %" PRId32 ": wrong number of parameters.\n", param_file_name_, cur_line); printf("usage: %s %s\n", line->words[0], line->words[1]); exit(EXIT_FAILURE); } env_var_method_ = NO_VAR; } else if (strcmp(line->words[1], "autoregressive_mean_variation") == 0) { if (line->nb_words != 5) { printf("ERROR in param file \"%s\" on line %" PRId32 ": wrong number of parameters.\n", param_file_name_, cur_line); printf("usage: %s %s sigma tau prng_seed\n", line->words[0], line->words[1]); exit(EXIT_FAILURE); } env_var_method_ = AUTOREGRESSIVE_MEAN_VAR; env_var_sigma_ = atof(line->words[2]); env_var_tau_ = atol(line->words[3]); env_var_seed_ = atoi(line->words[4]); } else if (strcmp(line->words[1], "autoregressive_height_variation") == 0) { if (line->nb_words != 5) { printf("ERROR in param file \"%s\" on line %" PRId32 ": wrong number of parameters.\n", param_file_name_, cur_line); printf("usage: %s %s sigma tau prng_seed\n", line->words[0], line->words[1]); exit(EXIT_FAILURE); } env_var_method_ = AUTOREGRESSIVE_HEIGHT_VAR; env_var_sigma_ = atof(line->words[2]); env_var_tau_ = atol(line->words[3]); env_var_seed_ = atoi(line->words[4]); } else if (strcmp(line->words[1], "add_local_gaussians") == 0) { if (line->nb_words != 3) { printf("ERROR in param file \"%s\" on line %" PRId32 ": wrong number of parameters.\n", param_file_name_, cur_line); printf("usage: %s %s prng_seed\n", line->words[0], line->words[1]); exit(EXIT_FAILURE); } env_var_method_ = LOCAL_GAUSSIANS_VAR; env_var_seed_ = atoi(line->words[2]); } #ifdef __REGUL else if (strcmp(line->words[1], "switch_in_a_list") == 0) { if (line->nb_words != 3) { printf("ERROR in param file \"%s\" on line %" PRId32 ": wrong number of parameters.\n", param_file_name_, cur_line); printf("usage: %s %s probability to switch between different environments\n", line->words[0], line->words[1]); exit(EXIT_FAILURE); } env_var_method_ = SWITCH_IN_A_LIST; _env_switch_probability = atof(line->words[2]); } #endif else { printf("ERROR in param file \"%s\" on line %" PRId32 " : unknown phenotypic target variation method.\n", param_file_name_, cur_line); exit(EXIT_FAILURE); } } else if (strcmp(line->words[0], "ENV_NOISE") == 0) { static bool env_noise_already_set = false; if (env_noise_already_set) { printf("ERROR in param file \"%s\" on line %" PRId32 " : duplicate entry for %s.\n", param_file_name_, cur_line, line->words[0]); exit(EXIT_FAILURE); } env_noise_already_set = true; if (strcmp(line->words[1], "none") == 0) { assert(line->nb_words == 2); env_noise_method_ = NO_NOISE; } else if (strcmp(line->words[1], "FRACTAL") == 0) { assert(line->nb_words == 6); env_noise_method_ = FRACTAL; env_noise_sampling_log_ = atoi(line->words[2]); env_noise_sigma_ = atof(line->words[3]); env_noise_alpha_ = atof(line->words[4]); env_noise_prob_ = atof(line->words[5]); env_noise_seed_ = atoi(line->words[6]); } else { printf("ERROR in param file \"%s\" on line %" PRId32 " : unknown phenotypic target noise method.\n", param_file_name_, cur_line); exit(EXIT_FAILURE); } } else if (strcmp(line->words[0], "SECRETION_FITNESS_CONTRIB") == 0) { printf("ERROR in param file \"%s\" on line %" PRId32 ": %s is no longer a valid option, " "use SECRETION_CONTRIB_TO_FITNESS instead.\n", param_file_name_, cur_line, line->words[0]); exit(EXIT_FAILURE); } else if (strcmp(line->words[0], "SECRETION_CONTRIB_TO_FITNESS") == 0) { secretion_contrib_to_fitness_ = atof(line->words[1]); } else if (strcmp(line->words[0], "SECRETION_DIFFUSION_PROP") == 0) { secretion_diffusion_prop_ = atof(line->words[1]); } else if (strcmp(line->words[0], "SECRETION_DEGRADATION_PROP") == 0) { secretion_degradation_prop_ = atof(line->words[1]); if (secretion_degradation_prop_ > 1 || secretion_degradation_prop_ < 0) { printf("ERROR in param file \"%s\" on line %" PRId32 ": degradation must be in (0,1).\n", param_file_name_, cur_line); exit(EXIT_FAILURE); } } else if (strcmp(line->words[0], "SECRETION_INITIAL") == 0) { secretion_init_ = atof(line->words[1]); } else if (strcmp(line->words[0], "SECRETION_COST") == 0) { secretion_cost_ = atof(line->words[1]); } else if (strcmp(line->words[0], "ALLOW_PLASMIDS") == 0) { if (strncmp(line->words[1], "true", 4) == 0) { allow_plasmids_ = true; } else if (strncmp(line->words[1], "false", 5) == 0) { allow_plasmids_ = false; } else { printf("ERROR in param file \"%s\" on line %" PRId32 ": unknown allow_plasmids option (use true/false).\n", param_file_name_, cur_line); exit(EXIT_FAILURE); } } else if (strcmp(line->words[0], "PLASMID_INITIAL_LENGTH") == 0) { plasmid_initial_length_ = atoi(line->words[1]); } else if (strcmp(line->words[0], "PLASMID_INITIAL_GENE") == 0) { plasmid_initial_gene_ = atoi(line->words[1]); } else if (strcmp(line->words[0], "PLASMID_MINIMAL_LENGTH") == 0) { plasmid_minimal_length_ = atoi(line->words[1]); } else if (strcmp(line->words[0], "PLASMID_MAXIMAL_LENGTH") == 0) { plasmid_maximal_length_ = atoi(line->words[1]); } else if (strcmp(line->words[0], "CHROMOSOME_MINIMAL_LENGTH") == 0) { chromosome_minimal_length_ = atoi(line->words[1]); } else if (strcmp(line->words[0], "CHROMOSOME_MAXIMAL_LENGTH") == 0) { chromosome_maximal_length_ = atoi(line->words[1]); } else if (strcmp(line->words[0], "PROB_HORIZONTAL_TRANS") == 0) { printf("ERROR in param file \"%s\" on line %" PRId32 ": %s is no longer a valid option, " "did you mean PROB_PLASMID_HT ?.\n", param_file_name_, cur_line, line->words[0]); exit(EXIT_FAILURE); } else if (strcmp(line->words[0], "PROB_PLASMID_HT") == 0) { prob_plasmid_HT_ = atof(line->words[1]); } else if (strcmp(line->words[0], "TUNE_DONOR_ABILITY") == 0) { tune_donor_ability_ = atof(line->words[1]); } else if (strcmp(line->words[0], "TUNE_RECIPIENT_ABILITY") == 0) { tune_recipient_ability_ = atof(line->words[1]); } else if (strcmp(line->words[0], "DONOR_COST") == 0) { donor_cost_ = atof(line->words[1]); } else if (strcmp(line->words[0], "RECIPIENT_COST") == 0) { recipient_cost_ = atof(line->words[1]); } else if (strcmp(line->words[0], "COMPUTE_PHEN_CONTRIB_BY_GU") == 0) { if (strncmp(line->words[1], "true", 4) == 0) { compute_phen_contrib_by_GU_ = true; } else if (strncmp(line->words[1], "false", 5) == 0) { compute_phen_contrib_by_GU_ = false; } else { printf("ERROR in param file \"%s\" on line %" PRId32 " : unknown compute_phen_contrib_by_GU option (use true/false).\n", param_file_name_, cur_line); exit(EXIT_FAILURE); } } else if (strcmp(line->words[0], "LOG") == 0) { for (int8_t i = 1 ; i < line->nb_words ; i++) { if (strcmp(line->words[i], "TRANSFER") == 0) { logs_ |= LOG_TRANSFER; } else if (strcmp(line->words[i], "REAR") == 0) { logs_ |= LOG_REAR; } else if (strcmp(line->words[i], "BARRIER") == 0) { logs_ |= LOG_BARRIER; } /*else if (strcmp(line->words[i], "LOADS") == 0) { tmp_to_be_logged |= LOG_LOADS; } */ else { printf("ERROR in param file \"%s\" on line %" PRId32 " : unknown log option %s.\n", param_file_name_, cur_line, line->words[1]); exit(EXIT_FAILURE); } } } else if (strcmp(line->words[0], "FUZZY_FLAVOR") == 0) { _fuzzy_flavor = atoi(line->words[1]); } #ifdef __REGUL else if (strcmp(line->words[0], "HILL_SHAPE_N") == 0) { _hill_shape_n = atof(line->words[1]); } else if (strcmp(line->words[0], "HILL_SHAPE_THETA") == 0) { _hill_shape_theta = atof(line->words[1]); } else if (strcmp(line->words[0], "DEGRADATION_RATE") == 0) { _degradation_rate = atof(line->words[1]); } else if (strcmp(line->words[0], "NB_DEGRADATION_STEP") == 0) { _nb_degradation_step = atoi(line->words[1]); } else if (strcmp(line->words[0], "NB_INDIV_AGE") == 0) { _nb_indiv_age = atoi(line->words[1]); } else if (strcmp(line->words[0], "RANDOM_BINDING_MATRIX") == 0) { if (strncmp(line->words[1], "true", 4) == 0) { _random_binding_matrix = true; } else if (strncmp(line->words[1], "false", 5) == 0) { _random_binding_matrix = false; } else { printf("ERROR in param file \"%s\" on line %" PRId32 " : unknown more random_binding_matrix option (use true/false).\n", param_file_name_, cur_line); exit(EXIT_FAILURE); } } else if (strcmp(line->words[0], "BINDING_ZEROS_PERCENTAGE") == 0) { _binding_zeros_percentage = atof(line->words[1]); } else if (strcmp(line->words[0], "INDIVIDUAL_EVALUATION_AGES") == 0) { _list_eval_step.clear(); for (int i = 1; i < line->nb_words; i++) _list_eval_step.insert(atoi(line->words[i])); } else if (strcmp(line->words[0], "WITH_HEREDITY") == 0) { if (strncmp(line->words[1], "true", 4) == 0) { _with_heredity = true; } else if (strncmp(line->words[1], "false", 5) == 0) { _with_heredity = false; } else { printf("ERROR in param file \"%s\" on line %" PRId32 " : unknown with_heredity option (use true/false).\n", param_file_name_, cur_line); exit(EXIT_FAILURE); } } else if (strcmp(line->words[0], "PROTEIN_PRESENCE_LIMIT") == 0) { _protein_presence_limit = atof(line->words[1]); } else if (strcmp(line->words[0], "NB_ENVIRONMENTS") == 0) { int16_t nb_env = atoi( line->words[1] ); if( nb_env < 1 ) { printf( "ERROR in param file \"%s\" on line %" PRId32 " : you must have at least one environment\n", param_file_name_, cur_line ); printf("you put %" PRId16 "\n", nb_env); exit( EXIT_FAILURE ); } // Utile uniquement en cas de reprise sur backup // Je ne sais pas comment ça va se passer avec cette version ... if( _env_gaussians_list.size() > 0 ) { _env_gaussians_list.clear(); } if( _env_signals_list.size() > 0 ) { _env_signals_list.clear(); } for( int16_t i = 0; i < nb_env; i++) { _env_gaussians_list.push_back(std::list()); _env_signals_list.push_back(std::list()); } } else if (strcmp(line->words[0], "CREATE_SIGNAL") == 0) { int signal_lenght = line->nb_words - 1; std::list codon_list; Codon* codon = NULL; for (int8_t i = 0; i < signal_lenght; i++) { if(strcmp(line->words[i+1], "h0")==0) { codon = new Codon(CODON_H0); } else if(strcmp(line->words[i+1], "h1")==0) { codon = new Codon(CODON_H1); } else if(strcmp(line->words[i+1], "w0")==0) { codon = new Codon(CODON_W0); } else if(strcmp(line->words[i+1], "w1")==0) { codon = new Codon(CODON_W1); } else if(strcmp(line->words[i+1], "m0")==0) { codon = new Codon(CODON_M0); } else if(strcmp(line->words[i+1], "m1")==0) { codon = new Codon(CODON_M1); } else { printf("Error this codon doesn't exist\n"); exit( EXIT_FAILURE ); } codon_list.push_back(codon); } _signals_models.push_back(new Protein_R(codon_list, 0.5, w_max_)); for (auto cod : codon_list) delete cod; codon_list.clear(); } else if (strcmp(line->words[0], "ENV_ADD_SIGNAL") == 0) { // le premier chiffre est l'indice d'environment en convention humaine ( le premier a 1) // On vérifie que cet indice n'est pas trop élevé ni négatif pour éviter les crash if ( atoi(line->words[1]) - 1 < _env_signals_list.size() && atoi(line->words[1]) > 0) { (_env_signals_list.at( atoi(line->words[1]) - 1)).push_back(atoi(line->words[2]) - 1); } else { printf( " ERROR in param file \"%s\" on line %" PRId32 " : There are only %ld environment.\n", param_file_name_, cur_line, _env_gaussians_list.size() ); exit( EXIT_FAILURE ); } } else if (strcmp(line->words[0], "REGUL_FIRST") == 0) { if (strncmp(line->words[1], "true", 4) == 0) { first_regul_ = true; } else if (strncmp(line->words[1], "false", 5) == 0) { first_regul_ = false; } } #endif else { printf("ERROR in param file \"%s\" on line %" PRId32 " : undefined key word \"%s\"\n", param_file_name_, cur_line, line->words[0]); exit(EXIT_FAILURE); } } void ParamLoader::read_file() { // The rewind is only necessary when using multiple param files rewind(param_file_); int32_t cur_line = 0; ParameterLine* parameter_line; // TODO : write parameter_line = new ParameterLine(param_file_) => ParameterLine::ParameterLine(char*) while ((parameter_line = line(&cur_line)) != NULL) { interpret_line(parameter_line, cur_line); delete parameter_line; } } void ParamLoader::CheckConsistency() { if (allow_plasmids_) { if (plasmid_initial_gene_ != 1) { // the plasmid will be copied from the chromosome if (plasmid_initial_length_ != -1) { printf( "WARNING: PLASMID_INITIAL_LENGTH is not taken into account because PLASMID_INITIAL_GENE is set to 0 (copy from chromosome)\n"); plasmid_initial_length_ = chromosome_initial_length_; } } else if (compute_phen_contrib_by_GU_ == false) { printf("ERROR: when using PLASMID_INITIAL_GENE==1, the paramater COMPUTE_PHEN_CONTRIB_BY_GU should be set to true.\n"); exit(EXIT_FAILURE); } if (plasmid_maximal_length_ == -1) plasmid_maximal_length_ = max_genome_length_; if (plasmid_minimal_length_ == -1) plasmid_minimal_length_ = min_genome_length_; if(plasmid_minimal_length_ > plasmid_initial_length_) { printf("ERROR: PLASMID_INITIAL_LENGTH is lower than PLASMID_MINIMAL_LENGTH\n"); exit(EXIT_FAILURE); } if (plasmid_maximal_length_ < plasmid_initial_length_) { printf("ERROR: PLASMID_INITIAL_LENGTH is higher than PLASMID_MAXIMAL_LENGTH\n"); exit(EXIT_FAILURE); } } if (chromosome_maximal_length_ == -1) chromosome_maximal_length_ = max_genome_length_; if (chromosome_minimal_length_ == -1) chromosome_minimal_length_ = min_genome_length_; if (chromosome_minimal_length_ > chromosome_initial_length_) { printf("ERROR: CHROMOSOME_INITIAL_LENGTH is lower than CHROMOSOME_MINIMAL_LENGTH\n"); exit(EXIT_FAILURE); } if (chromosome_maximal_length_ < chromosome_initial_length_) { printf("ERROR: CHROMOSOME_INITIAL_LENGTH is higher than PLASMID_MAXIMAL_LENGTH\n"); exit(EXIT_FAILURE); } // Check that the population fits in the spatial structure if (init_pop_size_ != grid_width_ * grid_height_) { printf("ERROR: the number of individuals (%" PRId32 ") does not match the size of the grid (%" PRId16 " * %" PRId16 ")\n", init_pop_size_, grid_width_, grid_height_); exit(EXIT_FAILURE); } } FuzzyFactory* FuzzyFactory::fuzzyFactory = NULL; void ParamLoader::load(ExpManager* exp_m, bool verbose, char* chromosome, int32_t lchromosome, char* plasmid, int32_t lplasmid) { // Check consistency of min, max and initial length of chromosome and plasmid // Default for by GU minimal or maximal size is -1. // If equal to -1, maximal sizes of each GU will be replaced by total maximal size for the whole genome CheckConsistency(); // Initialize prng_ // This one will be used to create the initial genome(s) and to generate seeds for other prng prng_ = std::make_shared(seed_); // Initialize mut_prng, stoch_prng, world_prng : // if mut_seed (respectively stoch_seed) not given in param.in, choose it at random if (mut_seed_ == 0) { mut_seed_ = prng_->random(1000000); } if (stoch_seed_ == 0) { stoch_seed_ = prng_->random(1000000); } auto mut_prng = std::make_shared(mut_seed_); auto stoch_prng = std::make_shared(stoch_seed_); auto world_prng = std::make_shared(prng_->random(1000000)); // Create aliases ExpSetup* exp_s = exp_m->exp_s(); Selection* sel = exp_m->sel(); OutputManager* output_m = exp_m->output_m(); output_m->InitStats(); // 1) ------------------------------------- Initialize the experimental setup #if __cplusplus == 201103L sel->set_prng(make_unique(prng_->random(1000000))); #else sel->set_prng(std::make_unique(prng_->random(1000000))); #endif // ---------------------------------------------------------------- Selection sel->set_selection_scheme(selection_scheme_); sel->set_selection_pressure(selection_pressure_); // ----------------------------------------------------------------- Transfer exp_s->set_with_HT(with_HT_); exp_s->set_repl_HT_with_close_points(repl_HT_with_close_points_); exp_s->set_HT_ins_rate(HT_ins_rate_); exp_s->set_HT_repl_rate(HT_repl_rate_); exp_s->set_repl_HT_detach_rate(repl_HT_detach_rate_); // ----------------------------------------------------------------- Plasmids exp_s->set_with_plasmids(allow_plasmids_); exp_s->set_prob_plasmid_HT(prob_plasmid_HT_); exp_s->set_tune_donor_ability(tune_donor_ability_); exp_s->set_tune_recipient_ability(tune_recipient_ability_); exp_s->set_donor_cost(donor_cost_); exp_s->set_recipient_cost(recipient_cost_); exp_s->set_swap_GUs(swap_GUs_); output_m->set_compute_phen_contrib_by_GU(compute_phen_contrib_by_GU_); // ---------------------------------------------------------------- Secretion exp_s->set_with_secretion(with_secretion_); exp_s->set_secretion_contrib_to_fitness(secretion_contrib_to_fitness_); exp_s->set_secretion_cost(secretion_cost_); exp_s->set_fuzzy_flavor(_fuzzy_flavor); #ifdef __REGUL exp_s->set_with_heredity(_with_heredity); exp_s->set_degradation_rate(_degradation_rate); exp_s->set_nb_degradation_step(_nb_degradation_step); exp_s->set_nb_indiv_age(_nb_indiv_age); exp_s->set_list_eval_step(_list_eval_step); exp_s->set_protein_presence_limit(_protein_presence_limit); exp_s->set_hill_shape(pow( _hill_shape_theta, _hill_shape_n )); exp_s->set_hill_shape_n( _hill_shape_n ); exp_s->init_binding_matrix(_random_binding_matrix,_binding_zeros_percentage,prng_); #endif exp_s->set_first_regul(first_regul_); if (FuzzyFactory::fuzzyFactory == NULL) FuzzyFactory::fuzzyFactory = new FuzzyFactory(exp_s); // 2) --------------------------------------------- Create and init a Habitat #ifndef __REGUL Habitat habitat; #else Habitat_R habitat; #endif // Shorthand for phenotypic target handler #ifndef __REGUL PhenotypicTargetHandler& phenotypic_target_handler = habitat.phenotypic_target_handler_nonconst(); #else PhenotypicTargetHandler_R& phenotypic_target_handler = habitat.phenotypic_target_handler_nonconst(); #endif // Move the gaussian list from the parameters to the phen target handler #ifndef __REGUL phenotypic_target_handler.set_gaussians(std_env_gaussians); #else phenotypic_target_handler.set_gaussians(_env_gaussians_list); phenotypic_target_handler.set_signals_models(_signals_models); phenotypic_target_handler.set_signals(_env_signals_list); #endif // Copy the sampling phenotypic_target_handler.set_sampling(env_sampling_); // Set phenotypic target segmentation if((env_axis_features_ != NULL) && (env_axis_segment_boundaries_ != NULL)) { // if param.in contained a line starting with ENV_AXIS_FEATURES, // we use the values indicated on this line phenotypic_target_handler.set_segmentation(env_axis_nb_segments_, env_axis_segment_boundaries_, env_axis_features_, env_axis_separate_segments_); } // else we leave the segmentation as it is by default // (one "metabolic" segment from X_MIN to X_MAX) // Set phenotypic target variation if (env_var_method_ != NO_VAR) { phenotypic_target_handler.set_var_method(env_var_method_); phenotypic_target_handler.set_var_prng(std::make_shared(env_var_seed_)); phenotypic_target_handler.set_var_sigma_tau(env_var_sigma_, env_var_tau_); #ifdef __REGUL phenotypic_target_handler.set_switch_probability(_env_switch_probability); #endif } // Set phenotypic target noise if (env_noise_method_ != NO_NOISE) { phenotypic_target_handler.set_noise_method(env_noise_method_); phenotypic_target_handler.set_noise_sampling_log(env_noise_sampling_log_); phenotypic_target_handler.set_noise_prng(std::make_shared(env_noise_seed_)); phenotypic_target_handler.set_noise_alpha(env_noise_alpha_); phenotypic_target_handler.set_noise_sigma(env_noise_sigma_); phenotypic_target_handler.set_noise_prob(env_noise_prob_); } // Build the phenotypic target #ifndef __REGUL phenotypic_target_handler.BuildPhenotypicTarget(); #else phenotypic_target_handler.InitPhenotypicTargetsAndModels( _nb_indiv_age ); #endif if (verbose) { #ifndef __REGUL printf("Entire geometric area of the phenotypic target : %f\n", phenotypic_target_handler.get_geometric_area()); #else phenotypic_target_handler.print_geometric_areas(); #endif } // 3) --------------------------------------------- Create the new population list indivs; // Generate a model ae_mut_param object auto param_mut = std::make_shared(); param_mut->set_point_mutation_rate(point_mutation_rate_); param_mut->set_small_insertion_rate(small_insertion_rate_); param_mut->set_small_deletion_rate(small_deletion_rate_); param_mut->set_max_indel_size(max_indel_size_); param_mut->set_with_4pts_trans(with_4pts_trans_); param_mut->set_with_alignments(with_alignments_); param_mut->set_with_HT(with_HT_); param_mut->set_repl_HT_with_close_points(repl_HT_with_close_points_); param_mut->set_HT_ins_rate(HT_ins_rate_); param_mut->set_HT_repl_rate(HT_repl_rate_); param_mut->set_repl_HT_detach_rate(repl_HT_detach_rate_); param_mut->set_duplication_rate(duplication_rate_); param_mut->set_deletion_rate(deletion_rate_); param_mut->set_translocation_rate(translocation_rate_); param_mut->set_inversion_rate(inversion_rate_); param_mut->set_neighbourhood_rate(neighbourhood_rate_); param_mut->set_duplication_proportion(duplication_proportion_); param_mut->set_deletion_proportion(deletion_proportion_); param_mut->set_translocation_proportion(translocation_proportion_); param_mut->set_inversion_proportion(inversion_proportion_); Individual* indiv = nullptr; int32_t id_new_indiv = 0; if (chromosome != NULL) { #ifndef __REGUL Individual* indiv = new Individual(exp_m, mut_prng, stoch_prng, param_mut, w_max_, min_genome_length_, max_genome_length_, allow_plasmids_, id_new_indiv++, strain_name_, 0); #else Individual_R* indiv = new Individual_R(exp_m, mut_prng, stoch_prng, param_mut, w_max_, min_genome_length_, max_genome_length_, allow_plasmids_, id_new_indiv++, strain_name_, 0); #endif indiv->add_GU(chromosome, lchromosome); indiv->genetic_unit_nonconst(0).set_min_gu_length(chromosome_minimal_length_); indiv->genetic_unit_nonconst(0).set_max_gu_length(chromosome_maximal_length_); if (plasmid != NULL) { if (! allow_plasmids_) { printf("ERROR: plasmid sequence provided but plasmids not allowed\n"); exit(EXIT_FAILURE); } indiv->add_GU(plasmid, lplasmid); indiv->genetic_unit_nonconst(1).set_min_gu_length(plasmid_minimal_length_); indiv->genetic_unit_nonconst(1).set_max_gu_length(plasmid_maximal_length_); } else if (allow_plasmids_) { printf("ERROR: please provide both the chromosome and plasmid sequences" "or none of them\n"); exit(EXIT_FAILURE); } indiv->set_with_stochasticity(with_stochasticity_); indiv->compute_statistical_data(); indiv->EvaluateInContext(habitat); printf("Starting with a clonal population of individual with metabolic error %f and secretion error %f \n",indiv->dist_to_target_by_feature(METABOLISM),indiv->dist_to_target_by_feature(SECRETION)); indivs.push_back(indiv); // Make the clones and add them to the list of individuals for (int32_t i = 1 ; i < init_pop_size_ ; i++) { #ifndef __REGUL Individual * clone = Individual::CreateClone(indiv, id_new_indiv++); #else Individual_R * clone = Individual_R::CreateClone(indiv, id_new_indiv++); #endif clone->EvaluateInContext(habitat); indivs.push_back(clone); } } else if (plasmid != NULL) { printf("ERROR: please provide both the chromosome and plasmid sequences" "or none of them\n"); exit(EXIT_FAILURE); } else if (init_method_ & ONE_GOOD_GENE) { if (init_method_ & CLONE) { // Create an individual with a "good" gene (in fact, make an indiv whose // fitness is better than that corresponding to a flat phenotype) // and set its id indiv = IndividualFactory::create_random_individual( exp_m, id_new_indiv++, param_mut, mut_prng, stoch_prng, habitat, w_max_, min_genome_length_, max_genome_length_, chromosome_initial_length_, allow_plasmids_, plasmid_initial_gene_, plasmid_initial_length_, strain_name_, prng_, true); indiv->genetic_unit_nonconst(0).set_min_gu_length(chromosome_minimal_length_); indiv->genetic_unit_nonconst(0).set_max_gu_length(chromosome_maximal_length_); if (allow_plasmids_) { indiv->genetic_unit_nonconst(1).set_min_gu_length(plasmid_minimal_length_); indiv->genetic_unit_nonconst(1).set_max_gu_length(plasmid_maximal_length_); } indiv->set_with_stochasticity(with_stochasticity_); // Add it to the list indivs.push_back(indiv); // Make the clones and add them to the list of individuals for (int32_t i = 1 ; i < init_pop_size_ ; i++) { // Add new clone to the list #ifndef __REGUL Individual * clone = Individual::CreateClone(indiv, id_new_indiv++); #else Individual_R * clone = Individual_R::CreateClone(dynamic_cast(indiv), id_new_indiv++); #endif clone->EvaluateInContext(habitat); indivs.push_back(clone); } } else // if (! CLONE) { for (int32_t i = 0 ; i < init_pop_size_ ; i++) { // Create an individual and set its id indiv = IndividualFactory::create_random_individual( exp_m, id_new_indiv++, param_mut, mut_prng, stoch_prng, habitat, w_max_, min_genome_length_, max_genome_length_, chromosome_initial_length_, allow_plasmids_, plasmid_initial_gene_, plasmid_initial_length_, strain_name_, prng_, true); indiv->genetic_unit_nonconst(0).set_min_gu_length(chromosome_minimal_length_); indiv->genetic_unit_nonconst(0).set_max_gu_length(chromosome_maximal_length_); if (allow_plasmids_) { indiv->genetic_unit_nonconst(1).set_min_gu_length(plasmid_minimal_length_); indiv->genetic_unit_nonconst(1).set_max_gu_length(plasmid_maximal_length_); } // Add it to the list indivs.push_back(indiv); } } } else // if (! ONE_GOOD_GENE) { if (init_method_ & CLONE) { // Create a random individual and set its id indiv = IndividualFactory::create_random_individual( exp_m, id_new_indiv++, param_mut, mut_prng, stoch_prng, habitat, w_max_, min_genome_length_, max_genome_length_, chromosome_initial_length_, allow_plasmids_, plasmid_initial_gene_, plasmid_initial_length_, strain_name_, prng_, false); indiv->genetic_unit_nonconst(0).set_min_gu_length(chromosome_minimal_length_); indiv->genetic_unit_nonconst(0).set_max_gu_length(chromosome_maximal_length_); if (allow_plasmids_) { indiv->genetic_unit_nonconst(1).set_min_gu_length(plasmid_minimal_length_); indiv->genetic_unit_nonconst(1).set_max_gu_length(plasmid_maximal_length_); } // Add it to the list indivs.push_back(indiv); // Make the clones and add them to the list of individuals for (int32_t i = 1 ; i < init_pop_size_ ; i++) { // Add clone to the list #ifndef __REGUL Individual * clone = Individual::CreateClone(indiv, id_new_indiv++); #else Individual_R * clone = Individual_R::CreateClone(dynamic_cast(indiv), id_new_indiv++); #endif clone->EvaluateInContext(habitat); indivs.push_back(clone); } } else // if (! CLONE) { for (int32_t i = 0 ; i < init_pop_size_ ; i++) { // Create a random individual and set its id indiv = IndividualFactory::create_random_individual( exp_m, id_new_indiv++, param_mut, mut_prng, stoch_prng, habitat, w_max_, min_genome_length_, max_genome_length_, chromosome_initial_length_, allow_plasmids_, plasmid_initial_gene_, plasmid_initial_length_, strain_name_, prng_, false); indiv->genetic_unit_nonconst(0).set_min_gu_length(chromosome_minimal_length_); indiv->genetic_unit_nonconst(0).set_max_gu_length(chromosome_maximal_length_); if (allow_plasmids_) { indiv->genetic_unit_nonconst(1).set_min_gu_length(plasmid_minimal_length_); indiv->genetic_unit_nonconst(1).set_max_gu_length(plasmid_maximal_length_); } // Add it to the list indivs.push_back(indiv); } } } // -------------------------------------------------------- Spatial structure exp_m->InitializeWorld(grid_width_, grid_height_, world_prng,mut_prng,stoch_prng, habitat, true); World* world = exp_m->world(); world->set_secretion_degradation_prop(secretion_degradation_prop_); world->set_secretion_diffusion_prop(secretion_diffusion_prop_); world->set_is_well_mixed(well_mixed); world->set_partial_mix_nb_permutations(partial_mix_nb_permutations); // Set each individual's position on the grid int16_t x, y; int16_t x_max = exp_m->grid_width(); int16_t y_max = exp_m->grid_height(); for (const auto& indiv: indivs) { do { x = exp_m->world()->prng()->random(x_max); y = exp_m->world()->prng()->random(y_max); } while (world->indiv_at(x, y) != NULL); world->PlaceIndiv(indiv, x, y); } world->set_best(0, 0); // 4) ------------------------------------------ Set the recording parameters output_m->set_backup_step(backup_step_); output_m->set_big_backup_step(big_backup_step_); if (record_tree_) { output_m->init_tree(exp_m, tree_step_); } if (make_dumps_) { output_m->set_dump_step(dump_step_); } output_m->set_logs(logs_); } // ================================================================= // Protected Methods // ================================================================= /*! \brief Format a line by parsing it and the words inside \param formated_line the resulted formated line \param line original line in char* \param line_is_interpretable boolean with about the possible intrepretation of the line */ void ParamLoader::format_line(ParameterLine * formated_line, char* line, bool* line_is_interpretable) { int16_t i = 0; int16_t j; // Parse line while (line[i] != '\n' && line[i] != '\0' && line[i] != '\r') { j = 0; // Flush white spaces and tabs while (line[i] == ' ' || line[i] == kTabChar) i++; // Check comments if (line[i] == '#') break; // If we got this far, there is content in the line *line_is_interpretable = true; // Parse word while (line[i] != ' ' && line[i] != kTabChar && line[i] != '\n' && line[i] != '\0' && line[i] != '\r') { formated_line->words[formated_line->nb_words][j++] = line[i++]; } // Add '\0' at end of word if it's not empty (line ending with space or tab) if (j != 0) { formated_line->words[formated_line->nb_words++][j] = '\0'; } } } /*! \brief Get a line in a file and format it \return line (pointer) \see format_line(ParameterLine* formated_line, char* line, bool* line_is_interpretable) */ ParameterLine *ParamLoader::line(int32_t* cur_line_ptr) // void { char line[255]; ParameterLine * formated_line = new ParameterLine(); bool found_interpretable_line = false; // Found line that is neither a comment nor empty while (!feof(param_file_) && !found_interpretable_line) { if (!fgets(line, 255, param_file_)) { delete formated_line; return NULL; } (*cur_line_ptr)++; format_line(formated_line, line, &found_interpretable_line); } if (found_interpretable_line) { return formated_line; } else { delete formated_line; return NULL; } } void ParamLoader::print_to_file(FILE* file) { // ------------------------------------------------------------ Constraints fprintf(file, "\nConstraints ---------------------------------------------\n"); fprintf(file, "min_genome_length : %" PRId32 "\n", min_genome_length_); fprintf(file, "max_genome_length : %" PRId32 "\n", max_genome_length_); fprintf(file, "W_MAX : %f\n", w_max_); // --------------------------------------------------------- Mutation rates fprintf(file, "\nMutation rates ------------------------------------------\n"); fprintf(file, "point_mutation_rate : %e\n", point_mutation_rate_); fprintf(file, "small_insertion_rate : %e\n", small_insertion_rate_); fprintf(file, "small_deletion_rate : %e\n", small_deletion_rate_); fprintf(file, "max_indel_size : %" PRId16 "\n", max_indel_size_); // -------------------------------------------- Rearrangements and Transfer fprintf(file, "\nRearrangements and Transfer -----------------------------\n"); fprintf(file, "with_4pts_trans : %s\n", with_4pts_trans_? "true" : "false"); fprintf(file, "with_alignments : %s\n", with_alignments_? "true" : "false"); fprintf(file, "with_HT : %s\n", with_HT_? "true" : "false"); fprintf(file, "repl_HT_with_close_points : %s\n", repl_HT_with_close_points_? "true" : "false"); fprintf(file, "HT_ins_rate : %e\n", HT_ins_rate_); fprintf(file, "HT_repl_rate : %e\n", HT_repl_rate_); // ---------------------------------------------------- Rearrangement rates if (with_alignments_) { fprintf(file, "\nRearrangement rates (with alignements) ------------------\n"); fprintf(file, "neighbourhood_rate : %e\n", neighbourhood_rate_); fprintf(file, "duplication_proportion : %e\n", duplication_proportion_); fprintf(file, "deletion_proportion : %e\n", deletion_proportion_); fprintf(file, "translocation_proportion : %e\n", translocation_proportion_); fprintf(file, "inversion_proportion : %e\n", inversion_proportion_); } else { fprintf(file, "\nRearrangement rates (without alignements) ----------------\n"); fprintf(file, "duplication_rate : %e\n", duplication_rate_); fprintf(file, "deletion_rate : %e\n", deletion_rate_); fprintf(file, "translocation_rate : %e\n", translocation_rate_); fprintf(file, "inversion_rate : %e\n", inversion_rate_); } // ------------------------------------------------------------ Alignements fprintf(file, "\nAlignements ---------------------------------------------\n"); fprintf(file, "align_fun_shape : %" PRId16 "\n", (int16_t) align_fun_shape_); fprintf(file, "align_sigm_lambda : %f\n", align_sigm_lambda_); fprintf(file, "align_sigm_mean : %" PRId16 "\n", align_sigm_mean_); fprintf(file, "align_lin_min : %" PRId16 "\n", align_lin_min_); fprintf(file, "align_lin_max : %" PRId16 "\n", align_lin_max_); fprintf(file, "align_max_shift : %" PRId16 "\n", align_max_shift_); fprintf(file, "align_w_zone_h_len : %" PRId16 "\n", align_w_zone_h_len_); fprintf(file, "align_match_bonus : %" PRId16 "\n", align_match_bonus_); fprintf(file, "align_mismatch_cost : %" PRId16 "\n", align_mismatch_cost_); // -------------------------------------------------------------- Selection fprintf(file, "\nSelection -----------------------------------------------\n"); switch (selection_scheme_) { case RANK_LINEAR : { fprintf(file, "selection_scheme : RANK_LINEAR\n"); break; } case RANK_EXPONENTIAL : { fprintf(file, "selection_scheme : RANK_EXPONENTIAL\n"); break; } case FITNESS_PROPORTIONATE : { fprintf(file, "selection_scheme : FITNESS_PROPORTIONATE\n"); break; } case FITTEST : { fprintf(file, "selection_scheme : FITTEST\n"); break; } default : { fprintf(file, "selection_scheme : UNKNOWN\n"); break; } } fprintf(file, "selection_pressure : %e\n", selection_pressure_); // -------------------------------------------------------------- Secretion fprintf(file, "\nSecretion -----------------------------------------------\n"); fprintf(file, "with_secretion : %s\n", with_secretion_? "true" : "false"); fprintf(file, "secretion_contrib_to_fitness : %e\n", secretion_contrib_to_fitness_); fprintf(file, "secretion_diffusion_prop : %e\n", secretion_diffusion_prop_); fprintf(file, "secretion_degradation_prop : %e\n", secretion_degradation_prop_); fprintf(file, "secretion_cost : %e\n", secretion_cost_); // --------------------------------------------------------------- Plasmids fprintf(file, "\nPlasmids ------------------------------------------------\n"); fprintf(file, "allow_plasmids : %s\n", allow_plasmids_? "true" : "false"); fprintf(file, "plasmid_minimal_length : %" PRId32 "\n", plasmid_minimal_length_); fprintf(file, "plasmid_maximal_length : %" PRId32 "\n", plasmid_maximal_length_); fprintf(file, "chromosome_minimal_length : %" PRId32 "\n", chromosome_minimal_length_); fprintf(file, "chromosome_maximal_length : %" PRId32 "\n", chromosome_maximal_length_); fprintf(file, "prob_plasmid_HT : %e\n", prob_plasmid_HT_); fprintf(file, "tune_donor_ability : %e\n", tune_donor_ability_); fprintf(file, "tune_recipient_ability : %e\n", tune_recipient_ability_); fprintf(file, "donor_cost : %e\n", donor_cost_); fprintf(file, "recipient_cost : %e\n", recipient_cost_); fprintf(file, "compute_phen_contrib_by_GU : %s\n", compute_phen_contrib_by_GU_? "true" : "false"); fprintf(file, "swap_GUs : %s\n", swap_GUs_? "true" : "false"); // ------------------------------------------------------- Translation cost fprintf(file, "\nTranslation cost ----------------------------------------\n"); fprintf(file, "translation_cost : %e\n", translation_cost_); } } // namespace aevol aevol-5.0/src/libaevol/Individual.cpp0000644000175000017500000013774112724051151014600 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #include #include #include #include #include #include #include "Codon.h" #include "ExpSetup.h" #include "ExpManager.h" #include "GridCell.h" #include "GeneticUnit.h" #include "VisAVis.h" #include "Utils.h" #ifdef __NO_X #ifdef __REGUL #include "raevol/Individual_R.h" #else #include "Individual.h" #endif #elif defined __X11 #ifdef __REGUL #include "raevol/Individual_R_X11.h" #else #include "Individual_X11.h" #endif #endif namespace aevol { // =========================================================================== // Constructors // =========================================================================== /** * // TODO */ Individual::Individual(ExpManager* exp_m, std::shared_ptr mut_prng, std::shared_ptr stoch_prng, std::shared_ptr param_mut, double w_max, int32_t min_genome_length, int32_t max_genome_length, bool allow_plasmids, int32_t id, const char* strain_name, int32_t age) { // Experiment manager exp_m_ = exp_m; // PRNGs mut_prng_ = mut_prng; stoch_prng_ = stoch_prng; // ID and rank of the indiv ; name and "age" of the strain set_id(id); rank_ = -1; // TODO: UNRANKED age_ = age; strain_name_ = new char[strlen(strain_name) + 1]; strcpy(strain_name_, strain_name); phenotype_activ_ = NULL; phenotype_inhib_ = NULL; phenotype_ = NULL; dist_to_target_by_segment_ = NULL; dist_to_target_by_feature_ = new double[NB_FEATURES]; fitness_by_feature_ = new double[NB_FEATURES]; for (int i = 0; i < NB_FEATURES; i++) { dist_to_target_by_feature_[i] = 0; fitness_by_feature_[i] = 0; } fitness_ = 0.0; // TODO Deal with cell coordinates on the grid // When using structured population, this is the cell the individual is in // x = y = -1; // The chromosome and plasmids (if allowed) // TODO ??? // Generic probes int_probes_ = new int32_t[5]; double_probes_ = new double[5]; for (int8_t i = 0; i < 5; i++) { int_probes_[i] = 0; double_probes_[i] = 0.0; } // Mutation rates etc... mut_params_ = param_mut; // Artificial chemistry w_max_ = w_max; // Genome size constraints min_genome_length_ = min_genome_length; max_genome_length_ = max_genome_length; // Plasmids settings allow_plasmids_ = allow_plasmids; // -------------------------------------------------- // "State" of the individual // -------------------------------------------------- evaluated_ = false; transcribed_ = false; translated_ = false; folded_ = false; phenotype_computed_ = false; distance_to_target_computed_ = false; fitness_computed_ = false; placed_in_population_ = false; // ---------------------------------------- // Statistical data // ---------------------------------------- modularity_ = 0.0; } /** * This constructor retrieves an individual from a backup file. * * Since this generation has already been processed, no unnecessary calculation * (e.g. fitness) will be done. * No transcription, translation or other process of that kind is performed. */ Individual::Individual(ExpManager* exp_m, gzFile backup_file) { exp_m_ = exp_m; // Retrieve the name and "age" of the strain int8_t strain_string_len; gzread(backup_file, &strain_string_len, sizeof(strain_string_len)); strain_name_ = new char[strain_string_len + 1]; gzread(backup_file, strain_name_, strain_string_len + 1); gzread(backup_file, &age_, sizeof(age_)); // Retrieve the PRNGs if (exp_m == NULL) { // Detached mode mut_prng_ = NULL; stoch_prng_ = NULL; } else { // TODO: => prngs as parameters mut_prng_ = exp_m->world()->mut_prng(); stoch_prng_ = exp_m->world()->stoch_prng(); assert(mut_prng_); assert(stoch_prng_); } // Retrieve id and rank gzread(backup_file, &id_, sizeof(id_)); gzread(backup_file, &rank_, sizeof(rank_)); // Retrieve spatial coordinates // gzread(backup_file, &x, sizeof(x)); // gzread(backup_file, &y, sizeof(y)); placed_in_population_ = false; // Retrieve generic probes int_probes_ = new int32_t[5]; double_probes_ = new double[5]; gzread(backup_file, int_probes_, 5 * sizeof(*int_probes_)); gzread(backup_file, double_probes_, 5 * sizeof(*double_probes_)); // Retrieve mutational parameters mut_params_ = std::make_shared(backup_file); // ------------------------------------------------- Phenotypic stochasticity gzread(backup_file, &with_stochasticity_, sizeof(with_stochasticity_)); // Retrieve artificial chemistry parameters gzread(backup_file, &w_max_, sizeof(w_max_)); // Retrieve genome size constraints gzread(backup_file, &min_genome_length_, sizeof(min_genome_length_)); gzread(backup_file, &max_genome_length_, sizeof(max_genome_length_)); // Retrieve plasmids settings int8_t tmp_allow_plasmids; gzread(backup_file, &tmp_allow_plasmids, sizeof(tmp_allow_plasmids)); allow_plasmids_ = tmp_allow_plasmids ? 1 : 0; // Retrieve genetic units int16_t nb_gen_units; gzread(backup_file, &nb_gen_units, sizeof(nb_gen_units)); for (int16_t i = 0; i < nb_gen_units; i++) genetic_unit_list_.emplace_back(this, backup_file); // -------------------------------------------------------------------------- // No more data to retrieve, the following are only structural // initializations (no data is set) // -------------------------------------------------------------------------- // Create empty fuzzy sets for activation and inhibition phenotype_activ_ = NULL; phenotype_inhib_ = NULL; phenotype_ = NULL; dist_to_target_by_segment_ = NULL; dist_to_target_by_feature_ = new double[NB_FEATURES]; fitness_by_feature_ = new double[NB_FEATURES]; for (int8_t i = 0; i < NB_FEATURES; i++) { dist_to_target_by_feature_[i] = 0.0; fitness_by_feature_[i] = 0.0; } // Initialize the computational state of the individual evaluated_ = false; transcribed_ = false; translated_ = false; folded_ = false; phenotype_computed_ = false; distance_to_target_computed_ = false; fitness_computed_ = false; modularity_ = -1; } /** * Copy constructor */ Individual::Individual(const Individual& other) { exp_m_ = other.exp_m_; // PRNGs mut_prng_ = other.mut_prng_; stoch_prng_ = other.stoch_prng_; int strain_string_len = strlen(other.strain_name_); strain_name_ = new char[strain_string_len + 1]; memcpy(strain_name_, other.strain_name_, strain_string_len + 1); age_ = other.age_; id_ = other.id_; rank_ = other.rank_; grid_cell_ = other.grid_cell_; evaluated_ = other.evaluated_; transcribed_ = other.transcribed_; translated_ = other.translated_; folded_ = other.folded_; phenotype_computed_ = other.phenotype_computed_; with_stochasticity_ = other.with_stochasticity_; // Artificial chemistry parameters w_max_ = other.w_max_; distance_to_target_computed_ = other.distance_to_target_computed_; fitness_computed_ = other.fitness_computed_; placed_in_population_ = other.placed_in_population_; // Copy genetic units from other // Should actually use GeneticUnit copy ctor which is disabled. for (const auto& gu: other.genetic_unit_list_) genetic_unit_list_.emplace_back(this, gu); // Copy phenotype if (phenotype_computed_) { phenotype_activ_ = FuzzyFactory::fuzzyFactory->create_fuzzy((*(other.phenotype_activ_))); phenotype_inhib_ = FuzzyFactory::fuzzyFactory->create_fuzzy((*(other.phenotype_inhib_))); phenotype_ = FuzzyFactory::fuzzyFactory->create_fuzzy((*(other.phenotype_))); } else { phenotype_activ_ = NULL; phenotype_inhib_ = NULL; phenotype_ = NULL; } // Copy fitness-related stuff dist_to_target_by_segment_ = NULL; dist_to_target_by_feature_ = new double[NB_FEATURES]; fitness_by_feature_ = new double[NB_FEATURES]; for (int8_t i = 0; i < NB_FEATURES; i++) { dist_to_target_by_feature_[i] = other.dist_to_target_by_feature_[i]; fitness_by_feature_[i] = other.fitness_by_feature_[i]; } fitness_ = other.fitness_; // Copy statistical data metrics_ = other.metrics_ ? new Metrics(*other.metrics_) : nullptr; nc_metrics_ = other.nc_metrics_ ? new NonCodingMetrics(*other.nc_metrics_) : nullptr; modularity_ = other.modularity_; // Generic probes int_probes_ = new int32_t[5]; double_probes_ = new double[5]; for (int8_t i = 0; i < 5; i++) { int_probes_[i] = other.int_probes_[i]; double_probes_[i] = other.double_probes_[i]; } // Mutation rates etc... mut_params_ = std::make_shared(*(other.mut_params_)); // Genome size constraints min_genome_length_ = other.min_genome_length_; max_genome_length_ = other.max_genome_length_; // Plasmids settings allow_plasmids_ = other.allow_plasmids_; } /** * Reproduction constructor * * This constructor creates a new individual with the same genome as it's * parent. The location of promoters will be copied but no further process will * be performed. * * The phenotype and the fitness are not set, neither is the statistical data. */ Individual::Individual(const Individual* parent, int32_t id, std::shared_ptr mut_prng, std::shared_ptr stoch_prng) { exp_m_ = parent->exp_m_; // PRNGs mut_prng_ = mut_prng; stoch_prng_ = stoch_prng; int strain_string_len = strlen(parent->strain_name_); strain_name_ = new char[strain_string_len + 1]; memcpy(strain_name_, parent->strain_name_, strain_string_len + 1); age_ = parent->age_ + 1; id_ = id; rank_ = -1; evaluated_ = false; transcribed_ = false; translated_ = false; folded_ = false; phenotype_computed_ = false; distance_to_target_computed_ = false; fitness_computed_ = false; placed_in_population_ = false; // x = y = -1; with_stochasticity_ = parent->with_stochasticity_; // Artificial chemistry parameters w_max_ = parent->w_max_; // Create new genetic units with their DNA copied from here // NOTE : The RNA lists (one per genetic unit) will also be copied so that we don't // need to look for promoters on the whole genome for (auto& gu: parent->genetic_unit_list_) genetic_unit_list_.emplace_back(this, &gu); phenotype_activ_ = NULL; phenotype_inhib_ = NULL; phenotype_ = NULL; // Initialize all the fitness-related stuff dist_to_target_by_segment_ = NULL; dist_to_target_by_feature_ = new double[NB_FEATURES]; fitness_by_feature_ = new double[NB_FEATURES]; for (int8_t i = 0; i < NB_FEATURES; i++) { dist_to_target_by_feature_[i] = 0.0; fitness_by_feature_[i] = 0.0; } // Generic probes int_probes_ = new int32_t[5]; double_probes_ = new double[5]; for (int8_t i = 0; i < 5; i++) { int_probes_[i] = parent->int_probes_[i]; double_probes_[i] = parent->double_probes_[i]; } // Mutation rates etc... mut_params_ = std::make_shared(*(parent->mut_params_)); // Genome size constraints min_genome_length_ = parent->min_genome_length_; max_genome_length_ = parent->max_genome_length_; // Plasmids settings allow_plasmids_ = parent->allow_plasmids_; // Initialize statistical data modularity_ = -1; } Individual* Individual::CreateIndividual(ExpManager* exp_m, gzFile backup_file) { Individual* indiv = NULL; #ifdef __NO_X #ifndef __REGUL indiv = new Individual(exp_m, backup_file); #else indiv = new Individual_R(exp_m, backup_file); #endif #elif defined __X11 #ifndef __REGUL indiv = new Individual_X11(exp_m, backup_file); #else indiv = new Individual_R_X11(exp_m, backup_file); #endif #endif return indiv; } /*! \brief Create a clone \param dolly original individual to be cloned \param id ID of the clone \return clone of dolly (not evaluated) */ Individual* Individual::CreateClone(const Individual* dolly, int32_t id) { Individual* indiv = new Individual(*dolly); indiv->set_id(id); return indiv; } // ================================================================= // Destructor // ================================================================= Individual::~Individual() { delete[] strain_name_; // Proteins and RNAs are recycled, don't delete them. delete phenotype_activ_; delete phenotype_inhib_; delete phenotype_; if (dist_to_target_by_segment_ != NULL) delete[] dist_to_target_by_segment_; delete[] dist_to_target_by_feature_; delete[] fitness_by_feature_; // Generic probes delete[] int_probes_; delete[] double_probes_; delete metrics_; delete nc_metrics_; } // ================================================================= // Non-inline Accessors // ================================================================= void Individual::set_exp_m(ExpManager* exp_m) { exp_m_ = exp_m; // Update pointer to exp_manager in each GU for (auto& gen_unit: genetic_unit_list_) gen_unit.set_exp_m(exp_m_); } /// TODO void Individual::set_grid_cell(GridCell* grid_cell) { grid_cell_ = grid_cell; placed_in_population_ = true; // x = grid_cell->x(); // y = grid_cell->y(); if (grid_cell->individual() != this) { grid_cell->set_individual(this); } } /// TODO const char* Individual::strain_name() const { return strain_name_; } /// TODO int32_t Individual::age() const { return age_; } /// TODO int32_t Individual::id() const { return id_; } /// TODO double* Individual::dist_to_target_by_segment() const { return dist_to_target_by_segment_; } /*! Get the individual's rank in the population (1 for the worst indiv, POP_SIZE for the best) Warning: be sure you call sort_individuals() before using rank_in_population */ int32_t Individual::rank() const { return rank_; } /// TODO ExpManager* Individual::exp_m() const { return exp_m_; } /// TODO std::shared_ptr Individual::mut_prng() const { return mut_prng_; } /// TODO std::shared_ptr Individual::stoch_prng() const { return stoch_prng_; } /*! Returns the number of genetic units */ int16_t Individual::nb_genetic_units() const { return genetic_unit_list_.size(); } /// Get the number of plasmids. That is, the number of genetic units /// minus one DNA-based genetic unit. int32_t Individual::nb_plasmids() const { return genetic_unit_list_.size() - 1; } /// TODO int32_t Individual::amount_of_dna() const { int32_t amount = 0; for (const auto& gen_unit: genetic_unit_list_) amount += gen_unit.dna()->length(); return amount; } /// Return the list of genetic units. const std::list& Individual::genetic_unit_list() const { return genetic_unit_list_; } std::list& Individual::genetic_unit_list_nonconst() { return genetic_unit_list_; } /// Remove all the elements from the GU list except the firt and the /// last ones. If the GU list has less that 2 elements, do nothing. void Individual::drop_nested_genetic_units() { if (genetic_unit_list_.size() <= 2) { return; } genetic_unit_list_.erase(std::next(genetic_unit_list_.begin()), std::prev(genetic_unit_list_.end())); assert(genetic_unit_list_.size() <= 2); } /// Returns genetic unit number `num_unit` (0 for main chromosome) const GeneticUnit& Individual::genetic_unit(int16_t num_unit) const { assert(num_unit < static_cast(genetic_unit_list_.size())); auto it = genetic_unit_list_.cbegin(); std::advance(it, num_unit); return *it; } /// Returns genetic unit number `num_unit` (0 for main chromosome) as /// a non-constant reference. To be used when the purpose is to alter /// the individual. GeneticUnit& Individual::genetic_unit_nonconst(int16_t num_unit) { assert(num_unit < static_cast(genetic_unit_list_.size())); auto it = genetic_unit_list_.begin(); std::advance(it, num_unit); return *it; } /// TODO double Individual::dist_to_target_by_feature( PhenotypicFeature feature) const { assert(distance_to_target_computed_); return dist_to_target_by_feature_[feature]; } /// TODO double Individual::fitness() const { assert(fitness_computed_); return fitness_; } /// TODO double Individual::fitness_by_feature(PhenotypicFeature feature) const { assert(fitness_computed_); return fitness_by_feature_[feature]; } /// TODO GridCell* Individual::grid_cell() const { return grid_cell_; } /// TODO const Habitat& Individual::habitat() const { return grid_cell_->habitat(); } /// TODO bool Individual::placed_in_population() const { return placed_in_population_; } /*! Returns the sequence of genetic unit number (0 for main chromosome) */ const char* Individual::genetic_unit_sequence(int16_t num_unit) const { return genetic_unit(num_unit).sequence(); } /*! Returns the sequence length of genetic unit number (0 for main chromosome) */ int32_t Individual::genetic_unit_seq_length(int16_t num_unit) const { return genetic_unit(num_unit).seq_length(); } /// TODO AbstractFuzzy* Individual::phenotype_activ() const { return phenotype_activ_; } /// TODO AbstractFuzzy* Individual::phenotype_inhib() const { return phenotype_inhib_; } /// TODO Phenotype* Individual::phenotype() const { return phenotype_; } const PhenotypicTarget& Individual::phenotypic_target() const { return grid_cell_->phenotypic_target(); } /// TODO const std::list& Individual::protein_list() const { return protein_list_; } /// TODO const std::list& Individual::rna_list() const { return rna_list_; } /// TODO int32_t Individual::total_genome_size() const { assert(metrics_ != nullptr); return metrics_->total_genome_size(); } /// TODO int16_t Individual::nb_coding_RNAs() const { assert(metrics_ != nullptr); return metrics_->nb_coding_RNAs(); } /// TODO int16_t Individual::nb_non_coding_RNAs() const { assert(metrics_ != nullptr); return metrics_->nb_non_coding_RNAs(); } /// TODO int32_t Individual::overall_size_coding_RNAs() const { assert(metrics_ != nullptr); return metrics_->overall_size_coding_RNAs(); } /// TODO double Individual::av_size_coding_RNAs() const { assert(metrics_ != nullptr); return metrics_->nb_coding_RNAs() == 0 ? 0.0 : metrics_->overall_size_coding_RNAs() / metrics_->nb_coding_RNAs(); } /// TODO int32_t Individual::overall_size_non_coding_RNAs() const { assert(metrics_ != nullptr); return metrics_->overall_size_non_coding_RNAs(); } /// TODO double Individual::av_size_non_coding_RNAs() const { assert(metrics_ != nullptr); return metrics_->nb_non_coding_RNAs() == 0 ? 0.0 : metrics_->overall_size_non_coding_RNAs() / metrics_->nb_non_coding_RNAs(); } /// TODO int16_t Individual::nb_genes_activ() const { assert(metrics_ != nullptr); return metrics_->nb_genes_activ(); } /// TODO int16_t Individual::nb_genes_inhib() const { assert(metrics_ != nullptr); return metrics_->nb_genes_inhib(); } /// TODO int16_t Individual::nb_functional_genes() const { assert(metrics_ != nullptr); return metrics_->nb_functional_genes(); } /// TODO int16_t Individual::nb_non_functional_genes() const { assert(metrics_ != nullptr); return metrics_->nb_non_functional_genes(); } /// TODO int32_t Individual::overall_size_functional_genes() const { assert(metrics_ != nullptr); return metrics_->overall_size_functional_genes(); } /// TODO double Individual::av_size_functional_genes() const { assert(metrics_ != nullptr); return metrics_->nb_functional_genes() == 0 ? 0.0 : metrics_->overall_size_functional_genes() / metrics_->nb_functional_genes(); } /// TODO int32_t Individual::overall_size_non_functional_genes() const { assert(metrics_ != nullptr); return metrics_->overall_size_non_functional_genes(); } /// TODO double Individual::av_size_non_functional_genes() const { assert(metrics_ != nullptr); return metrics_->nb_non_functional_genes() == 0 ? 0.0 : metrics_->overall_size_non_functional_genes() / metrics_->nb_non_functional_genes(); } /// TODO int32_t Individual::nb_bases_in_0_CDS() const { assert(nc_metrics_ != nullptr); return nc_metrics_->nb_bases_in_0_CDS(); } /// TODO int32_t Individual::nb_bases_in_0_functional_CDS() const { assert(nc_metrics_ != nullptr); return nc_metrics_->nb_bases_in_0_functional_CDS(); } /// TODO int32_t Individual::nb_bases_in_0_non_functional_CDS() const { assert(nc_metrics_ != nullptr); return nc_metrics_->nb_bases_in_0_non_functional_CDS(); } /// TODO int32_t Individual::nb_bases_in_0_RNA() const { assert(nc_metrics_ != nullptr); return nc_metrics_->nb_bases_in_0_RNA(); } /// TODO int32_t Individual::nb_bases_in_0_coding_RNA() const { assert(nc_metrics_ != nullptr); return nc_metrics_->nb_bases_in_0_coding_RNA(); } /// TODO int32_t Individual::nb_bases_in_0_non_coding_RNA() const { assert(nc_metrics_ != nullptr); return nc_metrics_->nb_bases_in_0_non_coding_RNA(); } /// TODO int32_t Individual::nb_bases_in_neutral_regions() const { assert(nc_metrics_ != nullptr); return nc_metrics_->nb_bases_in_neutral_regions(); } /// TODO int32_t Individual::nb_neutral_regions() const { assert(nc_metrics_ != nullptr); return nc_metrics_->nb_neutral_regions(); } /// TODO double Individual::modularity() { printf("\n WARNING : modularity measure not yet implemented.\n"); //~ if (modularity_ < 0) compute_modularity(); //~ return modularity_; return 0; } /// TODO double Individual::w_max() const { return w_max_; } // ------------------------------------------------------------- Mutation rates /// TODO double Individual::point_mutation_rate() const { return mut_params_->point_mutation_rate(); } /// TODO double Individual::small_insertion_rate() const { return mut_params_->small_insertion_rate(); } /// TODO double Individual::small_deletion_rate() const { return mut_params_->small_deletion_rate(); } /// TODO int16_t Individual::max_indel_size() const { return mut_params_->max_indel_size(); } // ---------------------------------- Rearrangement rates (without alignements) /// TODO double Individual::duplication_rate() const { return mut_params_->duplication_rate(); } /// TODO double Individual::deletion_rate() const { return mut_params_->deletion_rate(); } /// TODO double Individual::translocation_rate() const { return mut_params_->translocation_rate(); } /// TODO double Individual::inversion_rate() const { return mut_params_->inversion_rate(); } // ------------------------------------- Rearrangement rates (with alignements) /// TODO double Individual::neighbourhood_rate() const { return mut_params_->neighbourhood_rate(); } /// TODO double Individual::duplication_proportion() const { return mut_params_->duplication_proportion(); } /// TODO double Individual::deletion_proportion() const { return mut_params_->deletion_proportion(); } /// TODO double Individual::translocation_proportion() const { return mut_params_->translocation_proportion(); } /// TODO double Individual::inversion_proportion() const { return mut_params_->inversion_proportion(); } // ---------------------------------------------------------------- Transfer bool Individual::with_4pts_trans() const { return mut_params_->with_4pts_trans(); } bool Individual::with_HT() const { return mut_params_->with_HT(); } bool Individual::repl_HT_with_close_points() const { return mut_params_->repl_HT_with_close_points(); } double Individual::HT_ins_rate() const { return mut_params_->HT_ins_rate(); } double Individual::HT_repl_rate() const { return mut_params_->HT_repl_rate(); } double Individual::repl_HT_detach_rate() const { return mut_params_->repl_HT_detach_rate(); } // ---------------------------------------------------------------- Alignements bool Individual::with_alignments() const { return mut_params_->with_alignments(); } AlignmentFunctionShape Individual::align_fun_shape() const { return mut_params_->align_fun_shape(); } double Individual::align_sigm_lambda() const { return mut_params_->align_sigm_lambda(); } int16_t Individual::align_sigm_mean() const { return mut_params_->align_sigm_mean(); } int16_t Individual::align_lin_min() const { return mut_params_->align_lin_min(); } int16_t Individual::align_lin_max() const { return mut_params_->align_lin_max(); } int16_t Individual::align_max_shift() const { return mut_params_->align_max_shift(); } int16_t Individual::align_w_zone_h_len() const { return mut_params_->align_w_zone_h_len(); } int16_t Individual::align_match_bonus() const { return mut_params_->align_match_bonus(); } int16_t Individual::align_mismatch_cost() const { return mut_params_->align_mismatch_cost(); } /// TODO bool Individual::with_stochasticity() const { return with_stochasticity_; } void Individual::set_allow_plasmids(bool allow_plasmids) { allow_plasmids_ = allow_plasmids; } // Genome size constraints /// TODO int32_t Individual::min_genome_length() const { return min_genome_length_; } /// TODO int32_t Individual::max_genome_length() const { return max_genome_length_; } // Plasmids settings /// TODO bool Individual::allow_plasmids() const { return allow_plasmids_; } /*! \brief Return the int_probes_ \return int_probes_ */ int32_t* Individual::int_probes() const { return int_probes_; } /*! \brief Return the double_probes_ \return double_probes_ */ double* Individual::double_probes() const { return double_probes_; } // ===================================================================== // Setters' definitions // ===================================================================== void Individual::set_strain_name(char* name) { assert(name && strlen(name) < INT8_MAX); // Conservative, could be <= int8_t name_len = strlen(name); delete[] strain_name_; strain_name_ = new char[name_len + 1]; memcpy(strain_name_, name, name_len + 1); } /// TODO void Individual::set_id(int32_t id) { id_ = id; } /// TODO void Individual::set_rank(int32_t rank) { rank_ = rank; } /// TODO void Individual::set_placed_in_population(bool placed_in_population) { placed_in_population_ = placed_in_population; } /// TODO void Individual::set_w_max(double w_max) { w_max_ = w_max; } // Genome size constraints /// TODO void Individual::set_min_genome_length(int32_t min_genome_length) { min_genome_length_ = min_genome_length; } /// TODO void Individual::set_max_genome_length(int32_t max_genome_length) { max_genome_length_ = max_genome_length; } void Individual::set_point_mutation_rate(double point_mutation_rate) { mut_params_->set_point_mutation_rate(point_mutation_rate); } void Individual::set_small_insertion_rate(double small_insertion_rate) { mut_params_->set_small_insertion_rate(small_insertion_rate); } void Individual::set_small_deletion_rate(double small_deletion_rate) { mut_params_->set_small_deletion_rate(small_deletion_rate); } void Individual::set_max_indel_size(int16_t max_indel_size) { mut_params_->set_max_indel_size(max_indel_size); } void Individual::set_duplication_rate(double duplication_rate) { mut_params_->set_duplication_rate(duplication_rate); } void Individual::set_deletion_rate(double deletion_rate) { mut_params_->set_deletion_rate(deletion_rate); } void Individual::set_translocation_rate(double translocation_rate) { mut_params_->set_translocation_rate(translocation_rate); } void Individual::set_inversion_rate(double inversion_rate) { mut_params_->set_inversion_rate(inversion_rate); } void Individual::set_neighbourhood_rate(double neighbourhood_rate) { mut_params_->set_neighbourhood_rate(neighbourhood_rate); } void Individual::set_duplication_proportion(double duplication_proportion) { mut_params_->set_duplication_proportion(duplication_proportion); } void Individual::set_deletion_proportion(double deletion_proportion) { mut_params_->set_deletion_proportion(deletion_proportion); } void Individual::set_translocation_proportion(double translocation_proportion) { mut_params_->set_translocation_proportion(translocation_proportion); } void Individual::set_inversion_proportion(double inversion_proportion) { mut_params_->set_inversion_proportion(inversion_proportion); } void Individual::set_with_4pts_trans(bool with_4pts_trans) { mut_params_->set_with_4pts_trans(with_4pts_trans); } void Individual::set_with_alignments(bool with_alignments) { mut_params_->set_with_alignments(with_alignments); } void Individual::set_with_HT(bool with_HT) { mut_params_->set_with_HT(with_HT); } void Individual::set_repl_HT_with_close_points(bool repl_HT_with_close_points) { mut_params_->set_repl_HT_with_close_points(repl_HT_with_close_points); } void Individual::set_HT_ins_rate(double HT_ins_rate) { mut_params_->set_HT_ins_rate(HT_ins_rate); } void Individual::set_HT_repl_rate(double HT_repl_rate) { mut_params_->set_HT_repl_rate(HT_repl_rate); } void Individual::set_repl_HT_detach_rate(double repl_HT_detach_rate) { mut_params_->set_repl_HT_detach_rate(repl_HT_detach_rate); } void Individual::set_with_stochasticity(bool with_stoch) { with_stochasticity_ = with_stoch; } void Individual::set_stoch_prng(std::shared_ptr prng) { stoch_prng_ = prng; } void Individual::set_mut_prng(std::shared_ptr prng) { mut_prng_ = prng; } /*! \brief Change the int_probes_ \param int_probes 5 int32_t* that constitute a probe */ void Individual::set_int_probes(int32_t* int_probes) { int_probes_ = int_probes; } /*! \brief Change the double_probes_ \param double_probes 5 double* that constitute a probe */ void Individual::set_double_probes(double* double_probes) { double_probes_ = double_probes; } // ===================================================================== // functions' definition // ===================================================================== void Individual::reset_dist_to_target_by_segment( double* dist_to_target_by_segment) { if (dist_to_target_by_segment_ != NULL) delete[] dist_to_target_by_segment_; dist_to_target_by_segment_ = dist_to_target_by_segment; } void Individual::renew_dist_to_target_by_feature() { if (dist_to_target_by_feature_ != NULL) delete[] dist_to_target_by_feature_; dist_to_target_by_feature_ = new double[NB_FEATURES]; } void Individual::renew_fitness_by_feature() { if (fitness_by_feature_ != NULL) delete[] fitness_by_feature_; fitness_by_feature_ = new double[NB_FEATURES]; } void Individual::do_transcription_translation_folding() { if (transcribed_ == true && translated_ == true && folded_ == true) return; do_transcription(); do_translation(); do_folding(); make_protein_list(); } #ifdef DEBUG void Individual::assert_promoters() { // Perform assertion for each genetic unit // for (auto& gen_unit: genetic_unit_list_) // gen_unit.assert_promoters(); } void Individual::assert_promoters_order() { // Perform assertion for each genetic unit // for (auto& gen_unit: genetic_unit_list_) // gen_unit.assert_promoters_order(); } #endif // ================================================================= // Public Methods // ================================================================= void Individual::compute_phenotype() { if (phenotype_computed_) return; // Phenotype has already been computed, nothing to do. phenotype_computed_ = true; // Make sure the transcription, translation and folding stages have taken place do_transcription_translation_folding(); // We will use two fuzzy sets : // * phenotype_activ_ for the proteins realising a set of functions // * phenotype_inhib_ for the proteins inhibiting a set of functions // The phenotype will then be given by the sum of these 2 fuzzy sets phenotype_activ_ = FuzzyFactory::fuzzyFactory->create_fuzzy(); phenotype_inhib_ = FuzzyFactory::fuzzyFactory->create_fuzzy(); for (const auto& gen_unit: genetic_unit_list_) { phenotype_activ_->add(*gen_unit.activ_contribution()); phenotype_inhib_->add(*gen_unit.inhib_contribution()); } phenotype_activ_->clip(AbstractFuzzy::max, Y_MAX); phenotype_inhib_->clip(AbstractFuzzy::min, - Y_MAX); phenotype_ = FuzzyFactory::fuzzyFactory->create_fuzzy(); phenotype_->add(*phenotype_activ_); phenotype_->add(*phenotype_inhib_); phenotype_->clip(AbstractFuzzy::min, Y_MIN); phenotype_->simplify(); } void Individual::compute_distance_to_target(const PhenotypicTarget& target) { // Compute the areas between the phenotype and the target for each segment // If the target is not segmented, the total area is computed if (distance_to_target_computed_) { return; } // distance_to_target_ has already been computed, nothing to do. distance_to_target_computed_ = true; if (not phenotype_computed_) compute_phenotype(); // Compute the difference between the (whole) phenotype and the target AbstractFuzzy* delta = FuzzyFactory::fuzzyFactory->create_fuzzy(*phenotype_); delta->sub(*(target.fuzzy())); PhenotypicSegment ** segments = target.segments(); delete [] dist_to_target_by_segment_; dist_to_target_by_segment_ = new double [target.nb_segments()]; for (size_t i = 0 ; i < static_cast(target.nb_segments()) ; i++) { dist_to_target_by_segment_[i] = 0; } // TODO : We should take into account that we compute the areas in order (from the leftmost segment, rightwards) // => We shouldn't parse the whole list of points on the left of the segment we are considering (we have // already been through them!) for (size_t i = 0; i < static_cast(target.nb_segments()); i++) { dist_to_target_by_segment_[i] = delta->get_geometric_area( segments[i]->start, segments[i]->stop); dist_to_target_by_feature_[segments[i]->feature] += dist_to_target_by_segment_[i]; } delete delta; } /*! Computation of a "proper" fitness value (one that increases when the individual is fitter) Computation of a "proper" fitness value (one that increases when the individual is fitter) The behaviour of this function depends on many parameters and most notably on whether it is a "composite" fitness or not, and on the selection scheme. */ void Individual::compute_fitness(const PhenotypicTarget& target) { if (fitness_computed_) return; // Fitness has already been computed, nothing to do. fitness_computed_ = true; #ifdef NORMALIZED_FITNESS for (int8_t i = 0 ; i < NB_FEATURES ; i++) { if (envir->area_by_feature(i)==0.) { fitness_by_feature_[i] = 0.; } else { fitness_by_feature_[i] = (envir->area_by_feature(i) - dist_to_target_by_feature_[i]) / envir->area_by_feature(i); if ((fitness_by_feature_[i] < 0.) && (i != METABOLISM)) // non-metabolic fitness can NOT be lower than zero (we do not want individual to secrete a negative quantity of public good) { fitness_by_feature_[i] = 0.; } } } if ((! placed_in_population_) || (! exp_m_->with_secretion())) { fitness_ = fitness_by_feature_[METABOLISM]; } else { fitness_ = fitness_by_feature_[METABOLISM] * (1 + exp_m_->secretion_contrib_to_fitness() * (grid_cell_->compound_amount() - exp_m_->secretion_cost() * fitness_by_feature_[SECRETION])); } if (exp_m_->selection_scheme() == FITNESS_PROPORTIONATE) // Then the exponential selection is integrated inside the fitness value { fitness_ = exp(-exp_m_->selection_pressure() * (1 - fitness_)); } #else for (int8_t i = 0; i < NB_FEATURES; i++) { if (i == SECRETION) { fitness_by_feature_[SECRETION] = exp(-exp_m_->selection_pressure() * dist_to_target_by_feature_[SECRETION]) - exp(-exp_m_->selection_pressure() * target.area_by_feature(SECRETION)); if (fitness_by_feature_[i] < 0) { fitness_by_feature_[i] = 0; } } else { fitness_by_feature_[i] = exp( -exp_m_->selection_pressure() * dist_to_target_by_feature_[i]); } } // Calculate combined, total fitness here! // Multiply the contribution of metabolism and the amount of compound in the // habitat if ((!placed_in_population_) || (!exp_m_->with_secretion())) { fitness_ = fitness_by_feature_[METABOLISM]; } else { fitness_ = fitness_by_feature_[METABOLISM] * (1 + exp_m_->secretion_contrib_to_fitness() * grid_cell()->compound_amount() - exp_m_->secretion_cost() * fitness_by_feature_[SECRETION]); } #endif } void Individual::clear_everything_except_dna_and_promoters() { protein_list_.clear(); evaluated_ = false; transcribed_ = false; translated_ = false; folded_ = false; phenotype_computed_ = false; distance_to_target_computed_ = false; fitness_computed_ = false; for (auto& gen_unit: genetic_unit_list_) gen_unit.reset_expression(); if (phenotype_activ_ != NULL) { delete phenotype_activ_; phenotype_activ_ = NULL; } if (phenotype_inhib_ != NULL) { delete phenotype_inhib_; phenotype_inhib_ = NULL; } if (phenotype_ != NULL) { delete phenotype_; phenotype_ = NULL; } // Initialize all the fitness-related stuff if (dist_to_target_by_segment_ != NULL) { delete[] dist_to_target_by_segment_; dist_to_target_by_segment_ = NULL; } for (int8_t i = 0; i < NB_FEATURES; i++) { dist_to_target_by_feature_[i] = 0.0; fitness_by_feature_[i] = 0.0; } // For each RNA / individual / genetic_unit delete proteins it knows // Deleting the protein itself is made only once for (auto& gen_unit: genetic_unit_list_) gen_unit.clear_transcribed_proteins(); // Clear RNA and proteins rna_list_.clear(); protein_list_.clear(); // Reset statistical data delete metrics_; metrics_ = nullptr; delete nc_metrics_; nc_metrics_ = nullptr; modularity_ = -1; } void Individual::Reevaluate() { // useful for post-treatment programs that replay mutations // on a single individual playing the role of the successive // ancestors clear_everything_except_dna_and_promoters(); Evaluate(); } void Individual::ReevaluateInContext(const Habitat& habitat) { // useful for post-treatment programs that replay mutations // on a single individual playing the role of the successive // ancestors clear_everything_except_dna_and_promoters(); EvaluateInContext(habitat); } void Individual::add_GU(char*& sequence, int32_t length) { clear_everything_except_dna_and_promoters(); genetic_unit_list_.emplace_back(this, sequence, length); } /// Overloaded version to prevent the use of GeneticUnit disabled /// copy ctor. Forwards arguments to GeneticUnit's ctor. void Individual::add_GU(Individual* indiv, int32_t chromosome_length, std::shared_ptr prng) { clear_everything_except_dna_and_promoters(); genetic_unit_list_.emplace_back(indiv, chromosome_length, prng); } void Individual::remove_GU(int16_t num_unit) { clear_everything_except_dna_and_promoters(); auto it = genetic_unit_list_.begin(); std::advance(it, num_unit); genetic_unit_list_.erase(it); } void Individual::do_transcription() { if (transcribed_) { return; } // Transcription has already been performed, nothing to do. transcribed_ = true; for (auto& gen_unit: genetic_unit_list_) { gen_unit.do_transcription(); const auto& rna_list = gen_unit.rna_list(); for (auto& strand: {LEADING, LAGGING}) { for (auto& rna: rna_list[strand]) rna_list_.push_back(&rna); } } } void Individual::do_translation() { if (translated_) { return; } // ARNs have already been translated, nothing to do. translated_ = true; if (not transcribed_) do_transcription(); for (auto& gen_unit: genetic_unit_list_) { gen_unit.do_translation(); // append all proteins from `gen_unit` to `protein_list_` for (auto& strand_id: {LEADING, LAGGING}) { auto& strand = gen_unit.protein_list(strand_id); for (auto& p: strand) protein_list_.push_back(&p); } } } void Individual::do_folding() { if (folded_) { return; } // Proteins have already been folded, nothing to do. folded_ = true; if (not translated_) do_translation(); for (auto& gen_unit: genetic_unit_list_) gen_unit.compute_phenotypic_contribution(); } void Individual::Evaluate() { EvaluateInContext(grid_cell_->habitat()); } void Individual::EvaluateInContext(const Habitat& habitat) { if (evaluated_ == true) { return; } // Individual has already been evaluated, nothing to do. evaluated_ = true; // ---------------------------------------------------------------------- // Transcription - Translation - Folding // ---------------------------------------------------------------------- do_transcription_translation_folding(); // ---------------------------------------------------------------------- // Compute phenotype and compare it to the target => fitness // ---------------------------------------------------------------------- compute_phenotype(); compute_distance_to_target(habitat.phenotypic_target()); compute_fitness(habitat.phenotypic_target()); if (exp_m_->output_m()->compute_phen_contrib_by_GU()) for (auto& gen_unit: genetic_unit_list_) { gen_unit.compute_distance_to_target(habitat.phenotypic_target()); gen_unit.compute_fitness(habitat.phenotypic_target()); } } void Individual::inject_GU(Individual* donor) { // Add the GU at the end of the list genetic_unit_list_.emplace_back(this, donor->genetic_unit_list_.back()); } void Individual::inject_2GUs(Individual* partner) { // We swap GUs from the end of the list. // TODO vld: As far as I understood the old code (47b27578), the // elements were not swapped but appended to the end of the other GU // lists. Error? Original author (Dule, commit 47b27578), asked for // clarification by e-mail on 2015-02-23. const auto& gu_list_back_it = std::prev( genetic_unit_list_.end()); // initial last cell from genetic_unit_list_ genetic_unit_list_.splice(genetic_unit_list_.end(), partner->genetic_unit_list_, std::prev(partner->genetic_unit_list_.end())); partner->genetic_unit_list_.splice(partner->genetic_unit_list_.end(), genetic_unit_list_, gu_list_back_it); } void Individual::compute_statistical_data() { if (metrics_ != nullptr) { return; } // Statistical data has already been computed, // nothing to do. metrics_ = new Metrics(); if (not phenotype_computed_) compute_phenotype(); for (const auto& gen_unit : genetic_unit_list_) { metrics_->Accumulate(gen_unit); } } void Individual::compute_non_coding() { if (nc_metrics_ != nullptr) return; // NC stats have already been computed, // nothing to do. nc_metrics_ = new NonCodingMetrics(); for (auto& gen_unit: genetic_unit_list_) { gen_unit.compute_non_coding(); nc_metrics_->Accumulate(gen_unit); } } void Individual::save(gzFile backup_file) const { //printf("Appel à la sauvegarde de Individual\n"); // Write the name and "age" of the strain int8_t strain_string_len = strlen(strain_name_); gzwrite(backup_file, &strain_string_len, sizeof(strain_string_len)); gzwrite(backup_file, strain_name_, strain_string_len + 1); gzwrite(backup_file, &age_, sizeof(age_)); // Write id and rank gzwrite(backup_file, &id_, sizeof(id_)); gzwrite(backup_file, &rank_, sizeof(rank_)); // Write the position of the individual // gzwrite(backup_file, &x, sizeof(x)); // gzwrite(backup_file, &y, sizeof(y)); // Write generic probes gzwrite(backup_file, int_probes_, 5 * sizeof(*int_probes_)); gzwrite(backup_file, double_probes_, 5 * sizeof(*double_probes_)); // Write mutational parameters mut_params_->save(backup_file); // ------------------------------------------------- Phenotypic stochasticity gzwrite(backup_file, &with_stochasticity_, sizeof(with_stochasticity_)); // Write artificial chemistry parameters gzwrite(backup_file, &w_max_, sizeof(w_max_)); // Write genome size constraints gzwrite(backup_file, &min_genome_length_, sizeof(min_genome_length_)); gzwrite(backup_file, &max_genome_length_, sizeof(max_genome_length_)); // Write plasmids settings int8_t tmp_allow_plasmids = allow_plasmids_; gzwrite(backup_file, &tmp_allow_plasmids, sizeof(tmp_allow_plasmids)); // Write genetic units int16_t nb_gen_units = genetic_unit_list_.size(); gzwrite(backup_file, &nb_gen_units, sizeof(nb_gen_units)); for (const auto& gen_unit: genetic_unit_list_) gen_unit.save(backup_file); } int32_t Individual::nb_terminators() { int32_t nb_term = 0; for (auto& gen_unit: genetic_unit_list_) nb_term += gen_unit.nb_terminators(); return nb_term; } /// Remove the bases that are not in coding RNA. /// /// Remove the bases that are not in coding RNA and test at each loss /// that fitness is not changed. void Individual::remove_non_coding_bases() { for (auto& gen_unit: genetic_unit_list_) gen_unit.remove_non_coding_bases(); // Delete the obsolete stats delete metrics_; metrics_ = NULL; delete nc_metrics_; nc_metrics_ = NULL; #ifdef DEBUG compute_statistical_data(); compute_non_coding(); assert(nb_bases_in_0_coding_RNA() == 0); #endif } /// Double the bases that are not in coding RNA. /// /// Double the bases that are not in coding RNA by addition of random /// bases and test at each addition that fitness is not changed. void Individual::double_non_coding_bases() { metrics_->total_genome_size_ = 0; int32_t initial_non_coding_base_nb = nb_bases_in_0_coding_RNA(); for (auto& gen_unit: genetic_unit_list_) gen_unit.double_non_coding_bases(); // Delete the obsolete stats delete metrics_; metrics_ = NULL; delete nc_metrics_; nc_metrics_ = NULL; #ifdef DEBUG compute_statistical_data(); compute_non_coding(); assert(nb_bases_in_0_coding_RNA() == 2 * initial_non_coding_base_nb); #endif } // ================================================================= // Protected Methods // ================================================================= // TODO vld: refactor make_protein_list and make_rna_list void Individual::make_protein_list() { // Clear list protein_list_.clear(); // Make a copy of each genetic unit's protein list for (auto& gen_unit: genetic_unit_list_) { // append all proteins from `gen_unit` to `protein_list_` for (auto& strand_id: {LEADING, LAGGING}) { auto& strand = gen_unit.protein_list(strand_id); for (auto& p: strand) protein_list_.push_back(&p); } } } void Individual::make_rna_list() { // Clear list rna_list_.clear(); // Make a copy of each genetic unit's rna list for (const auto& gen_unit: genetic_unit_list_) { // Create proxies const auto& rna_list = gen_unit.rna_list(); // append pointers to rna material to local rna_list_ for (auto& strand: {LEADING, LAGGING}) for (auto& rna: rna_list[strand]) rna_list_.push_back(&rna); } } } // namespace aevol aevol-5.0/src/libaevol/IndividualFactory.h0000644000175000017500000001260412724051151015563 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_INDIVIDUAL_FACTORY_H_ #define AEVOL_INDIVIDUAL_FACTORY_H_ // ============================================================================ // Includes // ============================================================================ #include #include #include #include #ifdef __NO_X #ifndef __REGUL #include #else #include #endif #elif defined __X11 #ifndef __REGUL #include #else #include #endif #endif #include "Habitat.h" namespace aevol { // ============================================================================ // Class declarations // ============================================================================ class IndividualFactory { public : // ========================================================================== // Constructors // ========================================================================== IndividualFactory() = default; //< Default ctor IndividualFactory(const IndividualFactory&) = delete; //< Copy ctor IndividualFactory(IndividualFactory&&) = delete; //< Move ctor // ========================================================================== // Destructor // ========================================================================== virtual ~IndividualFactory() = default; //< Destructor // ========================================================================== // Getters // ========================================================================== // ========================================================================== // Setters // ========================================================================== // ========================================================================== // Operators // ========================================================================== // ========================================================================== // Public Methods // ========================================================================== static Individual* create_random_individual( ExpManager* exp_m, int32_t id, std::shared_ptr param_mut, std::shared_ptr mut_prng, std::shared_ptr stoch_prng, const Habitat& habitat, double w_max, int32_t min_genome_length, int32_t max_genome_length, int32_t chromosome_initial_length, bool allow_plasmids, bool plasmid_initial_gene, int32_t plasmid_initial_length, char* strain_name, std::shared_ptr local_prng, bool better_than_flat); protected : // ========================================================================== // Protected Methods // ========================================================================== // ========================================================================== // Attributes // ========================================================================== }; // ============================================================================ // Getters' definitions // ============================================================================ // ============================================================================ // Setters' definitions // ============================================================================ // ============================================================================ // Operators' definitions // ============================================================================ // ============================================================================ // Inline functions' definition // ============================================================================ } // namespace aevol #endif // AEVOL_INDIVIDUAL_FACTORY_H_ aevol-5.0/src/libaevol/StatRecord.cpp0000644000175000017500000012206312724051151014551 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ================================================================= // Libraries // ================================================================= #include // ================================================================= // Project Files // ================================================================= #include "StatRecord.h" #include "AeTime.h" #include "ExpSetup.h" #include "Individual.h" #include "GeneticUnit.h" #include "ReplicationReport.h" #include "DnaReplicationReport.h" #ifdef __REGUL #include "raevol/Rna_R.h" #include "raevol/Protein_R.h" #include "raevol/Individual_R.h" #endif using std::list; namespace aevol { //############################################################################## // # // Class StatRecord # // # //############################################################################## // ================================================================= // Definition of static attributes // ================================================================= // ================================================================= // Constructors // ================================================================= StatRecord::StatRecord(const StatRecord &model) { pop_size_ = model.pop_size_; metabolic_error_ = model.metabolic_error_; metabolic_fitness_ = model.metabolic_fitness_; parent_metabolic_error_ = model.parent_metabolic_error_; secretion_error_ = model.secretion_error_; secretion_fitness_ = model.secretion_fitness_; parent_secretion_error_ = model.parent_secretion_error_; compound_amount_ = model.compound_amount_; fitness_ = model.fitness_; amount_of_dna_ = model.amount_of_dna_; nb_coding_rnas_ = model.nb_coding_rnas_; nb_non_coding_rnas_ = model.nb_non_coding_rnas_; av_size_coding_rnas_ = model.av_size_coding_rnas_; av_size_non_coding_rnas_ = model.av_size_non_coding_rnas_; nb_functional_genes_ = model.nb_functional_genes_; nb_non_functional_genes_ = model.nb_non_functional_genes_; av_size_functional_gene_ = model.av_size_functional_gene_; av_size_non_functional_gene_ = model.av_size_non_functional_gene_; nb_mut_ = model.nb_mut_; nb_rear_ = model.nb_rear_; nb_switch_ = model.nb_switch_; nb_indels_ = model.nb_indels_; nb_dupl_ = model.nb_dupl_; nb_del_ = model.nb_del_; nb_trans_ = model.nb_trans_; nb_inv_ = model.nb_inv_; dupl_rate_ = model.dupl_rate_; del_rate_ = model.del_rate_; trans_rate_ = model.trans_rate_; inv_rate_ = model.inv_rate_; mean_align_score_ = model.mean_align_score_; nb_bases_in_0_CDS_ = model.nb_bases_in_0_CDS_; nb_bases_in_0_functional_CDS_ = model.nb_bases_in_0_functional_CDS_; nb_bases_in_0_non_functional_CDS_ = model.nb_bases_in_0_non_functional_CDS_; nb_bases_in_0_RNA_ = model.nb_bases_in_0_RNA_; nb_bases_in_0_coding_RNA_ = model.nb_bases_in_0_coding_RNA_; nb_bases_in_0_non_coding_RNA_ = model.nb_bases_in_0_non_coding_RNA_; nb_bases_non_essential_ = model.nb_bases_non_essential_; nb_bases_non_essential_including_nf_genes_ = model.nb_bases_non_essential_including_nf_genes_; #ifdef __REGUL nb_influences_ = model.nb_influences_; nb_enhancing_influences_ = model.nb_enhancing_influences_; nb_operating_influences_ = model.nb_operating_influences_; av_value_influences_ = model.av_value_influences_; av_value_enhancing_influences_ = model.av_value_enhancing_influences_; av_value_operating_influences_ = model.av_value_operating_influences_; #endif } StatRecord::StatRecord(ExpSetup* exp_s, Individual* indiv, ReplicationReport* replic_report, chrom_or_gen_unit chrom_or_gu, bool compute_non_coding) { record_type_ = INDIV; // --------------- // Simulation data // --------------- pop_size_ = 0; // The pop_size value is irrelevant when dealing with a single // individual. It is present for column alignment. #ifdef __REGUL int32_t nb_activators = 0; int32_t nb_operators = 0; double mean_activator_activity = 0.0; double mean_operator_activity = 0.0; Individual_R* indiv_r = dynamic_cast(indiv); for (auto& rna: indiv_r->get_rna_list_coding()) { for (unsigned int i = 0; i < ((Rna_R*)rna)->nb_influences(); i++) { //compute the activity if (((Rna_R*)rna)->_enhancing_coef_list[i] > 0) { nb_activators++; mean_activator_activity += ((Rna_R*)rna)->_enhancing_coef_list[i]; } if (((Rna_R*)rna)->_operating_coef_list[i] > 0) { nb_operators++; mean_operator_activity += ((Rna_R*)rna)->_operating_coef_list[i]; } } } nb_enhancing_influences_ = nb_activators; nb_operating_influences_ = nb_operators; nb_influences_ = nb_operating_influences_ + nb_enhancing_influences_; av_value_influences_ = ( mean_activator_activity + mean_operator_activity ) / double ( nb_activators + nb_operators); av_value_enhancing_influences_ = ( mean_activator_activity ) / double ( nb_activators ); av_value_operating_influences_ = ( mean_operator_activity ) / double ( nb_operators); //ajout raevol_yo_2 int32_t nb_TF = 0; int32_t nb_pure_TF = 0; for (auto& prot: indiv_r->protein_list()) { if(prot->is_functional()) { if(!((Protein_R*)prot)->is_TF_) { nb_TF+=1; } } else { if(((Protein_R*)prot)->is_TF_) { nb_TF+=1; nb_pure_TF+=1; } } } nb_TF_ = nb_TF; nb_pure_TF_ = nb_pure_TF; #endif // TODO : These conditions are not well managed!!! if (indiv->nb_genetic_units() == 1) { // ------------------------------------------------- // Compute statistical data for the given individual // ------------------------------------------------- if (compute_non_coding) indiv->compute_non_coding(); const GeneticUnit& gen_unit = *indiv->genetic_unit_list().begin(); // Metabolic error stats metabolic_error_ = indiv->dist_to_target_by_feature(METABOLISM); metabolic_fitness_ = indiv->fitness_by_feature(METABOLISM); parent_metabolic_error_ = (replic_report != NULL) ? replic_report->parent_metabolic_error() : 0.0; // Fitness fitness_ = indiv->fitness(); // Secretion stats if (exp_s->with_secretion()) { secretion_error_ = indiv->dist_to_target_by_feature(SECRETION); secretion_fitness_ = indiv->fitness_by_feature(SECRETION); compound_amount_ = indiv->grid_cell()->compound_amount(); parent_secretion_error_ = 0.0; if (replic_report != NULL) { parent_secretion_error_ = replic_report->parent_secretion_error(); } } else { secretion_error_ = 0.0; secretion_fitness_ = 0.0; compound_amount_ = 0.0; parent_secretion_error_ = 0.0; } // Genes and RNA stats amount_of_dna_ = gen_unit.dna()->length(); nb_coding_rnas_ = gen_unit.nb_coding_RNAs(); nb_non_coding_rnas_ = gen_unit.nb_non_coding_RNAs(); av_size_coding_rnas_ = gen_unit.av_size_coding_RNAs(); av_size_non_coding_rnas_ = gen_unit.av_size_non_coding_RNAs(); nb_functional_genes_ = gen_unit.nb_functional_genes(); nb_non_functional_genes_ = gen_unit.nb_non_functional_genes(); av_size_functional_gene_ = gen_unit.av_size_functional_genes(); av_size_non_functional_gene_ = gen_unit.av_size_non_functional_genes(); // Non coding stats if (compute_non_coding) { nb_bases_in_0_CDS_ = gen_unit.nb_bases_in_0_CDS(); nb_bases_in_0_functional_CDS_ = gen_unit.nb_bases_in_0_functional_CDS(); nb_bases_in_0_non_functional_CDS_ = gen_unit.nb_bases_in_0_non_functional_CDS(); nb_bases_in_0_RNA_ = gen_unit.nb_bases_in_0_RNA(); nb_bases_in_0_coding_RNA_ = gen_unit.nb_bases_in_0_coding_RNA(); nb_bases_in_0_non_coding_RNA_ = gen_unit.nb_bases_in_0_non_coding_RNA(); nb_bases_non_essential_ = gen_unit.nb_bases_non_essential(); nb_bases_non_essential_including_nf_genes_ = gen_unit.nb_bases_non_essential_including_nf_genes(); } // Mutation stats if (replic_report != NULL) { nb_mut_ = replic_report->nb(S_MUT); nb_rear_ = replic_report->nb(REARR); nb_switch_ = replic_report->nb(SWITCH); nb_indels_ = replic_report->nb(INDEL); nb_dupl_ = replic_report->nb(DUPL); nb_del_ = replic_report->nb(DEL); nb_trans_ = replic_report->nb(TRANS); nb_inv_ = replic_report->nb(INV); // Rearrangement rate stats int32_t parent_genome_size = replic_report->parent_genome_size(); dupl_rate_ = nb_dupl_ / parent_genome_size; del_rate_ = nb_del_ / parent_genome_size; trans_rate_ = nb_trans_ / parent_genome_size; inv_rate_ = nb_inv_ / parent_genome_size; //~ // //~ if (nb_dupl_ + nb_del_ + nb_trans_ + nb_inv_ != 0) //~ { //~ printf("nb_dupl_ : %"PRId32"\n_nb_del : %"PRId32"\n_nb_trans : %"PRId32"\n_nb_inv : %"PRId32"\n", //~ (int32_t) nb_dupl_, (int32_t) nb_del_, (int32_t) nb_trans_, (int32_t) nb_inv_); //~ printf("parent genome size : %"PRId32"\n", parent_genome_size); //~ printf("dupl_rate_ : %f\n_del_rate : %f\n_trans_rate : %f\n_inv_rate : %f\n", //~ dupl_rate_, del_rate_, trans_rate_, inv_rate_); //~ getchar(); //~ } //~ // mean_align_score_ = replic_report->mean_align_score(); } } else if (chrom_or_gu == ALL_GU) { // ------------------------------------------------- // Compute statistical data for the given individual // ------------------------------------------------- // Metabolic error stats metabolic_error_ = (double) indiv->dist_to_target_by_feature(METABOLISM); metabolic_fitness_ = (double) indiv->fitness_by_feature(METABOLISM); parent_metabolic_error_ = (replic_report != NULL) ? replic_report->parent_metabolic_error() : 0.0; // Fitness fitness_ = indiv->fitness(); // Secretion stats if (exp_s->with_secretion()) { secretion_error_ = (double) indiv->dist_to_target_by_feature(SECRETION); secretion_fitness_ = (double) indiv->fitness_by_feature(SECRETION); compound_amount_ = (double) indiv->grid_cell()->compound_amount(); parent_secretion_error_ = 0.0; if (replic_report != NULL) { parent_secretion_error_ = replic_report->parent_secretion_error(); } } else { secretion_error_ = 0.0; secretion_fitness_ = 0.0; compound_amount_ = 0.0; parent_secretion_error_ = 0.0; } for (auto& gen_unit: indiv->genetic_unit_list_nonconst()) { // Genes and RNA stats amount_of_dna_ += gen_unit.dna()->length(); nb_coding_rnas_ += gen_unit.nb_coding_RNAs(); nb_non_coding_rnas_ += gen_unit.nb_non_coding_RNAs(); av_size_coding_rnas_ += gen_unit.av_size_coding_RNAs(); av_size_non_coding_rnas_ += gen_unit.av_size_non_coding_RNAs(); nb_functional_genes_ += gen_unit.nb_functional_genes(); nb_non_functional_genes_ += gen_unit.nb_non_functional_genes(); av_size_functional_gene_ += gen_unit.av_size_functional_genes(); av_size_non_functional_gene_ += gen_unit.av_size_non_functional_genes(); // Non coding stats if (compute_non_coding) { nb_bases_in_0_CDS_ += gen_unit.nb_bases_in_0_CDS(); nb_bases_in_0_functional_CDS_ += gen_unit.nb_bases_in_0_functional_CDS(); nb_bases_in_0_non_functional_CDS_ += gen_unit.nb_bases_in_0_non_functional_CDS(); nb_bases_in_0_RNA_ += gen_unit.nb_bases_in_0_RNA(); nb_bases_in_0_coding_RNA_ += gen_unit.nb_bases_in_0_coding_RNA(); nb_bases_in_0_non_coding_RNA_ += gen_unit.nb_bases_in_0_non_coding_RNA(); nb_bases_non_essential_ += gen_unit.nb_bases_non_essential(); nb_bases_non_essential_including_nf_genes_ += gen_unit.nb_bases_non_essential_including_nf_genes(); } // Mutation stats if (replic_report != NULL) { nb_mut_ += replic_report->nb(S_MUT); nb_rear_ += replic_report->nb(REARR); nb_switch_ += replic_report->nb(SWITCH); nb_indels_ += replic_report->nb(INDEL); nb_dupl_ += replic_report->nb(DUPL); nb_del_ += replic_report->nb(DEL); nb_trans_ += replic_report->nb(TRANS); nb_inv_ += replic_report->nb(INV); } } // Rearrangement rate stats if (replic_report != NULL) { int32_t parent_genome_size = replic_report->parent_genome_size(); dupl_rate_ = nb_dupl_ / parent_genome_size; del_rate_ = nb_del_ / parent_genome_size; trans_rate_ = nb_trans_ / parent_genome_size; inv_rate_ = nb_inv_ / parent_genome_size; mean_align_score_ = replic_report->mean_align_score(); } } else // => We have a multi-GU individual and we want only the main chromosome or only the plasmids // WARNING (TODO) As it is coded, this will work only if there is ONE SINGLE PLASMID! { if (chrom_or_gu != PLASMIDS and chrom_or_gu != CHROM) { printf("%s: error: StatRecord called with inappropriate `chrom_or_gu`\n", __FILE__); exit(EXIT_FAILURE); } GeneticUnit& gen_unit = (chrom_or_gu == PLASMIDS) ? *std::next(indiv->genetic_unit_list_nonconst().begin()) : indiv->genetic_unit_list_nonconst().front(); // ------------------------------------------------- // Compute statistical data for the given individual // ------------------------------------------------- // Metabolic error stats metabolic_error_ = (double) gen_unit.dist_to_target_by_feature(METABOLISM); metabolic_fitness_ = (double) gen_unit.fitness_by_feature(METABOLISM); parent_metabolic_error_ = (replic_report != NULL) ? replic_report->parent_metabolic_error() : 0.0; // Fitness fitness_ = indiv->fitness(); // Secretion stats if (exp_s->with_secretion()) { secretion_error_ = (double) gen_unit.dist_to_target_by_feature(SECRETION); secretion_fitness_ = (double) gen_unit.fitness_by_feature(SECRETION); compound_amount_ = (double) indiv->grid_cell()->compound_amount(); parent_secretion_error_ = 0.0; if (replic_report != NULL) { parent_secretion_error_ = replic_report->parent_secretion_error(); } } else { secretion_error_ = 0.0; secretion_fitness_ = 0.0; compound_amount_ = 0.0; parent_secretion_error_ = 0.0; } // Genes and RNA stats amount_of_dna_ = gen_unit.dna()->length(); nb_coding_rnas_ = gen_unit.nb_coding_RNAs(); nb_non_coding_rnas_ = gen_unit.nb_non_coding_RNAs(); av_size_coding_rnas_ = gen_unit.av_size_coding_RNAs(); av_size_non_coding_rnas_ = gen_unit.av_size_non_coding_RNAs(); nb_functional_genes_ = gen_unit.nb_functional_genes(); nb_non_functional_genes_ = gen_unit.nb_non_functional_genes(); av_size_functional_gene_ = gen_unit.av_size_functional_genes(); av_size_non_functional_gene_ = gen_unit.av_size_non_functional_genes(); // Non coding stats if (compute_non_coding) { nb_bases_in_0_CDS_ = gen_unit.nb_bases_in_0_CDS(); nb_bases_in_0_functional_CDS_ = gen_unit.nb_bases_in_0_functional_CDS(); nb_bases_in_0_non_functional_CDS_ = gen_unit.nb_bases_in_0_non_functional_CDS(); nb_bases_in_0_RNA_ = gen_unit.nb_bases_in_0_RNA(); nb_bases_in_0_coding_RNA_ = gen_unit.nb_bases_in_0_coding_RNA(); nb_bases_in_0_non_coding_RNA_ = gen_unit.nb_bases_in_0_non_coding_RNA(); nb_bases_non_essential_ = gen_unit.nb_bases_non_essential(); nb_bases_non_essential_including_nf_genes_ = gen_unit.nb_bases_non_essential_including_nf_genes(); } // Mutation stats // TODO Disabled // if (gen_unit.dna()->replication_report() != NULL) // { // nb_mut_ = gen_unit.dna()->replication_report()->nb(S_MUT); // nb_rear_ = gen_unit.dna()->replication_report()->nb(REARR); // nb_switch_ = gen_unit.dna()->replication_report()->nb(SWITCH); // nb_indels_ = gen_unit.dna()->replication_report()->nb(INDEL); // nb_dupl_ = gen_unit.dna()->replication_report()->nb(DUPL); // nb_del_ = gen_unit.dna()->replication_report()->nb(DEL); // nb_trans_ = gen_unit.dna()->replication_report()->nb(TRANS); // nb_inv_ = gen_unit.dna()->replication_report()->nb(INV); // } // Rearrangement rate stats if (replic_report != NULL) { int32_t parent_genome_size = replic_report->parent_genome_size(); dupl_rate_ = nb_dupl_ / parent_genome_size; del_rate_ = nb_del_ / parent_genome_size; trans_rate_ = nb_trans_ / parent_genome_size; inv_rate_ = nb_inv_ / parent_genome_size; mean_align_score_ = replic_report->mean_align_score(); } } } // Calculate average statistics for all the recorded values StatRecord::StatRecord(ExpSetup* exp_s, std::list> annotated_indivs, chrom_or_gen_unit chrom_or_gu) { record_type_ = POP; // --------------- // Simulation data // --------------- pop_size_ = static_cast(annotated_indivs.size()); // ------------------------------------------------------------------ // Compute statistical data for the each individual in the population // ------------------------------------------------------------------ for (const auto& annotated_indiv : annotated_indivs) { StatRecord indiv_stat_record(exp_s, annotated_indiv.first, annotated_indiv.second, chrom_or_gu, false); this->add(&indiv_stat_record, annotated_indiv.first->id()); } // ------------------------------------------------------------------ // Divide every accumulator by the number of indivs in the population // ------------------------------------------------------------------ this->divide(pop_size_); } // Calculate standard deviation for all the recorded values StatRecord::StatRecord(ExpSetup* exp_s, std::list> annotated_indivs, const StatRecord * means, chrom_or_gen_unit chrom_or_gu) { record_type_ = STDEVS; // --------------- // Simulation data // --------------- pop_size_ = static_cast(annotated_indivs.size()); // ------------------------------------------------------------------ // Compute statistical data for the each individual in the population // ------------------------------------------------------------------ for (const auto& annotated_indiv : annotated_indivs) { StatRecord indiv_stat_record(exp_s, annotated_indiv.first, annotated_indiv.second, chrom_or_gu, false); this->substract_power(means, &indiv_stat_record, 2); } // --------------------------------------------------------------------------------- // Divide every accumulator by the square root of number of indivs in the population // --------------------------------------------------------------------------------- this->divide(pow((pop_size_-1), 0.5)); } // Calculate skewness for all the recorded values StatRecord::StatRecord(ExpSetup* exp_s, std::list> annotated_indivs, const StatRecord* means, const StatRecord* stdevs, chrom_or_gen_unit chrom_or_gu) { record_type_ = SKEWNESS; // --------------- // Simulation data // --------------- pop_size_ = static_cast(annotated_indivs.size()); // ------------------------------------------------------------------ // Compute statistical data for the each individual in the population // ------------------------------------------------------------------ for (const auto& annotated_indiv : annotated_indivs) { StatRecord indiv_stat_record(exp_s, annotated_indiv.first, annotated_indiv.second, chrom_or_gu, false); this->substract_power(means, &indiv_stat_record, 3); } this->divide(-pop_size_); this->divide_record(stdevs, 3/2); } // ================================================================= // Destructors // ================================================================= StatRecord::~StatRecord() { } // ================================================================= // Public Methods // ================================================================= void StatRecord::write_to_file(FILE* stat_file, stats_type stat_type_to_print) const { if (stat_type_to_print == FITNESS_STATS) { fprintf(stat_file, "%" PRId64 " %" PRId32 " %e %" PRId32 " %e %e %e %e %e %e %e", AeTime::time(), pop_size_, fitness_, amount_of_dna_, metabolic_error_, parent_metabolic_error_, metabolic_fitness_, secretion_error_, parent_secretion_error_, secretion_fitness_, compound_amount_); #ifdef __REGUL fprintf(stat_file, " %" PRId32 " %" PRId32 " %" PRId32 " %f %f %f", nb_influences_, nb_enhancing_influences_, nb_operating_influences_, av_value_influences_, av_value_enhancing_influences_, av_value_operating_influences_); #endif } if (stat_type_to_print == MUTATION_STATS) { fprintf(stat_file, "%" PRId64 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 "", AeTime::time(), nb_mut_, nb_rear_, nb_switch_, nb_indels_, nb_dupl_, nb_del_, nb_trans_, nb_inv_); } if (stat_type_to_print == GENES_STATS) { fprintf(stat_file, "%" PRId64 " %" PRId32 " %" PRId32 " %f %f %" PRId32 " %" PRId32 " %f %f ", AeTime::time(), nb_coding_rnas_, nb_non_coding_rnas_, av_size_coding_rnas_, av_size_non_coding_rnas_, nb_functional_genes_, nb_non_functional_genes_, av_size_functional_gene_, av_size_non_functional_gene_); } if (stat_type_to_print == BP_STATS) { if (record_type_ == INDIV) { fprintf(stat_file, "%" PRId64 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 "", AeTime::time(), nb_bases_in_0_CDS_, nb_bases_in_0_functional_CDS_, nb_bases_in_0_non_functional_CDS_, nb_bases_in_0_RNA_, nb_bases_in_0_coding_RNA_, nb_bases_in_0_non_coding_RNA_, nb_bases_non_essential_, nb_bases_non_essential_including_nf_genes_); } else // if record_type_ == POP { // TO DO (if needed) : base-pair stats for all individuals, not just for the best one. // // fprintf(stat_file, "%" PRId64 " %f %f %f %f %f %f %f %f", // AeTime::time(), // nb_bases_in_0_CDS_, // nb_bases_in_0_functional_CDS_, // nb_bases_in_0_non_functional_CDS_, // nb_bases_in_0_RNA_, // nb_bases_in_0_coding_RNA_, // nb_bases_in_0_non_coding_RNA_, // nb_bases_non_essential_, // nb_bases_non_essential_including_nf_genes_); } } if (stat_type_to_print == REAR_STATS) { fprintf(stat_file, "%" PRId64 " %e %e %e %e %f", AeTime::time(), dupl_rate_, del_rate_, trans_rate_, inv_rate_, mean_align_score_); } fprintf(stat_file, "\n"); } void StatRecord::divide(double divisor) { // NB : pop_size is a "global" value and must not be divided. fitness_ /= divisor; metabolic_error_ /= divisor; parent_metabolic_error_ /= divisor; metabolic_fitness_ /= divisor; secretion_error_ /= divisor; parent_secretion_error_ /= divisor; secretion_fitness_ /= divisor; compound_amount_ /= divisor; amount_of_dna_ /= divisor; nb_coding_rnas_ /= divisor; nb_non_coding_rnas_ /= divisor; av_size_coding_rnas_ /= divisor; av_size_non_coding_rnas_ /= divisor; nb_functional_genes_ /= divisor; nb_non_functional_genes_ /= divisor; av_size_functional_gene_ /= divisor; av_size_non_functional_gene_ /= divisor; nb_mut_ /= divisor; nb_rear_ /= divisor; nb_switch_ /= divisor; nb_indels_ /= divisor; nb_dupl_ /= divisor; nb_del_ /= divisor; nb_trans_ /= divisor; nb_inv_ /= divisor; //~ printf("PREFINAL %f %f %f %f\n", dupl_rate_, del_rate_, trans_rate_, inv_rate_); dupl_rate_ /= divisor; del_rate_ /= divisor; trans_rate_ /= divisor; inv_rate_ /= divisor; //~ printf("FINAL %f %f %f %f\n", dupl_rate_, del_rate_, trans_rate_, inv_rate_); //~ getchar(); mean_align_score_ /= divisor; nb_bases_in_0_CDS_ /= divisor; nb_bases_in_0_functional_CDS_ /= divisor; nb_bases_in_0_non_functional_CDS_ /= divisor; nb_bases_in_0_RNA_ /= divisor; nb_bases_in_0_coding_RNA_ /= divisor; nb_bases_in_0_non_coding_RNA_ /= divisor; nb_bases_non_essential_ /= divisor; nb_bases_non_essential_including_nf_genes_ /= divisor; #ifdef __REGUL nb_influences_ /= divisor; nb_enhancing_influences_ /= divisor; nb_operating_influences_ /= divisor; av_value_influences_ /= divisor; av_value_enhancing_influences_ /= divisor; av_value_operating_influences_ /= divisor; #endif } void StatRecord::divide_record(const StatRecord* to_divide, double power) { // NB : pop_size is a "global" value and must not be divided. if (to_divide->fitness_ != 0) { fitness_ /= pow(to_divide->fitness_, power); } if (to_divide->metabolic_error_ != 0) { metabolic_error_ /= pow(to_divide->metabolic_error_, power); } if (to_divide->parent_metabolic_error_ != 0) { parent_metabolic_error_ /= pow(to_divide->parent_metabolic_error_, power); } if (to_divide->metabolic_fitness_ != 0) { metabolic_fitness_ /= pow(to_divide->metabolic_fitness_, power); } if (to_divide->secretion_error_ != 0) { secretion_error_ /= pow(to_divide->secretion_error_, power); } if (to_divide->parent_secretion_error_ != 0) { parent_secretion_error_ /= pow(to_divide->parent_secretion_error_, power); } if (to_divide->secretion_fitness_ != 0) { secretion_fitness_ /= pow(to_divide->secretion_fitness_, power); } if (to_divide->compound_amount_ != 0) { compound_amount_ /= pow(to_divide->compound_amount_, power); } if (to_divide->amount_of_dna_ != 0) { amount_of_dna_ /= pow(to_divide->amount_of_dna_, power); } if (to_divide->nb_coding_rnas_ != 0) { nb_coding_rnas_ /= pow(to_divide->nb_coding_rnas_, power); } if (to_divide->nb_non_coding_rnas_ != 0) { nb_non_coding_rnas_ /= pow(to_divide->nb_non_coding_rnas_, power); } if (to_divide->av_size_coding_rnas_ != 0) { av_size_coding_rnas_ /= pow(to_divide->av_size_coding_rnas_, power); } if (to_divide->av_size_non_coding_rnas_ != 0) { av_size_non_coding_rnas_ /= pow(to_divide->av_size_non_coding_rnas_, power); } if (to_divide->nb_functional_genes_ != 0) { nb_functional_genes_ /= pow(to_divide->nb_functional_genes_, power); } if (to_divide->nb_non_functional_genes_ != 0) { nb_non_functional_genes_ /= pow(to_divide->nb_non_functional_genes_, power); } if (to_divide->av_size_functional_gene_ != 0) { av_size_functional_gene_ /= pow(to_divide->av_size_functional_gene_, power); } if (to_divide->av_size_non_functional_gene_ != 0) { av_size_non_functional_gene_ /= pow(to_divide->av_size_non_functional_gene_, power); } if (to_divide->nb_mut_ != 0) { nb_mut_ /= pow(to_divide->nb_mut_, power); } if (to_divide->nb_rear_ != 0) { nb_rear_ /= pow(to_divide->nb_rear_, power); } if (to_divide->nb_switch_ != 0) { nb_switch_ /= pow(to_divide->nb_switch_, power); } if (to_divide->nb_indels_ != 0) { nb_indels_ /= pow(to_divide->nb_indels_, power); } if (to_divide->nb_dupl_ != 0) { nb_dupl_ /= pow(to_divide->nb_dupl_, power); } if (to_divide->nb_del_ != 0) { nb_del_ /= pow(to_divide->nb_del_, power); } if (to_divide->nb_trans_ != 0) { nb_trans_ /= pow(to_divide->nb_trans_, power); } if (to_divide->nb_inv_ != 0) { nb_inv_ /= pow(to_divide->nb_inv_, power); } if (to_divide->dupl_rate_ != 0) { dupl_rate_ /= pow(to_divide->dupl_rate_, power); } if (to_divide->del_rate_ != 0) { del_rate_ /= pow(to_divide->del_rate_, power); } if (to_divide->trans_rate_ != 0) { trans_rate_ /= pow(to_divide->trans_rate_, power); } if (to_divide->inv_rate_ != 0) { inv_rate_ /= pow(to_divide->inv_rate_, power); } if (to_divide->mean_align_score_ != 0) { mean_align_score_ /= pow(to_divide->mean_align_score_, power); } if (to_divide->nb_bases_in_0_CDS_ != 0) { nb_bases_in_0_CDS_ /= pow(to_divide->nb_bases_in_0_CDS_, power); } if (to_divide->nb_bases_in_0_functional_CDS_ != 0) { nb_bases_in_0_functional_CDS_ /= pow(to_divide->nb_bases_in_0_functional_CDS_, power); } if (to_divide->nb_bases_in_0_non_functional_CDS_ != 0) { nb_bases_in_0_non_functional_CDS_ /= pow(to_divide->nb_bases_in_0_non_functional_CDS_, power); } if (to_divide->nb_bases_in_0_RNA_ != 0) { nb_bases_in_0_RNA_ /= pow(to_divide->nb_bases_in_0_RNA_, power); } if (to_divide->nb_bases_in_0_coding_RNA_ != 0) { nb_bases_in_0_coding_RNA_ /= pow(to_divide->nb_bases_in_0_coding_RNA_, power); } if (to_divide->nb_bases_in_0_non_coding_RNA_ != 0) { nb_bases_in_0_non_coding_RNA_ /= pow(to_divide->nb_bases_in_0_non_coding_RNA_, power); } if (to_divide->nb_bases_non_essential_ != 0) { nb_bases_non_essential_ /= pow(to_divide->nb_bases_non_essential_, power); } if (to_divide->nb_bases_non_essential_including_nf_genes_ != 0) { nb_bases_non_essential_including_nf_genes_ /= pow(to_divide->nb_bases_non_essential_including_nf_genes_, power); } #ifdef __REGUL if (to_divide->nb_influences_ != 0) { nb_influences_ /= pow(to_divide->nb_influences_, power); } if (to_divide->nb_enhancing_influences_ != 0) { nb_enhancing_influences_ /= pow(to_divide->nb_enhancing_influences_, power); } if (to_divide->nb_operating_influences_ != 0) { nb_operating_influences_ /= pow(to_divide->nb_operating_influences_, power); } if (to_divide->av_value_influences_ != 0) { av_value_influences_ /= pow(to_divide->av_value_influences_, power); } if (to_divide->av_value_enhancing_influences_ != 0) { av_value_enhancing_influences_ /= pow(to_divide->av_value_enhancing_influences_, power); } if (to_divide->av_value_operating_influences_ != 0) { av_value_operating_influences_ /= pow(to_divide->av_value_operating_influences_, power); } #endif } void StatRecord::add(StatRecord * to_add, int32_t index) { // NB : pop_size is a global values and must not be summed. fitness_ += to_add->fitness_; metabolic_error_ += to_add->metabolic_error_; parent_metabolic_error_ += to_add->parent_metabolic_error_; metabolic_fitness_ += to_add->metabolic_fitness_; secretion_error_ += to_add->secretion_error_; parent_secretion_error_ += to_add->parent_secretion_error_; secretion_fitness_ += to_add->secretion_fitness_; compound_amount_ += to_add->compound_amount_; amount_of_dna_ += to_add->amount_of_dna_; nb_coding_rnas_ += to_add->nb_coding_rnas_; nb_non_coding_rnas_ += to_add->nb_non_coding_rnas_; av_size_coding_rnas_ += to_add->av_size_coding_rnas_; av_size_non_coding_rnas_ += to_add->av_size_non_coding_rnas_; nb_functional_genes_ += to_add->nb_functional_genes_; nb_non_functional_genes_ += to_add->nb_non_functional_genes_; av_size_functional_gene_ += to_add->av_size_functional_gene_; av_size_non_functional_gene_ += to_add->av_size_non_functional_gene_; nb_mut_ += to_add->nb_mut_; nb_rear_ += to_add->nb_rear_; nb_switch_ += to_add->nb_switch_; nb_indels_ += to_add->nb_indels_; nb_dupl_ += to_add->nb_dupl_; nb_del_ += to_add->nb_del_; nb_trans_ += to_add->nb_trans_; nb_inv_ += to_add->nb_inv_; dupl_rate_ += to_add->dupl_rate_; del_rate_ += to_add->del_rate_; trans_rate_ += to_add->trans_rate_; inv_rate_ += to_add->inv_rate_; //~ printf("%f %f %f %f\n", to_add->dupl_rate_, to_add->del_rate_, to_add->trans_rate_, to_add->inv_rate_); mean_align_score_ += to_add->mean_align_score_; nb_bases_in_0_CDS_ += to_add->nb_bases_in_0_CDS_; nb_bases_in_0_functional_CDS_ += to_add->nb_bases_in_0_functional_CDS_; nb_bases_in_0_non_functional_CDS_ += to_add->nb_bases_in_0_non_functional_CDS_; nb_bases_in_0_RNA_ += to_add->nb_bases_in_0_RNA_; nb_bases_in_0_coding_RNA_ += to_add->nb_bases_in_0_coding_RNA_; nb_bases_in_0_non_coding_RNA_ += to_add->nb_bases_in_0_non_coding_RNA_; nb_bases_non_essential_ += to_add->nb_bases_non_essential_; nb_bases_non_essential_including_nf_genes_ += to_add->nb_bases_non_essential_including_nf_genes_; #ifdef __REGUL nb_influences_ += to_add->nb_influences_; nb_enhancing_influences_ += to_add->nb_enhancing_influences_; nb_operating_influences_ += to_add->nb_operating_influences_; av_value_influences_ += to_add->av_value_influences_; av_value_enhancing_influences_ += to_add->av_value_enhancing_influences_; av_value_operating_influences_ += to_add->av_value_operating_influences_; #endif } void StatRecord::substract_power(const StatRecord * means, const StatRecord * to_substract, double power) { // NB : pop_size is a "global" value and must not be summed. fitness_ += pow(means->fitness_ - to_substract->fitness_, power); metabolic_error_ += pow(means->metabolic_error_ - to_substract->metabolic_error_, power); parent_metabolic_error_ += pow(means->parent_metabolic_error_ - to_substract->parent_metabolic_error_, power); metabolic_fitness_ += pow(means->metabolic_fitness_ - to_substract->metabolic_fitness_, power); secretion_error_ += pow(means->secretion_error_ - to_substract->secretion_error_, power); parent_secretion_error_ += pow(means->parent_secretion_error_ - to_substract->parent_secretion_error_, power); secretion_fitness_ += pow(means->secretion_fitness_ - to_substract->secretion_fitness_, power); compound_amount_ += pow(means->compound_amount_ - to_substract->compound_amount_, power); amount_of_dna_ += pow(means->amount_of_dna_ - to_substract->amount_of_dna_, power); nb_coding_rnas_ += pow(means->nb_coding_rnas_ - to_substract->nb_coding_rnas_, power); nb_non_coding_rnas_ += pow(means->nb_non_coding_rnas_ - to_substract->nb_non_coding_rnas_, power); av_size_coding_rnas_ += pow(means->av_size_coding_rnas_ - to_substract->av_size_coding_rnas_, power); av_size_non_coding_rnas_ += pow(means->av_size_non_coding_rnas_ - to_substract->av_size_non_coding_rnas_, power); nb_functional_genes_ += pow(means->nb_functional_genes_ - to_substract->nb_functional_genes_, power); nb_non_functional_genes_ += pow(means->nb_non_functional_genes_ - to_substract->nb_non_functional_genes_, power); av_size_functional_gene_ += pow(means->av_size_functional_gene_ - to_substract->av_size_functional_gene_, power); av_size_non_functional_gene_ += pow(means->av_size_non_functional_gene_ - to_substract->av_size_non_functional_gene_, power); nb_mut_ += pow(means->nb_mut_ - to_substract->nb_mut_, power); nb_rear_ += pow(means->nb_rear_ - to_substract->nb_rear_, power); nb_switch_ += pow(means->nb_switch_ - to_substract->nb_switch_, power); nb_indels_ += pow(means->nb_indels_ - to_substract->nb_indels_, power); nb_dupl_ += pow(means->nb_dupl_ - to_substract->nb_dupl_, power); nb_del_ += pow(means->nb_del_ - to_substract->nb_del_, power); nb_trans_ += pow(means->nb_trans_ - to_substract->nb_trans_, power); nb_inv_ += pow(means->nb_inv_ - to_substract->nb_inv_, power); dupl_rate_ += pow(means->dupl_rate_ - to_substract->dupl_rate_, power); del_rate_ += pow(means->del_rate_ - to_substract->del_rate_, power); trans_rate_ += pow(means->trans_rate_ - to_substract->trans_rate_, power); inv_rate_ += pow(means->inv_rate_ - to_substract->inv_rate_, power); mean_align_score_ += pow(means->mean_align_score_ - to_substract->mean_align_score_, power); nb_bases_in_0_CDS_ += pow(means->nb_bases_in_0_CDS_ - to_substract->nb_bases_in_0_CDS_, power); nb_bases_in_0_functional_CDS_ += pow(means->nb_bases_in_0_functional_CDS_ - to_substract->nb_bases_in_0_functional_CDS_, power); nb_bases_in_0_non_functional_CDS_ += pow(means->nb_bases_in_0_non_functional_CDS_ - to_substract->nb_bases_in_0_non_functional_CDS_, power); nb_bases_in_0_RNA_ += pow(means->nb_bases_in_0_RNA_ - to_substract->nb_bases_in_0_RNA_, power); nb_bases_in_0_coding_RNA_ += pow(means->nb_bases_in_0_coding_RNA_ - to_substract->nb_bases_in_0_coding_RNA_, power); nb_bases_in_0_non_coding_RNA_ += pow(means->nb_bases_in_0_non_coding_RNA_ - to_substract->nb_bases_in_0_non_coding_RNA_, power); nb_bases_non_essential_ += pow(means->nb_bases_non_essential_ - to_substract->nb_bases_non_essential_, power); nb_bases_non_essential_including_nf_genes_ += pow(means->nb_bases_non_essential_including_nf_genes_ - to_substract->nb_bases_non_essential_including_nf_genes_, power); #ifdef __REGUL nb_influences_ += pow(means->nb_influences_ - to_substract->nb_influences_, power); nb_enhancing_influences_ += pow(means->nb_enhancing_influences_ - to_substract->nb_enhancing_influences_, power); nb_operating_influences_ += pow(means->nb_operating_influences_ - to_substract->nb_operating_influences_, power); av_value_influences_ += pow(means->av_value_influences_ - to_substract->av_value_influences_, power); av_value_enhancing_influences_ += pow(means->av_value_enhancing_influences_ - to_substract->av_value_enhancing_influences_, power); av_value_operating_influences_ += pow(means->av_value_operating_influences_ - to_substract->av_value_operating_influences_, power); #endif } // ================================================================= // Protected Methods // ================================================================= } // namespace aevol aevol-5.0/src/libaevol/SmallInsertion.h0000644000175000017500000001030412724051151015101 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_SMALLINSERTION_H_ #define AEVOL_SMALLINSERTION_H_ // ============================================================================ // Includes // ============================================================================ #include #include "LocalMutation.h" namespace aevol { /** * */ class SmallInsertion : public LocalMutation { public : // ========================================================================== // Constructors // ========================================================================== SmallInsertion() = default; //< Default ctor SmallInsertion(const SmallInsertion&); //< Copy ctor SmallInsertion(SmallInsertion&&) = delete; //< Move ctor SmallInsertion(int32_t pos, int32_t length, const char* seq); virtual Mutation* Clone() const override { return new SmallInsertion(*this); }; // ========================================================================== // Destructor // ========================================================================== virtual ~SmallInsertion() noexcept; //< Destructor // ========================================================================== // Operators // ========================================================================== /// Copy assignment SmallInsertion& operator=(const SmallInsertion& other); /// Move assignment SmallInsertion& operator=(SmallInsertion&& other) = delete; // ========================================================================== // Public Methods // ========================================================================== virtual void save(gzFile backup_file) const override; virtual void load(gzFile backup_file) override; void generic_description_string(char* str) const override; // ========================================================================== // Getters // ========================================================================== virtual MutationType mut_type() const override { return S_INS; }; int32_t pos() const { return pos_; }; int32_t length() const { return length_; }; char* seq() const { return seq_; }; // ========================================================================== // Setters // ========================================================================== protected : // ========================================================================== // Protected Methods // ========================================================================== // ========================================================================== // Attributes // ========================================================================== int32_t pos_; int32_t length_; char* seq_; }; } // namespace aevol #endif //AEVOL_SMALLINSERTION_H_ aevol-5.0/src/libaevol/Dna.cpp0000644000175000017500000034715012726277112013220 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ================================================================= // Includes // ================================================================= #include "Dna.h" #include #include #include #include #include #include #include "ExpManager.h" #include "ExpSetup.h" #include "GeneticUnit.h" #include "Individual.h" #include "Rna.h" #include "Utils.h" #include "VisAVis.h" #include "Alignment.h" #include "Mutation.h" #include "PointMutation.h" #include "SmallInsertion.h" #include "SmallDeletion.h" #include "Duplication.h" #include "Deletion.h" #include "Translocation.h" #include "Inversion.h" #include "InsertionHT.h" #include "ReplacementHT.h" namespace aevol { // ########################################################################### // // Class Dna // // ########################################################################### // ================================================================= // Definition of static attributes // ================================================================= // ================================================================= // Constructors // ================================================================= /** * Create a random dna sequence of length belonging to . */ Dna::Dna(GeneticUnit* gen_unit, int32_t length, std::shared_ptr prng) : ae_string(length, prng) { gen_unit_ = gen_unit; exp_m_ = gen_unit->exp_m(); indiv_ = gen_unit->indiv(); } /** * Create a new piece of dna identical to the model but belonging to */ Dna::Dna(GeneticUnit* gen_unit, const Dna& model) : ae_string(model) { gen_unit_ = gen_unit; exp_m_ = gen_unit->exp_m(); indiv_ = gen_unit->indiv(); } /** * Create a new piece of dna identical to the parent's but belonging to * */ Dna::Dna(GeneticUnit* gen_unit, Dna* const parent_dna) : ae_string(parent_dna->data_, parent_dna->length_) { gen_unit_ = gen_unit; exp_m_ = gen_unit->exp_m(); indiv_ = gen_unit->indiv(); } /** * Create a new piece of dna with sequence (of length ). * WARNING : will be used directly as the new dna sequence (it will not * be copied), which means the caller must not delete it. */ // TODO(dpa) make seq a rvalue ref and set it to NULL ? Dna::Dna(GeneticUnit* gen_unit, char* seq, int32_t length) : ae_string(seq, length, true) { gen_unit_ = gen_unit; exp_m_ = gen_unit->exp_m(); indiv_ = gen_unit->indiv(); } /** * Load a piece of dna from */ Dna::Dna(GeneticUnit* gen_unit, gzFile backup_file) : ae_string(backup_file) { gen_unit_ = gen_unit; exp_m_ = gen_unit->exp_m(); indiv_ = gen_unit->indiv(); } /** * Create a dna sequence from a text file */ Dna::Dna(GeneticUnit* gen_unit, char* organism_file_name) : ae_string(organism_file_name) { gen_unit_ = gen_unit; exp_m_ = gen_unit->exp_m(); indiv_ = gen_unit->indiv(); } // ================================================================= // Destructors // ================================================================= Dna::~Dna() = default; // ================================================================= // Non inline Accessors // ================================================================= char* Dna::subsequence(int32_t from, int32_t to, Strand strand) const { char* subseq = NULL; from = Utils::mod(from, length_); to = Utils::mod(to, length_); if (strand == LEADING) { if (from < to) { subseq = new char[to - from + 1]; subseq[to - from] = '\0'; strncpy(subseq, &(data_[from]), to - from); } else { subseq = new char[length_ - from + to + 1]; subseq[length_ - from + to] = '\0'; strncpy(subseq, &(data_[from]), length_ - from); strncpy(&subseq[length_ - from], data_, to); } } else { // if (strand == LAGGING) if (from > to) { subseq = new char[from - to + 1]; subseq[from - to] = '\0'; for (int32_t i = 0; i < from - to; i++) { subseq[i] = (data_[from - 1 - i] == '1') ? '0' : '1'; } } else { subseq = new char[from + length_ - to + 1]; subseq[from + length_ - to] = '\0'; for (int32_t i = 0; i < from; i++) { subseq[i] = (data_[from - 1 - i] == '1') ? '0' : '1'; } for (int32_t i = 0; i < length_ - to; i++) { subseq[from + i] = (data_[length_ - 1 - i] == '1') ? '0' : '1'; } } } return subseq; } // ================================================================= // Public Methods // ================================================================= /// Perform mutations and record how many of them occurred int32_t Dna::perform_mutations(int32_t parent_id) { int32_t nb_events = 0; if (indiv_->with_HT()) nb_events += do_transfer(parent_id); if (indiv_->with_alignments()) nb_events += do_rearrangements_with_align(); else nb_events += do_rearrangements(); nb_events += do_small_mutations(); return nb_events; } int32_t Dna::do_small_mutations() { // ============================================================== // 1. Compute how many rearrangements this genome will undertake // ============================================================== // // Given the rate p (by nucl.) of insertion - for instance -, the number of // insertions we perform on the genome follows a binomial law B(n,p), with // n = genome length. int32_t nb_swi = indiv_->mut_prng_-> binomial_random(length_, indiv_->point_mutation_rate()); int32_t nb_ins = indiv_->mut_prng_-> binomial_random(length_, indiv_->small_insertion_rate()); int32_t nb_del = indiv_->mut_prng_-> binomial_random(length_, indiv_->small_deletion_rate()); int32_t nb_mut = nb_swi + nb_ins + nb_del; // ==================================================== // 2. Perform those small mutations in a random order // ==================================================== // // We put the 'nb_small_mutations_' mutation events in an "urn". // Then we repeat a random drawing of one mutation event in this urn, // without replacement, until no mutation event is left in the urn. // Here is the "urn" we use at the beginning: // // ----------------------------------------------------------- // | swi | swi | swi | ins | ins | ins | del | del | del | del | // ----------------------------------------------------------- // ^ ^ ^ // nb_swi nb_swi nb_swi // +nb_ins +nb_ins // +nb_del // // Random draw of one mutation = random draw of one position in this "urn". // Given this position, we know what kind of mutation we have drawn. int32_t random_value; Mutation* mut = nullptr; for (int32_t i = nb_mut; i >= 1; i--) { random_value = indiv_->mut_prng_->random(i); if (random_value < nb_swi) { mut = do_switch(); nb_swi--; // updating the urn (no replacement!)... } else if (random_value < nb_swi + nb_ins) { mut = do_small_insertion(); nb_ins--; } else { // (random_value >= nb_swi + nb_ins) => del mut = do_small_deletion(); nb_del--; } // Record mutation in tree if (mut != NULL) { indiv_->notifyObservers(MUTATION, mut); delete mut; } } return nb_mut; } int32_t Dna::do_rearrangements() { // ============================================================== // 1. Compute how many rearrangements this genome will undertake // ============================================================== // // Given the rate p (by nucl.) of duplication - for instance -, the number of // duplications we perform on the genome follows a binomial law B(n, p), with // n = genome length. int32_t nb_dupl = indiv_->mut_prng_-> binomial_random(length_, indiv_->duplication_rate()); int32_t nb_del = indiv_->mut_prng_-> binomial_random(length_, indiv_->deletion_rate()); int32_t nb_trans = indiv_->mut_prng_-> binomial_random(length_, indiv_->translocation_rate()); int32_t nb_inv = indiv_->mut_prng_-> binomial_random(length_, indiv_->inversion_rate()); int32_t nb_rear = nb_dupl + nb_del + nb_trans + nb_inv; // =================================================== // 2. Perform those rearrangements in a random order // =================================================== // // We put the nb_rea rearrangements in an "urn". Then we repeat a random draw // of one rearrangement in this urn, without replacement, until no rearrange- // -ment is left in the urn. Here is the "urn" we use at the beginning: // // ---------------------------------------------------------------- // | Dupl | Dupl | Del Del | Del | Trans | Trans | Inv | Inv | Inv | // ---------------------------------------------------------------- // ^ ^ ^ ^ // nb_dupl nb_dupl nb_dupl nb_dupl // +nb_del +nb_del +nb_del // +nb_trans +nb_trans // +nb_inv // // Random draw of one rearrangement = random draw of one position in this urn. // Given this position, we know what kind of rearrangement we have drawn. int32_t random_value; Mutation* mut = nullptr; for (int32_t i = nb_rear; i >= 1; i--) { random_value = indiv_->mut_prng_->random(i); if (random_value < nb_dupl) { mut = do_duplication(); nb_dupl--; // Updating the urn (no replacement!)... } else if (random_value < nb_dupl + nb_del) { mut = do_deletion(); nb_del--; } else if (random_value < nb_dupl + nb_del + nb_trans) { mut = do_translocation(); nb_trans--; } else { mut = do_inversion(); nb_inv--; } // Record rearrangement in tree if (mut != NULL) { indiv_->notifyObservers(MUTATION, mut); delete mut; } } return nb_rear; } int32_t Dna::do_rearrangements_with_align() { // Whether we look for a direct or indirect alignment bool direct_sense; // Determines the type of rearrangement that will be done if an alignment // is found double rand1 = 0.0; // Minimum alignment score needed to recombine (stochastic) int16_t needed_score; // Points defining the sequences between which we will look for an alignment int32_t seed1, seed2; // Indiv's Time To Live double ttl = 1.0; // Number of pairs of sequences we will try to align int32_t nb_pairs; // Keep trace of the original length of the genome int32_t genome_size = length_; int32_t nb_rearr = 0; Mutation* mut = nullptr; VisAVis* alignment = NULL; ///////////////////////////////////////////////////////////////////////////// // For each pair of points to be tested // (i.e. while the organism is still "alive"), // 1) Draw a random sense (direct or indirect). // 2) Determine the minimum alignment score needed for a rear to occur. // 3) Test the existence of an alignment with a high enough score. // 4) If such an alignment was found, determine the type of rear to be // performed and proceed (WARNING : translocations require another // alignment to be found between the sequence to be translocated and // the rest of the chromosome). // 5) If there was a change in the chromosome's length, update the // individual's TTL and nb_pairs according to new genome size. // 6) If there was a rearrangement, we either save its record in the tree or // delete it. ///////////////////////////////////////////////////////////////////////////// nb_pairs = static_cast( ceil(ttl * length_ * indiv_->neighbourhood_rate())); for (; nb_pairs > 0; nb_pairs--) { ///////////////////////////////////////////////// // 1) Draw a random sense (direct or indirect) // ///////////////////////////////////////////////// // Determine whether we look for a direct or indirect alignment direct_sense = (indiv_->mut_prng_->random() < 0.5); // Determine the type of rearrangement to be done. This is an // anticipation on step 4) for optimization purpose (save computation // time if the type of rear is "none" rand1 = indiv_->mut_prng_->random(); /////////////////////////////////////////////////////////////////////////// // 2) Determine the minimum alignment score needed for a rearrangement // to occur /////////////////////////////////////////////////////////////////////////// if (indiv_->align_fun_shape() == LINEAR) { needed_score = static_cast( ceil(indiv_->align_lin_min() + indiv_->mut_prng_->random() * (indiv_->align_lin_max() - indiv_->align_lin_min()))); } else { // I want the probability of rearrangement for an alignment of score // to be prob = 1 / (1 + exp(-(score-mean)/lambda)) // The score needed for a rearrangement to take place with a given random // drawing is hence needed_score = ceil(-lambda * log(1/rand - 1) + mean) needed_score = static_cast( ceil(-indiv_->align_sigm_lambda() * log(1 / indiv_->mut_prng_->random() - 1) + indiv_->align_sigm_mean())); if (needed_score < 0) needed_score = 0; //~ //~ FILE* tmp_file = fopen("scores.out", "a"); //~ fprintf(tmp_file, "%"PRId16"\n", needed_score); //~ fclose(tmp_file); //~ } // Determine where to look for an alignment (draw seeds) seed1 = indiv_->mut_prng_->random(length_); seed2 = indiv_->mut_prng_->random(length_); if (direct_sense) { if (rand1 >= indiv_->duplication_proportion() + indiv_->deletion_proportion() + indiv_->translocation_proportion()) { // rand1 corresponds to "no rearrangement" => Nothing to do continue; } //////////////////////////////////////////////////////////////////// // 3) Test the existence of an alignment with a high enough score // //////////////////////////////////////////////////////////////////// alignment = Alignment::search_alignment_direct(this, seed1, this, seed2, needed_score); if (alignment == NULL) { // No alignment found continue; } //~ printf("direct needed_score : %"PRId32"\n", needed_score); //////////////////////////////////////////////////////////////////////// // 4) Determine the type of rearrangement to be performed and proceed // //////////////////////////////////////////////////////////////////////// if (rand1 < indiv_->duplication_proportion()) { // Remember the length of the segment to be duplicated and of the // genome before the duplication int32_t segment_length = Utils::mod(alignment->i_2() - alignment->i_1(), length_); int32_t gu_size_before = length_; int32_t gu_size_after = gu_size_before + segment_length; int32_t genome_size_before = indiv_->amount_of_dna(); int32_t genome_size_after = genome_size_before + segment_length; if ((genome_size_after > indiv_->max_genome_length()) || (gu_size_after > gen_unit_->max_gu_length())) { if (exp_m_->output_m()->is_logged(LOG_BARRIER)) { // Write an entry in the barrier log file fprintf(exp_m_->output_m()->log(LOG_BARRIER), "%" PRId64 " %" PRId32 " DUPLICATION %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 "\n", AeTime::time(), indiv_->id(), segment_length, 0, gu_size_before, genome_size_before); } } else { // Perform in situ (tandem) DUPLICATION do_duplication(alignment->i_1(), alignment->i_2(), alignment->i_2()); // Report the duplication mut = new Duplication(alignment->i_1(), alignment->i_2(), alignment->i_2(), segment_length, needed_score); nb_rearr++; // Write a line in rearrangement logfile if (exp_m_->output_m()->is_logged(LOG_REAR)) { fprintf(exp_m_->output_m()->log(LOG_REAR), "%" PRId64 " %" PRId32 " %" PRId8 " %" PRId32 " %" PRId32 " %" PRId16 "\n", AeTime::time(), indiv_->id(), int8_t(DUPL), segment_length, genome_size_before, needed_score); } } } else if (rand1 < indiv_->duplication_proportion() + indiv_->deletion_proportion()) { // Remember the length of the segment to be duplicated and of the // genome before the deletion int32_t segment_length = Utils::mod(alignment->i_2() - alignment->i_1() - 1, length_) + 1; int32_t gu_size_before = length_; int32_t gu_size_after = gu_size_before - segment_length; int32_t genome_size_before = indiv_->amount_of_dna(); int32_t genome_size_after = genome_size_before - length_; if ((genome_size_after < indiv_->min_genome_length()) || (gu_size_after < gen_unit_->min_gu_length())) { if (exp_m_->output_m()->is_logged(LOG_BARRIER)) { // Write an entry in the barrier log file fprintf(exp_m_->output_m()->log(LOG_BARRIER), "%" PRId64 " %" PRId32 " DELETION %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 "\n", AeTime::time(), indiv_->id(), segment_length, 0, gu_size_before, genome_size_before); } } else { // Perform DELETION do_deletion(alignment->i_1(), alignment->i_2()); // Report the deletion mut = new Deletion(alignment->i_1(), alignment->i_2(), segment_length, needed_score); nb_rearr++; // Write a line in rearrangement logfile if (exp_m_->output_m()->is_logged(LOG_REAR)) { fprintf(exp_m_->output_m()->log(LOG_REAR), "%" PRId64 " %" PRId32 " %" PRId8 " %" PRId32 " %" PRId32 " %" PRId16 "\n", AeTime::time(), indiv_->id(), int8_t(DEL), segment_length, genome_size_before, needed_score); } } } else { assert(rand1 < indiv_->duplication_proportion() + indiv_->deletion_proportion() + indiv_->translocation_proportion()); // Perform TRANSLOCATION // Make sure the segment to be translocated doesn't contain OriC // TODO(dpa) is that still necessary? if (alignment->i_1() > alignment->i_2()) { alignment->swap(); } // Remember the length of the segment to be translocated int32_t segment_length = Utils::mod(alignment->i_2() - alignment->i_1(), length_); // Extract the segment to be translocated GeneticUnit* translocated_segment = extract_into_new_GU(alignment->i_1(), alignment->i_2()); // Look for an alignment between the segment to be translocated and // the rest of the genome bool direct_sense; int16_t needed_score_2; VisAVis* alignment_2 = NULL; int32_t seed1, seed2; nb_pairs = static_cast( ceil(ttl * length_ * indiv_->neighbourhood_rate())); for (; nb_pairs > 0; nb_pairs--) { direct_sense = (indiv_->mut_prng_->random() < 0.5); if (indiv_->align_fun_shape() == LINEAR) { needed_score_2 = static_cast( ceil(indiv_->align_lin_min() + indiv_->mut_prng_->random() * (indiv_->align_lin_max() - indiv_->align_lin_min()))); } else { needed_score_2 = static_cast( ceil(-indiv_->align_sigm_lambda() * log(1 / indiv_->mut_prng_->random() - 1) + indiv_->align_sigm_mean())); if (needed_score_2 < 0) needed_score_2 = 0; } seed1 = indiv_->mut_prng_->random(length_); seed2 = indiv_->mut_prng_->random(segment_length); if (direct_sense) { alignment_2 = Alignment::search_alignment_direct( this, seed1, translocated_segment->dna(), seed2, needed_score_2); } else { // if indirect alignment_2 = Alignment::search_alignment_indirect( this, seed1, translocated_segment->dna(), seed2, needed_score_2); } if (alignment_2 != NULL) { //~ printf("transloc needed_score : %"PRId32"\n", needed_score_2); break; } } // If an alignment was found between the segment to be translocated // and the rest of the genome, proceed to the translocation. // Else, replace the extracted segment at its former position // (cancel the translocation event). if (alignment_2 != NULL) { // Proceed to the translocation insert_GU(translocated_segment, alignment_2->i_1(), alignment_2->i_2(), (alignment_2->sense() == INDIRECT)); // Report the translocation mut = new Translocation(alignment->i_1(), alignment->i_2(), alignment_2->i_1(), alignment_2->i_2(), segment_length, (alignment_2->sense() == INDIRECT), needed_score, needed_score_2); nb_rearr++; // Write a line in rearrangement logfile if (exp_m_->output_m()->is_logged(LOG_REAR)) { fprintf(exp_m_->output_m()->log(LOG_REAR), "%" PRId64 " %" PRId32 " %" PRId8 " %" PRId32 " %" PRId32 " %" PRId16 "\n", AeTime::time(), indiv_->id(), int8_t(TRANS), segment_length, length_, needed_score_2); } delete alignment_2; } else { // Cancel the translocation // (re-place the extracted segment at its former position) insert_GU(translocated_segment, alignment->i_1(), 0, false); } delete translocated_segment; } delete alignment; } else { // if indirect if (rand1 >= indiv_->inversion_proportion()) { // rand1 corresponds to no rearrangement => Nothing to do continue; } //~ printf("indirect needed_score : %"PRId32"\n", needed_score); //////////////////////////////////////////////////////////////////// // 3) Test the existence of an alignment with a high enough score // //////////////////////////////////////////////////////////////////// alignment = Alignment::search_alignment_indirect(this, seed1, this, seed2, needed_score); if (alignment == NULL) { // No alignment found continue; } ///////////////////////////// // 4) Proceed to inversion // ///////////////////////////// // Make sure the segment to be inverted doesn't contain OriC if (alignment->i_1() > alignment->i_2()) { alignment->swap(); } // Remember the length of the segment to be duplicated int32_t segment_length = Utils::mod(alignment->i_2() - alignment->i_1(), length_); // Proceed do_inversion(alignment->i_1(), alignment->i_2()); // Report the inversion mut = new Inversion(alignment->i_1(), alignment->i_2(), segment_length, needed_score); nb_rearr++; // Write a line in rearrangement logfile if (exp_m_->output_m()->is_logged(LOG_REAR)) { fprintf(exp_m_->output_m()->log(LOG_REAR), "%" PRId64 " %" PRId32 " %" PRId8 " %" PRId32 " %" PRId32 " %" PRId16 "\n", AeTime::time(), indiv_->id(), int8_t(INV), segment_length, length_, needed_score); } delete alignment; } /////////////////////////////////////////////////////////////////////////// // 5) If there was a change in the chromosome's length, // update the individual's TTL and nb_pairs according to new genome size /////////////////////////////////////////////////////////////////////////// if (genome_size != length_) { ttl = (static_cast(nb_pairs - 1)) / (static_cast(genome_size)) / indiv_->neighbourhood_rate(); genome_size = length_; nb_pairs = static_cast( ceil(ttl * length_ * indiv_->neighbourhood_rate())) + 1; } /////////////////////////////////////////////////////////////////////////// // 6) If there was a rearrangement, we either save its record in the tree // or delete it. /////////////////////////////////////////////////////////////////////////// if (mut != NULL) { indiv_->notifyObservers(MUTATION, mut); delete mut; } } return nb_rearr; } int32_t Dna::do_transfer(int32_t parent_id) { Mutation* mut = nullptr; int32_t nb_transfer = 0; if (indiv_->mut_prng()->random() < indiv_->HT_ins_rate()) { mut = do_ins_HT(parent_id); if (mut != nullptr) { indiv_->notifyObservers(MUTATION, mut); nb_transfer++; delete mut; } } if (indiv_->mut_prng()->random() < indiv_->HT_repl_rate()) { mut = do_repl_HT(parent_id); if (mut != nullptr) { indiv_->notifyObservers(MUTATION, mut); nb_transfer++; delete mut; } } return nb_transfer; } PointMutation* Dna::do_switch() { PointMutation* mut = nullptr; int32_t pos = indiv_->mut_prng_->random(length_); if (do_switch(pos)) { // Report the mutation mut = new PointMutation(pos); } return mut; } SmallInsertion* Dna::do_small_insertion() { SmallInsertion* mut = nullptr; // Determine the position and size of the small insertion int32_t pos = indiv_->mut_prng_->random(length_); int16_t nb_insert; if (indiv_->max_indel_size() == 1) { nb_insert = 1; } else { nb_insert = 1 + indiv_->mut_prng_->random(indiv_->max_indel_size()); // must be in [1 ; max_indel_size] } // Check that the insertion won't throw the genome size over the limit if ((indiv_->amount_of_dna() + nb_insert > indiv_->max_genome_length()) || (length_ + nb_insert > gen_unit_->max_gu_length())) { if (exp_m_->output_m()->is_logged(LOG_BARRIER)) { // Write an entry in the barrier log file fprintf(exp_m_->output_m()->log(LOG_BARRIER), "%" PRId64 " %" PRId32 " S_INS %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 "\n", AeTime::time(), indiv_->id(), nb_insert, 0, length_, indiv_->amount_of_dna()); } return NULL; } // Prepare the sequence to be inserted char* inserted_seq = new char[nb_insert + 1]; char inserted_char; for (int16_t j = 0; j < nb_insert; j++) { inserted_char = static_cast('0' + indiv_->mut_prng_->random(NB_BASE)); inserted_seq[j] = inserted_char; } inserted_seq[nb_insert] = '\0'; // Proceed to the insertion and report it if (do_small_insertion(pos, nb_insert, inserted_seq)) { // Report the insertion mut = new SmallInsertion(pos, nb_insert, inserted_seq); } // Delete the sequence delete[] inserted_seq; return mut; } SmallDeletion* Dna::do_small_deletion() { SmallDeletion* mut = nullptr; // Determine the position and size of the small deletion int32_t pos = indiv_->mut_prng_->random(length_); int16_t nb_del; if (indiv_->max_indel_size() == 1) { nb_del = 1; } else { nb_del = 1 + indiv_->mut_prng_->random(indiv_->max_indel_size()); // must be in [1 ; max_indel_size] } // Check that the insertion will shrink neither the genome nor the GU size // under their respective limit if ((indiv_->amount_of_dna() - nb_del < indiv_->min_genome_length()) || (length_ - nb_del < gen_unit_->min_gu_length())) { if (exp_m_->output_m()->is_logged(LOG_BARRIER)) { // Write an entry in the barrier log file fprintf(exp_m_->output_m()->log(LOG_BARRIER), "%" PRId64 " %" PRId32 " S_DEL %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 "\n", AeTime::time(), indiv_->id(), nb_del, 0, length_, indiv_->amount_of_dna()); } return nullptr; } if (do_small_deletion(pos, nb_del)) { mut = new SmallDeletion(pos, nb_del); } return mut; } bool Dna::do_switch(int32_t pos) { // Perform the mutation if (data_[pos] == '0') data_[pos] = '1'; else data_[pos] = '0'; // Remove promoters containing the switched base gen_unit_->remove_promoters_around(pos, Utils::mod(pos + 1, length_)); // Look for potential new promoters containing the switched base if (length_ >= PROM_SIZE) gen_unit_->look_for_new_promoters_around(pos, Utils::mod(pos + 1, length_)); return true; } bool Dna::do_small_insertion(int32_t pos, int16_t nb_insert, char* seq) { // Check genome size limit assert(length_ + nb_insert <= gen_unit_->max_gu_length()); assert(indiv_->amount_of_dna() + nb_insert <= indiv_->max_genome_length()); // Remove the promoters that will be broken gen_unit_->remove_promoters_around(pos); // Insert the sequence insert(pos, seq, nb_insert); // Look for new promoters if (length_ >= PROM_SIZE) { if (length_ - nb_insert < PROM_SIZE) { // Special case where the genome was smaller than a promoter before the // insertion and greater than (or as big as) a promoter after the // insertion. // In that case, we must look for new promoters thoroughly on the whole // genome using locate_promoters gen_unit_->locate_promoters(); } else { gen_unit_->move_all_promoters_after(pos, nb_insert); gen_unit_->look_for_new_promoters_around(pos, Utils::mod(pos + nb_insert, length_)); } } return true; } bool Dna::do_small_deletion(int32_t pos, int16_t nb_del) { // Check genome size limit assert(length_ - nb_del >= gen_unit_->min_gu_length()); assert(indiv_->amount_of_dna() - nb_del >= indiv_->min_genome_length()); // Remove promoters containing at least one nucleotide from the sequence to // delete gen_unit_->remove_promoters_around(pos, Utils::mod(pos + nb_del, length_)); // Do the deletion and update promoter list if (pos + nb_del <= length_) { // the deletion does not contain the origin of // replication // Do the deletion remove(pos, pos + nb_del); // Update promoter list if (length_ >= PROM_SIZE) { gen_unit_->move_all_promoters_after(pos, -nb_del); gen_unit_->look_for_new_promoters_around(Utils::mod(pos, length_)); } } else { // the deletion contains the origin of replication // Do the deletion int32_t nb_del_at_pos_0 = nb_del - length_ + pos; remove(pos, length_); remove(0, nb_del_at_pos_0); pos -= nb_del_at_pos_0; // Update promoter list if (length_ >= PROM_SIZE) { gen_unit_->move_all_promoters_after(0, -nb_del_at_pos_0); gen_unit_->look_for_new_promoters_around(0); } } return true; } Duplication* Dna::do_duplication() { Duplication* mut = nullptr; int32_t pos_1, pos_2, pos_3; pos_1 = indiv_->mut_prng_->random(length_); pos_2 = indiv_->mut_prng_->random(length_); pos_3 = indiv_->mut_prng_->random(length_); // Remember the length of the segment to be duplicated and of the former // genome int32_t segment_length = Utils::mod(pos_2 - pos_1 - 1, length_) + 1; int32_t gu_size_before = length_; int32_t gu_size_after = gu_size_before + segment_length; int32_t genome_size_before = indiv_->amount_of_dna(); int32_t genome_size_after = genome_size_before + segment_length; if ((gu_size_after > gen_unit_->max_gu_length()) || (genome_size_after > indiv_->max_genome_length())) { if (exp_m_->output_m()->is_logged(LOG_BARRIER)) { // Write an entry in the barrier log file fprintf(exp_m_->output_m()->log(LOG_BARRIER), "%" PRId64 " %" PRId32 " DUPLICATION %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 "\n", AeTime::time(), indiv_->id(), segment_length, 0, gu_size_before, genome_size_before); } } else { // Perform the duplication do_duplication(pos_1, pos_2, pos_3); // Report the duplication mut = new Duplication(pos_1, pos_2, pos_3, segment_length); // Write a line in rearrangement logfile if (exp_m_->output_m()->is_logged(LOG_REAR)) { fprintf(exp_m_->output_m()->log(LOG_REAR), "%" PRId64 " %" PRId32 " %" PRId8 " %" PRId32 " %" PRId32 "\n", AeTime::time(), indiv_->id(), int8_t(DUPL), segment_length, genome_size_before); } } return mut; } Deletion* Dna::do_deletion() { Deletion* mut = nullptr; int32_t pos_1, pos_2; pos_1 = indiv_->mut_prng_->random(length_); pos_2 = indiv_->mut_prng_->random(length_); // Remember the length of the segment to be deleted and of the genome // before the deletion int32_t segment_length = Utils::mod(pos_2 - pos_1 - 1, length_) + 1; int32_t gu_size_before = length_; int32_t gu_size_after = gu_size_before - segment_length; int32_t genome_size_before = indiv_->amount_of_dna(); int32_t genome_size_after = genome_size_before - segment_length; if ((gu_size_after < gen_unit_->min_gu_length()) || (genome_size_after < indiv_->min_genome_length())) { if (exp_m_->output_m()->is_logged(LOG_BARRIER)) { // Write an entry in the barrier log file fprintf(exp_m_->output_m()->log(LOG_BARRIER), "%" PRId64 " %" PRId32 " DELETION %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 "\n", AeTime::time(), indiv_->id(), segment_length, 0, gu_size_before, genome_size_before); } } else { // Perform the deletion do_deletion(pos_1, pos_2); // Report the deletion mut = new Deletion(pos_1, pos_2, segment_length); // Write a line in rearrangement logfile if (exp_m_->output_m()->is_logged(LOG_REAR)) { fprintf(exp_m_->output_m()->log(LOG_REAR), "%" PRId64 " %" PRId32 " %" PRId8 " %" PRId32 " %" PRId32 "\n", AeTime::time(), indiv_->id(), int8_t(DEL), segment_length, genome_size_before); } } return mut; } Translocation* Dna::do_translocation() { Translocation* mut = nullptr; int32_t pos_1, pos_2, pos_3, pos_4; int32_t segment_length; bool invert; if (indiv_->allow_plasmids()) { // ----------------------------------------------------------------- // WARNING : This is only valid when there is only 1 plasmid allowed // ----------------------------------------------------------------- int32_t pos_1_rel, pos_2_rel, pos_3_rel, pos_4_rel; Individual* indiv = indiv_; const GeneticUnit* chromosome = &indiv->genetic_unit_list().front(); const GeneticUnit* plasmid = &*std::next(indiv->genetic_unit_list().begin()); int32_t chrom_length = chromosome->dna()->length(); int32_t total_amount_of_dna = indiv->amount_of_dna(); // 1) What sequence are we translocating? pos_1_rel = indiv_->mut_prng_->random(length_); pos_2_rel = indiv_->mut_prng_->random(length_); int32_t segment_length = Utils::mod(pos_2_rel - pos_1_rel, length_); pos_3_rel = Utils::mod(pos_1_rel + indiv_->mut_prng_->random(segment_length), length_); if (gen_unit_ == chromosome) { pos_1 = pos_1_rel; pos_2 = pos_2_rel; pos_3 = pos_3_rel; } else { // (gen_unit_ == plasmid) pos_1 = pos_1_rel + chrom_length; pos_2 = pos_2_rel + chrom_length; pos_3 = pos_3_rel + chrom_length; } // 2) Where are we translocating it? pos_4 = indiv_->mut_prng_->random(total_amount_of_dna - segment_length); if (gen_unit_ == chromosome) { if (pos_1 <= pos_2) { if (pos_4 >= pos_1) { pos_4 += segment_length; } } else { if (pos_4 >= chrom_length - segment_length) { pos_4 += segment_length; } else { pos_4 += pos_2; } } if (pos_4 >= chrom_length) { pos_4_rel = pos_4 - chrom_length; } else { pos_4_rel = pos_4; } } else { // (gen_unit_ == plasmid) if (pos_1 <= pos_2) { if (pos_4 >= pos_1) { pos_4 += segment_length; } } else { if (pos_4 >= chrom_length) { pos_4 += pos_2_rel; } } if (pos_4 >= chrom_length) { pos_4_rel = pos_4 - chrom_length; } else { pos_4_rel = pos_4; } } invert = (indiv_->mut_prng_->random(2) == 0); // If inter GU translocation if ((gen_unit_ == chromosome && pos_4 >= chrom_length) || (gen_unit_ == plasmid && pos_4 < chrom_length)) { if (do_inter_GU_translocation(pos_1_rel, pos_2_rel, pos_3_rel, pos_4_rel, invert)) { // Report the translocation mut = new Translocation(pos_1_rel, pos_2_rel, pos_3_rel, pos_4_rel, segment_length, invert); // Write a line in rearrangement logfile if (exp_m_->output_m()->is_logged(LOG_REAR)) { fprintf(exp_m_->output_m()->log(LOG_REAR), "%" PRId64 " %" PRId32 " %" PRId8 " %" PRId32 " %" PRId32 "\n", AeTime::time(), indiv_->id(), int8_t(TRANS), segment_length, length_); } } } else { if (do_translocation(pos_1_rel, pos_2_rel, pos_3_rel, pos_4_rel, invert)) { // NOLINT(whitespace/braces) mut = new Translocation(pos_1_rel, pos_2_rel, pos_3_rel, pos_4_rel, segment_length, invert); // Write a line in rearrangement logfile if (exp_m_->output_m()->is_logged(LOG_REAR)) { fprintf(exp_m_->output_m()->log(LOG_REAR), "%" PRId64 " %" PRId32 " %" PRId8 " %" PRId32 " %" PRId32 "\n", AeTime::time(), indiv_->id(), int8_t(TRANS), segment_length, length_); } } } } else { // (! ae_common::params->allow_plasmids()) pos_1 = indiv_->mut_prng_->random(length_); pos_2 = indiv_->mut_prng_->random(length_); if (pos_1 == pos_2) return NULL; // As it is commented in do_translocation(int32_t pos_1, int32_t pos_2, // int32_t pos_3, int32_t pos_4, bool invert), translocating segment // [pos_1, pos_2] is the same as translocating segment [pos_2, pos_1] // Since OriC must be at position 0, we will always translocate segment // [pos_1, pos_2] with pos_1 < pos_2 if (pos_1 > pos_2) Utils::exchange(pos_1, pos_2); segment_length = pos_2 - pos_1; // Generate a position between pos_1 and pos_2 pos_3 = pos_1 + indiv_->mut_prng_->random(segment_length); // Generate a position that is NOT between pos_1 and pos_2 pos_4 = indiv_->mut_prng_->random(length_ - segment_length); if (pos_4 >= pos_1) pos_4 += segment_length; invert = (indiv_->mut_prng_->random(2) == 0); if (do_translocation(pos_1, pos_2, pos_3, pos_4, invert)) { // Report the translocation mut = new Translocation(pos_1, pos_2, pos_3, pos_4, segment_length, invert); // Write a line in rearrangement logfile if (exp_m_->output_m()->is_logged(LOG_REAR)) { fprintf(exp_m_->output_m()->log(LOG_REAR), "%" PRId64 " %" PRId32 " %" PRId8 " %" PRId32 " %" PRId32 "\n", AeTime::time(), indiv_->id(), int8_t(TRANS), segment_length, length_); } } } return mut; } Inversion* Dna::do_inversion() { Inversion* mut = nullptr; int32_t pos_1, pos_2; int32_t segment_length; pos_1 = indiv_->mut_prng_->random(length_); pos_2 = indiv_->mut_prng_->random(length_); if (pos_1 == pos_2) return NULL; // Invert everything <=> Invert nothing! // Invert the segment that don't contain OriC if (pos_1 > pos_2) Utils::exchange(pos_1, pos_2); segment_length = pos_2 - pos_1; if (do_inversion(pos_1, pos_2)) { // Report the inversion mut = new Inversion(pos_1, pos_2, segment_length); // Write a line in rearrangement logfile if (exp_m_->output_m()->is_logged(LOG_REAR)) { fprintf(exp_m_->output_m()->log(LOG_REAR), "%" PRId64 " %" PRId32 " %" PRId8 " %" PRId32 " %" PRId32 "\n", AeTime::time(), indiv_->id(), int8_t(INV), segment_length, length_); } } return mut; } Mutation* Dna::do_insertion(const char* seq_to_insert, int32_t seq_length /*= -1*/) { Mutation* mut = nullptr; Utils::ExitWithDevMsg("Not implemented yet", __FILE__, __LINE__); // // Compute seq_length if not known // if (seq_length == -1) { // seq_length = strlen(seq_to_insert); // } // // // Where to insert the sequence // int32_t pos = indiv_->mut_prng_->random(length_); // // if (do_insertion(pos, seq_to_insert, seq_length)) { // // Report the insertion // mut = new Mutation(); // mut->report_insertion(pos, seq_length, seq_to_insert); // } return mut; } bool Dna::do_duplication(int32_t pos_1, int32_t pos_2, int32_t pos_3) { // Duplicate segment [pos_1; pos_2[ and insert the duplicate before pos_3 char* duplicate_segment = NULL; int32_t seg_length; if (pos_1 < pos_2) { // // pos_1 pos_2 -> 0- // | | - - // 0---------------------------------> - - // =============== - - pos_1 // tmp (copy) - - // ----- | // pos_2 <-' // seg_length = pos_2 - pos_1; duplicate_segment = new char[seg_length + 1]; memcpy(duplicate_segment, &data_[pos_1], seg_length); duplicate_segment[seg_length] = '\0'; } else { // if (pos_1 >= pos_2) // The segment to duplicate includes the origin of replication. // The copying process will be done in two steps. // // ,-> // pos_2 pos_1 | -> 0- // | | - - pos_2 // 0---------------------------------> pos_1 - - // ====== ======= - - // tmp2 tmp1 - - // ----- // // int32_t tmp1_len = length_ - pos_1; int32_t tmp2_len = pos_2; seg_length = tmp1_len + tmp2_len; duplicate_segment = new char[seg_length + 1]; memcpy(duplicate_segment, &data_[pos_1], tmp1_len); // Copy tmp1 memcpy(&duplicate_segment[tmp1_len], data_, tmp2_len); // Copy tmp2 duplicate_segment[seg_length] = '\0'; } // Create a copy of the promoters beared by the segment to be duplicated // (they will be inserted in the individual's RNA list later) Promoters2Strands duplicated_promoters = {{}, {}}; gen_unit_->duplicate_promoters_included_in(pos_1, pos_2, duplicated_promoters); gen_unit_->remove_promoters_around(pos_3); insert(pos_3, duplicate_segment, seg_length); if (length_ >= PROM_SIZE) { if (length_ - seg_length < PROM_SIZE) { // Special case where the genome was smaller than a promoter before // the insertion and greater than (or as big as) a promoter after the // insertion. // In that case, we must look for new promoters thoroughly on the whole // genome using locate_promoters gen_unit_->locate_promoters(); } else { gen_unit_->move_all_promoters_after(pos_3, seg_length); gen_unit_->insert_promoters_at(duplicated_promoters, pos_3); gen_unit_->look_for_new_promoters_around(pos_3); gen_unit_->look_for_new_promoters_around(pos_3 + seg_length); } } delete[] duplicate_segment; return true; } bool Dna::do_deletion(int32_t pos_1, int32_t pos_2) { // Delete segment going from pos_1 (included) to pos_2 (excluded) if (pos_1 < pos_2) { // // pos_1 pos_2 -> 0- // | | - - // 0---------------------------------> - - // =============== - - pos_1 // tmp (copy) - - // ----- | // pos_2 <-' // int32_t segment_length = pos_2 - pos_1; // Remove promoters containing at least one nucleotide from the sequence // to delete gen_unit_->remove_promoters_around(pos_1, pos_2); // Delete the sequence between pos_1 and pos_2 remove(pos_1, pos_2); // Update promoter list if (length_ >= PROM_SIZE) { gen_unit_->move_all_promoters_after(pos_1, -segment_length); gen_unit_->look_for_new_promoters_around(pos_1); } } else { // if (pos_1 >= pos_2) // The segment to delete includes the origin of replication. // The deletion process will be done in two steps. // // ,-> // pos_2 pos_1 | -> 0- // | | - - pos_2 // 0---------------------------------> pos_1 - - // ===== ======= - - // tmp2 tmp1 - - // ----- // // // int32_t segment_length = length_ + pos_2 - pos_1; //useless variable // Remove promoters containing at least one nucleotide from the sequence // to delete gen_unit_->remove_promoters_around(pos_1, pos_2); // Delete the sequence between pos_1 and pos_2 remove(pos_1, length_); // delete tmp1 from genome remove(0, pos_2); // delete tmp2 from genome // Update promoter list if (length_ >= PROM_SIZE) { gen_unit_->move_all_promoters_after(0, -pos_2); gen_unit_->look_for_new_promoters_around(0); } } return true; } bool Dna::do_translocation(int32_t pos_1, int32_t pos_2, int32_t pos_3, int32_t pos_4, bool invert) { // Provided that OriC must be at position 0 // // 1) Note that in Case 1 (without inversion), whichever position // comes first, translocating segment [pos_1->pos_2] to pos_4 // through pos_3 is always equivalent to rearrange the sequences from // an ABCDE order to ADCBE // 2) In Case 2, depending on which position comes first, we may have the // following rearrangements : // (ABCDE => ADB'C'E) or (ABCDE => AC'D'BE) // where X' stands for "inverted X" // // Case 1 : Without inversion // // A B C D E // |----->=======[>=======>-------[>-------| // pos_1 pos_3 pos_2 pos_4 // | // V // A D C B E // |----->-------[>=======>=======[>-------| // // // A B C D E // |=====>-------[>------->=======[>=======| // pos_2 pos_4 pos_1 pos_3 // | // V // A D C B E // |=====>=======[>------->-------[>=======| // // // A B C D E // |====[>========>-------[>------->=======| // pos_3 pos_2 pos_4 pos_1 // | // V // A D C B E // |=====[>------->-------[>=======[>=======| // // // A B C D E // |----[>-------->=======[>=======>-------| // pos_4 pos_1 pos_3 pos_2 // | // V // A D C B E // |-----[>=======>=======[>-------[>-------| // // Case 2 : With inversion // // Case 2.A // // A B C D E // |----->=======[>=======>-------<]-------| // pos_1 pos_3 pos_2 pos_4 // | // V // A D B' C' E // |----->-------<]=======<=======<]-------| // // // A B C D E // |=====>-------[>------->=======<]=======| // pos_2 pos_4 pos_1 pos_3 // | // V // A D B' C' E // |=====>=======<]-------<-------<]=======| // // Case 2.B // // A B C D E // |====[>========>-------<]------->=======| // pos_3 pos_2 pos_4 pos_1 // | // V // A C' D' B E // |=====[>-------<-------[>=======>=======| // // // A B C D E // |----<]-------->=======[>=======>-------| // pos_4 pos_1 pos_3 pos_2 // | // V // A C' D' B E // |-----<]=======>=======<]------->-------| // Determine which position comes first and do the corresponding rearrangement // TODO(dpa) use min from std int32_t pos_min = Utils::min(pos_1, Utils::min(pos_2, Utils::min(pos_3, pos_4))); if (not invert) { if (pos_min == pos_1) { ABCDE_to_ADCBE(pos_1, pos_3, pos_2, pos_4); } else if (pos_min == pos_2) { ABCDE_to_ADCBE(pos_2, pos_4, pos_1, pos_3); } else if (pos_min == pos_3) { ABCDE_to_ADCBE(pos_3, pos_2, pos_4, pos_1); } else { // if (pos_min == pos_4) ABCDE_to_ADCBE(pos_4, pos_1, pos_3, pos_2); } } else { // invert if (pos_min == pos_1) { ABCDE_to_ADBpCpE(pos_1, pos_3, pos_2, pos_4); } else if (pos_min == pos_2) { ABCDE_to_ADBpCpE(pos_2, pos_4, pos_1, pos_3); } else if (pos_min == pos_3) { ABCDE_to_ACpDpBE(pos_3, pos_2, pos_4, pos_1); } else { // if (pos_min == pos_4) ABCDE_to_ACpDpBE(pos_4, pos_1, pos_3, pos_2); } } return true; } bool Dna::do_inter_GU_translocation(int32_t pos_1_rel, int32_t pos_2_rel, int32_t pos_3_rel, int32_t pos_4_rel, bool invert) { // TODO(???) check GU lengths according to positions and size limit int32_t segment_length = Utils::mod(pos_2_rel - pos_1_rel, length_); if (pos_1_rel == pos_2_rel) { // TODO(???) shouldn't that raise an error? return false; } // Do not allow translocation if it would decrease the size of the origin // GU below a given threshold if ((length_ - segment_length) < gen_unit_->min_gu_length()) { if (exp_m_->output_m()->is_logged(LOG_BARRIER)) { // Write an entry in the barrier log file fprintf(exp_m_->output_m()->log(LOG_BARRIER), "%" PRId64 " %" PRId32 " TRANS %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 "\n", AeTime::time(), indiv_->id(), segment_length, 0, length_, indiv_->amount_of_dna()); } return false; } // const GeneticUnit& chromosome = indiv_->genetic_unit(0); const GeneticUnit& plasmid = indiv_->genetic_unit(1); // TODO(vld) (2015-02-23): check if this == is sound const GeneticUnit& destination_GU = (gen_unit_ == &chromosome) ? plasmid : chromosome; int32_t dest_gu_size_before = destination_GU.seq_length(); // Do not allow translocation if it would increase the size of the receiving // GU above a given threshold if (dest_gu_size_before + segment_length > destination_GU.max_gu_length()) { if (exp_m_->output_m()->is_logged(LOG_BARRIER)) { // Write an entry in the barrier log file fprintf(exp_m_->output_m()->log(LOG_BARRIER), "%" PRId64 " %" PRId32 " TRANS %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 "\n", AeTime::time(), indiv_->id(), segment_length, 0, dest_gu_size_before, indiv_->amount_of_dna()); } return false; } // Provided that OriC must be at position 0 // // Case 1: inter_GU_ABCDE_to_ACDBE // // A B C D E // |---->=====>----| |----[>----| // p1r p2r p4r // | // V // A C D B E // |---->----| |----[>====[>----| // p1r p4r p4r+(p2r-p1r) // // // Case 2: inter_GU_ABCDE_to_BDCAE // // A B C D E // |====>----->====| |----[>----| // p2r p1r p4r // | // V // B D C A E // |-----| |----[>====[>====>----| // p4r | // p4r+(length_-p1r) // | // p4r+(length_-(p1r-p2r)) // Determine which position comes first and do the corresponding rearrangement // int32_t pos_min = Utils::min(pos_1, pos_2); if (not invert) { if (pos_1_rel < pos_2_rel) { segment_length = Utils::mod(pos_2_rel - pos_1_rel, length_); inter_GU_ABCDE_to_ACDBE(pos_1_rel, pos_2_rel, pos_4_rel); } else { segment_length = Utils::mod(pos_1_rel - pos_2_rel, length_); inter_GU_ABCDE_to_BDCAE(pos_2_rel, pos_1_rel, pos_4_rel); } } else { // invert if (pos_1_rel < pos_2_rel) { segment_length = Utils::mod(pos_2_rel - pos_1_rel, length_); do_inversion(pos_1_rel, pos_2_rel); inter_GU_ABCDE_to_ACDBE(pos_1_rel, pos_2_rel, pos_4_rel); } else { // pos_1_rel > pos_2_rel segment_length = Utils::mod(pos_1_rel - pos_2_rel, length_); if (pos_2_rel != 0) { do_inversion(0, pos_2_rel); } if (pos_1_rel != length_) { do_inversion(pos_1_rel, length_); } inter_GU_ABCDE_to_BDCAE(pos_2_rel, pos_1_rel, pos_4_rel); } } return true; } bool Dna::do_inversion(int32_t pos_1, int32_t pos_2) { // Invert segment going from pos_1 (included) to pos_2 (excluded) // Exemple : sequence 011101001100 => 110011010001 if (pos_1 == pos_2) return false; // Invert everything <=> Invert nothing! assert(pos_1 < pos_2); // // pos_1 pos_2 -> 0- // | | - - // 0---------------------------------> - - // =============== - - pos_1 // tmp (copy) - - // ----- | // pos_2 <-' // int32_t seg_length = pos_2 - pos_1; // Create the inverted sequence char* inverted_segment = NULL; inverted_segment = new char[seg_length + 1]; // #pragma simd // #pragma distribute_point // for (int32_t i = 0, j = pos_2 - 1; i < seg_length; i = i + 4, j = j - 4) { // if (data_[j] == '0') inverted_segment[i] = '1'; // else inverted_segment[i] = '0'; // if (data_[j - 1] == '0') inverted_segment[i + 1] = '1'; // else inverted_segment[i + 1] = '0'; // if (data_[j - 2] == '0') inverted_segment[i + 2] = '1'; // else inverted_segment[i + 2] = '0'; // if (data_[j - 3] == '0') inverted_segment[i + 3] = '1'; // else inverted_segment[i + 3] = '0'; // } for (int32_t i = 0, j = pos_2 - 1; i < seg_length; i++, j--) { if (data_[j] == '0') inverted_segment[i] = '1'; else inverted_segment[i] = '0'; } inverted_segment[seg_length] = '\0'; // Remove promoters that included a breakpoint gen_unit_->remove_promoters_around(pos_1); gen_unit_->remove_promoters_around(pos_2); // Invert the sequence replace(pos_1, inverted_segment, seg_length); // Update promoter list if (length_ >= PROM_SIZE) { gen_unit_->invert_promoters_included_in(pos_1, pos_2); gen_unit_->look_for_new_promoters_around(pos_1); gen_unit_->look_for_new_promoters_around(pos_2); } delete[] inverted_segment; return true; } bool Dna::do_insertion(int32_t pos, const char* seq_to_insert, int32_t seq_length) { // Remove the promoters that will be broken gen_unit_->remove_promoters_around(pos); // Insert the sequence insert(pos, seq_to_insert, seq_length); // Look for new promoters if (length_ >= PROM_SIZE) { gen_unit_->move_all_promoters_after(pos, seq_length); gen_unit_->look_for_new_promoters_around(pos, pos + seq_length); } return true; } Mutation* Dna::do_ins_HT(int32_t parent_id) { Mutation* mut = nullptr; // TODO(dpa) disabled // int32_t nb_indivs = exp_m_->pop()->nb_indivs(); // // // Insertion transfer // // Requirements: // // * A circular exogenote => an alignment on the donor chromosome // // * An alignment between the exogenote and the endogenote // // // 1) Draw a random donor (uniform drawing). // // We use the rank because indivs are sorted by rank (1 for the worst, // // POP_SIZE for the best). // Individual * donor = NULL; // do { // donor = exp_m_->pop()-> // indiv_by_rank(exp_m_->sel()->prng()->random(nb_indivs) + // 1); // } // while (donor->id() == parent_id); // // // 2) Look for an alignment within the donor genome // VisAVis* alignment_1 = NULL; // Dna* donor_dna = donor->genetic_unit(0).dna(); // int32_t nb_pairs_1 = // static_cast( // ceil(donor_dna->length() * indiv_->neighbourhood_rate())); // // alignment_1 = donor_dna->search_alignment(donor_dna, nb_pairs_1, DIRECT); // // if (alignment_1 != NULL) { // // 3) Make a copy of the sequence to be transferred (the exogenote) // GeneticUnit* exogenote = // donor_dna->copy_into_new_GU(alignment_1->i_1(), // alignment_1->i_2()); // // // 4) Look for an alignments between the exogenote and the endogenote // VisAVis* alignment_2 = NULL; // int32_t nb_pairs_2 = static_cast( // ceil(length() * indiv_->neighbourhood_rate())); // // alignment_2 = // exogenote->dna()->search_alignment(this, nb_pairs_2, // BOTH_SENSES); // // if (alignment_2 != NULL) { // int32_t gu_length_before = length_; // int32_t gu_length_after = // gu_length_before + exogenote->dna()->length(); // int32_t genome_length_before = indiv_->amount_of_dna(); // int32_t genome_length_after = // genome_length_before + exogenote->dna()->length(); // // if ((genome_length_after > indiv_->max_genome_length()) || // (gu_length_after > gen_unit_->max_gu_length())) { // if (exp_m_->output_m()->is_logged(LOG_BARRIER)) { // // Write an entry in the barrier log file // fprintf(exp_m_->output_m()->log(LOG_BARRIER), // "%" PRId64 " %" PRId32 " INS_TRANSFER %" PRId32 " %" PRId32 // " %" PRId32 " %" PRId32 "\n", // AeTime::time(), // indiv_->id(), // exogenote->dna()->length(), // 0, // gu_length_before, // genome_length_before); // } // } // else { // insert_GU(exogenote, // alignment_2->i_2(), alignment_2->i_1(), // (alignment_2->sense() == INDIRECT)); // //~ fprintf(logfile, "RESULT:\n%s\n\n\n", new_indiv_dna->data()); // //~ fflush(logfile); // // // Write a line in transfer logfile // if (exp_m_->output_m()->is_logged(LOG_TRANSFER)) { // fprintf(exp_m_->output_m()->log(LOG_TRANSFER), // "%" PRId64 " %" PRId32 " %" PRId32 " 0 %" PRId32 // " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 // " %" PRId32 " %" PRId16 " %" PRId32 " %" PRId32 // " %" PRId16 "\n", // AeTime::time(), // indiv_->id(), // donor->id(), // exogenote->dna()->length(), // 0, // genome_length_before, // length(), // alignment_1->i_1(), // alignment_1->i_2(), // alignment_1->score(), // alignment_2->i_1(), // alignment_2->i_2(), // alignment_2->score()); // } // // #ifdef BIG_DEBUG // ae_common::sim->logs()->flush(); // indiv_->assert_promoters(); // indiv_->assert_promoters_order(); // #endif // // if (exp_m_->output_m()->record_tree() && // exp_m_->output_m()->tree_mode() == NORMAL) { // char* donor_seq; // if (alignment_2->sense() == DIRECT) { // donor_seq = exogenote->dna()-> // subsequence(alignment_2->i_1(), // alignment_2->i_1(), LEADING); // } // else { // donor_seq = exogenote->dna()-> // subsequence(alignment_2->i_1(), // alignment_2->i_1(), LAGGING); // } // // Report the transfer // mut = new Mutation(); // mut->report_ins_HT(alignment_1->i_1(), alignment_1->i_2(), // alignment_2->i_1(), alignment_2->i_2(), // exogenote->dna()->length(), // alignment_1->score(), // alignment_2->score(), // donor->id(), // alignment_2->sense(), // donor_seq); // delete [] donor_seq; // } // } // // delete alignment_2; // } // // delete exogenote; // delete alignment_1; // } return mut; } Mutation* Dna::do_repl_HT(int32_t parent_id) { Mutation* mut = nullptr; // TODO(dpa) disabled // int32_t nb_indivs = exp_m_->pop()->nb_indivs(); // // // Replacement transfer // // Requirements: // // * 2 distinct alignments between the (linear) exogenote and the // // endogenote // // // 1) Draw a random donor (uniform drawing). // // We use the rank because indivs are sorted by rank (1 for the worst, // // POP_SIZE for the best). // Individual * donor = NULL; // do { // donor = exp_m_->pop()-> // indiv_by_rank(exp_m_->sel()->prng()->random(nb_indivs) // + 1); // } // while (donor->id() == parent_id); // // // 2) Look for an alignment between the parent genome and the donor genome // VisAVis* alignment_1 = NULL; // VisAVis* alignment_2 = NULL; // Dna* donor_dna = donor->genetic_unit(0).dna(); // AlignmentSense sense = (exp_m_->sel()->prng()->random() < 0.5) ? // DIRECT : INDIRECT; // int32_t nb_pairs_1 = static_cast( // ceil(length() * indiv_->neighbourhood_rate())); // int32_t nb_pairs_2 = static_cast( // ceil(length() * indiv_->neighbourhood_rate())); // int8_t search_sense = 0; // // alignment_1 = search_alignment(donor_dna, nb_pairs_1, sense); // if (alignment_1 != NULL) { // if (exp_m_->repl_HT_with_close_points()) { // alignment_2 = // search_alignment_around_positions(donor_dna, // alignment_1->i_1(), // alignment_1->i_2(), // alignment_1->sense(), // search_sense); // if (alignment_2 != NULL && // alignment_2->i_1() == alignment_1->i_1()) { // delete alignment_2; // alignment_2 = NULL; // } // if (alignment_2 != NULL) { // // If the second alignment is found upstream of the first alignment, // // they are inverse to facilitate // if (search_sense == -1) { // VisAVis* tmp_alignment = new VisAVis(*alignment_1); // alignment_1->copy(alignment_2); // alignment_2->copy(tmp_alignment); // delete tmp_alignment; // } // } // } // else { // // Look for a second alignement between the parent and the donor // // (must be different from alignment_1) // while (alignment_2 == NULL && nb_pairs_2 > 0) { // alignment_2 = search_alignment(donor_dna, nb_pairs_2, sense); // // // Forbid the replacement of the whole genome of the parent // if (alignment_2 != NULL && // alignment_2->i_1() == alignment_1->i_1()) { // delete alignment_2; // alignment_2 = NULL; // } // } // } // // // If both alignments were found, proceed to the transfer // if (alignment_2 != NULL) { // int32_t gu_length_before = length_; // int32_t exogenote_length = // Utils::mod(alignment_2->i_2() - alignment_1->i_2() - 1, // donor_dna->length()) + 1; // int32_t replaced_seq_length = // Utils::mod(alignment_2->i_1() - alignment_1->i_1() - 1, // gu_length_before) + 1; // int32_t gu_length_after = // gu_length_before - replaced_seq_length + exogenote_length; // // int32_t genome_length_before = indiv_->amount_of_dna(); // int32_t genome_length_after = // genome_length_before - replaced_seq_length + exogenote_length; // // if (genome_length_after < indiv_->min_genome_length() || // genome_length_after > indiv_->max_genome_length() || // gu_length_after < gen_unit_->min_gu_length() || // gu_length_after > gen_unit_->max_gu_length()) { // if (exp_m_->output_m()->is_logged(LOG_BARRIER)) { // // Write an entry in the barrier log file // fprintf(exp_m_->output_m()->log(LOG_BARRIER), // "%" PRId64 " %" PRId32 " REPL_TRANSFER %" PRId32 " %" PRId32 // " %" PRId32 " %" PRId32 "\n", // AeTime::time(), // indiv_->id(), // exogenote_length, // replaced_seq_length, // gu_length_before, // genome_length_before); // } // } // else { // // 3) Make a copy of the sequence to be transferred (the exogenote) // GeneticUnit* exogenote = NULL; // if (sense == DIRECT) { // exogenote = donor_dna->copy_into_new_GU(alignment_1->i_2(), // alignment_2->i_2()); // } // else { // exogenote = donor_dna->copy_into_new_GU(alignment_2->i_2(), // alignment_1->i_2()); // } // // char* alignment1_parent_dna = nullptr; // char* alignment2_parent_dna = nullptr; // char* alignment1_donor_dna = nullptr; // char* alignment2_donor_dna = nullptr; // if (exp_m_->output_m()->is_logged(LOG_TRANSFER) == true) { // if (sense == DIRECT) { // alignment1_parent_dna = // subsequence(alignment_1->i_1(), // alignment_1->i_1() + // 2 * indiv_->align_w_zone_h_len() + // indiv_->align_max_shift(), LEADING); // alignment2_parent_dna = // subsequence(alignment_2->i_1(), // alignment_2->i_1() + // 2 * indiv_->align_w_zone_h_len() + // indiv_->align_max_shift(), LEADING); // alignment1_donor_dna = // donor_dna->subsequence( // alignment_1->i_2(), // alignment_1->i_2() + // 2 * indiv_->align_w_zone_h_len() + // indiv_->align_max_shift(), LEADING); // alignment2_donor_dna = // donor_dna->subsequence( // alignment_2->i_2(), // alignment_2->i_2() + // 2 * indiv_->align_w_zone_h_len() + // indiv_->align_max_shift(), LEADING); // } // else { // alignment1_parent_dna = // subsequence(alignment_1->i_1(), // alignment_1->i_1() + // 2 * indiv_->align_w_zone_h_len() + // indiv_->align_max_shift(), LEADING); // alignment2_parent_dna = // subsequence(alignment_2->i_1(), // alignment_2->i_1() + // 2 * indiv_->align_w_zone_h_len() + // indiv_->align_max_shift(), LEADING); // alignment1_donor_dna = // donor_dna->subsequence( // alignment_1->i_2(), // alignment_1->i_2() - // 2 * indiv_->align_w_zone_h_len() - // indiv_->align_max_shift(), LAGGING); // alignment2_donor_dna = // donor_dna->subsequence( // alignment_2->i_2(), // alignment_2->i_2() - // 2 * indiv_->align_w_zone_h_len() - // indiv_->align_max_shift(), LAGGING); // } // } // // // Delete the sequence to be replaced // do_deletion(alignment_1->i_1(), alignment_2->i_1()); // if (alignment_1->i_1() < alignment_2->i_1()) { // insert_GU(exogenote, alignment_1->i_1(), 0, sense == INDIRECT); // } // else { // insert_GU(exogenote, 0, 0, sense == INDIRECT); // } // // // Write a line in transfer logfile // if (exp_m_->output_m()->is_logged(LOG_TRANSFER)) { // fprintf(exp_m_->output_m()->log(LOG_TRANSFER), // "%" PRId64 " %" PRId32 " %" PRId32 " 1 %" PRId32 " %" PRId32 // " %" PRId32 " %" PRId32 " %" PRId16 " %" PRId32 " %" PRId32 // " %" PRId16 " %" PRId32 " %" PRId32 " %" PRId16 // " %" PRId16 "\n", // AeTime::time(), // indiv_->id(), // donor->id(), // exogenote->dna()->length(), // replaced_seq_length, // genome_length_before, // length(), // (int16_t) alignment_1->sense(), // alignment_1->i_1(), // alignment_1->i_2(), // alignment_1->score(), // alignment_2->i_1(), // alignment_2->i_2(), // alignment_2->score() , // (int16_t) search_sense); // // fprintf(exp_m_->output_m()->log(LOG_TRANSFER), // "\tAlignment 1:\n\t\t%s\n\t\t%s\n" // "\tAlignment 2:\n\t\t%s\n\t\t%s\n", // alignment1_parent_dna, alignment1_donor_dna, // alignment2_parent_dna, alignment2_donor_dna); // // delete [] alignment1_parent_dna; // delete [] alignment2_parent_dna; // delete [] alignment1_donor_dna; // delete [] alignment2_donor_dna; // } // // if (exp_m_->output_m()->record_tree() && // exp_m_->output_m()->tree_mode() == NORMAL) { // // Report the transfer // char* donor_seq; // if (alignment_2->sense() == DIRECT) { // donor_seq = exogenote->dna()-> // subsequence(0, exogenote->dna()->length(), LEADING); // } // else { // donor_seq = exogenote->dna()-> // subsequence(0, exogenote->dna()->length(), LAGGING); // } // mut = new Mutation(); // mut->report_repl_HT(alignment_1->i_1(), alignment_1->i_2(), // alignment_2->i_1(), alignment_2->i_2(), // replaced_seq_length, // exogenote->dna()->length(), // alignment_1->score(), // alignment_2->score(), // donor->id(), // alignment_2->sense(), // donor_seq); // delete [] donor_seq; // } // // delete exogenote; // } // delete alignment_2; // } // delete alignment_1; // } return mut; } bool Dna::do_ins_HT(int32_t pos, const char* seq_to_insert, int32_t seq_length) { // NOLINT(whitespace/braces) // Remove the promoters that will be broken gen_unit_->remove_promoters_around(pos); // Insert the sequence insert(pos, seq_to_insert, seq_length); // Look for new promoters if (length_ >= PROM_SIZE) { gen_unit_->move_all_promoters_after(pos, seq_length); gen_unit_->look_for_new_promoters_around(pos, pos + seq_length); } return true; } bool Dna::do_repl_HT(int32_t pos1, int32_t pos2, const char* seq_to_insert, int32_t seq_length) { // Remove the promoters that will be broken gen_unit_->remove_promoters_around(pos1); // Delete the replaced segment do_deletion(pos1, pos2); // Insert the sequence int32_t insertion_position; if (pos1 < pos2) { insertion_position = pos1; } else { insertion_position = 0; } insert(insertion_position, seq_to_insert, seq_length); // Look for new promoters if (length_ >= PROM_SIZE) { gen_unit_->move_all_promoters_after(insertion_position, seq_length); gen_unit_->look_for_new_promoters_around(insertion_position, insertion_position + seq_length); } return true; } void Dna::undergo_this_mutation(const Mutation& mut) { switch (mut.mut_type()) { case SWITCH : do_switch(dynamic_cast(mut).pos()); break; case S_INS : { const auto& s_ins = dynamic_cast(mut); do_small_insertion(s_ins.pos(), s_ins.length(), s_ins.seq()); break; } case S_DEL : { const auto& s_del = dynamic_cast(mut); do_small_deletion(s_del.pos(), s_del.length()); break; } case DUPL : { const auto& dupl = dynamic_cast(mut); do_duplication(dupl.pos1(), dupl.pos2(), dupl.pos3()); break; } case DEL : { const auto& del = dynamic_cast(mut); do_deletion(del.pos1(), del.pos2()); break; } case TRANS : { const auto& trans = dynamic_cast(mut); do_translocation(trans.pos1(), trans.pos2(), trans.pos3(), trans.pos4(), trans.invert()); break; } case INV : { const auto& inv = dynamic_cast(mut); do_inversion(inv.pos1(), inv.pos2()); break; } case INS_HT : { const auto& ins_ht = dynamic_cast(mut); do_ins_HT(ins_ht.receiver_pos(), ins_ht.seq(), ins_ht.length()); break; } case REPL_HT : { const auto& repl_ht = dynamic_cast(mut); do_repl_HT(repl_ht.receiver_pos1(), repl_ht.receiver_pos2(), repl_ht.seq(), repl_ht.length()); break; } default : fprintf(stderr, "ERROR, invalid mutation type in file %s:%d\n", __FILE__, __LINE__); exit(EXIT_FAILURE); break; } } void Dna::compute_statistical_data() { // **************************************************************************** // WARNING Deprecated // **************************************************************************** assert(false); } #ifndef __REGUL void Dna::set_GU(std::vector> rna_list, const GeneticUnit* GU ) { for ( auto& strand : { LEADING, LAGGING } ) for ( auto& rna : rna_list[strand]) rna. set_genetic_unit(GU); } #else void Dna::set_GU(std::vector> rna_list, const GeneticUnit* GU) { for (auto& strand: {LEADING, LAGGING}) for (auto& rna: rna_list[strand]) rna.set_genetic_unit(GU); } #endif GeneticUnit* Dna::extract_into_new_GU(int32_t pos_1, int32_t pos_2) { assert(pos_1 < pos_2); int32_t seq_length = pos_2 - pos_1; // =============== Remove/Extract promoters from old sequence =============== // Remove promoters around breakpoints gen_unit_->remove_promoters_around(pos_1); gen_unit_->remove_promoters_around(pos_2); // Remove promoters belonging to the sequence (to be extracted) from the // "old" GU and put them in a stand-alone promoter list (with indices // ranging from 0 to seq_length-1) Promoters2Strands proms_GU_1 = {{}, {}}; gen_unit_->extract_promoters_included_in(pos_1, pos_2, proms_GU_1); GeneticUnit::shift_promoters(proms_GU_1, -pos_1, length_); // ==================== Manage sequences ==================== // Copy the sequence in a stand-alone char* (size must be multiple of // BLOCK_SIZE) int32_t length_GU_1 = seq_length; char* sequence_GU_1 = new char[nb_blocks(length_GU_1) * BLOCK_SIZE]; memcpy(sequence_GU_1, &data_[pos_1], length_GU_1 * sizeof(char)); sequence_GU_1[length_GU_1] = '\0'; // Remove the sequence from the "old" GU int32_t length_GU_0 = length_ - seq_length; char* sequence_GU_0 = new char[nb_blocks(length_GU_0) * BLOCK_SIZE]; memcpy(sequence_GU_0, data_, pos_1 * sizeof(char)); memcpy(&sequence_GU_0[pos_1], &data_[pos_2], (length_ - pos_2) * sizeof(char)); sequence_GU_0[length_GU_0] = '\0'; set_data(sequence_GU_0, length_GU_0); // ==================== Create the new genetic unit ==================== GeneticUnit* GU_1 = new GeneticUnit(indiv_, sequence_GU_1, length_GU_1, proms_GU_1); // ==================== Update promoter lists ==================== // Shift the position of the promoters of the "old" GU gen_unit_->move_all_promoters_after(pos_1, -seq_length); // Look for new promoters around breakpoints gen_unit_->look_for_new_promoters_around(pos_1); GU_1->look_for_new_promoters_around(0); return GU_1; } /*! \brief Copy the sequence going from pos_1 (included) to pos_2 (excluded) into a new standalone genetic unit. The new genetic unit's list of promoter is up-to-date. if (pos_1 == pos_2), the whole genome is copied */ GeneticUnit* Dna::copy_into_new_GU(int32_t pos_1, int32_t pos_2) const { int32_t seq_length = Utils::mod(pos_2 - pos_1, length_); if (seq_length == 0) seq_length = length_; // ==================== Copy promoters from old sequence ==================== // Copy the promoters belonging to the sequence to be copied from the "old" // GU into a stand-alone promoter list (with indices ranging from 0 to // seq_length - 1) Promoters2Strands proms_new_GU = {{}, {}}; gen_unit_->copy_promoters_included_in(pos_1, pos_2, proms_new_GU); GeneticUnit::shift_promoters(proms_new_GU, -pos_1, length_); // ==================== Manage sequences ==================== // Copy the sequence in a stand-alone char* (size must be multiple of // BLOCK_SIZE) int32_t length_new_GU = seq_length; char* sequence_new_GU = new char[nb_blocks(length_new_GU) * BLOCK_SIZE]; if (pos_1 < pos_2) { memcpy(sequence_new_GU, &data_[pos_1], length_new_GU * sizeof(char)); } else { memcpy(sequence_new_GU, &data_[pos_1], (length_ - pos_1) * sizeof(char)); memcpy(&sequence_new_GU[length_ - pos_1], &data_[0], pos_2 * sizeof(char)); } sequence_new_GU[length_new_GU] = '\0'; // ==================== Create the new genetic unit ==================== GeneticUnit* new_GU = new GeneticUnit(indiv_, sequence_new_GU, length_new_GU, proms_new_GU); // ==================== Update new GU promoter list ==================== // Look for new promoters around breakpoints new_GU->look_for_new_promoters_around(0); return new_GU; } /** * \brief Insert the genetic unit GU_to_insert at pos_B, through pos_D. * * Sequence is inverted if invert == true * * * GU to insert: segments C and D, breakpoint pos_D. * Current GU: segments A and B, breakpoint pos_B. \verbatim If invert is false, the insertion will render ADCB A B C D |-------[>-------| + |=====[>========| pos_B pos_D | V A D C B |-------[>=====|========[>-------| If invert is true, the insertion will render ACpDpB with Cp (resp. Dp) = inverted C (resp. D). A B C D |-------[>-------| + |=====<]========| pos_B pos_D | V A Cp Dp B |-------[>=====|========[>-------| \endverbatim Sequence from GU_to_insert is untouched but its list of promoters is emptied */ void Dna::insert_GU(GeneticUnit* GU_to_insert, int32_t pos_B, int32_t pos_D, bool invert) { // Compute segment lengths const char* GUti_data = GU_to_insert->dna()->data(); int32_t len_A = pos_B; int32_t len_B = length_ - pos_B; int32_t len_C = pos_D; int32_t len_D = GU_to_insert->dna()->length() - pos_D; int32_t len_AB = length_; int32_t len_CD = GU_to_insert->dna()->length(); int32_t len_ABCD = len_AB + len_CD; // ==================== Insert the sequence ==================== // Create new genome char* new_seq = new char[BLOCK_SIZE * nb_blocks(len_ABCD)]; // Insert A memcpy(new_seq, data_, len_A * sizeof(char)); // Insert C and D (inverted?) if (invert) { // Build Cp and Dp char* seq_Cp = new char[pos_D + 1]; for (int32_t i = 0, j = pos_D - 1; i < len_C; i++, j--) { if (GUti_data[j] == '0') seq_Cp[i] = '1'; else seq_Cp[i] = '0'; } seq_Cp[len_C] = '\0'; char* seq_Dp = new char[len_D + 1]; for (int32_t i = 0, j = len_CD - 1; i < len_D; i++, j--) { if (GUti_data[j] == '0') seq_Dp[i] = '1'; else seq_Dp[i] = '0'; } seq_Dp[len_D] = '\0'; // Insert Cp and DP // TODO(???) Maybe we should construct Cp and Dp directly at their rightful // place... memcpy(&new_seq[len_A], seq_Cp, len_C * sizeof(char)); memcpy(&new_seq[len_A + len_C], seq_Dp, len_D * sizeof(char)); delete[] seq_Cp; delete[] seq_Dp; } else { // if (invert == false) // Insert D and C memcpy(&new_seq[len_A], &GUti_data[pos_D], len_D * sizeof(char)); memcpy(&new_seq[len_A + len_D], GUti_data, len_C * sizeof(char)); } // Insert B memcpy(&new_seq[len_A + len_C + len_D], &data_[pos_B], len_B * sizeof(char)); new_seq[len_ABCD] = '\0'; // Remove promoters that are astride segments A and B : breakpoint pos_B gen_unit_->remove_promoters_around(pos_B); set_data(new_seq, len_ABCD); // ==================== Manage promoters ==================== // Remove promoters that are astride segments C and D : breakpoint pos_D GU_to_insert->remove_promoters_around(pos_D); // Shift the position of the promoters of segment B gen_unit_->move_all_promoters_after(pos_B, len_CD); // Extract promoters of segments C and D. // NOTE : We want ALL THE PROMOTERS to be transfered, not only those that // are completely included in segment C or D. Hence, we will use // extract_promoters_starting_between() instead of // extract_promoters_included_in(). // NOTE : Once removed the promoters starting on sequence D, the remaining // is precisely the promoters starting on sequence C (and they are // at their rightful position). We can hence directly use the list // of promoters from GU_to_insert. Promoters2Strands proms_C = {{}, {}}; Promoters2Strands proms_D = {{}, {}}; if (pos_D != 0) { // TODO(???) : Manage this in the different functions? with a parameter // WholeGenomeEventHandling ? GU_to_insert->extract_promoters_starting_between(0, pos_D, proms_C); } GU_to_insert->extract_promoters_starting_between(pos_D, len_CD, proms_D); assert(GU_to_insert->rna_list()[LEADING].empty()); assert(GU_to_insert->rna_list()[LAGGING].empty()); GeneticUnit::shift_promoters(proms_D, -len_C, len_D); if (invert) { //~ printf("+++++++++++++++++++++++++++++++++++++\n"); //~ GeneticUnit::print_rnas(proms_C); //~ GeneticUnit::print_rnas(proms_D); //~ printf("//////////////////////////////////////\n"); GeneticUnit::invert_promoters(proms_C, len_C); GeneticUnit::invert_promoters(proms_D, len_D); //~ GeneticUnit::print_rnas(proms_C); //~ GeneticUnit::print_rnas(proms_D); //~ printf("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); gen_unit_->insert_promoters_at(proms_C, len_A); gen_unit_->insert_promoters_at(proms_D, len_A + len_C); } else { // if (invert == false) gen_unit_->insert_promoters_at(proms_D, len_A); gen_unit_->insert_promoters_at(proms_C, len_A + len_D); } // Look for new promoters around breakpoints gen_unit_->look_for_new_promoters_around(pos_B); gen_unit_->look_for_new_promoters_around(pos_B + len_CD); gen_unit_->take_ownership_of_all_rnas(); } /** * \brief Looks for an alignment between this and chrom2 in the given sense * with max nb_pairs trials. nb_pairs is updated accordingly * * Performs local alignment searches between this and chrom2 around randomly * drawn pairs of points. * The minimum score will be generated according to align_fun_shape and * associated parameters for each pair of points. * The parameter nb_pairs will be updated according to how many trials * were necessary for an alignment to be found. * * The sense of the searched alignment can be either DIRECT, INDIRECT or * BOTH_SENSE. * In the latter case, the sense will be randomly drawn (uniformly between * DIRECT and INDIRECT) for each pair of points. */ VisAVis* Dna::search_alignment(Dna* chrom2, int32_t& nb_pairs, AlignmentSense sense) { VisAVis* alignment = NULL; // Which sense (direct or indirect) AlignmentSense cur_sense = sense; // Minimum alignement score needed to recombine (stochastic) int16_t needed_score; for (; nb_pairs > 0; nb_pairs--) { /////////////////////////////////////// // 1) Draw random sense (if needed) // /////////////////////////////////////// if (sense == BOTH_SENSES) { cur_sense = (indiv_->mut_prng_->random() < 0.5) ? DIRECT : INDIRECT; } ///////////////////////////////////////////////////// // 2) Determine the minimum alignment score needed // ///////////////////////////////////////////////////// if (indiv_->align_fun_shape() == LINEAR) { needed_score = static_cast( ceil(indiv_->align_lin_min() + indiv_->mut_prng_->random() * (indiv_->align_lin_max() - indiv_->align_lin_min()))); } else { // I want the probability of rearrangement for an alignment of score // to be prob = 1 / (1 + exp(-(score-mean_score)/lambda)) // The score needed for a rearrangement to take place with a given // random drawing is hence // needed_score = ceil(-lambda * log(1/rand - 1) + mean) needed_score = static_cast( ceil(-indiv_->align_sigm_lambda() * log(1 / indiv_->mut_prng_->random() - 1) + indiv_->align_sigm_mean())); if (needed_score < 0) needed_score = 0; } /////////////////////////////////////////////////////////////// // 3) Determine where to look for an alignement (draw seeds) // /////////////////////////////////////////////////////////////// int32_t seed1 = indiv_->mut_prng_->random(length_); int32_t seed2 = indiv_->mut_prng_->random(chrom2->length()); //////////////////////////////////////////////////////////////////// // 3) Test the existence of an alignment with a high enough score // //////////////////////////////////////////////////////////////////// if (cur_sense == DIRECT) { alignment = Alignment::search_alignment_direct(this, seed1, chrom2, seed2, needed_score); if (alignment != NULL) { return alignment; } } else { // if (cur_sense = INDIRECT) alignment = Alignment::search_alignment_indirect(this, seed1, chrom2, seed2, needed_score); if (alignment != NULL) { return alignment; } } } return NULL; } /** * \brief Looks for an alignment between this and chrom2 in the given sense * around the given positions * * Performs local alignment searches between this and chrom2 around the given * positions * The minimum score will be generated according to align_fun_shape and * associated parameters for each pair of points. * The parameter nb_pairs will be updated according to how many trials were * necessary for an alignment to be found. * * The sense of the searched alignment can be either DIRECT, INDIRECT or * BOTH_SENSE. * In the latter case, the sense will be randomly drawn (uniformly between * DIRECT and INDIRECT) for each pair of points. */ VisAVis* Dna::search_alignment_around_positions(Dna* chrom2, int32_t chrom1_pos_1, int32_t chrom2_pos_1, AlignmentSense sense, int8_t& search_sense) { VisAVis* alignment = NULL; VisAVis* tmp_alignment = NULL; // Which sense (direct or indirect) AlignmentSense cur_sense = sense; // Minimum alignement score needed to recombine (stochastic) int16_t needed_score; int32_t chrom1_pos_for_research; int32_t chrom2_pos_for_research; int32_t size_between_two_alignments = 3 * indiv_->align_w_zone_h_len(); /////////////////////////////////////// // 1) Draw random sense (if needed) // /////////////////////////////////////// if (sense == BOTH_SENSES) { printf("WARNING : Alignment could not be searched in both senses " "in %s:%d\n", __FILE__, __LINE__); return (NULL); } ///////////////////////////////////////////////////// // 2) Determine the minimum alignment score needed // ///////////////////////////////////////////////////// if (indiv_->align_fun_shape() == LINEAR) { needed_score = static_cast( ceil(indiv_->align_lin_min() + indiv_->mut_prng_->random() * (indiv_->align_lin_max() - indiv_->align_lin_min()))); } else { // I want the probability of rearrangement for an alignment of score // to be prob = 1 / (1 + exp(-(score-mean_score)/lambda)) // The score needed for a rearrangement to take place with a given // random drawing is hence // needed_score = ceil(-lambda * log(1/rand - 1) + mean) needed_score = static_cast( ceil(-indiv_->align_sigm_lambda() * log(1 / indiv_->mut_prng_->random() - 1) + indiv_->align_sigm_mean())); if (needed_score < 0) needed_score = 0; } ///////////////////////////////////////////////////////// // 3) Determine the sense by which the research begins // ///////////////////////////////////////////////////////// int16_t first_research_sense = (indiv_->mut_prng_->random() < 0.5) ? 1 : -1; int16_t second_research_sense = -1 * first_research_sense; ///////////////////////////////////////////////////////////////////////////// // 4) Test the first sense for the existence of an alignment with a high // enough score ///////////////////////////////////////////////////////////////////////////// chrom1_pos_for_research = chrom1_pos_1; chrom2_pos_for_research = chrom2_pos_1; int16_t i = 0; while (indiv_->mut_prng_->random() < 1 - exp_m_->repl_HT_detach_rate()) { chrom1_pos_for_research = Utils::mod(chrom1_pos_for_research + first_research_sense * size_between_two_alignments, this->length()); if (cur_sense == DIRECT) { chrom2_pos_for_research = Utils::mod(chrom2_pos_for_research + first_research_sense * size_between_two_alignments, chrom2->length()); tmp_alignment = Alignment::search_alignment_direct(this, chrom1_pos_for_research, chrom2, chrom2_pos_for_research, needed_score); } else { // if (cur_sense = INDIRECT) chrom2_pos_for_research = Utils::mod(chrom2_pos_for_research - first_research_sense * size_between_two_alignments, chrom2->length()); tmp_alignment = Alignment::search_alignment_indirect(this, chrom1_pos_for_research, chrom2, chrom2_pos_for_research, needed_score); } if (tmp_alignment == NULL) { if (alignment != NULL) { search_sense = first_research_sense; return alignment; } else { break; } } else { if (alignment != NULL) { alignment->copy(tmp_alignment); } else { alignment = new VisAVis(*tmp_alignment); } delete tmp_alignment; chrom1_pos_for_research = alignment->i_1(); chrom2_pos_for_research = alignment->i_2(); } i++; } if (alignment != NULL) { search_sense = first_research_sense; return alignment; } ///////////////////////////////////////////////////////////////////////////// // 5) Test the second sense for the existence of an alignment with a high // enough score ///////////////////////////////////////////////////////////////////////////// alignment = NULL; chrom1_pos_for_research = chrom1_pos_1; chrom2_pos_for_research = chrom2_pos_1; i = 0; while (indiv_->mut_prng_->random() < 1 - exp_m_->repl_HT_detach_rate()) { chrom1_pos_for_research = Utils::mod(chrom1_pos_for_research + second_research_sense * size_between_two_alignments, this->length()); if (cur_sense == DIRECT) { chrom2_pos_for_research = Utils::mod(chrom2_pos_for_research + second_research_sense * size_between_two_alignments, chrom2->length()); tmp_alignment = Alignment::search_alignment_direct(this, chrom1_pos_for_research, chrom2, chrom2_pos_for_research, needed_score); } else { // if (cur_sense = INDIRECT) chrom2_pos_for_research = Utils::mod(chrom2_pos_for_research - second_research_sense * size_between_two_alignments, chrom2->length()); tmp_alignment = Alignment::search_alignment_indirect(this, chrom1_pos_for_research, chrom2, chrom2_pos_for_research, needed_score); } if (tmp_alignment == NULL) { if (alignment != NULL) { search_sense = second_research_sense; return alignment; } else { break; } } else { if (alignment != NULL) { alignment->copy(tmp_alignment); } else { alignment = new VisAVis(*tmp_alignment); } delete tmp_alignment; chrom1_pos_for_research = alignment->i_1(); chrom2_pos_for_research = alignment->i_2(); } i++; } if (alignment != NULL) { search_sense = second_research_sense; return alignment; } return NULL; } // ================================================================= // Protected Methods // ================================================================= /** * Extract the sequence going from pos_1 (included) to pos_2 (excluded) * into a new standalone genetic unit. * Promoter lists are created / updated accordingly */ void Dna::ABCDE_to_ADCBE(int32_t pos_B, int32_t pos_C, int32_t pos_D, int32_t pos_E) { // Rearrange the sequence from ABCDE to ADCBE (complex translocation // of segment defined between positions pos_B and pos_D) // // Segments are identified by pos_x values as shown below. // // TODO(dpa) CHECK THIS !!! // WARNING : Segment C includes nucleotide at pos_D // NOTE : WTF??? // // A B C D E // |----->=======[>=======>-------[>-------| => // pos_B pos_C pos_D pos_E // // | // V // // A D C B E // |----->-------[>=======>=======[>-------| // Check points' order and range assert(pos_B >= 0 && pos_C >= pos_B && pos_D >= pos_C && pos_E >= pos_D && pos_E <= length_); // Compute segment lengths int32_t len_A = pos_B; int32_t len_B = pos_C - pos_B; int32_t len_C = pos_D - pos_C; int32_t len_D = pos_E - pos_D; int32_t len_E = length_ - pos_E; int32_t len_AD = len_A + len_D; int32_t len_ADC = len_AD + len_C; int32_t len_ADCB = len_ADC + len_B; // Create new sequence char* new_genome = new char[nb_blocks_ * BLOCK_SIZE]; memcpy(new_genome, data_, len_A * sizeof(char)); memcpy(&new_genome[len_A], &data_[pos_D], len_D * sizeof(char)); memcpy(&new_genome[len_AD], &data_[pos_C], len_C * sizeof(char)); memcpy(&new_genome[len_ADC], &data_[pos_B], len_B * sizeof(char)); memcpy(&new_genome[len_ADCB], &data_[pos_E], len_E * sizeof(char)); new_genome[length_] = '\0'; // Replace sequence // NB : The size of the genome doesn't change. Therefore, we don't nee // to update length_ and nb_blocks_ delete[] data_; data_ = new_genome; // ========== Update promoter list ========== if (length_ >= PROM_SIZE) { // Remove promoters that include a breakpoint gen_unit_->remove_promoters_around(pos_B); gen_unit_->remove_promoters_around(pos_C); gen_unit_->remove_promoters_around(pos_D); gen_unit_->remove_promoters_around(pos_E); // Create temporary lists for promoters to move and/or invert Promoters2Strands promoters_B = {{}, {}}; Promoters2Strands promoters_C = {{}, {}}; Promoters2Strands promoters_D = {{}, {}}; // Extract promoters that are totally included in each segment to be moved // and shift them to their new positions if (len_B >= PROM_SIZE) { gen_unit_->extract_promoters_included_in(pos_B, pos_C, promoters_B); GeneticUnit::shift_promoters(promoters_B, len_D + len_C, gen_unit_->dna()->length()); } if (len_C >= PROM_SIZE) { gen_unit_->extract_promoters_included_in(pos_C, pos_D, promoters_C); GeneticUnit::shift_promoters(promoters_C, len_D - len_B, gen_unit_->dna()->length()); } if (len_D >= PROM_SIZE) { gen_unit_->extract_promoters_included_in(pos_D, pos_E, promoters_D); GeneticUnit::shift_promoters(promoters_D, -len_B - len_C, gen_unit_->dna()->length()); } // Reinsert the shifted promoters gen_unit_->insert_promoters(promoters_B); gen_unit_->insert_promoters(promoters_C); gen_unit_->insert_promoters(promoters_D); // 5) Look for new promoters including a breakpoint gen_unit_->look_for_new_promoters_around(len_A); gen_unit_->look_for_new_promoters_around(len_AD); gen_unit_->look_for_new_promoters_around(len_ADC); gen_unit_->look_for_new_promoters_around(len_ADCB); } } void Dna::ABCDE_to_ADBpCpE(int32_t pos_B, int32_t pos_C, int32_t pos_D, int32_t pos_E) { // Rearrange the sequence from ABCDE to ADBpCpE (complex translocation // with inversion of segment defined between positions pos_B and pos_D) // Bp (resp Cp) stands for inverted B (resp C) // // Segments are identified by pos_x values as shown below. // // TODO(dpa) CHECK THIS !!! // WARNING : Segment C includes nucleotide at pos_D // NOTE : WTF??? // // A B C D E // |----->=======[>=======>-------<]-------| // pos_B pos_C pos_D pos_E // // | // V // // A D Bp Cp E // |----->-------<]=======<=======<]-------| // Check points' order and range assert(pos_B >= 0 && pos_C >= pos_B && pos_D >= pos_C && pos_E >= pos_D && pos_E <= length_); // Compute segment lengths int32_t len_A = pos_B; int32_t len_B = pos_C - pos_B; int32_t len_C = pos_D - pos_C; int32_t len_D = pos_E - pos_D; int32_t len_E = length_ - pos_E; int32_t len_AD = len_A + len_D; int32_t len_ADB = len_AD + len_B; int32_t len_ADBC = len_ADB + len_C; // Create new sequence char* new_genome = new char[nb_blocks_ * BLOCK_SIZE]; // Copy segments A and D memcpy(new_genome, data_, len_A * sizeof(char)); memcpy(&new_genome[len_A], &data_[pos_D], len_D * sizeof(char)); // Build Bp and put it in the new genome char* inverted_segment = new char[len_B + 1]; //#pragma simd //#pragma distribute_point for (int32_t i = 0, j = pos_C - 1; i < len_B; i++, j--) { if (data_[j] == '0') inverted_segment[i] = '1'; else inverted_segment[i] = '0'; } inverted_segment[len_B] = '\0'; memcpy(&new_genome[len_AD], inverted_segment, len_B * sizeof(char)); delete[] inverted_segment; // Build Cp and put it in the new genome inverted_segment = new char[len_C + 1]; //#pragma simd //#pragma distribute_point for (int32_t i = 0, j = pos_D - 1; i < len_C; i++, j--) { if (data_[j] == '0') inverted_segment[i] = '1'; else inverted_segment[i] = '0'; } inverted_segment[len_C] = '\0'; memcpy(&new_genome[len_ADB], inverted_segment, len_C * sizeof(char)); delete[] inverted_segment; // Copy segment E into the new genome memcpy(&new_genome[len_ADBC], &data_[pos_E], len_E * sizeof(char)); new_genome[length_] = '\0'; // Replace sequence delete[] data_; data_ = new_genome; // ========== Update promoter list ========== if (length_ >= PROM_SIZE) { // Remove promoters that include a breakpoint gen_unit_->remove_promoters_around(pos_B); gen_unit_->remove_promoters_around(pos_C); gen_unit_->remove_promoters_around(pos_D); gen_unit_->remove_promoters_around(pos_E); // Create temporary lists for promoters to move and/or invert Promoters2Strands promoters_B = {{}, {}}; Promoters2Strands promoters_C = {{}, {}}; Promoters2Strands promoters_D = {{}, {}}; // 2) Extract promoters that are totally included in each segment to be // moved (B, C and D) if (len_B >= PROM_SIZE) { gen_unit_->extract_promoters_included_in(pos_B, pos_C, promoters_B); } if (len_C >= PROM_SIZE) { gen_unit_->extract_promoters_included_in(pos_C, pos_D, promoters_C); } if (len_D >= PROM_SIZE) { gen_unit_->extract_promoters_included_in(pos_D, pos_E, promoters_D); } // 3a) Invert promoters of segments B and C GeneticUnit::invert_promoters(promoters_B, pos_B, pos_C); GeneticUnit::invert_promoters(promoters_C, pos_C, pos_D); // 3b) Shift these promoters positions GeneticUnit::shift_promoters(promoters_B, len_D, gen_unit_->dna()->length()); GeneticUnit::shift_promoters(promoters_C, len_D, gen_unit_->dna()->length()); GeneticUnit::shift_promoters(promoters_D, -len_B - len_C, gen_unit_->dna()->length()); // 4) Reinsert the shifted promoters gen_unit_->insert_promoters(promoters_C); gen_unit_->insert_promoters(promoters_B); gen_unit_->insert_promoters(promoters_D); // 5) Look for new promoters including a breakpoint gen_unit_->look_for_new_promoters_around(len_A); gen_unit_->look_for_new_promoters_around(len_AD); gen_unit_->look_for_new_promoters_around(len_ADB); gen_unit_->look_for_new_promoters_around(len_ADBC); } } void Dna::ABCDE_to_ACpDpBE(int32_t pos_B, int32_t pos_C, int32_t pos_D, int32_t pos_E) { // Rearrange the sequence from ABCDE to ACpDpBE (complex translocation with // inversion of segment defined between positions pos_C and pos_E) // Cp (resp Dp) stands for inverted C (resp D) // // Segments are identified by pos_x values as shown below. // // TODO(dpa) CHECK THIS !!! // WARNING : Segment D includes nucleotide at pos_E // NOTE : WTF??? // // A B C D E // |----<]-------->=======[>=======>-------| // pos_B pos_C pos_D pos_E // // | // V // // A C' D' B E // |-----<]=======>=======<]------->-------| // Check points' order and range assert(pos_B >= 0 && pos_C >= pos_B && pos_D >= pos_C && pos_E >= pos_D && pos_E <= length_); // Compute segment lengths int32_t len_A = pos_B; int32_t len_B = pos_C - pos_B; int32_t len_C = pos_D - pos_C; int32_t len_D = pos_E - pos_D; int32_t len_E = length_ - pos_E; int32_t len_AC = len_A + len_C; int32_t len_ACD = len_AC + len_D; int32_t len_ACDB = len_ACD + len_B; // Create new sequence char* new_genome = new char[nb_blocks_ * BLOCK_SIZE]; // Copy segment A memcpy(new_genome, data_, len_A * sizeof(char)); // Build Cp and put it in the new genome char* inverted_segment = new char[len_C + 1]; #pragma simd #pragma distribute_point for (int32_t i = 0, j = pos_D - 1; i < len_C; i++, j--) { if (data_[j] == '0') inverted_segment[i] = '1'; else inverted_segment[i] = '0'; } inverted_segment[len_C] = '\0'; memcpy(&new_genome[len_A], inverted_segment, len_C * sizeof(char)); delete[] inverted_segment; // Build Dp and put it in the new genome inverted_segment = new char[len_D + 1]; #pragma simd #pragma distribute_point for (int32_t i = 0, j = pos_E - 1; i < len_D; i++, j--) { if (data_[j] == '0') inverted_segment[i] = '1'; else inverted_segment[i] = '0'; } inverted_segment[len_D] = '\0'; memcpy(&new_genome[len_AC], inverted_segment, len_D * sizeof(char)); delete[] inverted_segment; // Copy segments B and E memcpy(&new_genome[len_ACD], &data_[pos_B], len_B * sizeof(char)); memcpy(&new_genome[len_ACDB], &data_[pos_E], len_E * sizeof(char)); new_genome[length_] = '\0'; // Replace sequence delete[] data_; data_ = new_genome; // ========== Update promoter list ========== // 1) Remove promoters that include a breakpoint // 2) Extract promoters that are totally included in each segment to be // moved (B, C and D) // 3) Shift (and invert when needed) these promoters positions // 4) Reinsert the shifted promoters // 5) Look for new promoters including a breakpoint if (length_ >= PROM_SIZE) { // 1) Remove promoters that include a breakpoint gen_unit_->remove_promoters_around(pos_B); gen_unit_->remove_promoters_around(pos_C); gen_unit_->remove_promoters_around(pos_D); gen_unit_->remove_promoters_around(pos_E); // Create temporary lists for promoters to move and/or invert Promoters2Strands promoters_B = {{}, {}}; Promoters2Strands promoters_C = {{}, {}}; Promoters2Strands promoters_D = {{}, {}}; // 2) Extract promoters that are totally included in each segment to be // moved (B, C and D) if (len_B >= PROM_SIZE) { gen_unit_->extract_promoters_included_in(pos_B, pos_C, promoters_B); } if (len_C >= PROM_SIZE) { gen_unit_->extract_promoters_included_in(pos_C, pos_D, promoters_C); } if (len_D >= PROM_SIZE) { gen_unit_->extract_promoters_included_in(pos_D, pos_E, promoters_D); } // 3a) Invert promoters of segments C and D GeneticUnit::invert_promoters(promoters_C, pos_C, pos_D); GeneticUnit::invert_promoters(promoters_D, pos_D, pos_E); // 3b) Shift these promoters positions GeneticUnit::shift_promoters(promoters_B, len_C + len_D, gen_unit_->dna()->length()); GeneticUnit::shift_promoters(promoters_C, -len_B, gen_unit_->dna()->length()); GeneticUnit::shift_promoters(promoters_D, -len_B, gen_unit_->dna()->length()); // 4) Reinsert the shifted promoters gen_unit_->insert_promoters(promoters_B); gen_unit_->insert_promoters(promoters_D); gen_unit_->insert_promoters(promoters_C); // 5) Look for new promoters including a breakpoint gen_unit_->look_for_new_promoters_around(len_A); gen_unit_->look_for_new_promoters_around(len_AC); gen_unit_->look_for_new_promoters_around(len_ACD); gen_unit_->look_for_new_promoters_around(len_ACDB); } } void Dna::inter_GU_ABCDE_to_ACDBE(int32_t pos_B, int32_t pos_C, int32_t pos_E) { // Check points' order and range assert((pos_B >= 0 && pos_C >= pos_B) && (pos_E >= 0)); if (pos_B != pos_C) { // Useful values Individual* indiv = indiv_; GeneticUnit& chromosome = indiv->genetic_unit_nonconst(0); GeneticUnit& plasmid = indiv->genetic_unit_nonconst(1); GeneticUnit& destination_GU = (gen_unit_ == &chromosome) ? plasmid : chromosome; // Compute segment lengths int32_t len_A = pos_B; int32_t len_B = pos_C - pos_B; int32_t len_C = length_ - pos_C; int32_t len_D = pos_E; int32_t len_E = destination_GU.dna()->length() - pos_E; int32_t len_AC = len_A + len_C; int32_t len_DB = len_D + len_B; int32_t len_DBE = len_DB + len_E; // Create the new sequence of this genetic unit int32_t tmp = ae_string::nb_blocks(len_AC); char* new_sequence_this = new char[tmp * BLOCK_SIZE]; memcpy(new_sequence_this, data_, len_A * sizeof(char)); memcpy(&new_sequence_this[len_A], &data_[pos_C], len_C * sizeof(char)); new_sequence_this[len_AC] = '\0'; // Create the new sequence of the destination genetic unit tmp = ae_string::nb_blocks(len_DBE) * BLOCK_SIZE; char* new_sequence_dest = new char[tmp]; const char* dest_GU_former_seq = destination_GU.dna()->data(); memcpy(new_sequence_dest, dest_GU_former_seq, len_D * sizeof(char)); memcpy(&new_sequence_dest[len_D], &data_[pos_B], len_B * sizeof(char)); memcpy(&new_sequence_dest[len_DB], &dest_GU_former_seq[pos_E], len_E * sizeof(char)); new_sequence_dest[len_DBE] = '\0'; // ========== Update promoter list ========== // 1) Remove promoters that include a breakpoint // 2) Extract promoters that are totally included in each segment to be // moved (B, C and E) // NB : Sequences have to be updated at this stage in order to have the // correct lengths when managing new promoter positions // ........ // 3) Shift these promoters positions // 4) Reinsert the shifted promoters // 5) Look for new promoters including a breakpoint // 1) Remove promoters that include a breakpoint gen_unit_->remove_promoters_around(pos_B); gen_unit_->remove_promoters_around(pos_C); destination_GU.remove_promoters_around(pos_E); // Create temporary lists for promoters to move and/or invert Promoters2Strands promoters_B = {{}, {}}; // 2) Extract promoters that are totally included in each segment to be // moved (B, C and E) if (len_B >= PROM_SIZE) { gen_unit_->extract_promoters_included_in(pos_B, pos_C, promoters_B); } // ========== Replace sequences ========== set_data(new_sequence_this, len_AC); destination_GU.dna()->set_data(new_sequence_dest, len_DBE); // 3) Shift these promoters positions GeneticUnit::shift_promoters(promoters_B, len_D - len_A, destination_GU.dna()->length()); // Reassign promoters to their new genetic unit for (auto& strand : {LEADING, LAGGING}) for (auto& rna : promoters_B[strand]) rna.set_genetic_unit(&destination_GU); // Shift the promoters of sequences C and E gen_unit_->move_all_promoters_after(pos_C, -len_B); destination_GU.move_all_promoters_after(pos_E, len_B); // 4) Reinsert the shifted promoters destination_GU.insert_promoters(promoters_B); // 5) Look for new promoters including a breakpoint gen_unit_->look_for_new_promoters_around(0); gen_unit_->look_for_new_promoters_around(len_A); destination_GU.look_for_new_promoters_around(0); destination_GU.look_for_new_promoters_around(len_D); destination_GU.look_for_new_promoters_around(len_DB); } } void Dna::inter_GU_ABCDE_to_BDCAE(int32_t pos_B, int32_t pos_C, int32_t pos_E) { // Check points' order and range assert((pos_B >= 0 && pos_C >= pos_B) && (pos_E >= 0)); // Compute segment lengths int32_t len_A = pos_B; int32_t len_B = pos_C - pos_B; int32_t len_C = length_ - pos_C; //~ int32_t len_ABC = length_; int32_t len_DA = len_A + pos_E; inter_GU_ABCDE_to_ACDBE(0, pos_B, pos_E); inter_GU_ABCDE_to_ACDBE(len_B, (len_B + len_C), len_DA); } }// namespace aevol aevol-5.0/src/libaevol/X11Window.h0000644000175000017500000001647112724051151013712 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_X11_WINDOW_H_ #define AEVOL_X11_WINDOW_H_ // ================================================================= // Libraries // ================================================================= #include #include // ================================================================= // Project Files // ================================================================= #include #include #include #include namespace aevol { // ================================================================= // Class declarations // ================================================================= enum color_map { WHITE, BLACK, RED, GREEN, BLUE, ORANGE, YELLOW, GREY, LIGHT_GREY, DARK_GREY, DARKER_GREY }; class X11Window { public : // ================================================================= // Constructors // ================================================================= X11Window(); X11Window(Display* display, int8_t screen, Atom * atoms, uint16_t pos_x, uint16_t pos_y, uint16_t width, uint16_t height, const char* caption); // ================================================================= // Destructors // ================================================================= virtual ~X11Window(); // ================================================================= // Accessors // ================================================================= GC gc_white() { return gcWhite_; }; GC gc_black() { return gcBlack_; }; GC getGCBlue() { return gcBlue_; }; GC getGCRed() { return gcRed_; }; GC getGCLightGrey() { return gcLightGrey_; }; GC getGCDarkGrey() { return gcDarkGrey_; }; GC getGCDarkerGrey() { return gcDarkerGrey_; }; GC getGCGrey() { return gcGrey_; }; GC getGCGreen() { return gcGreen_; }; GC getGCOrange() { return gcOrange_; }; GC getGCYellow() { return gcYellow_; }; uint16_t width() { return width_; }; uint16_t height() { return height_; }; Window window() { return window_; }; Display * display() { return display_; }; // ================================================================= // Public Methods // ================================================================= void resize(unsigned int width, unsigned int height); inline void blacken(); void draw_string(int16_t x, int16_t y, char* str); void draw_line(int16_t x1, int16_t y1, int16_t x2, int16_t y2, color_map color, bool bold = false); void draw_line(int16_t x1, int16_t y1, int16_t x2, int16_t y2, char* color, bool bold = false); void draw_circle(int16_t x, int16_t y, int16_t diam); void draw_arc(int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2); void draw_arc(int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2, char* color); void draw_arc_64(int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2); void draw_arc_64(int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2, char* color); void fill_arc(int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2); void fill_arc(int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2, char* color); void fill_arc_64(int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2); void fill_arc_64(int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2, char* color); void fill_rectangle(int16_t x, int16_t y, int16_t width, int16_t height, color_map color); void fill_rectangle(int16_t x, int16_t y, int16_t width, int16_t height, char* color); static char* color(double mean); // ================================================================= // Public Attributes // ================================================================= protected : // ================================================================= // Forbidden Constructors // ================================================================= //~ X11Window() //~ { //~ printf("ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__); //~ exit(EXIT_FAILURE); //~ }; X11Window(const X11Window &model) { printf("ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__); exit(EXIT_FAILURE); }; // ================================================================= // Protected Methods // ================================================================= uint32_t pixel(Display *display, int8_t screen, char *color_name, uint32_t default_color); void set_codes(); // ================================================================= // Protected Attributes // ================================================================= Display * display_; int8_t screen_; Window window_; Cursor cursor_; uint16_t width_; uint16_t height_; // Graphic Contexts GC gcWhite_; GC gcBlack_; GC gcRed_; GC gcGreen_; GC gcBlue_; GC gcOrange_; GC gcYellow_; GC gcGrey_; GC gcLightGrey_; GC gcDarkGrey_; GC gcDarkerGrey_; }; // ===================================================================== // Accessors' definitions // ===================================================================== // ===================================================================== // Inline functions' definition // ===================================================================== void X11Window::blacken() { fill_rectangle(0, 0, width_, height_, BLACK); } } // namespace aevol #endif // AEVOL_X11_WINDOW_H_ aevol-5.0/src/libaevol/ExpManager.cpp0000644000175000017500000005235212730777745014556 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ================================================================= // Includes // ================================================================= #include #include #include #include #include #include #include "ExpManager.h" #include "Individual.h" #ifdef __REGUL #include "raevol/Individual_R.h" #endif #ifdef __TRACING__ #include "ae_logger.h" #include using namespace std::chrono; unordered_map> ae_logger::logMap; string ae_logger::logFile = "logger_csv.log"; mutex ae_logger::loggerMtx; #endif using std::cout; using std::endl; namespace aevol { //############################################################################## // # // Class ExpManager # // # //############################################################################## // =========================================================================== // Definition of static attributes // =========================================================================== // =========================================================================== // Constructors // =========================================================================== ExpManager::ExpManager() { // ------------------------------------------------------ Experimental setup exp_s_ = new ExpSetup(this); // ------------------------------------------------------------------- World world_ = nullptr; // ---------------------------------------------------------- Output manager output_m_ = new OutputManager(this); // -------------------------------- Timestep up to which we want to simulate t_end_ = 0; // ------------------------------------------------------------- Quit signal quit_signal_received_ = false; } // =========================================================================== // Destructor // =========================================================================== ExpManager::~ExpManager() noexcept { delete exp_s_; delete output_m_; delete world_; } // =========================================================================== // Algorithms // =========================================================================== // =========================================================================== // Public Methods // =========================================================================== void ExpManager::InitializeWorld(int16_t grid_width, int16_t grid_height, std::shared_ptr prng, std::shared_ptr mut_prng, std::shared_ptr stoch_prng, Habitat& habitat, bool share_phenotypic_target) { world_ = new World(); world_->set_prng(prng); world_->set_mut_prng(mut_prng); world_->set_stoch_prng(stoch_prng); world_->InitGrid(grid_width, grid_height, habitat, share_phenotypic_target); } /*! \brief Save the experiment */ void ExpManager::Save() const { WriteSetupFiles(); output_m_->write_current_generation_outputs(); } /*! \brief Save all the static data (the data that is constant throughout a simulation) Save * The experimental setup * The output profile These are written in the current directory in gzipped binary files as well as plain text files This data should be saved once and for all when the experiment is created. There is no need to save this data in the middle of a simulation since it is constant throughout the experiment. \see load(int64_t t0, char* exp_setup_file_name, char* out_prof_file_name, char* pop_file_name, char* sel_file_name, char* world_file_name, bool verbose) \see WriteDynamicFiles() */ void ExpManager::WriteSetupFiles() const { // 1) Create missing directories create_missing_directories(); // 2) Open setup files (experimental setup and output profile) gzFile exp_s_file, out_p_file; open_setup_files(exp_s_file, out_p_file, AeTime::time(), "w"); // 4) Write setup data exp_s_->write_setup_file(exp_s_file); output_m_->WriteSetupFile(out_p_file); // 5) Close setup files close_setup_files(exp_s_file, out_p_file); } /*! \brief Save all the dynamic data (the data that changes over the simulation) Save the state of * The population * The world * The PRNG (random generator) used for the selection These are written in the current directory in gzipped binary files whose names are appended with the current generation number. WARNING: The experimental setup and output profile are *not* saved. These should be saved once and for all when the experiment is created. \see load(int64_t t0, char* exp_setup_file_name, char* out_prof_file_name, char* pop_file_name, char* sel_file_name, char* world_file_name, bool verbose) \see WriteSetupFiles() */ void ExpManager::WriteDynamicFiles() const { // Create missing directories create_missing_directories(); // Open backup files gzFile sel_file, world_file; open_backup_files(sel_file, world_file, AeTime::time(), "w"); // Save experiment sel()->save(sel_file); world_->save(world_file); // Close backup files close_backup_files(sel_file, world_file); } /*! \brief Saves a complete copy of the experiment at the provided location. Save both the setup (constant) and the backup (dynamic) files to the directory. Dynamic file names will be appended with the Static files (saved both as gzipped binary and plain text) * The experimental setup * The output profile Dynamic files (saved as gzipped binary) * The world * The PRNG (random generator) used for the selection \see load(int32_t first_gener, char* exp_setup_file_name, char* out_prof_file_name, char* pop_file_name, char* sel_file_name, char* world_file_name, bool verbose) \see WriteSetupFiles() \see WriteDynamicFiles() */ void ExpManager::Propagate(char* outdir) const { // Reset timestep int64_t propagated_timestep = AeTime::time(); int64_t timestep = 0; AeTime::set_time(timestep); // Create missing directories create_missing_directories(outdir); // Open setup files and backup files gzFile exp_s_file, out_p_file, sel_file, world_file; open_setup_files(exp_s_file, out_p_file, timestep, "w", outdir); open_backup_files(sel_file, world_file, timestep, "w", outdir); // Write setup data exp_s_->write_setup_file(exp_s_file); output_m_->WriteSetupFile(out_p_file); // Write the state of selection and world into the backups sel()->save(sel_file); world_->save(world_file); // Close setup and backup files close_setup_files(exp_s_file, out_p_file); close_backup_files(sel_file, world_file); // Copy stats output_m_->PropagateStats(outdir, propagated_timestep); // Write last gener file output_m_->WriteLastGenerFile(outdir); } void ExpManager::step_to_next_generation() { // TODO Apply phenotypic target variation and noise world_->ApplyHabitatVariation(); // Take a step in time AeTime::plusplus(); // Create the corresponding new generation exp_s_->step_to_next_generation(); // Write statistical data and store phylogenetic data (tree) output_m_->write_current_generation_outputs(); } /*! \brief Load an experiment with the provided files */ // TODO check verbose (what does it do ?, is it consistent ?) void ExpManager::load(gzFile& exp_s_file, gzFile& exp_backup_file, gzFile& world_file, gzFile& out_p_file, bool verbose, bool to_be_run /* = true */) { // ---------------------------------------- Retrieve experimental setup data printf(" Loading experimental setup..."); fflush(stdout); exp_s_->load(exp_s_file, exp_backup_file, verbose); printf(" OK\n"); if (FuzzyFactory::fuzzyFactory == NULL) FuzzyFactory::fuzzyFactory = new FuzzyFactory(exp_s_); // ---------------------------------------------------------- Retrieve world printf(" Loading world..."); fflush(stdout); world_ = new World(); world_->load(world_file, this); printf(" OK\n"); // --------------------------------------------- Retrieve output profile data printf(" Loading output profile..."); fflush(stdout); output_m_->load(out_p_file, verbose, to_be_run); printf(" OK\n"); // -------------------------------------------- Link world and output profile if (record_tree()) { // TODO(dpa) Document this !!! sel()->addObserver(tree(), NEW_INDIV); sel()->addObserver(tree(), END_GENERATION); } // --------------------------------------------------- Recompute unsaved data world_->evaluate_individuals(); } /*! \brief Load an experiment with default files from a given directory */ // TODO check verbose (what does it do ?, is it consistent ?) void ExpManager::load(const char* dir, int64_t t0, bool verbose, bool to_be_run /* = true */) { AeTime::set_time(t0); // ------------------------------------------------------------------------- // Open setup files and backup files // ------------------------------------------------------------------------- gzFile exp_s_file, out_p_file; gzFile exp_backup_file, world_file; open_setup_files(exp_s_file, out_p_file, t0, "r", dir); open_backup_files(exp_backup_file, world_file, t0, "r", dir); // ------------------------------------------------------------------------- // Load data from backup and parameter files // ------------------------------------------------------------------------- load(exp_s_file, exp_backup_file, world_file, out_p_file, verbose, to_be_run); // ------------------------------------------------------------------------- // Close setup and backup files // ------------------------------------------------------------------------- close_setup_files(exp_s_file, out_p_file); close_backup_files(exp_backup_file, world_file); if (FuzzyFactory::fuzzyFactory == NULL) FuzzyFactory::fuzzyFactory = new FuzzyFactory(exp_s_); /*printf("Factory flavor %d : %d\n", exp_s_->get_fuzzy_flavor(), FuzzyFactory::fuzzyFactory->get_fuzzy_flavor());*/ } /** * \brief Load an experiment with the provided constitutive files */ // TODO check verbose (what does it do ?, is it consistent ?) void ExpManager::load(int64_t t0, char* exp_setup_file_name, char* exp_backup_file_name, char* world_file_name, char* out_prof_file_name, bool verbose /*= false*/, bool to_be_run /*= true*/) { AeTime::set_time(t0); // --------------------------------------------------------------------------- // Open files and check them // --------------------------------------------------------------------------- gzFile exp_setup_file = gzopen(exp_setup_file_name, "r"); gzFile out_prof_file = gzopen(out_prof_file_name, "r"); gzFile exp_backup_file = gzopen(exp_backup_file_name, "r"); gzFile world_file = gzopen(world_file_name, "r"); if (exp_setup_file == Z_NULL) { printf("%s:%d: error: could not open backup file %s\n", __FILE__, __LINE__, exp_setup_file_name); exit(EXIT_FAILURE); } if (out_prof_file == Z_NULL) { printf("%s:%d: error: could not open backup file %s\n", __FILE__, __LINE__, out_prof_file_name); exit(EXIT_FAILURE); } if (exp_backup_file == Z_NULL) { printf("%s:%d: error: could not open backup file %s\n", __FILE__, __LINE__, exp_backup_file_name); exit(EXIT_FAILURE); } if (world_file == Z_NULL) { printf("%s:%d: error: could not open backup file %s\n", __FILE__, __LINE__, world_file_name); exit(EXIT_FAILURE); } // --------------------------------------------------------------------------- // Actually load data // --------------------------------------------------------------------------- load(exp_setup_file, exp_backup_file, world_file, out_prof_file, verbose, to_be_run); // --------------------------------------------------------------------------- // Close setup and backup files // --------------------------------------------------------------------------- gzclose(exp_setup_file); gzclose(exp_backup_file); gzclose(world_file); gzclose(out_prof_file); } /** * Run the simulation */ void ExpManager::run_evolution() { // We are running a simulation. // Save the setup files to keep track of the setup history WriteSetupFiles(); #ifdef __TRACING__ ae_logger::init("logger_csv.log"); /*printf("Launching TRACING...\n");*/ #else /*printf("Launching NOT TRACING...\n");*/ #endif #ifdef __TRACING__ high_resolution_clock::time_point t_t1 = high_resolution_clock::now(); high_resolution_clock::time_point t_t2,t1,t2; #endif if (exp_s_->first_regul()) if (AeTime::time() < 10000 || AeTime::time() > 20000) regul_or_not_ = true; else regul_or_not_ = false; else if (AeTime::time() < 10000 || AeTime::time() > 20000) regul_or_not_ = false; else regul_or_not_ = true; // For each generation while (true) { // termination condition is into the loop printf("============================== %" PRId64 " ==============================\n", AeTime::time()); printf(" Best individual's distance to target (metabolic) : %f\n", best_indiv()->dist_to_target_by_feature(METABOLISM)); if (AeTime::time() >= t_end_ or quit_signal_received()) break; #ifdef __X11 display(); #endif #ifdef __TRACING__ t1 = high_resolution_clock::now(); #endif // Take one step in the evolutionary loop if (AeTime::time() == 10000 || AeTime::time() == 20000) regul_or_not_ = !regul_or_not_; step_to_next_generation(); #ifdef __TRACING__ t2 = high_resolution_clock::now(); auto duration = std::chrono::duration_cast( t2 - t1 ).count(); ae_logger::addLog(SELECTION,duration); ae_logger::flush(AeTime::get_time()); #endif } #ifdef __TRACING__ t_t2 = high_resolution_clock::now(); auto duration = std::chrono::duration_cast( t_t2 - t_t1 ).count(); ae_logger::addLog(TOTAL,duration); ae_logger::flush(AeTime::get_time()); #endif output_m_->flush(); printf("================================================================\n"); printf(" The run is finished. \n"); printf(" Printing the final best individual into " BEST_LAST_ORG_FNAME "\n"); FILE* org_file = fopen(BEST_LAST_ORG_FNAME, "w"); fputs(best_indiv()->genetic_unit_sequence(0), org_file); fclose(org_file); } void ExpManager::update_best() { world_->update_best(); } // =========================================================================== // Protected Methods // =========================================================================== void ExpManager::create_missing_directories(const char* dir /*= "."*/) const { char cur_dir_name[255]; int status; // Base directory status = mkdir(dir, 0755); if ((status == -1) && (errno != EEXIST)) { err(EXIT_FAILURE, cur_dir_name, errno); } // Experimental setup sprintf(cur_dir_name, "%s/" EXP_S_DIR, dir); status = mkdir(cur_dir_name, 0755); if ((status == -1) && (errno != EEXIST)) { err(EXIT_FAILURE, cur_dir_name, errno); } // Output profile sprintf(cur_dir_name, "%s/" OUT_P_DIR, dir); status = mkdir(cur_dir_name, 0755); if ((status == -1) && (errno != EEXIST)) { err(EXIT_FAILURE, cur_dir_name, errno); } // World sprintf(cur_dir_name, "%s/" WORLD_DIR, dir); status = mkdir(cur_dir_name, 0755); if (status == -1 && errno != EEXIST) { err(EXIT_FAILURE, cur_dir_name, errno); } // Stats sprintf(cur_dir_name, "%s/" STATS_DIR, dir); status = mkdir(cur_dir_name, 0755); if (status == -1 && errno != EEXIST) { err(EXIT_FAILURE, cur_dir_name, errno); } } void ExpManager::open_backup_files(gzFile& exp_backup_file, gzFile& world_file, int64_t t, const char mode[3], const char* dir /*= "."*/) const { assert(strcmp(mode, "w") == 0 or strcmp(mode, "r") == 0); // ------------------------------------------------------------------------- // Generate backup file names for mandatory files. // ------------------------------------------------------------------------- char exp_backup_file_name[255]; char world_file_name[255]; sprintf(exp_backup_file_name, "%s/" EXP_S_FNAME_FORMAT, dir, t); sprintf(world_file_name, "%s/" WORLD_FNAME_FORMAT, dir, t); // ------------------------------------------------------------------------- // Open backup files // ------------------------------------------------------------------------- exp_backup_file = gzopen(exp_backup_file_name, mode); world_file = gzopen(world_file_name, mode); // ------------------------------------------------------------------------- // Check that files were correctly opened // ------------------------------------------------------------------------- if (exp_backup_file == Z_NULL) { printf("%s:%d: error: could not open backup file %s\n", __FILE__, __LINE__, exp_backup_file_name); exit(EXIT_FAILURE); } if (world_file == Z_NULL) { printf("%s:%d: error: could not open backup file %s\n", __FILE__, __LINE__, world_file_name); exit(EXIT_FAILURE); } } void ExpManager::close_backup_files(gzFile& exp_backup_file, gzFile& world_file) const { gzclose(exp_backup_file); gzclose(world_file); } void ExpManager::open_setup_files( gzFile& exp_s_file, gzFile& out_p_file, int64_t t, const char mode[3], const char* dir /*= "."*/) const { // 1) Generate setup file names char exp_s_file_name[255]; char out_p_file_name[255]; sprintf(exp_s_file_name, "%s/" EXP_S_CONST_FNAME_FORMAT, dir); sprintf(out_p_file_name, "%s/" OUT_P_FNAME_FORMAT, dir); // 2) Open backup files exp_s_file = gzopen(exp_s_file_name, mode); out_p_file = gzopen(out_p_file_name, mode); // 3) Check that files were correctly opened if (exp_s_file == Z_NULL) { printf("%s:%d: error: could not open backup file %s\n", __FILE__, __LINE__, exp_s_file_name); exit(EXIT_FAILURE); } if (out_p_file == Z_NULL) { printf("%s:%d: error: could not open backup file %s\n", __FILE__, __LINE__, out_p_file_name); exit(EXIT_FAILURE); } } void ExpManager::close_setup_files(gzFile& exp_s_file, gzFile& out_p_file) const { gzclose(exp_s_file); gzclose(out_p_file); } // =========================================================================== // Non inline accessors // =========================================================================== Individual* ExpManager::indiv_by_id(int32_t id) const { return world_->indiv_by_id(id); } Individual* ExpManager::indiv_by_rank(int32_t rank) const { return world_->indiv_by_id(rank); } /** * Returns a list of all the individuals with their replication report */ std::list> ExpManager::indivs_annotated() const { std::list> annotated_list; for (const auto& indiv : indivs()) { annotated_list.emplace_back(indiv, tree() ? tree()->report_by_index(AeTime::time(), indiv->id()) : nullptr); } return annotated_list; } } // namespace aevol aevol-5.0/src/libaevol/raevol/0000755000175000017500000000000012735464421013351 500000000000000aevol-5.0/src/libaevol/raevol/PhenotypicTarget_R.cpp0000644000175000017500000000735112724051151017543 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ============================================================================ // Includes // ============================================================================ #include "PhenotypicTarget_R.h" #include "FuzzyFactory.h" #include namespace aevol { //############################################################################## // # // Class PhenotypicTarget # // # //############################################################################## // ============================================================================ // Definition of static attributes // ============================================================================ // ============================================================================ // Constructors // ============================================================================ PhenotypicTarget_R::PhenotypicTarget_R() : PhenotypicTarget() { id_ = 0; //signals_ = NULL; } PhenotypicTarget_R::PhenotypicTarget_R( int8_t id) : PhenotypicTarget() { id_ = id; //signals_ = NULL; } PhenotypicTarget_R::PhenotypicTarget_R(const PhenotypicTarget_R& rhs) : PhenotypicTarget(rhs) { id_ = rhs.id_; signals_ = rhs.signals_; } // ============================================================================ // Destructor // ============================================================================ PhenotypicTarget_R::~PhenotypicTarget_R() { } // ============================================================================ // Methods // ============================================================================ void PhenotypicTarget_R::save(gzFile backup_file) const { //printf("Appel a la sauvegarde de PhenotypicTarget_R\n"); SaveSegmentation(backup_file); // Backup id gzwrite(backup_file, &id_, sizeof(id_)); } void PhenotypicTarget_R::load(gzFile backup_file) { //printf("Appel au chargement de PhenotypicTarget_R\n"); LoadSegmentation(backup_file); // Retrieve id gzread(backup_file, &id_, sizeof(id_)); } // ============================================================================ // Non inline accessors // ============================================================================ } // namespace aevol aevol-5.0/src/libaevol/raevol/Individual_R_X11.h0000644000175000017500000001166212724051151016440 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_INDIVIDUAL_R_X11_H_ #define AEVOL_INDIVIDUAL_R_X11_H_ // ================================================================= // Libraries // ================================================================= #include // ================================================================= // Project Files // ================================================================= #include "Individual_R.h" #include "Individual_X11.h" namespace aevol { // ================================================================= // Class declarations // ================================================================= class Individual_R_X11 : public Individual_R, Individual_X11 { public : // ================================================================= // Constructors // ================================================================= Individual_R_X11( const Individual_R_X11 &model ); Individual_R_X11(ExpManager * exp_m, std::shared_ptr mut_prng, std::shared_ptr stoch_prng, std::shared_ptr param_mut, double w_max, int32_t min_genome_length, int32_t max_genome_length, bool allow_plasmids, int32_t id, const char* strain_name, int32_t age); Individual_R_X11( Individual_R_X11* parent, int32_t id, std::shared_ptr mut_prng, std::shared_ptr stoch_prng); Individual_R_X11( ExpManager* exp_m, gzFile backup_file ); // ================================================================= // Destructors // ================================================================= virtual ~Individual_R_X11( void ) noexcept; // ================================================================= // Accessors // ================================================================= // ================================================================= // Public Methods // ================================================================= virtual void display_regulation( X11Window* win ); virtual void display_concentrations( X11Window* win ); virtual void display_phenotype( X11Window* win, const Habitat_R& habitat ); // ================================================================= // Public Attributes // ================================================================= protected : // ================================================================= // Forbidden Constructors // ================================================================= /* ae_individual_R_X11(const ae_individual &model) { printf("ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__); exit(EXIT_FAILURE); };*/ // ================================================================= // Protected Methods // ================================================================= // ================================================================= // Protected Attributes // ================================================================= }; // ===================================================================== // Accessors definitions // ===================================================================== } // namespace aevol #endif // AEVOL_INDIVIDUAL_R_X11_H_ aevol-5.0/src/libaevol/raevol/Habitat_R.h0000644000175000017500000001405312724051151015270 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // //***************************************************************************** #ifndef AEVOL_HABITAT_R_H__ #define AEVOL_HABITAT_R_H__ // ============================================================================ // Includes // ============================================================================ #include #include #include #include #include #include #include "PhenotypicTargetHandler_R.h" #include "Habitat.h" namespace aevol { // ============================================================================ // Class declarations // ============================================================================ class Habitat_R : public virtual Habitat { public : // ========================================================================== // Constructors // ========================================================================== Habitat_R(void); //< Default ctor Habitat_R(const Habitat_R&) = delete; //< Copy ctor Habitat_R(Habitat_R&&) = delete; //< Move ctor Habitat_R(const Habitat_R&, bool share_phenotypic_target); Habitat_R(gzFile backup_file, PhenotypicTargetHandler_R* phenotypic_target_handler_); // ========================================================================== // Destructor // ========================================================================== virtual ~Habitat_R(void) = default; //< Destructor // ========================================================================== // Operators // ========================================================================== // ========================================================================== // Public Methods // ========================================================================== virtual void ApplyVariation(); virtual void save(gzFile backup_file, bool skip_phenotypic_target = false) const; virtual void load(gzFile backup_file, PhenotypicTargetHandler_R* phenotypic_target_handler); // ========================================================================== // Getters // ========================================================================== virtual const PhenotypicTarget& phenotypic_target() const { Utils::ExitWithDevMsg("You should not call a phenotypic target without age id in RAevol", __FILE__, __LINE__); return *(new PhenotypicTarget()); // suppress warning } const PhenotypicTarget_R& phenotypic_target( int8_t age ) const { return (dynamic_cast(phenotypic_target_handler_))->phenotypic_target( age ); } int8_t number_of_phenotypic_targets() const { return (dynamic_cast(phenotypic_target_handler_))->number_of_phenotypic_targets(); } virtual const PhenotypicTargetHandler_R& phenotypic_target_handler() const { return *(dynamic_cast (phenotypic_target_handler_)); } virtual PhenotypicTargetHandler_R& phenotypic_target_handler_nonconst() const { return *(dynamic_cast (phenotypic_target_handler_));; } const std::list signals() const { return (dynamic_cast(phenotypic_target_handler_))->signals(); } // ========================================================================== // Setters // ========================================================================== protected : // ========================================================================== // Protected Methods // ========================================================================== // ========================================================================== // Attributes // ========================================================================== }; // ============================================================================ // Getters' definitions // ============================================================================ // ============================================================================ // Setters' definitions // ============================================================================ // ============================================================================ // Operators' definitions // ============================================================================ // ============================================================================ // Inline functions' definition // ============================================================================ } // namespace aevol #endif // AEVOL_HABITAT_R_H__ aevol-5.0/src/libaevol/raevol/Habitat_R.cpp0000644000175000017500000001111512724051151015617 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ============================================================================ // Includes // ============================================================================ #include "Habitat_R.h" #include "PhenotypicTargetHandler_R.h" #include using std::cout; using std::endl; namespace aevol { //############################################################################## // # // Class Habitat # // # //############################################################################## // ============================================================================ // Definition of static attributes // ============================================================================ // ============================================================================ // Constructors // ============================================================================ Habitat_R::Habitat_R(void) { compound_amount_ = 0.0; phenotypic_target_handler_ = new PhenotypicTargetHandler_R(); } Habitat_R::Habitat_R(const Habitat_R& rhs, bool share_phenotypic_target) { assert(share_phenotypic_target); compound_amount_ = rhs.compound_amount_; phenotypic_target_handler_ = rhs.phenotypic_target_handler_; } Habitat_R::Habitat_R(gzFile backup_file, PhenotypicTargetHandler_R* phenotypic_target_handler) { load(backup_file, phenotypic_target_handler); } // ============================================================================ // Destructor // ============================================================================ // ============================================================================ // Setters' definitions // ============================================================================ // ============================================================================ // Methods // ============================================================================ void Habitat_R::ApplyVariation() { //printf("Appel au apply_variation de habitat_R\n"); dynamic_cast(phenotypic_target_handler_)->ApplyVariation(); } void Habitat_R::save(gzFile backup_file, bool skip_phenotypic_target /*= false*/) const { //printf("Appel a la sauvegarde de Habitat_R\n"); gzwrite(backup_file, &compound_amount_, sizeof(compound_amount_)); if (not skip_phenotypic_target) { phenotypic_target_handler_->save(backup_file); } } void Habitat_R::load(gzFile backup_file, PhenotypicTargetHandler_R* phenotypic_target_handler) { //printf("Appel au chargement de Habitat_R\n"); gzread(backup_file, &compound_amount_, sizeof(compound_amount_)); if (phenotypic_target_handler == NULL) phenotypic_target_handler_ = new PhenotypicTargetHandler_R(backup_file); else phenotypic_target_handler_ = phenotypic_target_handler; } // ============================================================================ // Non inline accessors // ============================================================================ } // namespace aevol aevol-5.0/src/libaevol/raevol/PhenotypicTargetHandler_R.h0000644000175000017500000001675012724051151020511 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // //***************************************************************************** #ifndef AEVOL_PHENOTYPIC_TARGET_HANDLER_R_H__ #define AEVOL_PHENOTYPIC_TARGET_HANDLER_R_H__ // ============================================================================ // Includes // ============================================================================ #include #include #include #include #include //#include #include #include "PhenotypicTargetHandler.h" #include "PhenotypicTarget_R.h" #include "../Utils.h" //#include "Habitat_R.h" //using std::list; namespace aevol { // ============================================================================ // Class declarations // ============================================================================ class Habitat_R; /** * Manages a phenotypic target and its "evolution" over time * * Handles a phenotypic target, the variation and/or noise that may be applied * to it as well as the set of possible phenotypic targets and the rules that * define how and when we switch from one to another */ class PhenotypicTargetHandler_R : public virtual PhenotypicTargetHandler { public : // ========================================================================== // Constructors // ========================================================================== PhenotypicTargetHandler_R(void); //< Default ctor PhenotypicTargetHandler_R(const PhenotypicTargetHandler_R&); //< Copy ctor PhenotypicTargetHandler_R(PhenotypicTargetHandler_R&&) = delete; //< Move ctor PhenotypicTargetHandler_R(gzFile backup_file); // ========================================================================== // Destructor // ========================================================================== virtual ~PhenotypicTargetHandler_R(void); //< Destructor // ========================================================================== // Operators // ========================================================================== // ========================================================================== // Public Methods // ========================================================================== virtual void ApplyVariation(); void InitPhenotypicTargetsAndModels(int8_t nb_indiv_age); void print_geometric_areas(); virtual void save(gzFile backup_file) const; virtual void load(gzFile backup_file); // ========================================================================== // Getters // ========================================================================== const std::vector& phenotypic_targets() const { return phenotypic_targets_; } const PhenotypicTarget_R& phenotypic_target_model(int8_t env_id) const { assert(env_id >= 0 && env_id <= (int8_t) phenotypic_target_models_.size()); return *(phenotypic_target_models_.at(env_id)); } const PhenotypicTarget_R& phenotypic_target(int8_t age) const { assert(age >= 0 && age <= (int8_t) phenotypic_targets_.size()); return *(phenotypic_targets_.at(age-1)); } int8_t number_of_phenotypic_targets() const { return phenotypic_targets_.size(); } virtual double mean_environmental_area() const { double total_dist = 0.0; for(int8_t i = 0; i< (int8_t) phenotypic_targets_.size(); i++) { total_dist += phenotypic_targets_.at(i)->area_by_feature(METABOLISM); } return total_dist/(double) phenotypic_targets_.size(); } const std::list signals() const { return signals_models_list_; } // ========================================================================== // Setters // ========================================================================== void set_gaussians(const std::vector>& gaussians_list) { env_gaussians_list_ = gaussians_list; } void set_signals(const std::vector>& signals_list) { env_signals_list_ = signals_list; } void set_signals_models(const std::vector& signals_list) { signals_models_ = signals_list; std::list temp_list; for(Protein_R* prot : signals_list) { temp_list.push_back(prot); } signals_models_list_ = temp_list; } void set_switch_probability(double p) { env_switch_probability_ = p; } virtual void set_segmentation(int8_t nb_segments, double* boundaries, PhenotypicFeature * features, bool separate_segments = false) { for(PhenotypicTarget_R* phenotypic_target : phenotypic_target_models_) { phenotypic_target->set_segmentation(nb_segments, boundaries, features, separate_segments); } } protected : // ========================================================================== // Protected Methods // ========================================================================== void InitPhenotypicTargetsModels(); void BuildPhenotypicTargetsModels(); void BuildPhenotypicTargetModel( int8_t id); // This function keep only the last element of the vector void ResetPhenotypicTargets(); void InitPhenotypicTargets(int8_t nb_indiv_age); void addEnv( int8_t env_id ); void changeEnv( int8_t ind, int8_t env_id ); // ========================================================================== // Attributes // ========================================================================== std::vector phenotypic_target_models_; std::vector phenotypic_targets_; std::vector> env_gaussians_list_; std::vector> env_signals_list_; std::vector signals_models_; std::list signals_models_list_; double env_switch_probability_; }; // ============================================================================ // Inline functions' definition // ============================================================================ } // namespace aevol #endif // AEVOL_PHENOTYPIC_TARGET_HANDLER_R_H__ aevol-5.0/src/libaevol/raevol/Protein_R.h0000644000175000017500000001602612724051151015336 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AE_PROTEIN_R_H #define AE_PROTEIN_R_H // ================================================================= // Libraries // ================================================================= // ================================================================= // Project Files // ================================================================= #include "Codon.h" #include "Protein.h" #include "Rna_R.h" namespace aevol { //############################################################################## // # // Class ae_protein_R # // # //############################################################################## class GeneticUnit; class Protein_R : public Protein { public : // ================================================================= // Constructors // ================================================================= Protein_R() = delete; Protein_R(const Protein_R &model) = delete; Protein_R( GeneticUnit* gen_unit, const Protein_R &model ); Protein_R( GeneticUnit* gen_unit, const std::list codon_list, Strand strand, int32_t shine_dal_pos, Rna* rna, double w_max ); // TODO Rna_R? Protein_R( const std::list codon_list, double concentration, double w_max); Protein_R( gzFile backup_file ); // ================================================================= // Destructors // ================================================================= virtual ~Protein_R( void ); // ================================================================= // Accessors // ================================================================= inline void set_inherited( bool is_inherited ); inline void set_signal( bool is_signal); inline bool is_inherited( void ); inline bool is_signal( void ); // ================================================================= // Public Methods // ================================================================= //inline ae_protein_R* copy( void ); inline void multiply_concentration( double factor ); inline void set_concentration ( double concentration); inline void update_concentration( void ); inline void reset_concentration( void ); inline void set_initial_concentration( void ); void compute_delta_concentration( void ); int8_t get_codon( int32_t index ); // void add_influence( ae_influence_R* influence ); void save( gzFile backup_file ); // void remove_influence( ae_influence_R* influence ); inline int8_t get_cod_tab(int32_t index) const; void add_RNA( Rna * rna ); long get_id() { return _id; }; // ================================================================= // Public Attributes // ================================================================= bool is_TF_; static long id; int8_t* _cod_tab; //bool _concentration_has_change = true; protected : // ================================================================= // Forbidden Constructors // ================================================================= // ================================================================= // Protected Methods // ================================================================= void remove_influences( void ); // ================================================================= // Protected Attributes // ================================================================= std::vector _rna_R_list; double _delta_concentration; bool _inherited; bool _signal; double _initial_concentration; // concentration at cell birth long _id; }; // ===================================================================== // Accessors definitions // ===================================================================== //std::vector ae_protein_R::get_influence_list( void ) //{ // return _influence_list; //} // ===================================================================== // Inline functions' definition // ===================================================================== inline void Protein_R::update_concentration( void ) { // _concentration_has_change = _delta_concentration != 0 ? true : false; concentration_ += _delta_concentration; } inline void Protein_R::set_inherited( bool is_inherited ) { _inherited = is_inherited; } inline void Protein_R::set_signal( bool is_signal ) { _signal = is_signal; } inline void Protein_R::reset_concentration( void ) { concentration_ = _initial_concentration; } inline void Protein_R::set_initial_concentration( void ) { _initial_concentration = concentration_; } inline bool Protein_R::is_inherited( void ) { return _inherited; } inline bool Protein_R::is_signal( void ) { return _signal; } // ===================================================================== // Inline functions' definition // ===================================================================== inline void Protein_R::multiply_concentration( double factor ) { concentration_ *= factor; } inline void Protein_R::set_concentration( double concentration ) { concentration_ = concentration; } inline int8_t Protein_R::get_cod_tab(int32_t index) const { return _cod_tab[index]; } } // namespace aevol #endif // AE_PROTEIN_R_H aevol-5.0/src/libaevol/raevol/Individual_R_X11.cpp0000644000175000017500000005762312724051151017002 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // //***************************************************************************** // ================================================================= // Libraries // ================================================================= // ================================================================= // Project Files // ================================================================= #include "Individual_R_X11.h" #include "../ExpManager.h" #include "../ExpManager_X11.h" namespace aevol { //############################################################################## // # // Class ae_individual_R_X11 # // # //############################################################################## // ================================================================= // Definition of static attributes // ================================================================= // ================================================================= // Constructors // ================================================================= Individual_R_X11::Individual_R_X11( const Individual_R_X11 &model ) : Individual( model ), Individual_R( model ), Individual_X11( model ) { //printf("ae_individual_R_X11( model )"); } Individual_R_X11::Individual_R_X11(ExpManager* exp_m, std::shared_ptr mut_prng, std::shared_ptr stoch_prng, std::shared_ptr param_mut, double w_max, int32_t min_genome_length, int32_t max_genome_length, bool allow_plasmids, int32_t id, const char* strain_name, int32_t age) : Individual(exp_m,mut_prng,stoch_prng,param_mut,w_max,min_genome_length, max_genome_length,allow_plasmids,id,strain_name,age), Individual_R(exp_m,mut_prng,stoch_prng,param_mut,w_max,min_genome_length, max_genome_length,allow_plasmids,id,strain_name,age), Individual_X11(exp_m,mut_prng,stoch_prng,param_mut,w_max,min_genome_length, max_genome_length,allow_plasmids,id,strain_name,age) { } Individual_R_X11::Individual_R_X11( Individual_R_X11* parent, int32_t id, std::shared_ptr mut_prng, std::shared_ptr stoch_prng ) : Individual( parent, id, mut_prng, stoch_prng ), Individual_R( parent, id, mut_prng, stoch_prng ), Individual_X11( parent, id, mut_prng, stoch_prng ) { //printf("ae_individual_R_X11( parent )"); } Individual_R_X11::Individual_R_X11( ExpManager* exp_m, gzFile backup_file ) : Individual( exp_m, backup_file ), Individual_R( exp_m, backup_file ), Individual_X11( exp_m, backup_file ) { } // ================================================================= // Destructors // ================================================================= Individual_R_X11::~Individual_R_X11( void ) noexcept { } // ================================================================= // Public Methods // ================================================================= void Individual_R_X11::display_concentrations( X11Window* win ) { char* color = new char[8]; char* color2 = NULL; strcpy( color, "#FFFFFF" ); //variable qui sert à stocker du texte à afficher char display_string[40]; int16_t nb_prot = 0; int16_t life_time = exp_m_->exp_s()->get_nb_indiv_age(); //deux pointeurs utilisés pour défiler dans la liste de protéines // ae_list_node* prot_node = NULL; // ae_protein_R* prot = NULL; //Draw the number of proteins if ( exp_m_->exp_s()->get_with_heredity()) { nb_prot = protein_list_.size(); sprintf( display_string, "Nb proteins: %" PRId32 " (inherited: %ld)",nb_prot,_inherited_protein_list.size()); } else { nb_prot = protein_list_.size(); sprintf( display_string, "Nb proteins: %" PRId32 " (without heredity)",nb_prot); } win->draw_string( 15, 15, display_string ); //Draw the life time sprintf( display_string, "Life duration: %" PRId32 "",life_time); win->draw_string( 15, 30, display_string ); //Draw the box win->draw_line( win->width() / 10 , 2* win->height() / 10 , 9 * win->width() / 10 , 2 * win->height() / 10 ,color); win->draw_line( win->width() / 10 , 9 * win->height() / 10 , 9 * win->width() / 10 , 9 * win->height() / 10 ,color); win->draw_line( win->width() / 10 , 2* win->height() / 10 , win->width() / 10 , 9 * win->height() / 10 ,color); win->draw_line( 9 * win->width() / 10 , 2 * win->height() / 10 , 9 * win->width() / 10 , 9 * win->height() / 10 ,color); // save the initial list of proteins //std::list init_prot_list = protein_list_; _initial_protein_list = protein_list_; //_protein_list.insert(_protein_list.end(), habitat.signals().begin(), habitat.signals().end()); for(Protein_R* prot :dynamic_cast(this->habitat()).signals()) { protein_list_.push_back(prot); } //set the concentrations of proteins to their initial value double* concentrations = new double[protein_list_.size()]; // initialise le tableau de concentrations. // int16_t prot_index = 0; int i = 0; for (const auto& prot : protein_list_) { ((Protein_R*)prot)->reset_concentration(); concentrations[i] = ((Protein_R*)prot)->concentration(); i++; } set_influences(); // compute steps double x_step = 0.8 * win->width() / (double)(exp_m()->exp_s()->get_nb_indiv_age()); double y_step = 0.7 * win->height(); //printf("START IN HERE .......\n \n"); for (int8_t i = 1; i <= exp_m_->exp_s()->get_nb_indiv_age(); i++) { //Set the concentration of signals for this age for(Protein_R* prot1 : dynamic_cast(this->habitat()).signals()) { prot1->set_concentration(0.0); } for(Protein_R* prot2 : dynamic_cast(this->habitat()).phenotypic_target(i).signals()) { prot2->set_concentration(0.9); } for (int j = 0; j < exp_m()->exp_s()->get_nb_degradation_step(); j++) update_concentrations(); //affichage des points n+1 dans la concentration //prot_index = 0; int proti = 0; //printf("Age[%d] : ",i); for (const auto& prot : protein_list_) { // morceau ajouté pour colorer les protéines en fonctions de leur paramètres if ( ((Protein_R*)prot)->is_functional() ) { color2 = X11Window::color( ((Protein_R*)prot)->mean() ); } else { color2 = new char[8]; strcpy( color2, "#FFFFFF" ); } win->draw_line( (int16_t)((win->width() / 10) + ((i-1)*x_step)), (int16_t)(( 9 * win->height() / 10)-(concentrations[proti]*y_step)), (int16_t)((win->width() / 10) + (( i) * x_step)), (int16_t)((9 * win->height() / 10)-(((Protein_R*)prot)->concentration()*y_step)) ,color2); concentrations[proti]=((Protein_R*)prot)->concentration(); //if (((Protein_R*)prot)->get_id() == 34483) { //printf("p[%ld]=%f ",((Protein_R*)prot)->get_id(),((Protein_R*)prot)->concentration()); //} //printf("%d -- %f (%f) | ",proti,((Protein_R*)prot)->concentration(),((Protein_R*)prot)->mean()); delete[] color2; proti++; } //printf("\n"); } protein_list_.clear(); protein_list_ = _initial_protein_list; //init_prot_list.clear(); delete[] concentrations; delete[] color; } void Individual_R_X11::display_regulation( X11Window* win ) { int16_t nb_activators = 0; int16_t nb_operators = 0; double min_merged_activator_activity = 10; double min_merged_operator_activity = 10; double max_merged_activator_activity = 0; double max_merged_operator_activity = 0; double min_activator_activity = 10; double min_operator_activity = 10; double max_activator_activity = 0; double max_operator_activity = 0; double mean_activator_activity = 0; double mean_operator_activity = 0; // Retreive the genetic unit corresponding to the main chromosome GeneticUnit* gen_unit = &genetic_unit_list_.front(); int32_t genome_length = gen_unit->dna()->length(); // draw color scale char *color_bar = new char[8]; for ( int16_t i = 0 ; i < (win->width()/2) ; i++ ) { sprintf( color_bar, "#%02x%02x%02x", 255 - (i * 255 * 2) / win->width(),0,0 ); win->draw_line( i, win->height() * 19 / 20, i, win->height(), color_bar ); } for ( int16_t i = (win->width()/2) ; i < (win->width()) ; i++ ) { sprintf( color_bar, "#%02x%02x%02x",0, ((i - (win->width() / 2)) * 255 * 2 ) / win->width(), 0 ); win->draw_line( i, win->height() * 19 / 20, i, win->height(), color_bar ); } delete [] color_bar; char display_string[80]; sprintf( display_string, "-"); win->draw_string( 15, (win->height() * 19 / 20) - 5, display_string ); sprintf( display_string, "0"); win->draw_string( win->width()/2, (win->height() * 19 / 20) - 5, display_string ); sprintf( display_string, "+"); win->draw_string( win->width()-15, (win->height() * 19 / 20) - 5, display_string ); // Compute display diameter according to genome length and window size int16_t win_size = std::min( win->width(), win->height() ); int16_t diam = round( win_size * log( (double)genome_length ) / 16 ); // Prevent diameter from getting greater than 2/3 of the window size if ( diam > 2 * win_size / 3 ) { diam = 2 * win_size / 3; } // Compute coordinates of the upper-left corner of the containing square int16_t pos_x = (win->width() - diam) / 2; int16_t pos_y = (win->height() - diam) / 2; double len_link; char* color = new char[8]; strcpy( color, "#FFFFFF" ); // Draw main circle win->draw_circle( pos_x, pos_y, diam ); // --------------- // Draw each RNA // --------------- // NB : As we want OriC to be at the "top" of the circle and the orientation // to be clockwise, the drawing angle (theta) will be given as // (90 - alpha), alpha being the "classical" trigonometric angle int16_t alpha_rna_first,alpha_prot_first; // Angles of first and last transcribed bases from OriC (degrees) int16_t theta_rna_first, theta_prot_first; // Transposed angles on the trigonometric circle (degrees) // Same as above with precision = 1/64 degree int16_t alpha_rna_first_64,alpha_prot_first_64; int16_t theta_rna_first_64,theta_prot_first_64; int16_t pos_rna_x,pos_rna_y,pos_prot_x,pos_prot_y; int8_t nb_signals = 0; // search for max and min regulation values (in order to scale colors) for (const auto& rna: _rna_list_coding) { // --------------- // Draw each regulation link // --------------- for (unsigned int i = 0; i < rna->nb_influences(); i++) { //if (rna->_protein_list[i] != nullptr) { //compute the activity if (rna->_enhancing_coef_list[i] > 0) { nb_activators++; mean_activator_activity += rna->_enhancing_coef_list[i]; //printf("RNA %ld is activated by %ld at %f (mean %f)\n", // rna->get_id(),rna->_protein_list[i]->get_id(),rna->_enhancing_coef_list[i],mean_activator_activity); if (rna->_enhancing_coef_list[i] > max_activator_activity) max_activator_activity = rna->_enhancing_coef_list[i]; if (rna->_enhancing_coef_list[i] < min_activator_activity) min_activator_activity = rna->_enhancing_coef_list[i]; } if (rna->_operating_coef_list[i] > 0) { nb_operators++; mean_operator_activity += rna->_operating_coef_list[i]; //printf("RNA %ld is operated by %ld at %f (mean %f %f)\n", // rna->get_id(),rna->_protein_list[i]->get_id(),rna->_operating_coef_list[i],mean_activator_activity, // mean_operator_activity); if (rna->_operating_coef_list[i] > max_operator_activity) max_operator_activity = rna->_operating_coef_list[i]; if (rna->_operating_coef_list[i] < min_operator_activity) min_operator_activity = rna->_operating_coef_list[i]; } double merged_activity = rna->_enhancing_coef_list[i] - rna->_operating_coef_list[i]; //if (merged_activity !=0) printf("RNA %ld is merge active by %ld at %f \n",rna->get_id(),rna->_protein_list[i]->get_id(),rna->_enhancing_coef_list[i], // merged_activity); if (merged_activity > 0) { if (merged_activity > max_merged_activator_activity) max_merged_activator_activity = merged_activity; if (merged_activity < min_activator_activity) min_merged_activator_activity = merged_activity; } if (merged_activity < 0) { if (merged_activity < max_merged_operator_activity) max_merged_operator_activity = merged_activity; if (merged_activity > min_merged_operator_activity) min_merged_operator_activity = merged_activity; } // } } } sprintf( display_string, "Activation links: %" PRId32 ", mean: %lf (max: %lf min:%lf)", nb_activators,mean_activator_activity/(double)nb_activators,max_activator_activity,min_activator_activity); win->draw_string( 15, 15, display_string ); sprintf( display_string, "Inhibition links: %" PRId32 ", mean: %lf (max: %lf min: %lf)", nb_operators,mean_operator_activity/(double)nb_operators,max_operator_activity,min_operator_activity); win->draw_string( 15, 30, display_string ); // end search for max // begin links drawing procedure for (const auto& rna: _rna_list_coding) { // Alpha : angles from OriC (in degrees) // Theta : angles on the trigonometric circle (in degrees) // nb_sect : "length" in degrees of the arc to be drawn alpha_rna_first = (int16_t) round( 360 * ((double) rna->first_transcribed_pos() / (double) genome_length)); theta_rna_first = std::fmod(90 - alpha_rna_first, 360); // These are the same as above but with a higher precision (1/64 degrees) alpha_rna_first_64 = (int16_t) round(64 * 360 * ((double) rna->first_transcribed_pos() / (double) genome_length)); theta_rna_first_64 = std::fmod(64 * 90 - alpha_rna_first_64, 64 * 360); pos_rna_x = (win->width() / 2.0) + (cos((theta_rna_first_64 / (64 * 180.0) * M_PI)) * diam / 2.0); pos_rna_y = (win->height() / 2.0) - (sin((theta_rna_first_64 / (64 * 180.0) * M_PI)) * diam / 2.0); // --------------- // Draw each regulation link // --------------- nb_signals = 0; for (unsigned int i = 0; i < rna->_nb_influences; i++) { Protein_R* prot = rna->_protein_list[i]; if (!(prot->is_signal())) { alpha_prot_first = (int16_t) round(360 * ((double) prot->first_translated_pos() / (double) genome_length)); theta_prot_first = std::fmod(90 - alpha_prot_first, 360); alpha_prot_first_64 = (int16_t) round(64 * 360 * ((double) prot->first_translated_pos() / (double) genome_length)); theta_prot_first_64 = std::fmod(64 * 90 - alpha_prot_first_64, 64 * 360); pos_prot_x = (win->width() / 2.0) + (cos((theta_prot_first_64 / (64 * 180.0) * M_PI)) * diam / 2.0); pos_prot_y = (win->height() / 2.0) - (sin((theta_prot_first_64 / (64 * 180.0) * M_PI)) * diam / 2.0); } else { nb_signals += 1; pos_prot_x = (win->width() / 10.0) * nb_signals; pos_prot_y = (win->height() * 0.9); } // compute the color of the link double merged_influence = rna->_enhancing_coef_list[i] - rna->_operating_coef_list[i]; //printf("Merged influence of RNA %ld with prot %ld is %f (%f %f)\n",rna->get_id(),rna->_protein_list[i]->get_id(), // merged_influence,rna->_enhancing_coef_list[i],rna->_operating_coef_list[i]); if (merged_influence > 0) { //printf("ONE %lf %lf %d\n", merged_influence, max_merged_activator_activity,(int)((255 * merged_influence) / max_merged_activator_activity)); //printf("COLOR : #%02x%02x%02x\n", 0,(int)((255 * merged_influence) / max_merged_activator_activity),0); sprintf(color, "#%02x%02x%02x", 0, (int) ((255 * merged_influence) / max_merged_activator_activity), 0); } else { //printf("TWO %lf %lf %d\n", merged_influence, max_merged_activator_activity,(int)((255 * merged_influence) / max_merged_activator_activity)); //printf("COLOR : #%02x%02x%02x\n", (int)((255 * merged_influence) / max_merged_operator_activity),0,0); sprintf(color, "#%02x%02x%02x", (int) ((255 * merged_influence) / max_merged_operator_activity), 0, 0); } if (merged_influence != 0.0) { //compute the lenght of the line len_link = sqrt( ((pos_rna_x - pos_prot_x) * (pos_rna_x - pos_prot_x)) + ((pos_rna_y - pos_prot_y) * (pos_rna_y - pos_prot_y))); //draw the link win->draw_line(pos_rna_x, pos_rna_y, pos_prot_x, pos_prot_y, color); //printf("Draw link from %d %d to %d %f with color\n",pos_rna_x, pos_rna_y, pos_prot_x, pos_prot_y); //draw the arrow going to the protein to the rna regulated the arrow is well centered win->draw_line( (int16_t) (((pos_rna_x + pos_prot_x) / 2.0) + (5.0 * (pos_rna_x - pos_prot_x) / len_link)), (int16_t) (((pos_rna_y + pos_prot_y) / 2.0) + (5.0 * (pos_rna_y - pos_prot_y) / len_link)), (int16_t) (((pos_rna_x + pos_prot_x) / 2.0) + (5.0 * (pos_rna_y - pos_prot_y) / len_link) - (5.0 * (pos_rna_x - pos_prot_x) / len_link)), (int16_t) (((pos_rna_y + pos_prot_y) / 2.0) - (5.0 * (pos_rna_x - pos_prot_x) / len_link) - (5.0 * (pos_rna_y - pos_prot_y) / len_link)), color); win->draw_line( (int16_t) (((pos_rna_x + pos_prot_x) / 2.0) + (5.0 * (pos_rna_x - pos_prot_x) / len_link)), (int16_t) (((pos_rna_y + pos_prot_y) / 2.0) + (5.0 * (pos_rna_y - pos_prot_y) / len_link)), (int16_t) (((pos_rna_x + pos_prot_x) / 2.0) - (5.0 * (pos_rna_y - pos_prot_y) / len_link) - (5.0 * (pos_rna_x - pos_prot_x) / len_link)), (int16_t) (((pos_rna_y + pos_prot_y) / 2.0) + (5.0 * (pos_rna_x - pos_prot_x) / len_link) - (5.0 * (pos_rna_y - pos_prot_y) / len_link)), color); } } } delete[] color; } void Individual_R_X11::display_phenotype( X11Window* win, const Habitat_R& habitat ) { init_indiv(habitat); double dist_temp = 0; char* color = new char[8]; char* color2 = NULL; int nb_eval = 0; strcpy( color, "#FFFFFF" ); //variable qui sert à stocker du texte à afficher char display_string[40]; int16_t nb_prot = 0; int16_t life_time = exp_m()->exp_s()->get_nb_indiv_age(); //set the concentrations of proteins to their initial value double* concentrations = new double[protein_list_.size()]; // initialise le tableau de concentrations. int16_t prot_index = 0; for (auto& prot : protein_list_) { concentrations[prot_index++] = ((Protein_R*)prot)->concentration(); } // compute steps double x_step = 0.8 * win->width() / (double)(life_time * exp_m()->exp_s()->get_nb_degradation_step()); double y_step = 0.7 * win->height(); // Go from an evaluation date to the next //int8_t compteur_env = 0; //envir = env_list[compteur_env]; //int16_t nb_signals = 0; //Add the signals protein to the individual // _signals = envir->get_signals(); //for ( int8_t i = 0; i < _cloned_signals[compteur_env].size(); i++) //{ // ((ae_protein_R*) _cloned_signals[compteur_env][i])->set_concentration(0.9); //} std::set* eval = exp_m()->exp_s()->get_list_eval_step(); std::list initial_protein_list = protein_list_; for (int i = 1; i <= exp_m()->exp_s()->get_nb_indiv_age(); i++) { //Set the concentration of signals for this age for(Protein_R* prot1 : habitat.signals()) { prot1->set_concentration(0.0); } for(Protein_R* prot2 : habitat.phenotypic_target(i).signals()) { prot2->set_concentration(0.9); } for (int j = 0; j < exp_m()->exp_s()->get_nb_degradation_step(); j++) { update_concentrations(); } update_phenotype(); dynamic_cast(exp_m())->display_3D(win, *(phenotype()), WHITE, (life_time * 5) - (5 * i), (life_time * -3) + (3 * i),true); dynamic_cast(exp_m())->display_3D(win, *(habitat.phenotypic_target(i ).fuzzy()), RED, (life_time * 5) - (5 * i), (life_time * -3) + (3 * i), false); // if its an evaluation date if (eval->find(i) != eval->end()) { for (int i=0; idraw_string( 15, 15*nb_eval, display_string ); } } //Draw the evaluation result sprintf( display_string, "Mean dist_to_target = %lf",dist_temp/(double)nb_eval); win->draw_string( 15, 15*(nb_eval + 1), display_string ); protein_list_.clear(); protein_list_ = initial_protein_list; delete[] concentrations; delete[] color; } // ================================================================= // Protected Methods // ================================================================= } // namespace aevol aevol-5.0/src/libaevol/raevol/Rna_R.h0000644000175000017500000001170712724051151014437 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_RNA_R_H_ #define AEVOL_RNA_R_H_ // ================================================================= // Libraries // ================================================================= #include // ================================================================= // Project Files // ================================================================= #include "Rna.h" #include "Protein_R.h" namespace aevol { // ================================================================= // Class declarations // ================================================================= class Protein_R; class Rna_R : public Rna { public : // ================================================================= // Constructors // ================================================================= Rna_R( GeneticUnit* gen_unit, const Rna_R &model ); Rna_R( GeneticUnit* gen_unit, Strand strand, int32_t index, int8_t diff ); // ================================================================= // Destructors // ================================================================= virtual ~Rna_R( void ); // ================================================================= // Accessors // ================================================================= inline std::vector get_protein_list( void ); // ================================================================= // Public Methods // ================================================================= void set_influences( std::list& protein_list ); double get_synthesis_rate( void ); double get_affinity_with_protein( int32_t index, Protein *protein ); int32_t get_enhancer_position( void ); int32_t get_operator_position( void ); long get_id() { return _id; }; int nb_influences() { return _nb_influences; } // ================================================================= // Public Attributes // ================================================================= std::vector _protein_list; std::vector _enhancing_coef_list; std::vector _operating_coef_list; //std::vector _protein_concentration_list; static long id; int _nb_influences = 0; protected : // ================================================================= // Forbidden Constructors // ================================================================= /* ae_rna() { printf("ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__); exit(EXIT_FAILURE); };*/ // ================================================================= // Protected Methods // ================================================================= //inline ae_rna_R* copy( void ); double affinity_with_protein( int32_t index, Protein *protein ); // ================================================================= // Protected Attributes // ================================================================ long _id; }; // ===================================================================== // Accessors definitions // ===================================================================== // ===================================================================== // Inline functions' definition // ===================================================================== } // namespace aevol #endif // AEVOL_RNA_R_H_ aevol-5.0/src/libaevol/raevol/PhenotypicTargetHandler_R.cpp0000644000175000017500000003772412724051151021050 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // //***************************************************************************** // ============================================================================ // Includes // ============================================================================ #if __cplusplus == 201103L #include "make_unique.h" #endif #include "PhenotypicTargetHandler_R.h" #include "Habitat_R.h" #include "ExpSetup.h" #include "HybridFuzzy.h" #include "Utils.h" #include using std::cout; using std::endl; namespace aevol { //############################################################################## // # // Class PhenotypicTargetHandler # // # //############################################################################## // ============================================================================ // Definition of static attributes // ============================================================================ // ============================================================================ // Constructors // ============================================================================ PhenotypicTargetHandler_R::PhenotypicTargetHandler_R() : PhenotypicTargetHandler(), phenotypic_target_models_(0), phenotypic_targets_(0) { env_switch_probability_ = 0.1; } PhenotypicTargetHandler_R::PhenotypicTargetHandler_R( const PhenotypicTargetHandler_R& rhs) : PhenotypicTargetHandler(rhs) { phenotypic_target_models_ = rhs.phenotypic_target_models_; phenotypic_targets_ = rhs.phenotypic_targets_; env_gaussians_list_ = rhs.env_gaussians_list_; env_signals_list_ = rhs.env_signals_list_; signals_models_ = rhs.signals_models_; env_switch_probability_ = rhs.env_switch_probability_; } PhenotypicTargetHandler_R::PhenotypicTargetHandler_R(gzFile backup_file) { load(backup_file); } // ============================================================================ // Destructor // ============================================================================ PhenotypicTargetHandler_R::~PhenotypicTargetHandler_R() { for(Protein_R* prot : signals_models_) { delete prot; } signals_models_.clear(); } // ============================================================================ // Methods // ============================================================================ void PhenotypicTargetHandler_R::ApplyVariation() { switch (var_method_) { case NO_VAR : return; case AUTOREGRESSIVE_MEAN_VAR : Utils::ExitWithDevMsg("Not implemented yet", __FILE__, __LINE__); //ApplyAutoregressiveMeanVariation(); break; case AUTOREGRESSIVE_HEIGHT_VAR : Utils::ExitWithDevMsg("Not implemented yet", __FILE__, __LINE__); //ApplyAutoregressiveHeightVariation(); break; case SWITCH_IN_A_LIST : { //printf("ApplyVariation SWITCH_IN_A_LIST\n"); // A security in order to preserve the program from an infinite loop : while( id_new_env == id_old_env ) int8_t nb_env_in_list = phenotypic_target_models_.size(); int8_t last_age = phenotypic_targets_.size(); //printf("last_age = %d\n", last_age); if ( nb_env_in_list <= 1 ) { break; } //reset the vector of phenotypic targets keeping only the last environment ResetPhenotypicTargets(); // Shortcuts used : int8_t id_old_env = phenotypic_targets_.at(0)->get_id(); int8_t id_new_env = 0; //Special case for the first env that may change also : if ( var_prng_->random() < env_switch_probability_) { //we have to change to a new env that have an id different from the old one while( id_new_env == id_old_env ) { id_new_env = var_prng_->random(nb_env_in_list); } //The environment has changed id_old_env = id_new_env; changeEnv(0,id_new_env); } // At each age we have to add the environment of this age for (int8_t i = 1; i < last_age ; i++) { id_new_env = id_old_env; // if we have to change of environment : if ( var_prng_->random() < env_switch_probability_) { //we have to change to a new env that have an id different from the old one while( id_new_env == id_old_env ) { id_new_env = var_prng_->random(nb_env_in_list); } //The environment has changed id_old_env = id_new_env; } addEnv(id_new_env); } break; } default : Utils::ExitWithDevMsg("Unknown variation method", __FILE__, __LINE__); break; } } void PhenotypicTargetHandler_R::InitPhenotypicTargetsAndModels( int8_t nb_indiv_age ) { InitPhenotypicTargetsModels(); BuildPhenotypicTargetsModels(); InitPhenotypicTargets(nb_indiv_age); } void PhenotypicTargetHandler_R::print_geometric_areas() { double area = 0.0; for (int8_t i = 0; i < phenotypic_target_models_.size() ; i++) { area = phenotypic_target_models_.at(i)->fuzzy()->get_geometric_area(); printf("Entire geometric area of the phenotypic target %d: %f\n", i, area); } } void PhenotypicTargetHandler_R::save(gzFile backup_file) const { //printf("Appel a la sauvegarde de PhenotypicTargetHandler_R\n"); PhenotypicTargetHandler::save(backup_file); // Sauvegarde en plus gzwrite(backup_file, &env_switch_probability_, sizeof(env_switch_probability_)); // Save gaussians : int8_t nb_gaussian_list = env_gaussians_list_.size(); int8_t nb_gaussians = 0; gzwrite(backup_file, &nb_gaussian_list, sizeof(nb_gaussian_list)); for (const std::list& gaussian_list: env_gaussians_list_) { nb_gaussians = gaussian_list.size(); gzwrite(backup_file, &nb_gaussians, sizeof(nb_gaussians)); for (const Gaussian & g: gaussian_list) { g.save(backup_file); } } // Save signals_models : int8_t nb_signals_models = signals_models_.size(); gzwrite(backup_file, &nb_signals_models, sizeof(nb_signals_models)); for (Protein_R* p: signals_models_) { p->save(backup_file); } // We do not need to save signals_models_list as its just a copy // Save env_signals_list : int8_t nb_signal_list = env_signals_list_.size(); int8_t nb_signals = 0; gzwrite(backup_file, &nb_signal_list, sizeof(nb_signal_list)); for (const std::list& signals_list: env_signals_list_) { nb_signals = signals_list.size(); gzwrite(backup_file, &nb_signals, sizeof(nb_signals)); for (const int8_t & id: signals_list) { gzwrite(backup_file, &id, sizeof(id)); } } // Save segmentation : int8_t nb_models = phenotypic_target_models_.size(); gzwrite(backup_file, &nb_models, sizeof(nb_models)); for (PhenotypicTarget_R* model: phenotypic_target_models_) { model->save( backup_file); } // We have to save phenotypic_targets_ but we cannot since its a vector of pointer // Thus we save the ids int8_t nb_env = phenotypic_targets_.size(); gzwrite(backup_file, &nb_env, sizeof(nb_env)); int8_t id = 0; for (PhenotypicTarget_R* env: phenotypic_targets_) { id = env->get_id(); gzwrite(backup_file, &id, sizeof(id)); } } void PhenotypicTargetHandler_R::load(gzFile backup_file) { //printf("Appel au chargement de PhenotypicTargetHandler_R\n"); PhenotypicTargetHandler::load(backup_file); // Chargement en plus gzread(backup_file, &env_switch_probability_, sizeof(env_switch_probability_)); //Load gaussians : int8_t nb_gaussian_list = 0; int8_t nb_gaussians = 0; gzread(backup_file, &nb_gaussian_list, sizeof(nb_gaussian_list)); //printf("Loading %d gaussians list\n", nb_gaussian_list); for( int8_t i = 0; i()); gzread(backup_file, &nb_gaussians, sizeof(nb_gaussians)); //printf("There are %d gaussian in gaussians list %d\n", nb_gaussians, i); for (int8_t j = 0 ; j < nb_gaussians ; j++) { env_gaussians_list_.back().push_back(Gaussian(backup_file)); //printf("Nb gaussians in current_gaussians : %d\n", env_gaussians_list_.back().size()); /*printf("Gaussian %d. Height = %f, Mean = %f, width = %f\n",j, env_gaussians_list_.back().back().get_height(), env_gaussians_list_.back().back().get_mean(), env_gaussians_list_.back().back().get_width() );*/ } } // Load signals_models int8_t nb_signals_models = 0; gzread(backup_file, &nb_signals_models, sizeof(nb_signals_models)); for (int8_t i = 0; i< nb_signals_models; i++) { signals_models_.push_back(new Protein_R(backup_file)); } // Rebuild signals_models_list for(Protein_R* prot : signals_models_) { signals_models_list_.push_back(prot); } // Load env_signals_list int8_t nb_signal_list = 0; int8_t nb_signals = 0; int8_t id = 0; gzread(backup_file, &nb_signal_list, sizeof(nb_signal_list)); for( int8_t i = 0; i()); gzread(backup_file, &nb_signals, sizeof(nb_signals)); for (int8_t j = 0 ; j < nb_signals ; j++) { gzread(backup_file, &id, sizeof(id)); env_signals_list_.back().push_back(id); } } // Now that gaussians are loaded we can build our PhenotypicTargetsModels InitPhenotypicTargetsModels(); //load segmentation : int8_t nb_models = 0; gzread(backup_file, &nb_models, sizeof(nb_models)); for (int8_t i = 0 ; i < nb_models ; i++) { phenotypic_target_models_.at(i)->load( backup_file ); } BuildPhenotypicTargetsModels(); //Debug //print_geometric_areas(); // We load the phenotypic targets after having built the models int8_t nb_env = 0; gzread(backup_file, &nb_env, sizeof(nb_env)); id = 0; PhenotypicTarget_R* env_to_add = NULL; for (int8_t i = 0 ; i < nb_env ; i++) { gzread(backup_file, &id, sizeof(id)); addEnv(id); } } // ============================================================================ // Protected Methods // ============================================================================ void PhenotypicTargetHandler_R::InitPhenotypicTargetsModels() { // First of all we have to know how many models do we have : int8_t nb_models = env_gaussians_list_.size(); //debug //printf("PhenotypicTargetHandler_R::InitPhenotypicTargets : we have %d env\n", nb_models); for (int8_t i = 0; i < nb_models ; i++) { phenotypic_target_models_.push_back(new PhenotypicTarget_R( i )); } } void PhenotypicTargetHandler_R::BuildPhenotypicTargetsModels() { // First of all we have to know how many models do we have : int8_t nb_models = env_gaussians_list_.size(); //debug //printf("PhenotypicTargetHandler_R::BuildPhenotypicTargets : we have %d env\n", nb_models); for (int8_t i = 0; i < nb_models ; i++) { BuildPhenotypicTargetModel(i); } } void PhenotypicTargetHandler_R::BuildPhenotypicTargetModel( int8_t id) { //printf("Appel a BuildPhenotypicTargetModel avec id = %d\n", id); // NB : Extreme points (at abscissa X_MIN and X_MAX) will be generated, we need to erase the list first PhenotypicTarget_R* phenotypic_target = phenotypic_target_models_.at(id); phenotypic_target->fuzzy()->reset(); //printf("On a %d gaussiennes\n", env_gaussians_list_.at(id).size()); // Generate sample points from gaussians if (not env_gaussians_list_.at(id).empty()) { for (int16_t i = 0; i <= sampling_; i++) { Point new_point = Point( X_MIN + (double) i * (X_MAX - X_MIN) / (double) sampling_, 0.0); int gi = 0; for (const Gaussian& g: env_gaussians_list_.at(id)) { gi++; new_point.y += g.compute_y(new_point.x); } phenotypic_target->fuzzy()->add_point(new_point.x, new_point.y); } if (FuzzyFactory::fuzzyFactory->get_fuzzy_flavor() == 1) { HybridFuzzy* fuz = (HybridFuzzy*) phenotypic_target->fuzzy(); for (int i = 1; i < fuz->get_pheno_size(); i++) { if (fuz->points()[i] == 0.0) { int minL = i - 1; int maxL = i + 1; int dist = 1; while (fuz->points()[maxL] == 0.0) { maxL++; dist++; } double inc = 0.0; if (fuz->points()[maxL] > fuz->points()[minL]) { inc = (fuz->points()[maxL] - fuz->points()[minL]) / dist; } else { inc = (fuz->points()[minL] - fuz->points()[maxL]) / dist; minL = maxL; } for (int j = i; j < maxL; j++) { fuz->points()[j] = fuz->points()[minL] + inc; inc += inc; } } } } } // Add lower and upper bounds phenotypic_target->fuzzy()->clip(AbstractFuzzy::min, Y_MIN); phenotypic_target->fuzzy()->clip(AbstractFuzzy::max, Y_MAX); // Simplify (get rid of useless points) phenotypic_target->fuzzy()->simplify(); // Compute areas (total and by feature) phenotypic_target->ComputeArea(); double area = phenotypic_target->fuzzy()->get_geometric_area(); //printf("Entire geometric area of the phenotypic target %d: %f\n", id, area); //Add its signals to the env // build a temporary real signals list (not a id list) std::list signals_list; for(int8_t & signal_id : env_signals_list_.at(id)) { signals_list.push_back(signals_models_.at(signal_id)); } phenotypic_target->set_signals(signals_list); } void PhenotypicTargetHandler_R::ResetPhenotypicTargets() { PhenotypicTarget_R* last_env = phenotypic_targets_.back(); int8_t size = phenotypic_targets_.size(); phenotypic_targets_.clear(); phenotypic_targets_.resize(1); phenotypic_targets_.at(0) = last_env; phenotypic_targets_.reserve(size); //printf("Taille de l'habitat après reset : %d\n", phenotypic_targets_.size()); } void PhenotypicTargetHandler_R::InitPhenotypicTargets(int8_t nb_indiv_age) { phenotypic_targets_.clear(); //printf("Taille de l'habitat après le clear dans initialize... : %d\n", phenotypic_targets_.size()); phenotypic_targets_.reserve(nb_indiv_age); PhenotypicTarget_R* env_to_add; for (int i = 0; i < nb_indiv_age; ++i) { addEnv(0); } //printf("Taille de l'habitat avant applyvariation : %d\n", phenotypic_targets_.size()); ApplyVariation(); } void PhenotypicTargetHandler_R::addEnv( int8_t env_id ) { assert(env_id >= 0 && env_id <= phenotypic_target_models_.size()); phenotypic_targets_.push_back( phenotypic_target_models_.at(env_id) ); } void PhenotypicTargetHandler_R::changeEnv( int8_t ind, int8_t env_id ) { assert(env_id >= 0 && env_id <= phenotypic_target_models_.size()); phenotypic_targets_.at(ind) = phenotypic_target_models_.at(env_id); } // ============================================================================ // Non inline accessors // ============================================================================ } // namespace aevol aevol-5.0/src/libaevol/raevol/Individual_R.cpp0000644000175000017500000004155212724051151016343 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // //***************************************************************************** // ================================================================= // Libraries // ================================================================= // ================================================================= // Project Files // ================================================================= #include "Individual_R.h" #include "../ExpManager.h" namespace aevol { //############################################################################## // # // Class ae_individual_R # // # //############################################################################## // ================================================================= // Definition of static attributes // ================================================================= // ================================================================= // Constructors // ================================================================= /* * Used at initialization */ Individual_R::Individual_R(ExpManager* exp_m, std::shared_ptr mut_prng, std::shared_ptr stoch_prng, std::shared_ptr param_mut, double w_max, int32_t min_genome_length, int32_t max_genome_length, bool allow_plasmids, int32_t id, const char* strain_name, int32_t age) : Individual(exp_m,mut_prng,stoch_prng,param_mut,w_max,min_genome_length, max_genome_length,allow_plasmids,id,strain_name,age) { _indiv_age = 0; _networked = false; _dist_sum = 0; } Individual_R::Individual_R(const Individual_R& other) : Individual( other ) { _indiv_age = 0; _networked = false; _dist_sum = 0; if (exp_m_->exp_s()->get_with_heredity()) { _inherited_protein_list = std::vector( other._inherited_protein_list); } } Individual_R::Individual_R( Individual_R* parent, int32_t id, std::shared_ptr mut_prng, std::shared_ptr stoch_prng) : Individual( parent, id, mut_prng, stoch_prng ) { //~ printf( "ae_individual_R( parent ) : I have %d inherited proteins\n", parent->get_protein_list()->get_nb_elts() ); _indiv_age = 0; _networked = false; _dist_sum = 0; if (exp_m_->exp_s()->get_with_heredity()) { for (const auto& prot : parent->protein_list_) { if (prot->concentration() > parent->exp_m_->exp_s()->get_protein_presence_limit()) { Protein_R* inherited_prot = new Protein_R(prot->get_gen_unit(), (Protein_R&) *prot); inherited_prot->set_inherited(true); _inherited_protein_list.push_back(inherited_prot); } } } } Individual_R::Individual_R(ExpManager* exp_m, gzFile backup_file) : Individual( exp_m, backup_file ) { _indiv_age = 0; _networked = false; if( exp_m_->exp_s()->get_with_heredity() ) { // Retreive inherited proteins // _inherited_protein_list = new ae_list(); int16_t nb_inherited_proteins = 0; gzread( backup_file, &nb_inherited_proteins, sizeof(nb_inherited_proteins) ); for ( int16_t i = 0 ; i < nb_inherited_proteins ; i++ ) { _inherited_protein_list.push_back( new Protein_R( backup_file ) ); } } } // ================================================================= // Destructors // ================================================================= Individual_R::~Individual_R( void ) noexcept { // assert( !exp_m_->exp_s()->get_with_heredity() ); /* for (const auto& prot : parent->_protein_list) Protein_R* dp = _inherited_protein_list[i]; delete dp; }*/ if (exp_m_->exp_s()->get_with_heredity()) { for (unsigned int i = 0; i < _inherited_protein_list.size(); i++) delete _inherited_protein_list[i]; _inherited_protein_list.clear(); } for (unsigned int i = 0; i < _rna_list_coding.size(); i++) { _rna_list_coding[i] = NULL; } _rna_list_coding.clear(); } // ================================================================= // Public Methods // ================================================================= Individual_R* Individual_R::CreateClone(const Individual_R* dolly, int32_t id) { Individual_R* indiv = new Individual_R(*dolly); indiv->set_id(id); return indiv; } void Individual_R::Evaluate() { EvaluateInContext(grid_cell_->habitat()); } void Individual_R::EvaluateInContext(const Habitat_R& habitat) { if (evaluated_ == true) return; // Individual has already been evaluated, nothing to do. if (!_networked) { init_indiv(habitat); } std::set* eval = exp_m_->exp_s()->get_list_eval_step(); // i is thus the age of the individual for (int8_t i = 1; i <= exp_m_->exp_s()->get_nb_indiv_age(); i++) { //Set the concentration of signals for this age for(Protein_R* prot1 : habitat.signals()) { prot1->set_concentration(0.0); } for(Protein_R* prot2 : habitat.phenotypic_target(i).signals()) { prot2->set_concentration(0.9); } for (int j = 0; j < exp_m_->exp_s()->get_nb_degradation_step(); j++) { one_step(); } // If we have to evaluate the individual at this age if (eval->find(i) != eval->end()) { eval_step(habitat, i); } } final_step(habitat, exp_m_->exp_s()->get_nb_indiv_age()); protein_list_.clear(); protein_list_ = _initial_protein_list; } void Individual_R::EvaluateInContext(const Habitat& habitat) { EvaluateInContext(dynamic_cast (habitat)); } void Individual_R::init_indiv(const Habitat_R& habitat) { // --------------------------------------------------------------------------- // 1) Transcription - Translation - Folding - make_protein_list // --------------------------------------------------------------------------- transcribed_ = false; translated_ = false; folded_ = false; do_transcription_translation_folding(); if (phenotype_ != NULL) { delete phenotype_; delete phenotype_activ_; delete phenotype_inhib_; phenotype_ = NULL; phenotype_activ_ = NULL; phenotype_inhib_ = NULL; } phenotype_ = FuzzyFactory::fuzzyFactory->create_fuzzy(); phenotype_activ_ = FuzzyFactory::fuzzyFactory->create_fuzzy(); phenotype_inhib_ = FuzzyFactory::fuzzyFactory->create_fuzzy(); //---------------------------------------------------------------------------- // 2) Make a list of all the rna present in the individual // and initialise the concentrations of the proteins //---------------------------------------------------------------------------- make_rna_list(); _initial_protein_list = protein_list_; //_protein_list.insert(_protein_list.end(), habitat.signals().begin(), habitat.signals().end()); for(Protein_R* prot : habitat.signals()) { protein_list_.push_back(prot); } //---------------------------------------------------------------------------- // 3) Create influence graph (including the signals) //---------------------------------------------------------------------------- //printf("Protein %ld RNA %ld\n",protein_list_.size(),rna_list_.size()); set_influences(); _networked = true; } void Individual_R::one_step( void ) { //---------------------------------------------------------------------------- // 4) Make the individual "live its life" and compute partial phenotypes and // fitnesses //---------------------------------------------------------------------------- if (exp_m_->regul_or_not()) update_concentrations(); } void Individual_R::eval_step( const Habitat_R& habitat, int8_t age ) { update_phenotype(); distance_to_target_computed_ = false; phenotype_computed_ = true; for (int i=0; iexp_s()->get_list_eval_step()->size()); dist_to_target_by_feature_[METABOLISM] = _dist_sum / (double) (exp_m_->exp_s()->get_list_eval_step()->size()); fitness_computed_=false; // yoram attention il peut y avoir des soucis si on utilise des environnements segmentés ici compute_fitness(habitat.phenotypic_target( age )); phenotype_computed_ = true; } void Individual_R::set_influences() // Compute the influence of each protein over each coding RNA // As non-coding RNAs are completely inert, we don't care about their concentration // so we don't care if proteins activate or inhibit their transcription. { for(auto& rna : _rna_list_coding) { rna->set_influences( protein_list_ ); } } void Individual_R::update_concentrations( void ) { // Compute all the changes that will be applied to the concentrations // Concentrations must not be changed at this stage for (auto& prot : protein_list_) { if (!((Protein_R*)prot)->is_signal()) ((Protein_R*)prot)->compute_delta_concentration(); } // Apply the changes in concentrations we have just computed for (auto& prot : protein_list_) { if (!((Protein_R*)prot)->is_signal()) ((Protein_R*)prot)->update_concentration(); } } // Multiply the concentration of each protein by void Individual_R::multiply_concentrations( double factor ) { for (auto& prot : protein_list_) { ((Protein_R*)prot)->multiply_concentration( factor ); } } int8_t Individual_R::get_quadon( const GeneticUnit* gen_unit, Strand strand, int32_t pos ) { const char* dna = gen_unit->dna()->data(); int32_t len = gen_unit->dna()->length(); //int8_t quadon_1 = 0,quadon_2 = 0,quadon_3 = 0,quadon_4 = 0; int8_t quadon[4]; // printf("Length %d : %s\n\n",len,dna); if ( strand == LEADING ) { #pragma omp simd for ( int8_t i = 0 ; i < QUADON_SIZE ; i++ ) { quadon[i] = (dna[(pos+i) % len] == '1') ? 1 << (QUADON_SIZE - i - 1) : 0; } /*quadon_1 += (dna[(pos+0) % len] == '1') ? 1 << (QUADON_SIZE - 0 - 1) : 0; quadon_2 += (dna[(pos+1) % len] == '1') ? 1 << (QUADON_SIZE - 1 - 1) : 0; quadon_3 += (dna[(pos+2) % len] == '1') ? 1 << (QUADON_SIZE - 2 - 1) : 0; quadon_4 += (dna[(pos+3) % len] == '1') ? 1 << (QUADON_SIZE - 3 - 1) : 0;*/ //if ( dna[(pos+i) % len] == '1' ) //{ // quadon += 1 << (QUADON_SIZE - i - 1); //pow( 2, QUADON_SIZE - i - 1 ); //} //} } else // ( strand == LAGGING ) { #pragma omp simd for ( int8_t i = 0 ; i < QUADON_SIZE ; i++ ) { quadon[i] = (dna[(pos-i) % len] != '1') ? 1 << (QUADON_SIZE - i - 1) : 0; /*if ( dna[(pos-i) % len] != '1' ) // == and not != because we are on the complementary strand... { quadon += 1 << (QUADON_SIZE - i - 1); //pow( 2, QUADON_SIZE - i - 1 ); }*/ } /*quadon_1 += (dna[(pos-0) % len] != '1') ? 1 << (QUADON_SIZE - 0 - 1) : 0; quadon_2 += (dna[(pos-1) % len] != '1') ? 1 << (QUADON_SIZE - 1 - 1) : 0; quadon_3 += (dna[(pos-2) % len] != '1') ? 1 << (QUADON_SIZE - 2 - 1) : 0; quadon_4 += (dna[(pos-3) % len] != '1') ? 1 << (QUADON_SIZE - 3 - 1) : 0;*/ } return quadon[0]+quadon[1]+quadon[2]+quadon[3]; } void Individual_R::save( gzFile backup_file ) { //printf("Appel à la sauvegarde de Individual_R\n"); Individual::save( backup_file ); // Test if there is heredity, and if the generation is the first one (no inherited protein list). if (this->exp_m_->exp_s()->get_with_heredity() && !_inherited_protein_list.empty() ) { // Write inherited proteins int16_t nb_inherited_proteins = _inherited_protein_list.size(); gzwrite( backup_file, &nb_inherited_proteins, sizeof(nb_inherited_proteins) ); for (auto& prot : _inherited_protein_list) { prot->save( backup_file ); } } } // ================================================================= // Protected Methods // ================================================================= void Individual_R::make_protein_list( void ) { Individual::make_protein_list(); if (this->exp_m_->exp_s()->get_with_heredity()) { for (auto& prot : _inherited_protein_list) protein_list_.push_back(prot); } } void Individual_R::make_rna_list( void ) { Individual::make_rna_list(); _rna_list_coding = {}; // Parse the newly created RNA list and copy the coding RNAs in _rna_list_coding. for (const auto& gen_unit: genetic_unit_list_) { GeneticUnit* genu = const_cast(&gen_unit); // Create proxies const auto& rna_list = gen_unit.rna_list(); const auto& lead = rna_list[LEADING]; const auto& lagg = rna_list[LAGGING]; // append pointers to rna material to local _rna_list for (auto& strand: {LEADING, LAGGING}) for (auto& rna: rna_list[strand]) { //TODO Ugly fix, change it to avoid memory usage double if (rna.is_coding()) { Rna_R* prna = const_cast(&rna); //printf("COPY OR NOT : %ld == %ld",prna->get_id(),((Rna_R)rna).get_id()); _rna_list_coding.push_back( prna);//new Rna_R(genu, rna)); } } } } void Individual_R::update_phenotype( void ) { // We will use two fuzzy sets : // * _phenotype_activ for the proteins realising a set of functions // * _phenotype_inhib for the proteins inhibitting a set of functions // The phenotype will then be given by the sum of these 2 fuzzy sets phenotype_activ_->reset(); phenotype_inhib_->reset(); phenotype_->reset(); for (auto& prot : protein_list_) { if ( ((Protein_R*)prot)->is_functional() ) { if ( ((Protein_R*)prot)->height() > 0 ) { // added=true; phenotype_activ_->add_triangle( ((Protein_R*)prot)->mean(), ((Protein_R*)prot)->width(), ((Protein_R*)prot)->height() * ((Protein_R*)prot)->concentration() ); /* printf("Add triangle ACTIV %f %f %f (%f %f)\n",((Protein_R*)prot)->mean(), ((Protein_R*)prot)->width(), ((Protein_R*)prot)->height() * ((Protein_R*)prot)->concentration(), ((Protein_R*)prot)->height(), ((Protein_R*)prot)->concentration() );*/ } else { phenotype_inhib_->add_triangle( ((Protein_R*)prot)->mean(), ((Protein_R*)prot)->width(), ((Protein_R*)prot)->height() * ((Protein_R*)prot)->concentration() ); /* printf("Add triangle INHIB %f %f %f (%f %f)\n",((Protein_R*)prot)->mean(), ((Protein_R*)prot)->width(), ((Protein_R*)prot)->height() * ((Protein_R*)prot)->concentration(), ((Protein_R*)prot)->height(), ((Protein_R*)prot)->concentration() );*/ } } } phenotype_activ_->clip(AbstractFuzzy::max, Y_MAX); phenotype_inhib_->clip(AbstractFuzzy::min, - Y_MAX); phenotype_->add(*phenotype_activ_); phenotype_->add(*phenotype_inhib_); phenotype_->clip(AbstractFuzzy::min, Y_MIN); phenotype_->simplify(); // _phenotype->simplify(); } void Individual_R::clear_everything_except_dna_and_promoters() { _networked = false; _rna_list_coding.clear(); _dist_sum = 0.0; Individual::clear_everything_except_dna_and_promoters(); } } // namespace aevol aevol-5.0/src/libaevol/raevol/PhenotypicTarget_R.h0000644000175000017500000001223012724051151017200 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // //***************************************************************************** #ifndef AEVOL_PHENOTYPIC_TARGET_R_H__ #define AEVOL_PHENOTYPIC_TARGET_R_H__ // ============================================================================ // Includes // ============================================================================ #include #include #include #include #include "PhenotypicTarget.h" #include "Protein_R.h" namespace aevol { // ============================================================================ // Class declarations // ============================================================================ //class Protein_R; class PhenotypicTarget_R : public PhenotypicTarget { // Faut il le laisser ? //friend class PhenotypicTargetHandler; public : // ========================================================================== // Constructors // ========================================================================== PhenotypicTarget_R(void); //< Default ctor PhenotypicTarget_R(int8_t id); PhenotypicTarget_R(const PhenotypicTarget_R&); //< Copy ctor PhenotypicTarget_R(PhenotypicTarget_R&&) = delete; //< Move ctor // ========================================================================== // Destructor // ========================================================================== virtual ~PhenotypicTarget_R(void); //< Destructor // ========================================================================== // Operators // ========================================================================== // ========================================================================== // Public Methods // ========================================================================== void save(gzFile backup_file) const; void load(gzFile backup_file); // ========================================================================== // Getters // ========================================================================== int8_t get_id() const { return id_; } std::list signals() const { return signals_; } // ========================================================================== // Setters // ========================================================================== void set_signals(const std::list& signals_list) { signals_ = signals_list; } protected : // ========================================================================== // Protected Methods // ========================================================================== // ========================================================================== // Attributes // ========================================================================== // An identifier used to know the position of this Phenotypic target in PhenotypicTargetHandler int8_t id_; std::list signals_; }; // ============================================================================ // Getters' definitions // ============================================================================ // ============================================================================ // Setters' definitions // ============================================================================ // ============================================================================ // Operators' definitions // ============================================================================ // ============================================================================ // Inline functions' definition // ============================================================================ } // namespace aevol #endif // AEVOL_PHENOTYPIC_TARGET_R_H__ aevol-5.0/src/libaevol/raevol/Protein_R.cpp0000644000175000017500000001643212724051151015672 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ================================================================= // Libraries // ================================================================= // ================================================================= // Project Files // ================================================================= #include "Protein_R.h" #include "Codon.h" #include "GeneticUnit.h" #include "ExpManager.h" #include namespace aevol { //############################################################################## // # // Class Protein_R # // # //############################################################################## // ================================================================= // Definition of static attributes // ================================================================= long Protein_R::id = 0; // ================================================================= // Constructors // ================================================================= Protein_R::Protein_R( GeneticUnit* gen_unit, const Protein_R &model ) : Protein::Protein( gen_unit, model ) { concentration_ = model.concentration_; _initial_concentration = model.concentration_; _delta_concentration = model._delta_concentration; _signal = model._signal; _inherited = model._inherited; is_TF_ = model.is_TF_; _id = id++; if (!AA_list_.empty()) { _cod_tab = new int8_t[AA_list_.size()]; int i = 0; for (auto cod : AA_list_) { _cod_tab[i] = cod->value(); i++; } } } Protein_R::Protein_R( GeneticUnit* gen_unit, const std::list codon_list, Strand strand, int32_t shine_dal_pos, Rna* rna, double w_max ) : Protein::Protein( gen_unit, codon_list, strand, shine_dal_pos, rna, w_max ) { _rna_R_list.push_back((Rna_R*)rna); _initial_concentration = concentration_; _delta_concentration = 0; _inherited = false; _signal = false; is_TF_ = false; _id = id++; if (!AA_list_.empty()) { _cod_tab = new int8_t[AA_list_.size()]; int i = 0; for (auto cod : AA_list_) { _cod_tab[i] = cod->value(); i++; } } } //used to build the signal protein Protein_R::Protein_R( const std::list codon_list, double concentration, double w_max) : Protein::Protein( codon_list, concentration, w_max ) { _initial_concentration = 0; _delta_concentration = 0; _inherited = false; _signal = true; is_TF_ = false; _id = id++; if (!AA_list_.empty()) { _cod_tab = new int8_t[AA_list_.size()]; int i = 0; for (auto cod : AA_list_) { _cod_tab[i] = cod->value(); i++; } } } Protein_R::Protein_R( gzFile backup_file ) : Protein::Protein( backup_file ) { // the Influence list is re-calculate afterward, and then is not saved, nor use in this consctructor. gzread( backup_file, &_delta_concentration, sizeof(_delta_concentration) ); gzread( backup_file, &_inherited, sizeof(_inherited) ); gzread( backup_file, &_signal, sizeof(_signal) ); is_TF_ = false; _id = id++; if (!AA_list_.empty()) { _cod_tab = new int8_t[AA_list_.size()]; int i = 0; for (auto cod : AA_list_) { _cod_tab[i] = cod->value(); i++; } } } // ================================================================= // Destructors // ================================================================= Protein_R::~Protein_R( void ) { for (unsigned int i = 0; i < _rna_R_list.size(); i++) _rna_R_list[i] = NULL; _rna_R_list.clear(); delete [] _cod_tab; } // ================================================================= // Public Methods // ================================================================= void Protein_R::compute_delta_concentration( void ) { _delta_concentration = 0; if( _signal == false ) { //printf("Protein %ld is generated by ",_id); for (auto& rna: _rna_R_list) { //if (_id == 34483) printf("%ld (influenced by %ld) at %f - ",rna->get_id(),rna->_operating_coef_list.size(),rna->get_synthesis_rate()); assert( _inherited == false); _delta_concentration += rna->get_synthesis_rate(); ///if (_id == 34483) printf("Prot %ld synthesis by %ld at rate %e\n",_id,rna->get_id(),rna->get_synthesis_rate()); } //if (_id == 34483) printf("\n"); //if (_id == 34483) printf("Prot %ld BEFORE DEGRADATION concentration %f %f\n",_id,concentration_,_delta_concentration); _delta_concentration -= gen_unit_->exp_m()->exp_s()->get_degradation_rate() * concentration_; _delta_concentration *= 1/((double)gen_unit_->exp_m()->exp_s()->get_nb_degradation_step()); //if (_id == 34483) printf("Prot %ld AFTER degradation concentration %f %f\n",_id,concentration_,_delta_concentration); } } int8_t Protein_R::get_codon( int32_t index ) { return _cod_tab[index]; } void Protein_R::save( gzFile backup_file ) { Protein::save( backup_file ); // the Influence list is re-calculate afterward, and then is not saved. gzwrite( backup_file, &_delta_concentration, sizeof(_delta_concentration) ); gzwrite( backup_file, &_inherited, sizeof(_inherited) ); gzwrite( backup_file, &_signal, sizeof(_signal) ); } // ================================================================= // Protected Methods // ================================================================= void Protein_R::remove_influences( void ) { printf("ALERTE la proteine veut détruire une influence !!!\n"); _rna_R_list.clear(); } void Protein_R::add_RNA( Rna * rna ) { Protein::add_RNA(rna); _initial_concentration += rna->basal_level(); //printf("Add RNA %ld to protein %ld (influence by %ld)\n",((Rna_R*)rna)->get_id(),_id,((Rna_R*)rna)->_operating_coef_list.size()); _rna_R_list.push_back((Rna_R*)rna); } } // namespace aevol aevol-5.0/src/libaevol/raevol/Individual_R.h0000644000175000017500000001554312724051151016011 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_INDIVIDUAL_R_H_ #define AEVOL_INDIVIDUAL_R_H_ // ================================================================= // Libraries // ================================================================= #include #include #include // ================================================================= // Project Files // ================================================================= #include "Individual.h" #include "Rna_R.h" #include "Protein_R.h" #include "Habitat_R.h" namespace aevol { // ================================================================= // Class declarations // ================================================================= class Individual_R : public virtual Individual { public : // ================================================================= // Constructors // ================================================================= Individual_R() = delete; Individual_R(const Individual_R& other); Individual_R(ExpManager * exp_m, std::shared_ptr mut_prng, std::shared_ptr stoch_prng, std::shared_ptr param_mut, double w_max, int32_t min_genome_length, int32_t max_genome_length, bool allow_plasmids, int32_t id, const char* strain_name, int32_t age); Individual_R( Individual_R* parent, int32_t id, std::shared_ptr mut_prng, std::shared_ptr stoch_prng); Individual_R(ExpManager* exp_m, gzFile backup_file); static Individual_R* CreateClone(const Individual_R* dolly, int32_t id); // ================================================================= // Destructors // ================================================================= virtual ~Individual_R( void ) noexcept; // ================================================================= // Accessors // ================================================================= inline std::vector get_rna_list_coding( void ) const; // ================================================================= // Public Methods // ================================================================= /** * Main evaluation method */ virtual void Evaluate(); /** * Evaluate within the provided context */ virtual void EvaluateInContext(const Habitat_R& habitat); virtual void EvaluateInContext(const Habitat& habitat); virtual void init_indiv(const Habitat_R& habitat); virtual void one_step( void ); virtual void eval_step(const Habitat_R& habitat, int8_t age); virtual void final_step(const Habitat_R& habitat, int8_t age); //virtual void reevaluate(); //virtual void clear_everything_except_dna_and_promoters(); //void do_transcription_translation_folding(); // void do_transcription(); //void do_translation(); //void do_folding(); //void compute_phenotype(); //void compute_distance_to_target(const PhenotypicTarget& target); //void update_phenotype(); void set_influences( void ); void update_concentrations( void ); void multiply_concentrations( double factor ); int8_t get_quadon( const GeneticUnit* gen_unit, Strand strand, int32_t pos ); virtual void save( gzFile backup_file ); void clear_everything_except_dna_and_promoters(); inline std::vector get_inherited_protein_list( void) const; inline void set_networked( bool networked ); std::vector _rna_list_coding; // Please note that these RNAs are // actually managed via genetic units. // ================================================================= // Public Attributes // ================================================================= protected : // ================================================================= // Forbidden Constructors // ================================================================= /* ae_individual_R(const ae_individual &model) { printf("ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__); exit(EXIT_FAILURE); };*/ // ================================================================= // Protected Methods // ================================================================= virtual void make_protein_list( void ); virtual void make_rna_list( void ); void update_phenotype( void ); // ================================================================= // Protected Attributes // ================================================================= std::vector _inherited_protein_list; std::list _initial_protein_list; int _indiv_age; bool _networked; double _dist_sum; }; // ===================================================================== // Accessors definitions // ===================================================================== inline std::vector Individual_R::get_inherited_protein_list( void ) const { return _inherited_protein_list; } inline std::vector Individual_R::get_rna_list_coding( void ) const { return _rna_list_coding; } inline void Individual_R::set_networked( bool networked ) { _networked = networked; } } // namespace aevol #endif // AEVOL_INDIVIDUAL_R_H_ aevol-5.0/src/libaevol/raevol/Rna_R.cpp0000644000175000017500000002203212724051151014763 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // //***************************************************************************** // ================================================================= // Libraries // ================================================================= #include #ifdef __BLAS__ #include #endif // ================================================================= // Project Files // ================================================================= #include "Rna_R.h" #include "Individual_R.h" #include "ExpManager.h" namespace aevol { //############################################################################## // # // Class ae_rna_R # // # //############################################################################## // ================================================================= // Definition of static attributes // ================================================================= long Rna_R::id = 0; // ================================================================= // Constructors // ================================================================= Rna_R::Rna_R( GeneticUnit* gen_unit, const Rna_R &model ) : Rna( gen_unit, model ) { _protein_list = model._protein_list; _enhancing_coef_list = model._enhancing_coef_list; _operating_coef_list = model._operating_coef_list; _id = model._id; _nb_influences = model._nb_influences; } Rna_R::Rna_R( GeneticUnit* gen_unit, Strand strand, int32_t index, int8_t diff ) : Rna( gen_unit, strand, index, diff ) { _id = id++; _nb_influences = 0; } /* ae_rna_R::ae_rna_R( ae_rna_R* parent ) : ae_rna( parent ) { _influence_list = parent->_influence_list->copy(); } */ // ================================================================= // Destructors // ================================================================= Rna_R::~Rna_R( void ) { _protein_list.clear(); _enhancing_coef_list.clear(); _operating_coef_list.clear(); } // ================================================================= // Public Methods // ================================================================= void Rna_R::set_influences( std::list& protein_list ) { int32_t enhancer_position = get_enhancer_position(); int32_t operator_position = get_operator_position(); _protein_list.clear(); _protein_list.resize(protein_list.size()); _enhancing_coef_list.clear(); _enhancing_coef_list.resize(protein_list.size()); _operating_coef_list.clear(); _operating_coef_list.resize(protein_list.size()); int i = 0; double enhance=0,operate=0; //#pragma omp simd for (auto& prot : protein_list) { enhance = affinity_with_protein( enhancer_position, prot ); operate = affinity_with_protein( operator_position, prot ); if (enhance != 0.0 || operate != 0.0) { _protein_list[i] = (Protein_R*) prot; _enhancing_coef_list[i] = enhance; _operating_coef_list[i] = operate; _protein_list[i]->is_TF_ = true; // _protein_concentration_list[i] = prot->concentration(); i++; } //else // _protein_list[i] = nullptr; } _nb_influences = i==0 ? 0 : i-1; /*if (protein_list.size() > 0) printf("Set Influences of RNA %ld with %ld %ld %ld\n",_id,_enhancing_coef_list.size(),_operating_coef_list.size(), _protein_list.size());*/ } double Rna_R::get_synthesis_rate( void ) { double enhancer_activity = 0; double operator_activity = 0; //#ifndef __BLAS__ for (int i = 0; i < _nb_influences; i++) { enhancer_activity += _enhancing_coef_list[i] * _protein_list[i]->concentration_; operator_activity += _operating_coef_list[i] * _protein_list[i]->concentration_; } /*#else double enhancer_tab[_nb_influences]; double operator_tab[_nb_influences]; for (int i = 0; i < _nb_influences; i++) { enhancer_tab[i] = _enhancing_coef_list[i] * _protein_list[i]->concentration_; operator_tab[i] = _operating_coef_list[i] * _protein_list[i]->concentration_; } enhancer_activity = cblas_dasum(_nb_influences,enhancer_tab,1); operator_activity = cblas_dasum(_nb_influences,operator_tab,1); #endif*/ double enhancer_activity_pow_n = pow( enhancer_activity, gen_unit_->exp_m()->exp_s()->get_hill_shape_n() ); double operator_activity_pow_n = pow( operator_activity, gen_unit_->exp_m()->exp_s()->get_hill_shape_n() ); //if (enhancer_activity != 0.0 || operator_activity != 0.0) /*if (_id == 132073) printf("Synthesis of RNA %ld : E %f O %f EP %f OP %f SN %f S %f B %f\n",_id,enhancer_activity,operator_activity,enhancer_activity_pow_n, operator_activity_pow_n,gen_unit_->exp_m()->exp_s()->get_hill_shape_n(), gen_unit_->exp_m()->exp_s()->get_hill_shape(),basal_level_);*/ return basal_level_ * (gen_unit_->exp_m()->exp_s()->get_hill_shape() / (operator_activity_pow_n + gen_unit_->exp_m()->exp_s()->get_hill_shape())) * (1 + ((1 / basal_level_) - 1) * (enhancer_activity_pow_n / (enhancer_activity_pow_n + gen_unit_->exp_m()->exp_s()->get_hill_shape()))); } // ================================================================= // Protected Methods // ================================================================= int32_t Rna_R::get_enhancer_position( void ) { if(strand_ == LEADING) { return (pos_ - 20) % ( gen_unit_->dna()->length() ); } else // strand_ = LAGGING { return (pos_ + 20) % ( gen_unit_->dna()->length() ); } } int32_t Rna_R::get_operator_position( void ) { if(strand_ == LEADING) { return (pos_ + PROM_SIZE) % ( gen_unit_->dna()->length() ); } else // strand_ = LAGGING { return (pos_ - PROM_SIZE) % ( gen_unit_->dna()->length() ); } } double Rna_R::affinity_with_protein( int32_t index, Protein *protein ) { int32_t len = protein->length(); if (len < 5) return 0.0; #ifndef __BLAS__ double max = 0; double temp = 1; #else double tab_temp[len-4]; #endif int32_t quadon_tab[5]; // int32_t* codon_tab; // codon_tab = new int32_t[len]; Individual_R* indiv = NULL; Protein_R* prot = NULL; // printf("affinity_with_protein - len = %d\n",len); // Putting the quadons and the codons on local tab indiv = dynamic_cast< Individual_R* >( gen_unit_->indiv() ); prot = ( Protein_R* )( protein ); for ( int32_t i = 0 ; i < 5; i++ ) { quadon_tab[i] = indiv->get_quadon( gen_unit_, strand_, (index+i) ); } // for (int32_t i = 0 ; i < len ; i++ ) // { // codon_tab[i] = prot->get_codon(i); // } // // t2 = high_resolution_clock::now(); // duration = std::chrono::duration_cast( t2 - t1 ).count(); // ae_logger::addLog(CODON,duration); // t1 = t2; //// Calculate the affinity double (*binding_matrix)[MAX_QUADON][MAX_CODON] = &(gen_unit_->exp_m()->exp_s()->_binding_matrix); #pragma omp simd for ( int32_t i = 0 ; i < len - 4; i++ ) { #ifndef __BLAS__ temp = 1; #else tab_temp[i] = (*binding_matrix)[quadon_tab[0]][prot->_cod_tab[i]]; tab_temp[i] *= (*binding_matrix)[quadon_tab[1]][prot->_cod_tab[i+1]]; tab_temp[i] *= (*binding_matrix)[quadon_tab[2]][prot->_cod_tab[i+2]]; tab_temp[i] *= (*binding_matrix)[quadon_tab[3]][prot->_cod_tab[i+3]]; tab_temp[i] *= (*binding_matrix)[quadon_tab[4]][prot->_cod_tab[i+4]]; #endif #ifndef __BLAS__ for ( int8_t j = 0 ; j < 5 ; j++ ) { temp *= gen_unit_->exp_m()->exp_s()->_binding_matrix[quadon_tab[0]][prot->_cod_tab[i+j]]; } max = (max < temp) ? temp : max; #endif } #ifdef __BLAS__ return tab_temp[cblas_idamax(len-4,tab_temp,1)]; #else return max; #endif } } // namespace aevol aevol-5.0/src/libaevol/FuzzyFactory.h0000644000175000017500000001157212735461414014636 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // //***************************************************************************** #ifndef AEVOL_FUZZY_FACTORY_H__ #define AEVOL_FUZZY_FACTORY_H__ // ============================================================================ // Includes // ============================================================================ #include #include #include #include #include "AbstractFuzzy.h" namespace aevol { // ============================================================================ // Class declarations // ============================================================================ class ExpSetup; class FuzzyFactory { public : // ========================================================================== // Constructors // ========================================================================== FuzzyFactory(ExpSetup* exp_s) {_exp_s = exp_s;}; //< Default ctor // ========================================================================== // Destructor // ========================================================================== virtual ~FuzzyFactory(void) {}; //< Destructor // ========================================================================== // Getters // ========================================================================== int get_fuzzy_flavor(); // ========================================================================== // Setters // ========================================================================== // ========================================================================== // Operators // ========================================================================== // ========================================================================== // Public Methods // ========================================================================== /* static AbstractFuzzy* create_fuzzy(ExpSetup* exp_s); static AbstractFuzzy* create_fuzzy(ExpSetup* exp_s, const AbstractFuzzy& copy); static AbstractFuzzy* create_fuzzy(ExpSetup* exp_s, const gzFile backup);*/ AbstractFuzzy* create_fuzzy(); AbstractFuzzy* create_fuzzy(const AbstractFuzzy& copy); AbstractFuzzy* create_fuzzy(const gzFile backup); static FuzzyFactory* fuzzyFactory; protected : // ========================================================================== // Protected Methods // ========================================================================== // ========================================================================== // Attributes // ========================================================================== ExpSetup* _exp_s; }; // ============================================================================ // Getters' definitions // ============================================================================ // ============================================================================ // Setters' definitions // ============================================================================ // ============================================================================ // Operators' definitions // ============================================================================ // ============================================================================ // Inline functions' definition // ============================================================================ } // namespace aevol #endif //AEVOL_FUZZYFACTORY_H aevol-5.0/src/libaevol/JumpingMT.cpp0000644000175000017500000002500312724051151014345 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ================================================================= // Libraries // ================================================================= #include #include "AeTime.h" // ================================================================= // Project Files // ================================================================= #include "JumpingMT.h" #include "JumpPoly.h" namespace aevol { //############################################################################## // # // Class JumpingMT # // # //############################################################################## // ================================================================= // Definition of static attributes // ================================================================= int32_t JumpingMT::nb_jumps = 0; double JumpingMT::jump_time = 0; // ================================================================= // Constructors // ================================================================= /*! Create a generator initialized with a simple uint32_t */ JumpingMT::JumpingMT(const uint32_t& simple_seed) { sfmt_ = new sfmt_t(); sfmt_init_gen_rand(sfmt_, simple_seed); // Jump to get rid of the initializatino skew jump(); } /*! Create a copy of an existing generator */ JumpingMT::JumpingMT(const JumpingMT & model) { sfmt_ = new sfmt_t(); memcpy(sfmt_->state, model.sfmt_->state, SFMT_N*sizeof(sfmt_->state[0])); sfmt_->idx = model.sfmt_->idx; } /*! Load a generator from a gz backup file */ JumpingMT::JumpingMT(gzFile backup_file) { sfmt_ = new sfmt_t(); gzread(backup_file, sfmt_->state, SFMT_N * sizeof(sfmt_->state[0])); gzread(backup_file, &(sfmt_->idx), sizeof(sfmt_->idx)); } // ================================================================= // Destructors // ================================================================= JumpingMT::~JumpingMT() { delete sfmt_; } // ================================================================= // Public Methods // ================================================================= /*! Jump Ahead by a predefined jump length */ void JumpingMT::jump() { //~ clock_t start, end; //~ start = clock(); #ifdef TRIVIAL_METHOD_JUMP_SIZE for (int i = 0 ; i < TRIVIAL_METHOD_JUMP_SIZE ; i++) { sfmt_genrand_real2(sfmt_); } #else SFMT_jump(sfmt_, jump_poly); #endif //~ int nb_sup_steps = 100 * (double)rand() / ((double)RAND_MAX + 1); //~ for (int i = 0 ; i < nb_sup_steps ; i++) //~ { //~ sfmt_genrand_real2(sfmt_); //~ } //~ end = clock(); //~ jump_time += (end - start) * 1000 / CLOCKS_PER_SEC; //~ nb_jumps++; } /*! Binomial drawing of parameter (nb_drawings, prob). Number of successes out of nb_drawings trials each of probability prob. */ int32_t JumpingMT::binomial_random(int32_t nb_drawings, double prob) { int32_t nb_success; // The binomial distribution is invariant under changing // ProbSuccess to 1-ProbSuccess, if we also change the answer to // NbTrials minus itself; we ll remember to do this below. double p; if (prob <= 0.5) p = prob; else p = 1.0 - prob; // mean of the deviate to be produced double mean = nb_drawings * p; if (nb_drawings < 25) // Use the direct method while NbTrials is not too large. // This can require up to 25 calls to the uniform random. { nb_success = 0; for (int32_t j = 1 ; j <= nb_drawings ; j++) { if (random() < p) nb_success++; } } else if (mean < 1.0) // If fewer than one event is expected out of 25 or more trials, // then the distribution is quite accurately Poisson. Use direct Poisson method. { double g = exp(-mean); double t = 1.0; int32_t j; for (j = 0; j <= nb_drawings ; j++) { t = t * random(); if (t < g) break; } if (j <= nb_drawings) nb_success = j; else nb_success = nb_drawings; } else // Use the rejection method. { double en = nb_drawings; double oldg = gammln(en + 1.0); double pc = 1.0 - p; double plog = log(p); double pclog = log(pc); // rejection method with a Lorentzian comparison function. double sq = sqrt(2.0 * mean * pc); double angle, y, em, t; do { do { angle = M_PI * random(); y = tan(angle); em = sq*y + mean; } while (em < 0.0 || em >= (en + 1.0)); // Reject. em = floor(em); // Trick for integer-valued distribution. t = 1.2 * sq * (1.0 + y*y) * exp(oldg - gammln(em + 1.0) - gammln(en - em + 1.0) + em * plog + (en - em) * pclog); } while (random() > t); // Reject. This happens about 1.5 times per deviate, on average. nb_success = (int32_t) rint(em); } // Undo the symmetry transformation. if (p != prob) nb_success = nb_drawings - nb_success; return nb_success; } double JumpingMT::gaussian_random() { double x1, x2; double r = 0; do { x1 = 2.0 * random() - 1.0; x2 = 2.0 * random() - 1.0; r = x1*x1 + x2*x2; // (x1,x2) must be in the unit circle } while ((r >= 1.0) || (r == 0)); r = sqrt((-2.0 * log(r)) / r); // Box-muller transformation return x1 * r; } int8_t JumpingMT::roulette_random(double* probs, int8_t nb_elts) { double pick_one = 0.0; while (pick_one == 0) { pick_one = random(); } int8_t found_org = 0; pick_one -= probs[0]; while (pick_one > 0) { assert(found_org 0) { printf("Zero sum in multinomial function\n"); assert(false); exit(EXIT_FAILURE); } int32_t x; int32_t n = nb_drawings; for (int32_t i = 0 ; i < nb_colors - 1 ; i++) { // generate output by calling binomial (nb_colors-1) times p = source[i]; if (sum <= p) { // this fixes two problems: // 1. prevent division by 0 when sum = 0 // 2. prevent p/sum getting bigger than 1 in case of rounding errors x = n; } else { x = binomial_random(n, p/sum); } n = n - x; sum = sum - p; destination[i] = x; } // get the last one destination[nb_colors-1] = n; } void JumpingMT::save(gzFile backup_file) const { gzwrite(backup_file, sfmt_->state, SFMT_N * sizeof(sfmt_->state[0])); gzwrite(backup_file, &(sfmt_->idx), sizeof(sfmt_->idx)); } // ================================================================= // Protected Methods // ================================================================= double JumpingMT::gammln(double X) // Returns the value ln[gamma(X)] for X. // The gamma function is defined by the integral gamma(z) = int(0, +inf, t^(z-1).e^(-t)dt). // When the argument z is an integer, the gamma function is just the familiar factorial // function, but offset by one, n! = gamma(n + 1). { double x, y, tmp, ser; static double cof[6] = { 76.18009172947146, -86.50532032941677, 24.01409824083091, -1.231739572450155, 0.1208650973866179e-2, -0.5395239384953e-5 }; y = x = X; tmp = x + 5.5; tmp -= (x+0.5) * log(tmp); ser = 1.000000000190015; for (int8_t j = 0 ; j <= 5 ; j++) { ser += cof[j] / ++y; } return -tmp + log(2.5066282746310005 * ser / x); } // ================================================================= // Non inline accessors // ================================================================= } // namespace aevol aevol-5.0/src/libaevol/AbstractFuzzy.h0000644000175000017500000000556412724051151014765 00000000000000// // Created by arrouan on 30/07/15. // #ifndef AEVOL_ABSTRACTFUZZY_H #define AEVOL_ABSTRACTFUZZY_H #include #include "macros.h" #include "Point.h" namespace aevol { class AbstractFuzzy { public: // ========================================================================== // Constructors // ========================================================================== // AbstractFuzzy() {}; // AbstractFuzzy(const AbstractFuzzy& f) {}; // AbstractFuzzy(const gzFile backup) {}; // ========================================================================== // Destructor // ========================================================================== virtual ~AbstractFuzzy() {}; // ========================================================================== // Public Methods // ========================================================================== virtual void save(gzFile backup) const = 0; virtual void load(gzFile backup) = 0; virtual void reset() = 0; virtual void simplify() = 0; virtual void add_triangle(double mean, double width, double height) = 0; virtual void add(const AbstractFuzzy& f) = 0; virtual void sub(const AbstractFuzzy& f) = 0; virtual void add_point(double x, double y) = 0; /// `clipping_direction` is only used for `clip` function's keyword. enum clipping_direction: bool {min, max}; virtual void clip(clipping_direction direction, double bound) = 0; // ========================================================================== // Getters // ========================================================================== virtual double get_geometric_area() const = 0; virtual double get_geometric_area(double start_segment, double end_segment) const = 0; virtual bool is_identical_to(const AbstractFuzzy& fs, double tolerance) const = 0; virtual void print() const = 0; virtual void clear() = 0; // ========================================================================== // Setters // ========================================================================== // ========================================================================== // Operators // ========================================================================== protected: // ========================================================================== // Protected Methods // ========================================================================== // ========================================================================== // Attributes // ========================================================================== }; } // namespace aevol #endif //AEVOL_ABSTRACTFUZZY_H aevol-5.0/src/libaevol/Fuzzy.cpp0000644000175000017500000003436712724051151013637 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** /// TODO: add unit tests /// Why should there always be points (X_MIN, 0),(X_MAX, 0) ? /// Many tests for double-type equality ==. Should't we check mod ε? #include "Fuzzy.h" #include #include #include #include #include #include #include "Point.h" #include "macros.h" using std::list; using std::prev; using std::next; using std::find_if; using std::fabs; using std::cout; using std::endl; namespace aevol { /// Get probability of x belonging to fuzzy set. /// /// If there is an actual point in `points_` list with abscissa `x` /// return it ordinate. Otherwise interpolate surrounding points. /// /// TODO: use it! (vld, 2014-12-19) /// double Fuzzy::y(double x, list::const_iterator begin) const { assert(x >= X_MIN and x <= X_MAX); assert(points_.size() >= 2); // Get the first point having abscissa ≥ x list::const_iterator p2 = find_if(begin, points_.end(), [x](const Point& m){return m.x >= x;}); assert(p2 != points_.end()); if (p2->x == x) // If p2 has abscissa x, he's the guy return p2->y; else { // Otherwise interpolate list::const_iterator p1 = prev(p2); return p1->y + (x - p1->x) * ((p2->y - p1->y) / (p2->x - p1->x)); } } double Fuzzy::y(double x) const { return y(x, points_.begin()); } /// Get abscissa of point interpolated between `p1` and `p2`, at /// ordinate `y`. /// /// \pre{`p1` and `p2` should not be on the same horizontal line} /// otherwise any x would fit. /// /// \pre{`y` should be between `p1` and `p2` ordinates} Despite the /// fact that the reverse is mathematically sound, it's not supposed /// to happend here. double Fuzzy::x(const Point& p1, const Point& p2, double y) const { assert((p2.y <= y and y <= p1.y) or (p1.y <= y and y <= p2.y)); assert(p1.y != p2.y); double x = p1.x + (y - p1.y) * (p2.x - p1.x) / (p2.y - p1.y); assert((p2.x <= x and x <= p1.x) or (p1.x <= x and x <= p2.x)); return x; } /// Remove (some) superfluous points_. /// /// When several (≥3) consecutive points_ in the fuzzy set are on the /// same segment, the inner ones don't add information as they could /// be interpolated from the outer ones. This function trims down the /// `points_` list from such points_, only when they are on the same /// ordinate or on the same abscissa. /// /// For instance, on the following probability function, A and B would /// be removed: /// \verbatim /// ^ B /// | +--+-----+ /// | | \ --- /// | A+ \ / /// | | \ / /// |---+------------+-------+-----> /// \endverbatim /// /// TODO: double check if using this function is beneficial. Removed /// points_ could then be recreated. /// /// TODO: test with points_ /// {(X_MIN,0), ((X_MIN+X_MAX)/2,0), (X_MAX,0)} → {(X_MIN,0), (X_MAX,0)} /// d:= (X_MIN+X_MAX)/n {(X_MIN,0), ..., (k * (X_MIN + X_MAX) / n,0), ..., (X_MAX,0)} → {(X_MIN,0), (X_MAX,0)} /// idem on non-null ordinate /// idem on //y-axis /// test with points_ starting/ending with constant void Fuzzy::simplify() { // assert(invariant()); for (list::iterator p = points_.begin(); p != points_.end() and p != prev(points_.end()) and p != prev(points_.end(), 2); ++p) if (p->x == next(p)->x and p->x == next(p,2)->x) points_.erase(next(p), prev(find_if(p, points_.end(), [p](const Point& q){return q.x != p->x;}))); else if (p->y == next(p)->y and p->y == next(p,2)->y) points_.erase(next(p), prev(find_if(p, points_.end(), [p](const Point& q){return q.y != p->y;}))); // postcondition: // there are no 3 points_ that all share the same abscissas or that all share the same ordinates // all the points_ come from previous `points_` list // assert(invariant()); } /// Add a triangle to the fuzzy set. /// \param mean abscissa of its apex /// \param width of the side opposite to the apex /// \param height ordinate of the apex void Fuzzy::add_triangle(double mean, double width, double height) { // assert(invariant()); assert(width > 0.0); assert(X_MIN <= mean and mean <= X_MAX); assert(W_MIN <= width); // the maximum width depends on each individual // assert(MIN_H <= height and height <= MAX_H); Not necessarily because the concentration can be > 1 const double threshold = 1e-15; // TODO: should it not be the machine epsilon? // if not, it should at least be a class constant if (fabs(width) < threshold or fabs(height) < threshold) return; list::iterator p0, p1, p2; p0 = p1 = points_.begin(); p2 = prev(points_.end()); double x0 = mean - width; double x1 = mean; double x2 = mean + width; // TODO: bugfix? if points on borders X_MIN,MAX, should not the ordinate be appropriately set? // TODO: create_interpolated_point should return an ITERATOR to point list if (x0 >= X_MIN) p0 = create_interpolated_point(x0); p1 = create_interpolated_point(mean, p0); if (x2 <= X_MAX) p2 = create_interpolated_point(x2, p1); // Update points with abscissas in (x0;x1) for (list::iterator p = p0 ; p != p1 ; ++p) p->y += (p->x - x0) / (x1 - x0) * height; // Update points with abscissas in (x0;x1) for (list::iterator p = p1 ; p != p2 ; ++p) p->y += height * (x2 - p->x) / (x2 - x1); // assert(invariant()); return; } /// Add a fuzzy set to the current one. /// /// Should actually be called `operator+=()`. /// /// Semantically speaking, we deal with fuzzy sets over the same /// range. So adding two fuzzy sets sums up to adding the probability /// functions. void Fuzzy::add(const AbstractFuzzy& f) { const Fuzzy fs = (Fuzzy&)(f); // assert(invariant()); // Add interpolated points_ to current fuzzy set so that // `fs.points_` ⊂ `points_` for (const Point& q: fs.points_) create_interpolated_point(q.x); // each point in `points_` gets `fs`'s counterpart ordinate added to // it. for (Point& p: points_) p.y += fs.y(p.x); // assert(invariant()); } /// Substract to the current fuzzy set. /// /// TODO: Dumb version (?), to be completed. void Fuzzy::sub(const AbstractFuzzy& f) { const Fuzzy fs = (Fuzzy&)(f); // assert(invariant()); for (const Point& q: fs.points_) create_interpolated_point(q.x); for (Point& p: points_) p.y -= fs.y(p.x); // assert(invariant()); } /// Absolute area between x-axis and segment [p1,p2]. /// /// The area of a crossed trapezoid can be computed just the same as a /// normal one if the bases are counted algebrically (±). double trapezoid_area(const Point& p1, const Point& p2) { return fabs((p1.y + p2.y) / 2.0 * (p2.x - p1.x)); } double Fuzzy::get_geometric_area() const { return get_geometric_area(points_.begin(), points_.end()); } /// Get integral of the absolute of probability function. /// double Fuzzy::get_geometric_area(list::const_iterator begin, list::const_iterator end) const { // Precondition would be along the lines of: // assert(points_.begin() <= begin < end < points_.end()); double area = 0; for (list::const_iterator p = begin ; next(p) != end ; ++p) area += trapezoid_area(*p, *next(p)); return area; } double Fuzzy::get_geometric_area(double x_start, double x_stop) const { // assert(invariant()); // Precondition: X_MIN ≤ x_start < x_stop ≤ X_MAX assert(X_MIN <= x_start and x_start < x_stop and x_stop <= X_MAX); // first point with abscissa ≥ x_start list::const_iterator begin = find_if(points_.begin(), points_.end(), [x_start](const Point& p){return p.x >= x_start;}); // point following the last one with abscissa ≤ x_stop list::const_iterator end = find_if(begin, points_.end(), [x_stop](const Point& p){return p.x > x_stop;}); // area before begin double first_part = trapezoid_area(Point(x_start, y(x_start)), *begin); // area after prev(end) double last_part = trapezoid_area(*prev(end), Point(x_stop, y(x_stop))); return first_part + get_geometric_area(begin, end) + last_part; } // double Fuzzy::geometric_area(double start_segment, double end_segment) const { // // Precondition: X_MIN ≤ start_segment < end_segment ≤ X_MAX // assert(X_MIN <= start_segment and start_segment < end_segment and end_segment <= X_MAX); // Fuzzy copy(*this); // return copy.geometric_area(copy.create_interpolated_point(start_segment), next(copy.create_interpolated_point(end_segment))); // } double area_test() { Fuzzy f; f.add_triangle(0.5, 1.0, 0.5); double a = f.get_geometric_area(0.0, 1.0); return a; } /// Probability function gets clipped either upwise ou downwise. /// /// `pf` := min(`pf`, `upper_bound`) /// /// X above: removed | /// / \ | /// / \ X bound | /// --------o-----o-------------o-o-------- | /// / \ X / \ | /// X \ / \ / \ | /// X \ / X | /// \ / | /// underneath: kept X | /// `pf` := max(`pf`, `lower_bound`) void Fuzzy::clip(clipping_direction direction, double bound) { // assert(invariant()); for (list::iterator p = points_.begin() ; p != points_.end() ; ++p) { if (next(p) != points_.end() and ((p->y < bound and bound < next(p)->y) or (p->y > bound and bound > next(p)->y))) { // ie if p and next(p) are across bound // insert interpolated point // *after* p points_.insert(next(p), Point(x(*p, *next(p), bound), bound)); // could now fast forward over created point... TODO? } if ((direction == clipping_direction::min and p->y < bound) or (direction == clipping_direction::max and p->y > bound)) p->y = bound; } // assert(invariant()); } bool Fuzzy::is_identical_to(const AbstractFuzzy& f, double tolerance ) const { const Fuzzy fs = (Fuzzy&)(f); // Since list::size() has constant complexity since C++ 11, checking // size is an inexpensive first step. if (points_.size() != fs.points_.size()) return false; for (list::const_iterator p = points_.begin(), q = fs.points_.begin() ; p != points_.end() ; // no need to check q because both lists have same size ++p, ++q) if (fabs(p->x - q->x) > tolerance * (fabs(p->x) + fabs(q->x)) or fabs(p->y - q->y) > tolerance * (fabs(p->y) + fabs(q->y))) return false; return true; } void Fuzzy::save(gzFile backup_file) const { int16_t nb_points = points_.size(); gzwrite(backup_file, &nb_points, sizeof(nb_points)); cout << __FILE__ << ":" << __LINE__ << ":" << gztell(backup_file) << endl; cout << __FILE__ << ":" << __LINE__ << ":" << nb_points << endl; for (const Point& p : points_) writepoint(p, backup_file); } void Fuzzy::load(gzFile backup_file) { // assert(invariant()); int16_t nb_points; gzread(backup_file, &nb_points, sizeof(nb_points)); cout << __FILE__ << ":" << __LINE__ << ":" << gztell(backup_file) << endl; cout << __FILE__ << ":" << __LINE__ << ":" << nb_points << endl; for (int16_t i = 0 ; i < nb_points ; i++) points_.push_back(Point(readpoint(backup_file))); // assert(invariant()); } list::iterator Fuzzy::create_interpolated_point(double x) { return create_interpolated_point(x, points_.begin()); } /// Find first point before abscissa `x`, starting from `start`. /// /// `start_point` must refer to a point before abscissa `x` /// /// idempotent: creating existing point returns existing point list::iterator Fuzzy::create_interpolated_point(double x, std::list::iterator start) { // assert(invariant()); assert(x >= X_MIN and x <= X_MAX); // TODO: probably denotes a logic error if (start->x <= x) start = points_.begin(); // get first point with abscissa stricly greater than x list::iterator p = find_if(start, points_.end(), [x](Point& q){return q.x > x;}); if (prev(p)->x == x) { // point already in points_ // assert(invariant()); return prev(p); } // insert point before p // assert(invariant()); return points_.insert(p, Point(x, y(x))); } /// Check that list of `points_`' abscissas is (strictly) increasing. bool Fuzzy::is_increasing() const { for (list::const_iterator p = points_.begin() ; p != prev(points_.end(), 2) ; ++p) if (p->x > next(p)->x) return false; return true; } /// Set all points ordinate to 0 /// // TODO Not sure if it's useful. void Fuzzy::reset() { for (Point& p: points_) p.y = 0; // assert(invariant()); } void Fuzzy::clear() { points_.clear(); } void Fuzzy::add_point(double x, double y) { list::iterator p = find_if(points_.begin(), points_.end(), [x](Point& q){return q.x > x;}); if (prev(p)->x == x) { prev(p)->y += y; } else { points_.insert(p,Point(x,y)); } } void Fuzzy::print() const { for (const Point& p : points_) printf("[%f : %f] ",p.x,p.y); printf("\n"); } } // namespace aevol aevol-5.0/src/libaevol/SmallDeletion.cpp0000644000175000017500000000631312724051151015232 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ============================================================================ // Includes // ============================================================================ #include "SmallDeletion.h" namespace aevol { // ============================================================================ // Definition of static attributes // ============================================================================ // ============================================================================ // Constructors // ============================================================================ SmallDeletion::SmallDeletion(int32_t pos, int16_t length) : pos_(pos), length_(length) { } // ============================================================================ // Destructor // ============================================================================ // ============================================================================ // Methods // ============================================================================ void SmallDeletion::save(gzFile backup_file) const { int8_t tmp_mut_type = S_DEL; gzwrite(backup_file, &tmp_mut_type, sizeof(tmp_mut_type)); gzwrite(backup_file, &pos_, sizeof(pos_)); gzwrite(backup_file, &length_, sizeof(length_)); } void SmallDeletion::load(gzFile backup_file) { gzread(backup_file, &pos_, sizeof(pos_)); gzread(backup_file, &length_, sizeof(length_)); } void SmallDeletion::generic_description_string(char* str) const { sprintf(str, "%" PRId8 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId8 " %" PRId16 " %" PRId16 " %" PRId32 " %" PRId32, mut_type(), pos_, -1, -1, -1, -1, -1, -1, length_, -1); } // ============================================================================ // Non inline accessors // ============================================================================ } // namespace aevol aevol-5.0/src/libaevol/SFMT-src-1.4/0000755000175000017500000000000012735464421013717 500000000000000aevol-5.0/src/libaevol/SFMT-src-1.4/SFMT-common.h0000644000175000017500000001170412421166362016045 00000000000000#pragma once /** * @file SFMT-common.h * * @brief SIMD oriented Fast Mersenne Twister(SFMT) pseudorandom * number generator with jump function. This file includes common functions * used in random number generation and jump. * * @author Mutsuo Saito (Hiroshima University) * @author Makoto Matsumoto (The University of Tokyo) * * Copyright (C) 2006, 2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima * University. * Copyright (C) 2012 Mutsuo Saito, Makoto Matsumoto, Hiroshima * University and The University of Tokyo. * All rights reserved. * * The 3-clause BSD License is applied to this software, see * LICENSE.txt */ #ifndef SFMT_COMMON_H #define SFMT_COMMON_H #if defined(__cplusplus) extern "C" { #endif #include "SFMT.h" inline static void do_recursion(w128_t * r, w128_t * a, w128_t * b, w128_t * c, w128_t * d); inline static void rshift128(w128_t *out, w128_t const *in, int shift); inline static void lshift128(w128_t *out, w128_t const *in, int shift); /** * This function simulates SIMD 128-bit right shift by the standard C. * The 128-bit integer given in in is shifted by (shift * 8) bits. * This function simulates the LITTLE ENDIAN SIMD. * @param out the output of this function * @param in the 128-bit data to be shifted * @param shift the shift value */ #ifdef ONLY64 inline static void rshift128(w128_t *out, w128_t const *in, int shift) { uint64_t th, tl, oh, ol; th = ((uint64_t)in->u[2] << 32) | ((uint64_t)in->u[3]); tl = ((uint64_t)in->u[0] << 32) | ((uint64_t)in->u[1]); oh = th >> (shift * 8); ol = tl >> (shift * 8); ol |= th << (64 - shift * 8); out->u[0] = (uint32_t)(ol >> 32); out->u[1] = (uint32_t)ol; out->u[2] = (uint32_t)(oh >> 32); out->u[3] = (uint32_t)oh; } #else inline static void rshift128(w128_t *out, w128_t const *in, int shift) { uint64_t th, tl, oh, ol; th = ((uint64_t)in->u[3] << 32) | ((uint64_t)in->u[2]); tl = ((uint64_t)in->u[1] << 32) | ((uint64_t)in->u[0]); oh = th >> (shift * 8); ol = tl >> (shift * 8); ol |= th << (64 - shift * 8); out->u[1] = (uint32_t)(ol >> 32); out->u[0] = (uint32_t)ol; out->u[3] = (uint32_t)(oh >> 32); out->u[2] = (uint32_t)oh; } #endif /** * This function simulates SIMD 128-bit left shift by the standard C. * The 128-bit integer given in in is shifted by (shift * 8) bits. * This function simulates the LITTLE ENDIAN SIMD. * @param out the output of this function * @param in the 128-bit data to be shifted * @param shift the shift value */ #ifdef ONLY64 inline static void lshift128(w128_t *out, w128_t const *in, int shift) { uint64_t th, tl, oh, ol; th = ((uint64_t)in->u[2] << 32) | ((uint64_t)in->u[3]); tl = ((uint64_t)in->u[0] << 32) | ((uint64_t)in->u[1]); oh = th << (shift * 8); ol = tl << (shift * 8); oh |= tl >> (64 - shift * 8); out->u[0] = (uint32_t)(ol >> 32); out->u[1] = (uint32_t)ol; out->u[2] = (uint32_t)(oh >> 32); out->u[3] = (uint32_t)oh; } #else inline static void lshift128(w128_t *out, w128_t const *in, int shift) { uint64_t th, tl, oh, ol; th = ((uint64_t)in->u[3] << 32) | ((uint64_t)in->u[2]); tl = ((uint64_t)in->u[1] << 32) | ((uint64_t)in->u[0]); oh = th << (shift * 8); ol = tl << (shift * 8); oh |= tl >> (64 - shift * 8); out->u[1] = (uint32_t)(ol >> 32); out->u[0] = (uint32_t)ol; out->u[3] = (uint32_t)(oh >> 32); out->u[2] = (uint32_t)oh; } #endif /** * This function represents the recursion formula. * @param r output * @param a a 128-bit part of the internal state array * @param b a 128-bit part of the internal state array * @param c a 128-bit part of the internal state array * @param d a 128-bit part of the internal state array */ #ifdef ONLY64 inline static void do_recursion(w128_t *r, w128_t *a, w128_t *b, w128_t *c, w128_t *d) { w128_t x; w128_t y; lshift128(&x, a, SFMT_SL2); rshift128(&y, c, SFMT_SR2); r->u[0] = a->u[0] ^ x.u[0] ^ ((b->u[0] >> SFMT_SR1) & SFMT_MSK2) ^ y.u[0] ^ (d->u[0] << SFMT_SL1); r->u[1] = a->u[1] ^ x.u[1] ^ ((b->u[1] >> SFMT_SR1) & SFMT_MSK1) ^ y.u[1] ^ (d->u[1] << SFMT_SL1); r->u[2] = a->u[2] ^ x.u[2] ^ ((b->u[2] >> SFMT_SR1) & SFMT_MSK4) ^ y.u[2] ^ (d->u[2] << SFMT_SL1); r->u[3] = a->u[3] ^ x.u[3] ^ ((b->u[3] >> SFMT_SR1) & SFMT_MSK3) ^ y.u[3] ^ (d->u[3] << SFMT_SL1); } #else inline static void do_recursion(w128_t *r, w128_t *a, w128_t *b, w128_t *c, w128_t *d) { w128_t x; w128_t y; lshift128(&x, a, SFMT_SL2); rshift128(&y, c, SFMT_SR2); r->u[0] = a->u[0] ^ x.u[0] ^ ((b->u[0] >> SFMT_SR1) & SFMT_MSK1) ^ y.u[0] ^ (d->u[0] << SFMT_SL1); r->u[1] = a->u[1] ^ x.u[1] ^ ((b->u[1] >> SFMT_SR1) & SFMT_MSK2) ^ y.u[1] ^ (d->u[1] << SFMT_SL1); r->u[2] = a->u[2] ^ x.u[2] ^ ((b->u[2] >> SFMT_SR1) & SFMT_MSK3) ^ y.u[2] ^ (d->u[2] << SFMT_SL1); r->u[3] = a->u[3] ^ x.u[3] ^ ((b->u[3] >> SFMT_SR1) & SFMT_MSK4) ^ y.u[3] ^ (d->u[3] << SFMT_SL1); } #endif #endif #if defined(__cplusplus) } #endif aevol-5.0/src/libaevol/SFMT-src-1.4/SFMT.h0000644000175000017500000001701712421166362014562 00000000000000#pragma once /** * @file SFMT.h * * @brief SIMD oriented Fast Mersenne Twister(SFMT) pseudorandom * number generator using C structure. * * @author Mutsuo Saito (Hiroshima University) * @author Makoto Matsumoto (The University of Tokyo) * * Copyright (C) 2006, 2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima * University. * Copyright (C) 2012 Mutsuo Saito, Makoto Matsumoto, Hiroshima * University and The University of Tokyo. * All rights reserved. * * The 3-clause BSD License is applied to this software, see * LICENSE.txt * * @note We assume that your system has inttypes.h. If your system * doesn't have inttypes.h, you have to typedef uint32_t and uint64_t, * and you have to define PRIu64 and PRIx64 in this file as follows: * @verbatim typedef unsigned int uint32_t typedef unsigned long long uint64_t #define PRIu64 "llu" #define PRIx64 "llx" @endverbatim * uint32_t must be exactly 32-bit unsigned integer type (no more, no * less), and uint64_t must be exactly 64-bit unsigned integer type. * PRIu64 and PRIx64 are used for printf function to print 64-bit * unsigned int and 64-bit unsigned int in hexadecimal format. */ #ifndef SFMTST_H #define SFMTST_H #if defined(__cplusplus) extern "C" { #endif #include #include #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) #include #elif defined(_MSC_VER) || defined(__BORLANDC__) typedef unsigned int uint32_t; typedef unsigned __int64 uint64_t; #define inline __inline #else #include #if defined(__GNUC__) #define inline __inline__ #endif #endif #ifndef PRIu64 #if defined(_MSC_VER) || defined(__BORLANDC__) #define PRIu64 "I64u" #define PRIx64 "I64x" #else #define PRIu64 "llu" #define PRIx64 "llx" #endif #endif #include "SFMT-params.h" /*------------------------------------------ 128-bit SIMD like data type for standard C ------------------------------------------*/ #if defined(HAVE_ALTIVEC) #if !defined(__APPLE__) #include #endif /** 128-bit data structure */ union W128_T { vector unsigned int s; uint32_t u[4]; uint64_t u64[2]; }; #elif defined(HAVE_SSE2) #include /** 128-bit data structure */ union W128_T { uint32_t u[4]; uint64_t u64[2]; __m128i si; }; #else /** 128-bit data structure */ union W128_T { uint32_t u[4]; uint64_t u64[2]; }; #endif /** 128-bit data type */ typedef union W128_T w128_t; /** * SFMT internal state */ struct SFMT_T { /** the 128-bit internal state array */ w128_t state[SFMT_N]; /** index counter to the 32-bit internal state array */ int idx; }; typedef struct SFMT_T sfmt_t; void sfmt_fill_array32(sfmt_t * sfmt, uint32_t * array, int size); void sfmt_fill_array64(sfmt_t * sfmt, uint64_t * array, int size); void sfmt_init_gen_rand(sfmt_t * sfmt, uint32_t seed); void sfmt_init_by_array(sfmt_t * sfmt, uint32_t * init_key, int key_length); const char * sfmt_get_idstring(sfmt_t * sfmt); int sfmt_get_min_array_size32(sfmt_t * sfmt); int sfmt_get_min_array_size64(sfmt_t * sfmt); void sfmt_gen_rand_all(sfmt_t * sfmt); #ifndef ONLY64 /** * This function generates and returns 32-bit pseudorandom number. * init_gen_rand or init_by_array must be called before this function. * @param sfmt SFMT internal state * @return 32-bit pseudorandom number */ inline static uint32_t sfmt_genrand_uint32(sfmt_t * sfmt) { uint32_t r; uint32_t * psfmt32 = &sfmt->state[0].u[0]; if (sfmt->idx >= SFMT_N32) { sfmt_gen_rand_all(sfmt); sfmt->idx = 0; } r = psfmt32[sfmt->idx++]; return r; } #endif /** * This function generates and returns 64-bit pseudorandom number. * init_gen_rand or init_by_array must be called before this function. * The function gen_rand64 should not be called after gen_rand32, * unless an initialization is again executed. * @param sfmt SFMT internal state * @return 64-bit pseudorandom number */ inline static uint64_t sfmt_genrand_uint64(sfmt_t * sfmt) { #if defined(BIG_ENDIAN64) && !defined(ONLY64) uint32_t * psfmt32 = &sfmt->state[0].u[0]; uint32_t r1, r2; #else uint64_t r; #endif uint64_t * psfmt64 = &sfmt->state[0].u64[0]; assert(sfmt->idx % 2 == 0); if (sfmt->idx >= SFMT_N32) { sfmt_gen_rand_all(sfmt); sfmt->idx = 0; } #if defined(BIG_ENDIAN64) && !defined(ONLY64) r1 = psfmt32[sfmt->idx]; r2 = psfmt32[sfmt->idx + 1]; sfmt->idx += 2; return ((uint64_t)r2 << 32) | r1; #else r = psfmt64[sfmt->idx / 2]; sfmt->idx += 2; return r; #endif } /* ================================================= The following real versions are due to Isaku Wada ================================================= */ /** * converts an unsigned 32-bit number to a double on [0,1]-real-interval. * @param v 32-bit unsigned integer * @return double on [0,1]-real-interval */ inline static double sfmt_to_real1(uint32_t v) { return v * (1.0/4294967295.0); /* divided by 2^32-1 */ } /** * generates a random number on [0,1]-real-interval * @param sfmt SFMT internal state * @return double on [0,1]-real-interval */ inline static double sfmt_genrand_real1(sfmt_t * sfmt) { return sfmt_to_real1(sfmt_genrand_uint32(sfmt)); } /** * converts an unsigned 32-bit integer to a double on [0,1)-real-interval. * @param v 32-bit unsigned integer * @return double on [0,1)-real-interval */ inline static double sfmt_to_real2(uint32_t v) { return v * (1.0/4294967296.0); /* divided by 2^32 */ } /** * generates a random number on [0,1)-real-interval * @param sfmt SFMT internal state * @return double on [0,1)-real-interval */ inline static double sfmt_genrand_real2(sfmt_t * sfmt) { return sfmt_to_real2(sfmt_genrand_uint32(sfmt)); } /** * converts an unsigned 32-bit integer to a double on (0,1)-real-interval. * @param v 32-bit unsigned integer * @return double on (0,1)-real-interval */ inline static double sfmt_to_real3(uint32_t v) { return (((double)v) + 0.5)*(1.0/4294967296.0); /* divided by 2^32 */ } /** * generates a random number on (0,1)-real-interval * @param sfmt SFMT internal state * @return double on (0,1)-real-interval */ inline static double sfmt_genrand_real3(sfmt_t * sfmt) { return sfmt_to_real3(sfmt_genrand_uint32(sfmt)); } /** * converts an unsigned 32-bit integer to double on [0,1) * with 53-bit resolution. * @param v 32-bit unsigned integer * @return double on [0,1)-real-interval with 53-bit resolution. */ inline static double sfmt_to_res53(uint64_t v) { return v * (1.0/18446744073709551616.0L); } /** * generates a random number on [0,1) with 53-bit resolution * @param sfmt SFMT internal state * @return double on [0,1) with 53-bit resolution */ inline static double sfmt_genrand_res53(sfmt_t * sfmt) { return sfmt_to_res53(sfmt_genrand_uint64(sfmt)); } /* ================================================= The following function are added by Saito. ================================================= */ /** * generates a random number on [0,1) with 53-bit resolution from two * 32 bit integers */ inline static double sfmt_to_res53_mix(uint32_t x, uint32_t y) { return sfmt_to_res53(x | ((uint64_t)y << 32)); } /** * generates a random number on [0,1) with 53-bit resolution * using two 32bit integers. * @param sfmt SFMT internal state * @return double on [0,1) with 53-bit resolution */ inline static double sfmt_genrand_res53_mix(sfmt_t * sfmt) { uint32_t x, y; x = sfmt_genrand_uint32(sfmt); y = sfmt_genrand_uint32(sfmt); return sfmt_to_res53_mix(x, y); } #if defined(__cplusplus) } #endif #endif aevol-5.0/src/libaevol/SFMT-src-1.4/SFMT-params.h0000644000175000017500000000502512421166362016037 00000000000000#pragma once #ifndef SFMT_PARAMS_H #define SFMT_PARAMS_H #if !defined(SFMT_MEXP) #if defined(__GNUC__) && !defined(__ICC) #warning "SFMT_MEXP is not defined. I assume MEXP is 19937." #endif #define SFMT_MEXP 19937 #endif /*----------------- BASIC DEFINITIONS -----------------*/ /** Mersenne Exponent. The period of the sequence * is a multiple of 2^MEXP-1. * #define SFMT_MEXP 19937 */ /** SFMT generator has an internal state array of 128-bit integers, * and N is its size. */ #define SFMT_N (SFMT_MEXP / 128 + 1) /** N32 is the size of internal state array when regarded as an array * of 32-bit integers.*/ #define SFMT_N32 (SFMT_N * 4) /** N64 is the size of internal state array when regarded as an array * of 64-bit integers.*/ #define SFMT_N64 (SFMT_N * 2) /*---------------------- the parameters of SFMT following definitions are in paramsXXXX.h file. ----------------------*/ /** the pick up position of the array. #define SFMT_POS1 122 */ /** the parameter of shift left as four 32-bit registers. #define SFMT_SL1 18 */ /** the parameter of shift left as one 128-bit register. * The 128-bit integer is shifted by (SFMT_SL2 * 8) bits. #define SFMT_SL2 1 */ /** the parameter of shift right as four 32-bit registers. #define SFMT_SR1 11 */ /** the parameter of shift right as one 128-bit register. * The 128-bit integer is shifted by (SFMT_SL2 * 8) bits. #define SFMT_SR21 1 */ /** A bitmask, used in the recursion. These parameters are introduced * to break symmetry of SIMD. #define SFMT_MSK1 0xdfffffefU #define SFMT_MSK2 0xddfecb7fU #define SFMT_MSK3 0xbffaffffU #define SFMT_MSK4 0xbffffff6U */ /** These definitions are part of a 128-bit period certification vector. #define SFMT_PARITY1 0x00000001U #define SFMT_PARITY2 0x00000000U #define SFMT_PARITY3 0x00000000U #define SFMT_PARITY4 0xc98e126aU */ #if SFMT_MEXP == 607 #include "SFMT-params607.h" #elif SFMT_MEXP == 1279 #include "SFMT-params1279.h" #elif SFMT_MEXP == 2281 #include "SFMT-params2281.h" #elif SFMT_MEXP == 4253 #include "SFMT-params4253.h" #elif SFMT_MEXP == 11213 #include "SFMT-params11213.h" #elif SFMT_MEXP == 19937 #include "SFMT-params19937.h" #elif SFMT_MEXP == 44497 #include "SFMT-params44497.h" #elif SFMT_MEXP == 86243 #include "SFMT-params86243.h" #elif SFMT_MEXP == 132049 #include "SFMT-params132049.h" #elif SFMT_MEXP == 216091 #include "SFMT-params216091.h" #else #if defined(__GNUC__) && !defined(__ICC) #error "SFMT_MEXP is not valid." #undef SFMT_MEXP #else #undef SFMT_MEXP #endif #endif #endif /* SFMT_PARAMS_H */ aevol-5.0/src/libaevol/SFMT-src-1.4/SFMT-params86243.h0000644000175000017500000000371412421166362016451 00000000000000#pragma once #ifndef SFMT_PARAMS86243_H #define SFMT_PARAMS86243_H #define SFMT_POS1 366 #define SFMT_SL1 6 #define SFMT_SL2 7 #define SFMT_SR1 19 #define SFMT_SR2 1 #define SFMT_MSK1 0xfdbffbffU #define SFMT_MSK2 0xbff7ff3fU #define SFMT_MSK3 0xfd77efffU #define SFMT_MSK4 0xbf9ff3ffU #define SFMT_PARITY1 0x00000001U #define SFMT_PARITY2 0x00000000U #define SFMT_PARITY3 0x00000000U #define SFMT_PARITY4 0xe9528d85U /* PARAMETERS FOR ALTIVEC */ #if defined(__APPLE__) /* For OSX */ #define SFMT_ALTI_SL1 \ (vector unsigned int)(SFMT_SL1, SFMT_SL1, SFMT_SL1, SFMT_SL1) #define SFMT_ALTI_SR1 \ (vector unsigned int)(SFMT_SR1, SFMT_SR1, SFMT_SR1, SFMT_SR1) #define SFMT_ALTI_MSK \ (vector unsigned int)(SFMT_MSK1, SFMT_MSK2, SFMT_MSK3, SFMT_MSK4) #define SFMT_ALTI_MSK64 \ (vector unsigned int)(SFMT_MSK2, SFMT_MSK1, SFMT_MSK4, SFMT_MSK3) #define SFMT_ALTI_SL2_PERM \ (vector unsigned char)(25,25,25,25,3,25,25,25,7,0,1,2,11,4,5,6) #define SFMT_ALTI_SL2_PERM64 \ (vector unsigned char)(7,25,25,25,25,25,25,25,15,0,1,2,3,4,5,6) #define SFMT_ALTI_SR2_PERM \ (vector unsigned char)(7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14) #define SFMT_ALTI_SR2_PERM64 \ (vector unsigned char)(15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14) #else /* For OTHER OSs(Linux?) */ #define SFMT_ALTI_SL1 {SFMT_SL1, SFMT_SL1, SFMT_SL1, SFMT_SL1} #define SFMT_ALTI_SR1 {SFMT_SR1, SFMT_SR1, SFMT_SR1, SFMT_SR1} #define SFMT_ALTI_MSK {SFMT_MSK1, SFMT_MSK2, SFMT_MSK3, SFMT_MSK4} #define SFMT_ALTI_MSK64 {SFMT_MSK2, SFMT_MSK1, SFMT_MSK4, SFMT_MSK3} #define SFMT_ALTI_SL2_PERM {25,25,25,25,3,25,25,25,7,0,1,2,11,4,5,6} #define SFMT_ALTI_SL2_PERM64 {7,25,25,25,25,25,25,25,15,0,1,2,3,4,5,6} #define SFMT_ALTI_SR2_PERM {7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14} #define SFMT_ALTI_SR2_PERM64 {15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14} #endif /* For OSX */ #define SFMT_IDSTR "SFMT-86243:366-6-7-19-1:fdbffbff-bff7ff3f-fd77efff-bf9ff3ff" #endif /* SFMT_PARAMS86243_H */ aevol-5.0/src/libaevol/SFMT-src-1.4/Makefile.am0000644000175000017500000000240512515472636015677 00000000000000############################################ # Variables # ############################################ AUTOMAKE_OPTIONS = subdir-objects ######################## # Set library to build # ######################## noinst_LIBRARIES = libsfmt.a AM_CPPFLAGS = -I./ ############################################ # C99 exact-width integer specific support # ############################################ # __STDC_FORMAT_MACROS allows us to use exact-width integer format specifiers e.g. PRId32 (for printf etc) # __STDC_CONSTANT_MACROS allows us to define exact-width integer macros with e.g. INT32_C( ) # __STDC_LIMIT_MACROS allows us to use exact-width integer limit macros with e.g. INT32_MAX AM_CPPFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS SFMT_params = SFMT-params.h SFMT-params607.h SFMT-params1279.h SFMT-params2281.h SFMT-params4253.h SFMT-params11213.h SFMT-params19937.h SFMT-params44497.h SFMT-params86243.h SFMT-params132049.h SFMT-params216091.h libsfmt_adir = ./ libsfmt_a_CPPFLAGS = $(AM_CPPFLAGS) #libsfmt_a_HEADERS = SFMT.h SFMT-common.h $(SFMT_params) jump/SFMT-jump.h libsfmt_a_SOURCES = SFMT.c jump/SFMT-jump.cpp libsfmt_a_SOURCES += SFMT.h SFMT-common.h $(SFMT_params) jump/SFMT-jump.h aevol-5.0/src/libaevol/SFMT-src-1.4/SFMT-params2281.h0000644000175000017500000000370012421166362016352 00000000000000#pragma once #ifndef SFMT_PARAMS2281_H #define SFMT_PARAMS2281_H #define SFMT_POS1 12 #define SFMT_SL1 19 #define SFMT_SL2 1 #define SFMT_SR1 5 #define SFMT_SR2 1 #define SFMT_MSK1 0xbff7ffbfU #define SFMT_MSK2 0xfdfffffeU #define SFMT_MSK3 0xf7ffef7fU #define SFMT_MSK4 0xf2f7cbbfU #define SFMT_PARITY1 0x00000001U #define SFMT_PARITY2 0x00000000U #define SFMT_PARITY3 0x00000000U #define SFMT_PARITY4 0x41dfa600U /* PARAMETERS FOR ALTIVEC */ #if defined(__APPLE__) /* For OSX */ #define SFMT_ALTI_SL1 \ (vector unsigned int)(SFMT_SL1, SFMT_SL1, SFMT_SL1, SFMT_SL1) #define SFMT_ALTI_SR1 \ (vector unsigned int)(SFMT_SR1, SFMT_SR1, SFMT_SR1, SFMT_SR1) #define SFMT_ALTI_MSK \ (vector unsigned int)(SFMT_MSK1, SFMT_MSK2, SFMT_MSK3, SFMT_MSK4) #define SFMT_ALTI_MSK64 \ (vector unsigned int)(SFMT_MSK2, SFMT_MSK1, SFMT_MSK4, SFMT_MSK3) #define SFMT_ALTI_SL2_PERM \ (vector unsigned char)(1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8) #define SFMT_ALTI_SL2_PERM64 \ (vector unsigned char)(1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0) #define SFMT_ALTI_SR2_PERM \ (vector unsigned char)(7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14) #define SFMT_ALTI_SR2_PERM64 \ (vector unsigned char)(15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14) #else /* For OTHER OSs(Linux?) */ #define SFMT_ALTI_SL1 {SFMT_SL1, SFMT_SL1, SFMT_SL1, SFMT_SL1} #define SFMT_ALTI_SR1 {SFMT_SR1, SFMT_SR1, SFMT_SR1, SFMT_SR1} #define SFMT_ALTI_MSK {SFMT_MSK1, SFMT_MSK2, SFMT_MSK3, SFMT_MSK4} #define SFMT_ALTI_MSK64 {SFMT_MSK2, SFMT_MSK1, SFMT_MSK4, SFMT_MSK3} #define SFMT_ALTI_SL2_PERM {1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8} #define SFMT_ALTI_SL2_PERM64 {1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0} #define SFMT_ALTI_SR2_PERM {7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14} #define SFMT_ALTI_SR2_PERM64 {15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14} #endif /* For OSX */ #define SFMT_IDSTR "SFMT-2281:12-19-1-5-1:bff7ffbf-fdfffffe-f7ffef7f-f2f7cbbf" #endif /* SFMT_PARAMS2281_H */ aevol-5.0/src/libaevol/SFMT-src-1.4/SFMT-params607.h0000644000175000017500000000370612421166362016300 00000000000000#pragma once #ifndef SFMT_PARAMS607_H #define SFMT_PARAMS607_H #define SFMT_POS1 2 #define SFMT_SL1 15 #define SFMT_SL2 3 #define SFMT_SR1 13 #define SFMT_SR2 3 #define SFMT_MSK1 0xfdff37ffU #define SFMT_MSK2 0xef7f3f7dU #define SFMT_MSK3 0xff777b7dU #define SFMT_MSK4 0x7ff7fb2fU #define SFMT_PARITY1 0x00000001U #define SFMT_PARITY2 0x00000000U #define SFMT_PARITY3 0x00000000U #define SFMT_PARITY4 0x5986f054U /* PARAMETERS FOR ALTIVEC */ #if defined(__APPLE__) /* For OSX */ #define SFMT_ALTI_SL1 \ (vector unsigned int)(SFMT_SL1, SFMT_SL1, SFMT_SL1, SFMT_SL1) #define SFMT_ALTI_SR1 \ (vector unsigned int)(SFMT_SR1, SFMT_SR1, SFMT_SR1, SFMT_SR1) #define SFMT_ALTI_MSK \ (vector unsigned int)(SFMT_MSK1, SFMT_MSK2, SFMT_MSK3, SFMT_MSK4) #define SFMT_ALTI_MSK64 \ (vector unsigned int)(SFMT_MSK2, SFMT_MSK1, SFMT_MSK4, SFMT_MSK3) #define SFMT_ALTI_SL2_PERM \ (vector unsigned char)(3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10) #define SFMT_ALTI_SL2_PERM64 \ (vector unsigned char)(3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2) #define SFMT_ALTI_SR2_PERM \ (vector unsigned char)(5,6,7,0,9,10,11,4,13,14,15,8,19,19,19,12) #define SFMT_ALTI_SR2_PERM64 \ (vector unsigned char)(13,14,15,0,1,2,3,4,19,19,19,8,9,10,11,12) #else /* For OTHER OSs(Linux?) */ #define SFMT_ALTI_SL1 {SFMT_SL1, SFMT_SL1, SFMT_SL1, SFMT_SL1} #define SFMT_ALTI_SR1 {SFMT_SR1, SFMT_SR1, SFMT_SR1, SFMT_SR1} #define SFMT_ALTI_MSK {SFMT_MSK1, SFMT_MSK2, SFMT_MSK3, SFMT_MSK4} #define SFMT_ALTI_MSK64 {SFMT_MSK2, SFMT_MSK1, SFMT_MSK4, SFMT_MSK3} #define SFMT_ALTI_SL2_PERM {3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10} #define SFMT_ALTI_SL2_PERM64 {3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2} #define SFMT_ALTI_SR2_PERM {5,6,7,0,9,10,11,4,13,14,15,8,19,19,19,12} #define SFMT_ALTI_SR2_PERM64 {13,14,15,0,1,2,3,4,19,19,19,8,9,10,11,12} #endif /* For OSX */ #define SFMT_IDSTR "SFMT-607:2-15-3-13-3:fdff37ff-ef7f3f7d-ff777b7d-7ff7fb2f" #endif /* SFMT_PARAMS607_H */ aevol-5.0/src/libaevol/SFMT-src-1.4/SFMT-params11213.h0000644000175000017500000000371612421166362016434 00000000000000#pragma once #ifndef SFMT_PARAMS11213_H #define SFMT_PARAMS11213_H #define SFMT_POS1 68 #define SFMT_SL1 14 #define SFMT_SL2 3 #define SFMT_SR1 7 #define SFMT_SR2 3 #define SFMT_MSK1 0xeffff7fbU #define SFMT_MSK2 0xffffffefU #define SFMT_MSK3 0xdfdfbfffU #define SFMT_MSK4 0x7fffdbfdU #define SFMT_PARITY1 0x00000001U #define SFMT_PARITY2 0x00000000U #define SFMT_PARITY3 0xe8148000U #define SFMT_PARITY4 0xd0c7afa3U /* PARAMETERS FOR ALTIVEC */ #if defined(__APPLE__) /* For OSX */ #define SFMT_ALTI_SL1 \ (vector unsigned int)(SFMT_SL1, SFMT_SL1, SFMT_SL1, SFMT_SL1) #define SFMT_ALTI_SR1 \ (vector unsigned int)(SFMT_SR1, SFMT_SR1, SFMT_SR1, SFMT_SR1) #define SFMT_ALTI_MSK \ (vector unsigned int)(SFMT_MSK1, SFMT_MSK2, SFMT_MSK3, SFMT_MSK4) #define SFMT_ALTI_MSK64 \ (vector unsigned int)(SFMT_MSK2, SFMT_MSK1, SFMT_MSK4, SFMT_MSK3) #define SFMT_ALTI_SL2_PERM \ (vector unsigned char)(3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10) #define SFMT_ALTI_SL2_PERM64 \ (vector unsigned char)(3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2) #define SFMT_ALTI_SR2_PERM \ (vector unsigned char)(5,6,7,0,9,10,11,4,13,14,15,8,19,19,19,12) #define SFMT_ALTI_SR2_PERM64 \ (vector unsigned char)(13,14,15,0,1,2,3,4,19,19,19,8,9,10,11,12) #else /* For OTHER OSs(Linux?) */ #define SFMT_ALTI_SL1 {SFMT_SL1, SFMT_SL1, SFMT_SL1, SFMT_SL1} #define SFMT_ALTI_SR1 {SFMT_SR1, SFMT_SR1, SFMT_SR1, SFMT_SR1} #define SFMT_ALTI_MSK {SFMT_MSK1, SFMT_MSK2, SFMT_MSK3, SFMT_MSK4} #define SFMT_ALTI_MSK64 {SFMT_MSK2, SFMT_MSK1, SFMT_MSK4, SFMT_MSK3} #define SFMT_ALTI_SL2_PERM {3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10} #define SFMT_ALTI_SL2_PERM64 {3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2} #define SFMT_ALTI_SR2_PERM {5,6,7,0,9,10,11,4,13,14,15,8,19,19,19,12} #define SFMT_ALTI_SR2_PERM64 {13,14,15,0,1,2,3,4,19,19,19,8,9,10,11,12} #endif /* For OSX */ #define SFMT_IDSTR "SFMT-11213:68-14-3-7-3:effff7fb-ffffffef-dfdfbfff-7fffdbfd" #endif /* SFMT_PARAMS11213_H */ aevol-5.0/src/libaevol/SFMT-src-1.4/SFMT-params1279.h0000644000175000017500000000370012421166362016360 00000000000000#pragma once #ifndef SFMT_PARAMS1279_H #define SFMT_PARAMS1279_H #define SFMT_POS1 7 #define SFMT_SL1 14 #define SFMT_SL2 3 #define SFMT_SR1 5 #define SFMT_SR2 1 #define SFMT_MSK1 0xf7fefffdU #define SFMT_MSK2 0x7fefcfffU #define SFMT_MSK3 0xaff3ef3fU #define SFMT_MSK4 0xb5ffff7fU #define SFMT_PARITY1 0x00000001U #define SFMT_PARITY2 0x00000000U #define SFMT_PARITY3 0x00000000U #define SFMT_PARITY4 0x20000000U /* PARAMETERS FOR ALTIVEC */ #if defined(__APPLE__) /* For OSX */ #define SFMT_ALTI_SL1 \ (vector unsigned int)(SFMT_SL1, SFMT_SL1, SFMT_SL1, SFMT_SL1) #define SFMT_ALTI_SR1 \ (vector unsigned int)(SFMT_SR1, SFMT_SR1, SFMT_SR1, SFMT_SR1) #define SFMT_ALTI_MSK \ (vector unsigned int)(SFMT_MSK1, SFMT_MSK2, SFMT_MSK3, SFMT_MSK4) #define SFMT_ALTI_MSK64 \ (vector unsigned int)(SFMT_MSK2, SFMT_MSK1, SFMT_MSK4, SFMT_MSK3) #define SFMT_ALTI_SL2_PERM \ (vector unsigned char)(3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10) #define SFMT_ALTI_SL2_PERM64 \ (vector unsigned char)(3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2) #define SFMT_ALTI_SR2_PERM \ (vector unsigned char)(7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14) #define SFMT_ALTI_SR2_PERM64 \ (vector unsigned char)(15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14) #else /* For OTHER OSs(Linux?) */ #define SFMT_ALTI_SL1 {SFMT_SL1, SFMT_SL1, SFMT_SL1, SFMT_SL1} #define SFMT_ALTI_SR1 {SFMT_SR1, SFMT_SR1, SFMT_SR1, SFMT_SR1} #define SFMT_ALTI_MSK {SFMT_MSK1, SFMT_MSK2, SFMT_MSK3, SFMT_MSK4} #define SFMT_ALTI_MSK64 {SFMT_MSK2, SFMT_MSK1, SFMT_MSK4, SFMT_MSK3} #define SFMT_ALTI_SL2_PERM {3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10} #define SFMT_ALTI_SL2_PERM64 {3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2} #define SFMT_ALTI_SR2_PERM {7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14} #define SFMT_ALTI_SR2_PERM64 {15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14} #endif /* For OSX */ #define SFMT_IDSTR "SFMT-1279:7-14-3-5-1:f7fefffd-7fefcfff-aff3ef3f-b5ffff7f" #endif /* SFMT_PARAMS1279_H */ aevol-5.0/src/libaevol/SFMT-src-1.4/SFMT-params44497.h0000644000175000017500000000371612421166362016460 00000000000000#pragma once #ifndef SFMT_PARAMS44497_H #define SFMT_PARAMS44497_H #define SFMT_POS1 330 #define SFMT_SL1 5 #define SFMT_SL2 3 #define SFMT_SR1 9 #define SFMT_SR2 3 #define SFMT_MSK1 0xeffffffbU #define SFMT_MSK2 0xdfbebfffU #define SFMT_MSK3 0xbfbf7befU #define SFMT_MSK4 0x9ffd7bffU #define SFMT_PARITY1 0x00000001U #define SFMT_PARITY2 0x00000000U #define SFMT_PARITY3 0xa3ac4000U #define SFMT_PARITY4 0xecc1327aU /* PARAMETERS FOR ALTIVEC */ #if defined(__APPLE__) /* For OSX */ #define SFMT_ALTI_SL1 \ (vector unsigned int)(SFMT_SL1, SFMT_SL1, SFMT_SL1, SFMT_SL1) #define SFMT_ALTI_SR1 \ (vector unsigned int)(SFMT_SR1, SFMT_SR1, SFMT_SR1, SFMT_SR1) #define SFMT_ALTI_MSK \ (vector unsigned int)(SFMT_MSK1, SFMT_MSK2, SFMT_MSK3, SFMT_MSK4) #define SFMT_ALTI_MSK64 \ (vector unsigned int)(SFMT_MSK2, SFMT_MSK1, SFMT_MSK4, SFMT_MSK3) #define SFMT_ALTI_SL2_PERM \ (vector unsigned char)(3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10) #define SFMT_ALTI_SL2_PERM64 \ (vector unsigned char)(3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2) #define SFMT_ALTI_SR2_PERM \ (vector unsigned char)(5,6,7,0,9,10,11,4,13,14,15,8,19,19,19,12) #define SFMT_ALTI_SR2_PERM64 \ (vector unsigned char)(13,14,15,0,1,2,3,4,19,19,19,8,9,10,11,12) #else /* For OTHER OSs(Linux?) */ #define SFMT_ALTI_SL1 {SFMT_SL1, SFMT_SL1, SFMT_SL1, SFMT_SL1} #define SFMT_ALTI_SR1 {SFMT_SR1, SFMT_SR1, SFMT_SR1, SFMT_SR1} #define SFMT_ALTI_MSK {SFMT_MSK1, SFMT_MSK2, SFMT_MSK3, SFMT_MSK4} #define SFMT_ALTI_MSK64 {SFMT_MSK2, SFMT_MSK1, SFMT_MSK4, SFMT_MSK3} #define SFMT_ALTI_SL2_PERM {3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10} #define SFMT_ALTI_SL2_PERM64 {3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2} #define SFMT_ALTI_SR2_PERM {5,6,7,0,9,10,11,4,13,14,15,8,19,19,19,12} #define SFMT_ALTI_SR2_PERM64 {13,14,15,0,1,2,3,4,19,19,19,8,9,10,11,12} #endif /* For OSX */ #define SFMT_IDSTR "SFMT-44497:330-5-3-9-3:effffffb-dfbebfff-bfbf7bef-9ffd7bff" #endif /* SFMT_PARAMS44497_H */ aevol-5.0/src/libaevol/SFMT-src-1.4/jump/0000755000175000017500000000000012735464421014672 500000000000000aevol-5.0/src/libaevol/SFMT-src-1.4/jump/SFMT-jump.h0000644000175000017500000000110412421166362016474 00000000000000#ifndef SFMT_JUMP_H #define SFMT_JUMP_H /** * @file SFMT-jump.h * * @brief jump header file. * * @author Mutsuo Saito (Hiroshima University) * @author Makoto Matsumoto (The University of Tokyo) * * Copyright (C) 2012 Mutsuo Saito, Makoto Matsumoto, * Hiroshima University and The University of Tokyo. * All rights reserved. * * The 3-clause BSD License is applied to this software, see * LICENSE.txt */ #if defined(__cplusplus) extern "C" { #endif #include "../SFMT.h" void SFMT_jump(sfmt_t * sfmt, const char * jump_str); #if defined(__cplusplus) } #endif #endif aevol-5.0/src/libaevol/SFMT-src-1.4/jump/SFMT-jump.cpp0000644000175000017500000000567612421166362017051 00000000000000/** * @file SFMT-jump.c * * @brief do jump using jump polynomial. * * @author Mutsuo Saito (Hiroshima University) * @author Makoto Matsumoto (The University of Tokyo) * * Copyright (C) 2012 Mutsuo Saito, Makoto Matsumoto, * Hiroshima University and The University of Tokyo. * All rights reserved. * * The 3-clause BSD License is applied to this software, see * LICENSE.txt */ #include #include #include #include #include "SFMT-params.h" #include "SFMT.h" #include "SFMT-jump.h" #include "SFMT-common.h" #if defined(__cplusplus) extern "C" { #endif inline static void next_state(sfmt_t * sfmt); #if defined(HAVE_SSE2) /** * add internal state of src to dest as F2-vector. * @param dest destination state * @param src source state */ inline static void add(sfmt_t *dest, sfmt_t *src) { int dp = dest->idx / 4; int sp = src->idx / 4; int diff = (sp - dp + SFMT_N) % SFMT_N; int p; int i; for (i = 0; i < SFMT_N - diff; i++) { p = i + diff; dest->state[i].si = _mm_xor_si128(dest->state[i].si, src->state[p].si); } for (; i < SFMT_N; i++) { p = i + diff - SFMT_N; dest->state[i].si = _mm_xor_si128(dest->state[i].si, src->state[p].si); } } #else inline static void add(sfmt_t *dest, sfmt_t *src) { int dp = dest->idx / 4; int sp = src->idx / 4; int diff = (sp - dp + SFMT_N) % SFMT_N; int p; int i; for (i = 0; i < SFMT_N - diff; i++) { p = i + diff; for (int j = 0; j < 4; j++) { dest->state[i].u[j] ^= src->state[p].u[j]; } } for (; i < SFMT_N; i++) { p = i + diff - SFMT_N; for (int j = 0; j < 4; j++) { dest->state[i].u[j] ^= src->state[p].u[j]; } } } #endif /** * calculate next state * @param sfmt SFMT internal state */ inline static void next_state(sfmt_t * sfmt) { int idx = (sfmt->idx / 4) % SFMT_N; w128_t *r1, *r2; w128_t * pstate = sfmt->state; r1 = &pstate[(idx + SFMT_N - 2) % SFMT_N]; r2 = &pstate[(idx + SFMT_N - 1) % SFMT_N]; do_recursion(&pstate[idx], &pstate[idx], &pstate[(idx + SFMT_POS1) % SFMT_N], r1, r2); r1 = r2; r2 = &pstate[idx]; sfmt->idx = sfmt->idx + 4; } /** * jump ahead using jump_string * @param sfmt SFMT internal state input and output. * @param jump_string string which represents jump polynomial. */ void SFMT_jump(sfmt_t * sfmt, const char * jump_string) { sfmt_t work; int index = sfmt->idx; int bits; memset(&work, 0, sizeof(sfmt_t)); sfmt->idx = SFMT_N32; for (int i = 0; jump_string[i] != '\0'; i++) { bits = jump_string[i]; assert(isxdigit(bits)); bits = tolower(bits); if (bits >= 'a' && bits <= 'f') { bits = bits - 'a' + 10; } else { bits = bits - '0'; } bits = bits & 0x0f; for (int j = 0; j < 4; j++) { if ((bits & 1) != 0) { add(&work, sfmt); } next_state(sfmt); bits = bits >> 1; } } *sfmt = work; sfmt->idx = index; } #if defined(__cplusplus) } #endif aevol-5.0/src/libaevol/SFMT-src-1.4/SFMT-params4253.h0000644000175000017500000000370012421166362016353 00000000000000#pragma once #ifndef SFMT_PARAMS4253_H #define SFMT_PARAMS4253_H #define SFMT_POS1 17 #define SFMT_SL1 20 #define SFMT_SL2 1 #define SFMT_SR1 7 #define SFMT_SR2 1 #define SFMT_MSK1 0x9f7bffffU #define SFMT_MSK2 0x9fffff5fU #define SFMT_MSK3 0x3efffffbU #define SFMT_MSK4 0xfffff7bbU #define SFMT_PARITY1 0xa8000001U #define SFMT_PARITY2 0xaf5390a3U #define SFMT_PARITY3 0xb740b3f8U #define SFMT_PARITY4 0x6c11486dU /* PARAMETERS FOR ALTIVEC */ #if defined(__APPLE__) /* For OSX */ #define SFMT_ALTI_SL1 \ (vector unsigned int)(SFMT_SL1, SFMT_SL1, SFMT_SL1, SFMT_SL1) #define SFMT_ALTI_SR1 \ (vector unsigned int)(SFMT_SR1, SFMT_SR1, SFMT_SR1, SFMT_SR1) #define SFMT_ALTI_MSK \ (vector unsigned int)(SFMT_MSK1, SFMT_MSK2, SFMT_MSK3, SFMT_MSK4) #define SFMT_ALTI_MSK64 \ (vector unsigned int)(SFMT_MSK2, SFMT_MSK1, SFMT_MSK4, SFMT_MSK3) #define SFMT_ALTI_SL2_PERM \ (vector unsigned char)(1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8) #define SFMT_ALTI_SL2_PERM64 \ (vector unsigned char)(1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0) #define SFMT_ALTI_SR2_PERM \ (vector unsigned char)(7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14) #define SFMT_ALTI_SR2_PERM64 \ (vector unsigned char)(15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14) #else /* For OTHER OSs(Linux?) */ #define SFMT_ALTI_SL1 {SFMT_SL1, SFMT_SL1, SFMT_SL1, SFMT_SL1} #define SFMT_ALTI_SR1 {SFMT_SR1, SFMT_SR1, SFMT_SR1, SFMT_SR1} #define SFMT_ALTI_MSK {SFMT_MSK1, SFMT_MSK2, SFMT_MSK3, SFMT_MSK4} #define SFMT_ALTI_MSK64 {SFMT_MSK2, SFMT_MSK1, SFMT_MSK4, SFMT_MSK3} #define SFMT_ALTI_SL2_PERM {1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8} #define SFMT_ALTI_SL2_PERM64 {1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0} #define SFMT_ALTI_SR2_PERM {7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14} #define SFMT_ALTI_SR2_PERM64 {15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14} #endif /* For OSX */ #define SFMT_IDSTR "SFMT-4253:17-20-1-7-1:9f7bffff-9fffff5f-3efffffb-fffff7bb" #endif /* SFMT_PARAMS4253_H */ aevol-5.0/src/libaevol/SFMT-src-1.4/SFMT-params19937.h0000644000175000017500000000371012421166362016453 00000000000000#pragma once #ifndef SFMT_PARAMS19937_H #define SFMT_PARAMS19937_H #define SFMT_POS1 122 #define SFMT_SL1 18 #define SFMT_SL2 1 #define SFMT_SR1 11 #define SFMT_SR2 1 #define SFMT_MSK1 0xdfffffefU #define SFMT_MSK2 0xddfecb7fU #define SFMT_MSK3 0xbffaffffU #define SFMT_MSK4 0xbffffff6U #define SFMT_PARITY1 0x00000001U #define SFMT_PARITY2 0x00000000U #define SFMT_PARITY3 0x00000000U #define SFMT_PARITY4 0x13c9e684U /* PARAMETERS FOR ALTIVEC */ #if defined(__APPLE__) /* For OSX */ #define SFMT_ALTI_SL1 \ (vector unsigned int)(SFMT_SL1, SFMT_SL1, SFMT_SL1, SFMT_SL1) #define SFMT_ALTI_SR1 \ (vector unsigned int)(SFMT_SR1, SFMT_SR1, SFMT_SR1, SFMT_SR1) #define SFMT_ALTI_MSK \ (vector unsigned int)(SFMT_MSK1, SFMT_MSK2, SFMT_MSK3, SFMT_MSK4) #define SFMT_ALTI_MSK64 \ (vector unsigned int)(SFMT_MSK2, SFMT_MSK1, SFMT_MSK4, SFMT_MSK3) #define SFMT_ALTI_SL2_PERM \ (vector unsigned char)(1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8) #define SFMT_ALTI_SL2_PERM64 \ (vector unsigned char)(1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0) #define SFMT_ALTI_SR2_PERM \ (vector unsigned char)(7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14) #define SFMT_ALTI_SR2_PERM64 \ (vector unsigned char)(15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14) #else /* For OTHER OSs(Linux?) */ #define SFMT_ALTI_SL1 {SFMT_SL1, SFMT_SL1, SFMT_SL1, SFMT_SL1} #define SFMT_ALTI_SR1 {SFMT_SR1, SFMT_SR1, SFMT_SR1, SFMT_SR1} #define SFMT_ALTI_MSK {SFMT_MSK1, SFMT_MSK2, SFMT_MSK3, SFMT_MSK4} #define SFMT_ALTI_MSK64 {SFMT_MSK2, SFMT_MSK1, SFMT_MSK4, SFMT_MSK3} #define SFMT_ALTI_SL2_PERM {1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8} #define SFMT_ALTI_SL2_PERM64 {1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0} #define SFMT_ALTI_SR2_PERM {7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14} #define SFMT_ALTI_SR2_PERM64 {15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14} #endif /* For OSX */ #define SFMT_IDSTR "SFMT-19937:122-18-1-11-1:dfffffef-ddfecb7f-bffaffff-bffffff6" #endif /* SFMT_PARAMS19937_H */ aevol-5.0/src/libaevol/SFMT-src-1.4/SFMT-params216091.h0000644000175000017500000000371612421166362016527 00000000000000#pragma once #ifndef SFMT_PARAMS216091_H #define SFMT_PARAMS216091_H #define SFMT_POS1 627 #define SFMT_SL1 11 #define SFMT_SL2 3 #define SFMT_SR1 10 #define SFMT_SR2 1 #define SFMT_MSK1 0xbff7bff7U #define SFMT_MSK2 0xbfffffffU #define SFMT_MSK3 0xbffffa7fU #define SFMT_MSK4 0xffddfbfbU #define SFMT_PARITY1 0xf8000001U #define SFMT_PARITY2 0x89e80709U #define SFMT_PARITY3 0x3bd2b64bU #define SFMT_PARITY4 0x0c64b1e4U /* PARAMETERS FOR ALTIVEC */ #if defined(__APPLE__) /* For OSX */ #define SFMT_ALTI_SL1 \ (vector unsigned int)(SFMT_SL1, SFMT_SL1, SFMT_SL1, SFMT_SL1) #define SFMT_ALTI_SR1 \ (vector unsigned int)(SFMT_SR1, SFMT_SR1, SFMT_SR1, SFMT_SR1) #define SFMT_ALTI_MSK \ (vector unsigned int)(SFMT_MSK1, SFMT_MSK2, SFMT_MSK3, SFMT_MSK4) #define SFMT_ALTI_MSK64 \ (vector unsigned int)(SFMT_MSK2, SFMT_MSK1, SFMT_MSK4, SFMT_MSK3) #define SFMT_ALTI_SL2_PERM \ (vector unsigned char)(3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10) #define SFMT_ALTI_SL2_PERM64 \ (vector unsigned char)(3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2) #define SFMT_ALTI_SR2_PERM \ (vector unsigned char)(7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14) #define SFMT_ALTI_SR2_PERM64 \ (vector unsigned char)(15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14) #else /* For OTHER OSs(Linux?) */ #define SFMT_ALTI_SL1 {SFMT_SL1, SFMT_SL1, SFMT_SL1, SFMT_SL1} #define SFMT_ALTI_SR1 {SFMT_SR1, SFMT_SR1, SFMT_SR1, SFMT_SR1} #define SFMT_ALTI_MSK {SFMT_MSK1, SFMT_MSK2, SFMT_MSK3, SFMT_MSK4} #define SFMT_ALTI_MSK64 {SFMT_MSK2, SFMT_MSK1, SFMT_MSK4, SFMT_MSK3} #define SFMT_ALTI_SL2_PERM {3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10} #define SFMT_ALTI_SL2_PERM64 {3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2} #define SFMT_ALTI_SR2_PERM {7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14} #define SFMT_ALTI_SR2_PERM64 {15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14} #endif /* For OSX */ #define SFMT_IDSTR "SFMT-216091:627-11-3-10-1:bff7bff7-bfffffff-bffffa7f-ffddfbfb" #endif /* SFMT_PARAMS216091_H */ aevol-5.0/src/libaevol/SFMT-src-1.4/Makefile.in0000644000175000017500000005665212735464144015724 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ ############################################ # Variables # ############################################ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/libaevol/SFMT-src-1.4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \ $(top_srcdir)/m4/ax_boost_filesystem.m4 \ $(top_srcdir)/m4/ax_boost_system.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx_14.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru AM_V_AR = $(am__v_AR_@AM_V@) am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) am__v_AR_0 = @echo " AR " $@; am__v_AR_1 = libsfmt_a_AR = $(AR) $(ARFLAGS) libsfmt_a_LIBADD = am__dirstamp = $(am__leading_dot)dirstamp am__objects_1 = am_libsfmt_a_OBJECTS = libsfmt_a-SFMT.$(OBJEXT) \ jump/libsfmt_a-SFMT-jump.$(OBJEXT) $(am__objects_1) libsfmt_a_OBJECTS = $(am_libsfmt_a_OBJECTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) am__v_CXX_0 = @echo " CXX " $@; am__v_CXX_1 = CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) am__v_CXXLD_0 = @echo " CXXLD " $@; am__v_CXXLD_1 = SOURCES = $(libsfmt_a_SOURCES) DIST_SOURCES = $(libsfmt_a_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AEVOLCPPFLAGS = @AEVOLCPPFLAGS@ AEVOLCXXFLAGS = @AEVOLCXXFLAGS@ AEVOLLDFLAGS = @AEVOLLDFLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@ BOOST_LDFLAGS = @BOOST_LDFLAGS@ BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ HAVE_CXX11 = @HAVE_CXX11@ HAVE_CXX14 = @HAVE_CXX14@ HAVE_DOXYGEN = @HAVE_DOXYGEN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ XMKMF = @XMKMF@ X_CFLAGS = @X_CFLAGS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_LIBS = @X_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = subdir-objects ######################## # Set library to build # ######################## noinst_LIBRARIES = libsfmt.a ############################################ # C99 exact-width integer specific support # ############################################ # __STDC_FORMAT_MACROS allows us to use exact-width integer format specifiers e.g. PRId32 (for printf etc) # __STDC_CONSTANT_MACROS allows us to define exact-width integer macros with e.g. INT32_C( ) # __STDC_LIMIT_MACROS allows us to use exact-width integer limit macros with e.g. INT32_MAX AM_CPPFLAGS = -I./ -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS \ -D__STDC_LIMIT_MACROS SFMT_params = SFMT-params.h SFMT-params607.h SFMT-params1279.h SFMT-params2281.h SFMT-params4253.h SFMT-params11213.h SFMT-params19937.h SFMT-params44497.h SFMT-params86243.h SFMT-params132049.h SFMT-params216091.h libsfmt_adir = ./ libsfmt_a_CPPFLAGS = $(AM_CPPFLAGS) #libsfmt_a_HEADERS = SFMT.h SFMT-common.h $(SFMT_params) jump/SFMT-jump.h libsfmt_a_SOURCES = SFMT.c jump/SFMT-jump.cpp SFMT.h SFMT-common.h \ $(SFMT_params) jump/SFMT-jump.h all: all-am .SUFFIXES: .SUFFIXES: .c .cpp .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/libaevol/SFMT-src-1.4/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/libaevol/SFMT-src-1.4/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) jump/$(am__dirstamp): @$(MKDIR_P) jump @: > jump/$(am__dirstamp) jump/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) jump/$(DEPDIR) @: > jump/$(DEPDIR)/$(am__dirstamp) jump/libsfmt_a-SFMT-jump.$(OBJEXT): jump/$(am__dirstamp) \ jump/$(DEPDIR)/$(am__dirstamp) libsfmt.a: $(libsfmt_a_OBJECTS) $(libsfmt_a_DEPENDENCIES) $(EXTRA_libsfmt_a_DEPENDENCIES) $(AM_V_at)-rm -f libsfmt.a $(AM_V_AR)$(libsfmt_a_AR) libsfmt.a $(libsfmt_a_OBJECTS) $(libsfmt_a_LIBADD) $(AM_V_at)$(RANLIB) libsfmt.a mostlyclean-compile: -rm -f *.$(OBJEXT) -rm -f jump/*.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsfmt_a-SFMT.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@jump/$(DEPDIR)/libsfmt_a-SFMT-jump.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` libsfmt_a-SFMT.o: SFMT.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsfmt_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libsfmt_a-SFMT.o -MD -MP -MF $(DEPDIR)/libsfmt_a-SFMT.Tpo -c -o libsfmt_a-SFMT.o `test -f 'SFMT.c' || echo '$(srcdir)/'`SFMT.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsfmt_a-SFMT.Tpo $(DEPDIR)/libsfmt_a-SFMT.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='SFMT.c' object='libsfmt_a-SFMT.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsfmt_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libsfmt_a-SFMT.o `test -f 'SFMT.c' || echo '$(srcdir)/'`SFMT.c libsfmt_a-SFMT.obj: SFMT.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsfmt_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libsfmt_a-SFMT.obj -MD -MP -MF $(DEPDIR)/libsfmt_a-SFMT.Tpo -c -o libsfmt_a-SFMT.obj `if test -f 'SFMT.c'; then $(CYGPATH_W) 'SFMT.c'; else $(CYGPATH_W) '$(srcdir)/SFMT.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsfmt_a-SFMT.Tpo $(DEPDIR)/libsfmt_a-SFMT.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='SFMT.c' object='libsfmt_a-SFMT.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsfmt_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libsfmt_a-SFMT.obj `if test -f 'SFMT.c'; then $(CYGPATH_W) 'SFMT.c'; else $(CYGPATH_W) '$(srcdir)/SFMT.c'; fi` .cpp.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` jump/libsfmt_a-SFMT-jump.o: jump/SFMT-jump.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsfmt_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT jump/libsfmt_a-SFMT-jump.o -MD -MP -MF jump/$(DEPDIR)/libsfmt_a-SFMT-jump.Tpo -c -o jump/libsfmt_a-SFMT-jump.o `test -f 'jump/SFMT-jump.cpp' || echo '$(srcdir)/'`jump/SFMT-jump.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) jump/$(DEPDIR)/libsfmt_a-SFMT-jump.Tpo jump/$(DEPDIR)/libsfmt_a-SFMT-jump.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='jump/SFMT-jump.cpp' object='jump/libsfmt_a-SFMT-jump.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsfmt_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o jump/libsfmt_a-SFMT-jump.o `test -f 'jump/SFMT-jump.cpp' || echo '$(srcdir)/'`jump/SFMT-jump.cpp jump/libsfmt_a-SFMT-jump.obj: jump/SFMT-jump.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsfmt_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT jump/libsfmt_a-SFMT-jump.obj -MD -MP -MF jump/$(DEPDIR)/libsfmt_a-SFMT-jump.Tpo -c -o jump/libsfmt_a-SFMT-jump.obj `if test -f 'jump/SFMT-jump.cpp'; then $(CYGPATH_W) 'jump/SFMT-jump.cpp'; else $(CYGPATH_W) '$(srcdir)/jump/SFMT-jump.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) jump/$(DEPDIR)/libsfmt_a-SFMT-jump.Tpo jump/$(DEPDIR)/libsfmt_a-SFMT-jump.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='jump/SFMT-jump.cpp' object='jump/libsfmt_a-SFMT-jump.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsfmt_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o jump/libsfmt_a-SFMT-jump.obj `if test -f 'jump/SFMT-jump.cpp'; then $(CYGPATH_W) 'jump/SFMT-jump.cpp'; else $(CYGPATH_W) '$(srcdir)/jump/SFMT-jump.cpp'; fi` ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -rm -f jump/$(DEPDIR)/$(am__dirstamp) -rm -f jump/$(am__dirstamp) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) jump/$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) jump/$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES cscopelist-am ctags ctags-am distclean \ distclean-compile distclean-generic distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: aevol-5.0/src/libaevol/SFMT-src-1.4/SFMT-params132049.h0000644000175000017500000000371412421166362016525 00000000000000#pragma once #ifndef SFMT_PARAMS132049_H #define SFMT_PARAMS132049_H #define SFMT_POS1 110 #define SFMT_SL1 19 #define SFMT_SL2 1 #define SFMT_SR1 21 #define SFMT_SR2 1 #define SFMT_MSK1 0xffffbb5fU #define SFMT_MSK2 0xfb6ebf95U #define SFMT_MSK3 0xfffefffaU #define SFMT_MSK4 0xcff77fffU #define SFMT_PARITY1 0x00000001U #define SFMT_PARITY2 0x00000000U #define SFMT_PARITY3 0xcb520000U #define SFMT_PARITY4 0xc7e91c7dU /* PARAMETERS FOR ALTIVEC */ #if defined(__APPLE__) /* For OSX */ #define SFMT_ALTI_SL1 \ (vector unsigned int)(SFMT_SL1, SFMT_SL1, SFMT_SL1, SFMT_SL1) #define SFMT_ALTI_SR1 \ (vector unsigned int)(SFMT_SR1, SFMT_SR1, SFMT_SR1, SFMT_SR1) #define SFMT_ALTI_MSK \ (vector unsigned int)(SFMT_MSK1, SFMT_MSK2, SFMT_MSK3, SFMT_MSK4) #define SFMT_ALTI_MSK64 \ (vector unsigned int)(SFMT_MSK2, SFMT_MSK1, SFMT_MSK4, SFMT_MSK3) #define SFMT_ALTI_SL2_PERM \ (vector unsigned char)(1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8) #define SFMT_ALTI_SL2_PERM64 \ (vector unsigned char)(1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0) #define SFMT_ALTI_SR2_PERM \ (vector unsigned char)(7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14) #define SFMT_ALTI_SR2_PERM64 \ (vector unsigned char)(15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14) #else /* For OTHER OSs(Linux?) */ #define SFMT_ALTI_SL1 {SFMT_SL1, SFMT_SL1, SFMT_SL1, SFMT_SL1} #define SFMT_ALTI_SR1 {SFMT_SR1, SFMT_SR1, SFMT_SR1, SFMT_SR1} #define SFMT_ALTI_MSK {SFMT_MSK1, SFMT_MSK2, SFMT_MSK3, SFMT_MSK4} #define SFMT_ALTI_MSK64 {SFMT_MSK2, SFMT_MSK1, SFMT_MSK4, SFMT_MSK3} #define SFMT_ALTI_SL2_PERM {1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8} #define SFMT_ALTI_SL2_PERM64 {1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0} #define SFMT_ALTI_SR2_PERM {7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14} #define SFMT_ALTI_SR2_PERM64 {15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14} #endif /* For OSX */ #define SFMT_IDSTR "SFMT-132049:110-19-1-21-1:ffffbb5f-fb6ebf95-fffefffa-cff77fff" #endif /* SFMT_PARAMS132049_H */ aevol-5.0/src/libaevol/SFMT-src-1.4/SFMT.c0000644000175000017500000002750412421166362014557 00000000000000/** * @file SFMT.c * @brief SIMD oriented Fast Mersenne Twister(SFMT) * * @author Mutsuo Saito (Hiroshima University) * @author Makoto Matsumoto (Hiroshima University) * * Copyright (C) 2006, 2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima * University. * Copyright (C) 2012 Mutsuo Saito, Makoto Matsumoto, Hiroshima * University and The University of Tokyo. * All rights reserved. * * The 3-clause BSD License is applied to this software, see * LICENSE.txt */ #if defined(__cplusplus) extern "C" { #endif #include #include #include "SFMT.h" #include "SFMT-params.h" #include "SFMT-common.h" #if defined(__BIG_ENDIAN__) && !defined(__amd64) && !defined(BIG_ENDIAN64) #define BIG_ENDIAN64 1 #endif #if defined(HAVE_ALTIVEC) && !defined(BIG_ENDIAN64) #define BIG_ENDIAN64 1 #endif #if defined(ONLY64) && !defined(BIG_ENDIAN64) #if defined(__GNUC__) #error "-DONLY64 must be specified with -DBIG_ENDIAN64" #endif #undef ONLY64 #endif /** * parameters used by sse2. */ static const w128_t sse2_param_mask = {{SFMT_MSK1, SFMT_MSK2, SFMT_MSK3, SFMT_MSK4}}; /*---------------- STATIC FUNCTIONS ----------------*/ inline static int idxof(int i); inline static void gen_rand_array(sfmt_t * sfmt, w128_t *array, int size); inline static uint32_t func1(uint32_t x); inline static uint32_t func2(uint32_t x); static void period_certification(sfmt_t * sfmt); #if defined(BIG_ENDIAN64) && !defined(ONLY64) inline static void swap(w128_t *array, int size); #endif #if defined(HAVE_ALTIVEC) #include "SFMT-alti.h" #elif defined(HAVE_SSE2) #include "SFMT-sse2.h" #endif /** * This function simulate a 64-bit index of LITTLE ENDIAN * in BIG ENDIAN machine. */ #ifdef ONLY64 inline static int idxof(int i) { return i ^ 1; } #else inline static int idxof(int i) { return i; } #endif #if (!defined(HAVE_ALTIVEC)) && (!defined(HAVE_SSE2)) /** * This function fills the user-specified array with pseudorandom * integers. * * @param sfmt SFMT internal state * @param array an 128-bit array to be filled by pseudorandom numbers. * @param size number of 128-bit pseudorandom numbers to be generated. */ inline static void gen_rand_array(sfmt_t * sfmt, w128_t *array, int size) { int i, j; w128_t *r1, *r2; r1 = &sfmt->state[SFMT_N - 2]; r2 = &sfmt->state[SFMT_N - 1]; for (i = 0; i < SFMT_N - SFMT_POS1; i++) { do_recursion(&array[i], &sfmt->state[i], &sfmt->state[i + SFMT_POS1], r1, r2); r1 = r2; r2 = &array[i]; } for (; i < SFMT_N; i++) { do_recursion(&array[i], &sfmt->state[i], &array[i + SFMT_POS1 - SFMT_N], r1, r2); r1 = r2; r2 = &array[i]; } for (; i < size - SFMT_N; i++) { do_recursion(&array[i], &array[i - SFMT_N], &array[i + SFMT_POS1 - SFMT_N], r1, r2); r1 = r2; r2 = &array[i]; } for (j = 0; j < 2 * SFMT_N - size; j++) { sfmt->state[j] = array[j + size - SFMT_N]; } for (; i < size; i++, j++) { do_recursion(&array[i], &array[i - SFMT_N], &array[i + SFMT_POS1 - SFMT_N], r1, r2); r1 = r2; r2 = &array[i]; sfmt->state[j] = array[i]; } } #endif #if defined(BIG_ENDIAN64) && !defined(ONLY64) && !defined(HAVE_ALTIVEC) inline static void swap(w128_t *array, int size) { int i; uint32_t x, y; for (i = 0; i < size; i++) { x = array[i].u[0]; y = array[i].u[2]; array[i].u[0] = array[i].u[1]; array[i].u[2] = array[i].u[3]; array[i].u[1] = x; array[i].u[3] = y; } } #endif /** * This function represents a function used in the initialization * by init_by_array * @param x 32-bit integer * @return 32-bit integer */ static uint32_t func1(uint32_t x) { return (x ^ (x >> 27)) * (uint32_t)1664525UL; } /** * This function represents a function used in the initialization * by init_by_array * @param x 32-bit integer * @return 32-bit integer */ static uint32_t func2(uint32_t x) { return (x ^ (x >> 27)) * (uint32_t)1566083941UL; } /** * This function certificate the period of 2^{MEXP} * @param sfmt SFMT internal state */ static void period_certification(sfmt_t * sfmt) { int inner = 0; int i, j; uint32_t work; uint32_t *psfmt32 = &sfmt->state[0].u[0]; const uint32_t parity[4] = {SFMT_PARITY1, SFMT_PARITY2, SFMT_PARITY3, SFMT_PARITY4}; for (i = 0; i < 4; i++) inner ^= psfmt32[idxof(i)] & parity[i]; for (i = 16; i > 0; i >>= 1) inner ^= inner >> i; inner &= 1; /* check OK */ if (inner == 1) { return; } /* check NG, and modification */ for (i = 0; i < 4; i++) { work = 1; for (j = 0; j < 32; j++) { if ((work & parity[i]) != 0) { psfmt32[idxof(i)] ^= work; return; } work = work << 1; } } } /*---------------- PUBLIC FUNCTIONS ----------------*/ #define UNUSED_VARIABLE(x) (void)(x) /** * This function returns the identification string. * The string shows the word size, the Mersenne exponent, * and all parameters of this generator. * @param sfmt SFMT internal state */ const char *sfmt_get_idstring(sfmt_t * sfmt) { UNUSED_VARIABLE(sfmt); return SFMT_IDSTR; } /** * This function returns the minimum size of array used for \b * fill_array32() function. * @param sfmt SFMT internal state * @return minimum size of array used for fill_array32() function. */ int sfmt_get_min_array_size32(sfmt_t * sfmt) { UNUSED_VARIABLE(sfmt); return SFMT_N32; } /** * This function returns the minimum size of array used for \b * fill_array64() function. * @param sfmt SFMT internal state * @return minimum size of array used for fill_array64() function. */ int sfmt_get_min_array_size64(sfmt_t * sfmt) { UNUSED_VARIABLE(sfmt); return SFMT_N64; } #if !defined(HAVE_SSE2) && !defined(HAVE_ALTIVEC) /** * This function fills the internal state array with pseudorandom * integers. * @param sfmt SFMT internal state */ void sfmt_gen_rand_all(sfmt_t * sfmt) { int i; w128_t *r1, *r2; r1 = &sfmt->state[SFMT_N - 2]; r2 = &sfmt->state[SFMT_N - 1]; for (i = 0; i < SFMT_N - SFMT_POS1; i++) { do_recursion(&sfmt->state[i], &sfmt->state[i], &sfmt->state[i + SFMT_POS1], r1, r2); r1 = r2; r2 = &sfmt->state[i]; } for (; i < SFMT_N; i++) { do_recursion(&sfmt->state[i], &sfmt->state[i], &sfmt->state[i + SFMT_POS1 - SFMT_N], r1, r2); r1 = r2; r2 = &sfmt->state[i]; } } #endif #ifndef ONLY64 /** * This function generates pseudorandom 32-bit integers in the * specified array[] by one call. The number of pseudorandom integers * is specified by the argument size, which must be at least 624 and a * multiple of four. The generation by this function is much faster * than the following gen_rand function. * * For initialization, init_gen_rand or init_by_array must be called * before the first call of this function. This function can not be * used after calling gen_rand function, without initialization. * * @param sfmt SFMT internal state * @param array an array where pseudorandom 32-bit integers are filled * by this function. The pointer to the array must be \b "aligned" * (namely, must be a multiple of 16) in the SIMD version, since it * refers to the address of a 128-bit integer. In the standard C * version, the pointer is arbitrary. * * @param size the number of 32-bit pseudorandom integers to be * generated. size must be a multiple of 4, and greater than or equal * to (MEXP / 128 + 1) * 4. * * @note \b memalign or \b posix_memalign is available to get aligned * memory. Mac OSX doesn't have these functions, but \b malloc of OSX * returns the pointer to the aligned memory block. */ void sfmt_fill_array32(sfmt_t * sfmt, uint32_t *array, int size) { assert(sfmt->idx == SFMT_N32); assert(size % 4 == 0); assert(size >= SFMT_N32); gen_rand_array(sfmt, (w128_t *)array, size / 4); sfmt->idx = SFMT_N32; } #endif /** * This function generates pseudorandom 64-bit integers in the * specified array[] by one call. The number of pseudorandom integers * is specified by the argument size, which must be at least 312 and a * multiple of two. The generation by this function is much faster * than the following gen_rand function. * * @param sfmt SFMT internal state * For initialization, init_gen_rand or init_by_array must be called * before the first call of this function. This function can not be * used after calling gen_rand function, without initialization. * * @param array an array where pseudorandom 64-bit integers are filled * by this function. The pointer to the array must be "aligned" * (namely, must be a multiple of 16) in the SIMD version, since it * refers to the address of a 128-bit integer. In the standard C * version, the pointer is arbitrary. * * @param size the number of 64-bit pseudorandom integers to be * generated. size must be a multiple of 2, and greater than or equal * to (MEXP / 128 + 1) * 2 * * @note \b memalign or \b posix_memalign is available to get aligned * memory. Mac OSX doesn't have these functions, but \b malloc of OSX * returns the pointer to the aligned memory block. */ void sfmt_fill_array64(sfmt_t * sfmt, uint64_t *array, int size) { assert(sfmt->idx == SFMT_N32); assert(size % 2 == 0); assert(size >= SFMT_N64); gen_rand_array(sfmt, (w128_t *)array, size / 2); sfmt->idx = SFMT_N32; #if defined(BIG_ENDIAN64) && !defined(ONLY64) swap((w128_t *)array, size /2); #endif } /** * This function initializes the internal state array with a 32-bit * integer seed. * * @param sfmt SFMT internal state * @param seed a 32-bit integer used as the seed. */ void sfmt_init_gen_rand( sfmt_t * sfmt, uint32_t seed ) { int i; uint32_t *psfmt32 = &sfmt->state[0].u[0]; psfmt32[idxof(0)] = seed; for (i = 1; i < SFMT_N32; i++) { psfmt32[idxof(i)] = 1812433253UL * (psfmt32[idxof(i - 1)] ^ (psfmt32[idxof(i - 1)] >> 30)) + i; } sfmt->idx = SFMT_N32; period_certification(sfmt); } /** * This function initializes the internal state array, * with an array of 32-bit integers used as the seeds * @param sfmt SFMT internal state * @param init_key the array of 32-bit integers, used as a seed. * @param key_length the length of init_key. */ void sfmt_init_by_array(sfmt_t * sfmt, uint32_t *init_key, int key_length) { int i, j, count; uint32_t r; int lag; int mid; int size = SFMT_N * 4; uint32_t *psfmt32 = &sfmt->state[0].u[0]; if (size >= 623) { lag = 11; } else if (size >= 68) { lag = 7; } else if (size >= 39) { lag = 5; } else { lag = 3; } mid = (size - lag) / 2; memset(sfmt, 0x8b, sizeof(sfmt_t)); if (key_length + 1 > SFMT_N32) { count = key_length + 1; } else { count = SFMT_N32; } r = func1(psfmt32[idxof(0)] ^ psfmt32[idxof(mid)] ^ psfmt32[idxof(SFMT_N32 - 1)]); psfmt32[idxof(mid)] += r; r += key_length; psfmt32[idxof(mid + lag)] += r; psfmt32[idxof(0)] = r; count--; for (i = 1, j = 0; (j < count) && (j < key_length); j++) { r = func1(psfmt32[idxof(i)] ^ psfmt32[idxof((i + mid) % SFMT_N32)] ^ psfmt32[idxof((i + SFMT_N32 - 1) % SFMT_N32)]); psfmt32[idxof((i + mid) % SFMT_N32)] += r; r += init_key[j] + i; psfmt32[idxof((i + mid + lag) % SFMT_N32)] += r; psfmt32[idxof(i)] = r; i = (i + 1) % SFMT_N32; } for (; j < count; j++) { r = func1(psfmt32[idxof(i)] ^ psfmt32[idxof((i + mid) % SFMT_N32)] ^ psfmt32[idxof((i + SFMT_N32 - 1) % SFMT_N32)]); psfmt32[idxof((i + mid) % SFMT_N32)] += r; r += i; psfmt32[idxof((i + mid + lag) % SFMT_N32)] += r; psfmt32[idxof(i)] = r; i = (i + 1) % SFMT_N32; } for (j = 0; j < SFMT_N32; j++) { r = func2(psfmt32[idxof(i)] + psfmt32[idxof((i + mid) % SFMT_N32)] + psfmt32[idxof((i + SFMT_N32 - 1) % SFMT_N32)]); psfmt32[idxof((i + mid) % SFMT_N32)] ^= r; r -= i; psfmt32[idxof((i + mid + lag) % SFMT_N32)] ^= r; psfmt32[idxof(i)] = r; i = (i + 1) % SFMT_N32; } sfmt->idx = SFMT_N32; period_certification(sfmt); } #if defined(__cplusplus) } #endif aevol-5.0/src/libaevol/Protein.cpp0000644000175000017500000005316112724051151014121 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ================================================================= // Libraries // ================================================================= #include #include // ================================================================= // Project Files // ================================================================= #include "Protein.h" #include "ExpManager.h" #include "Codon.h" #include "Individual.h" #include "GeneticUnit.h" #include "Rna.h" #include "Utils.h" namespace aevol { //############################################################################## // # // Class Protein # // # //############################################################################## // ================================================================= // Definition of static attributes // ================================================================= // ================================================================= // Constructors // ================================================================= /** * Copy constructor. * * Copies the protein but does nothing regarding the RNAs transcribing it (creates an empty list). */ Protein::Protein(GeneticUnit* gen_unit, const Protein &model) { gen_unit_ = gen_unit; strand_ = model.strand_; shine_dal_pos_ = model.shine_dal_pos_; first_translated_pos_ = model.first_translated_pos_; last_translated_pos_ = model.last_translated_pos_; length_ = model.length_; concentration_ = model.concentration_; is_functional_ = model.is_functional_; // Copy the list of amino-acids // TODO vld: check if deep copy needed AA_list_ = model.AA_list_; // Copy triangle parameters mean_ = model.mean_; width_ = model.width_; height_ = model.height_; } Protein::Protein(GeneticUnit* gen_unit, const std::list& codon_list, Strand strand, int32_t shine_dal_pos, Rna* rna, double w_max) { assert(shine_dal_pos >= 0); assert(shine_dal_pos < gen_unit->seq_length()); gen_unit_ = gen_unit; strand_ = strand; shine_dal_pos_ = shine_dal_pos; length_ = codon_list.size(); #ifndef __REGUL // In Aevol the concentration of a new protein is set at the basal level concentration_ = rna->basal_level(); #else // In Raevol, there is two case, depending on the heredity if (gen_unit_->exp_m()->exp_s()->get_with_heredity() ) { // With heredity the new protein has a concentration set at 0, because there are inherited proteins which allow the regulation concentration_ = 0; } else { // Without heredity, we use the same concentration as in Aevol (No inherited proteins) concentration_ = rna->basal_level(); } #endif // TODO : make this cleaner... AA_list_ = codon_list; rna_list_.push_back(rna); if (strand_ == LEADING) { first_translated_pos_ = Utils::mod(shine_dal_pos_ + (SHINE_DAL_SIZE + SHINE_START_SPACER + CODON_SIZE), gen_unit_->dna()->length()); last_translated_pos_ = Utils::mod(first_translated_pos_ + (length_ * CODON_SIZE - 1), gen_unit_->dna()->length()); } else { first_translated_pos_ = Utils::mod(shine_dal_pos_ - (SHINE_DAL_SIZE + SHINE_START_SPACER + CODON_SIZE), gen_unit_->dna()->length()); last_translated_pos_ = Utils::mod(first_translated_pos_ - (length_ * CODON_SIZE - 1), gen_unit_->dna()->length()); } // ============================================================================ // Folding process (compute phenotypic contribution parameters from codon list) // ============================================================================ // 1) Compute values for M, W and H // 2) Normalize M, W and H values according to number of codons of each kind // 3) Normalize M, W and H values according to the allowed ranges (defined in macros.h) // -------------------------------- // 1) Compute values for M, W and H // -------------------------------- long double M = 0.0; long double W = 0.0; long double H = 0.0; int32_t nb_m = 0; int32_t nb_w = 0; int32_t nb_h = 0; bool bin_m = false; // Initializing to false will yield a conservation of the high weight bit bool bin_w = false; // when applying the XOR operator for the Gray to standard conversion bool bin_h = false; for (const auto& codon: codon_list) { switch (codon->value()) { case CODON_M0 : { // M codon found nb_m++; // Convert Gray code to "standard" binary code bin_m ^= false; // as bin_m was initialized to false, the XOR will have no effect on the high weight bit // A lower-than-the-previous-lowest weight bit was found, make a left bitwise shift //~ M <<= 1; M *= 2; // Add this nucleotide's contribution to M if (bin_m) M += 1; break; } case CODON_M1 : { // M codon found nb_m++; // Convert Gray code to "standard" binary code bin_m ^= true; // as bin_m was initialized to false, the XOR will have no effect on the high weight bit // A lower-than-the-previous-lowest bit was found, make a left bitwise shift //~ M <<= 1; M *= 2; // Add this nucleotide's contribution to M if (bin_m) M += 1; break; } case CODON_W0 : { // W codon found nb_w++; // Convert Gray code to "standard" binary code bin_w ^= false; // as bin_m was initialized to false, the XOR will have no effect on the high weight bit // A lower-than-the-previous-lowest weight bit was found, make a left bitwise shift //~ W <<= 1; W *= 2; // Add this nucleotide's contribution to W if (bin_w) W += 1; break; } case CODON_W1 : { // W codon found nb_w++; // Convert Gray code to "standard" binary code bin_w ^= true; // as bin_m was initialized to false, the XOR will have no effect on the high weight bit // A lower-than-the-previous-lowest weight bit was found, make a left bitwise shift //~ W <<= 1; W *= 2; // Add this nucleotide's contribution to W if (bin_w) W += 1; break; } case CODON_H0 : case CODON_START : // Start codon codes for the same amino-acid as H0 codon { // H codon found nb_h++; // Convert Gray code to "standard" binary code bin_h ^= false; // as bin_m was initialized to false, the XOR will have no effect on the high weight bit // A lower-than-the-previous-lowest weight bit was found, make a left bitwise shift //~ H <<= 1; H *= 2; // Add this nucleotide's contribution to H if (bin_h) H += 1; break; } case CODON_H1 : { // H codon found nb_h++; // Convert Gray code to "standard" binary code bin_h ^= true; // as bin_m was initialized to false, the XOR will have no effect on the high weight bit // A lower-than-the-previous-lowest weight bit was found, make a left bitwise shift //~ H <<= 1; H *= 2; // Add this nucleotide's contribution to H if (bin_h) H += 1; break; } } } // ---------------------------------------------------------------------------------- // 2) Normalize M, W and H values in [0;1] according to number of codons of each kind // ---------------------------------------------------------------------------------- if (nb_m != 0) mean_ = M / (pow(2, nb_m) - 1); else mean_ = 0.5; if (nb_w != 0) width_ = W / (pow(2, nb_w) - 1); else width_ = 0.0; if (nb_h != 0) height_ = H / (pow(2, nb_h) - 1); else height_ = 0.5; assert(mean_ >= 0.0 && mean_ <= 1.0); assert(width_ >= 0.0 && width_ <= 1.0); assert(height_ >= 0.0 && height_ <= 1.0); // ------------------------------------------------------------------------------------ // 3) Normalize M, W and H values according to the allowed ranges (defined in macros.h) // ------------------------------------------------------------------------------------ // x_min <= M <= x_max // w_min <= W <= w_max // h_min <= H <= h_max mean_ = (X_MAX - X_MIN) * mean_ + X_MIN; width_ = (w_max - W_MIN) * width_ + W_MIN; height_ = (H_MAX - H_MIN) * height_ + H_MIN; if (nb_m == 0 || nb_w == 0 || nb_h == 0 || width_ == 0.0 || height_ == 0.0) { is_functional_ = false; } else { is_functional_ = true; } assert(mean_ >= X_MIN && mean_ <= X_MAX); assert(width_ >= W_MIN && width_ <= indiv()->w_max()); assert(height_ >= H_MIN && height_ <= H_MAX); } /* Protein::Protein(Protein* parent) { gen_unit_ = parent->gen_unit_; strand_ = parent->strand_; shine_dal_pos_ = parent->shine_dal_pos_; first_translated_pos_ = parent->first_translated_pos_; last_translated_pos_ = parent->last_translated_pos_; length_ = parent->length_; concentration_ = parent->concentration_; mean_ = parent->mean_; width_ = parent->width_; height_ = parent->height_; } */ //Constructor for the signal proteins //modif raevol_yo_3 : now we really copy the codon list Protein::Protein(const std::list codon_list, double concentration, double w_max) // WARNING this constructor should not being used for other purpose // In particular codon list should be destroyer by the caller of this constructor // since we will copy the list to be sure to own it { gen_unit_ = NULL; strand_ = LEADING; shine_dal_pos_ = 0; length_ = codon_list.size(); first_translated_pos_ = 0; last_translated_pos_ = 0; concentration_ = concentration; // Copy the list of amino-acids for(Codon* c : codon_list) { AA_list_.push_back(new Codon(*c)); } // ============================================================================ // Folding process (compute phenotypic contribution parameters from codon list) // ============================================================================ // 1) Compute values for M, W and H // 2) Normalize M, W and H values according to number of codons of each kind // 3) Normalize M, W and H values according to the allowed ranges (defined in macros.h) // -------------------------------- // 1) Compute values for M, W and H // -------------------------------- long double M = 0.0; long double W = 0.0; long double H = 0.0; int32_t nb_m = 0; int32_t nb_w = 0; int32_t nb_h = 0; bool bin_m = false; // Initializing to false will yield a conservation of the high weight bit bool bin_w = false; // when applying the XOR operator for the Gray to standard conversion bool bin_h = false; for (const auto& codon: codon_list) { switch ( codon->value() ) { case CODON_M0 : { // M codon found nb_m++; // Convert Gray code to "standard" binary code bin_m ^= false; // as bin_m was initialized to false, the XOR will have no effect on the high weight bit // A lower-than-the-previous-lowest weight bit was found, make a left bitwise shift //~ M <<= 1; M *= 2; // Add this nucleotide's contribution to M if ( bin_m ) M += 1; break; } case CODON_M1 : { // M codon found nb_m++; // Convert Gray code to "standard" binary code bin_m ^= true; // as bin_m was initialized to false, the XOR will have no effect on the high weight bit // A lower-than-the-previous-lowest bit was found, make a left bitwise shift //~ M <<= 1; M *= 2; // Add this nucleotide's contribution to M if ( bin_m ) M += 1; break; } case CODON_W0 : { // W codon found nb_w++; // Convert Gray code to "standard" binary code bin_w ^= false; // as bin_m was initialized to false, the XOR will have no effect on the high weight bit // A lower-than-the-previous-lowest weight bit was found, make a left bitwise shift //~ W <<= 1; W *= 2; // Add this nucleotide's contribution to W if ( bin_w ) W += 1; break; } case CODON_W1 : { // W codon found nb_w++; // Convert Gray code to "standard" binary code bin_w ^= true; // as bin_m was initialized to false, the XOR will have no effect on the high weight bit // A lower-than-the-previous-lowest weight bit was found, make a left bitwise shift //~ W <<= 1; W *= 2; // Add this nucleotide's contribution to W if ( bin_w ) W += 1; break; } case CODON_H0 : case CODON_START : // Start codon codes for the same amino-acid as H0 codon { // H codon found nb_h++; // Convert Gray code to "standard" binary code bin_h ^= false; // as bin_m was initialized to false, the XOR will have no effect on the high weight bit // A lower-than-the-previous-lowest weight bit was found, make a left bitwise shift //~ H <<= 1; H *= 2; // Add this nucleotide's contribution to H if ( bin_h ) H += 1; break; } case CODON_H1 : { // H codon found nb_h++; // Convert Gray code to "standard" binary code bin_h ^= true; // as bin_m was initialized to false, the XOR will have no effect on the high weight bit // A lower-than-the-previous-lowest weight bit was found, make a left bitwise shift //~ H <<= 1; H *= 2; // Add this nucleotide's contribution to H if ( bin_h ) H += 1; break; } } } // ---------------------------------------------------------------------------------- // 2) Normalize M, W and H values in [0;1] according to number of codons of each kind // ---------------------------------------------------------------------------------- if ( nb_m != 0 ) mean_ = M / (pow(2, nb_m) - 1); else mean_ = 0.5; if ( nb_w != 0 ) width_ = W / (pow(2, nb_w) - 1); else width_ = 0.0; if ( nb_h != 0 ) height_ = H / (pow(2, nb_h) - 1); else height_ = 0.5; assert( mean_ >= 0.0 && mean_ <= 1.0 ); assert( width_ >= 0.0 && width_ <= 1.0 ); assert( height_ >= 0.0 && height_ <= 1.0 ); // ------------------------------------------------------------------------------------ // 3) Normalize M, W and H values according to the allowed ranges (defined in macros.h) // ------------------------------------------------------------------------------------ // x_min <= M <= x_max // w_min <= W <= w_max // h_min <= H <= h_max mean_ = (X_MAX - X_MIN) * mean_ + X_MIN; width_ = (w_max - W_MIN) * width_ + W_MIN; height_ = (H_MAX - H_MIN) * height_ + H_MIN; if ( nb_m == 0 || nb_w == 0 || nb_h == 0 || width_ == 0.0 || height_ == 0.0 ) { is_functional_ = false; } else { is_functional_ = true; } assert( mean_ >= X_MIN && mean_ <= X_MAX ); //NOT WORKING if indiv is nullptr // assert( width_ >= W_MIN && width_ <= indiv()->w_max() ); assert( height_ >= H_MIN && height_ <= H_MAX ); } Protein::Protein(gzFile backup_file) { gen_unit_ = NULL; int8_t tmp_strand; gzread(backup_file, &tmp_strand, sizeof(tmp_strand)); strand_ = (Strand) tmp_strand; gzread(backup_file, &shine_dal_pos_, sizeof(shine_dal_pos_)); gzread(backup_file, &first_translated_pos_, sizeof(first_translated_pos_)); gzread(backup_file, &last_translated_pos_, sizeof(last_translated_pos_)); gzread(backup_file, &length_, sizeof(length_)); gzread(backup_file, &concentration_, sizeof(concentration_)); gzread(backup_file, &is_functional_, sizeof(is_functional_)); gzread(backup_file, &mean_, sizeof(mean_)); gzread(backup_file, &width_, sizeof(width_)); gzread(backup_file, &height_, sizeof(height_)); // Retreive the AA int16_t nb_AA = 0; gzread(backup_file, &nb_AA, sizeof(nb_AA)); for (int16_t i = 0 ; i < nb_AA ; i++) AA_list_.push_back(new Codon(backup_file)); } // ================================================================= // Destructors // ================================================================= Protein::~Protein() { for (const auto& AA: AA_list_) delete AA; } // ================================================================= // Public Methods // ================================================================= int32_t Protein::last_STOP_base_pos() const { if (strand_ == LEADING) { return Utils::mod(last_translated_pos_ + 3, gen_unit_->dna()->length()); } else { return Utils::mod(last_translated_pos_ - 3, gen_unit_->dna()->length()); } } void Protein::add_RNA(Rna * rna) { rna_list_.push_back(rna); #ifndef __REGUL concentration_ += rna->basal_level(); #else if ( gen_unit_->exp_m()->exp_s()->get_with_heredity() ) { // With heredity the new protein has a concentration set at 0, because there are inherited proteins which allow the regulation concentration_ = 0; } else { // Without heredity, we use the same concentration as in Aevol (No inherited proteins) concentration_ += rna->basal_level(); } #endif } char* Protein::AA_sequence(char separator /*= ' '*/) const { char* seq = new char[3*length_]; // + 1 (for the '\0') - 1 (length_ - 1 spaces) int32_t i = 0; for (const auto& codon: AA_list_) { if (i != 0) seq[i++] = separator; switch (codon->value()) { case CODON_START : { seq[i++] = 'S'; seq[i++] = 'T'; break; } case CODON_M0 : { seq[i++] = 'M'; seq[i++] = '0'; break; } case CODON_M1 : { seq[i++] = 'M'; seq[i++] = '1'; break; } case CODON_W0 : { seq[i++] = 'W'; seq[i++] = '0'; break; } case CODON_W1 : { seq[i++] = 'W'; seq[i++] = '1'; break; } case CODON_H0 : { seq[i++] = 'H'; seq[i++] = '0'; break; } case CODON_H1 : { seq[i++] = 'H'; seq[i++] = '1'; break; } } } seq[3*length_-1] = '\0'; return seq; } void Protein::save(gzFile backup_file) { // The rna_list_ is not write because there is no need to, it is an empty list. int8_t tmp_strand = strand_; gzwrite(backup_file, &tmp_strand, sizeof(tmp_strand)); gzwrite(backup_file, &shine_dal_pos_, sizeof(shine_dal_pos_)); gzwrite(backup_file, &first_translated_pos_, sizeof(first_translated_pos_)); gzwrite(backup_file, &last_translated_pos_, sizeof(last_translated_pos_)); gzwrite(backup_file, &length_, sizeof(length_)); gzwrite(backup_file, &concentration_, sizeof(concentration_)); gzwrite(backup_file, &is_functional_, sizeof(is_functional_)); gzwrite(backup_file, &mean_, sizeof(mean_)); gzwrite(backup_file, &width_, sizeof(width_)); gzwrite(backup_file, &height_, sizeof(height_)); // Write the Acide Amino in the backup file int16_t nb_AA = AA_list_.size(); gzwrite(backup_file, &nb_AA, sizeof(nb_AA)); for (const auto& AA: AA_list_) AA->save(backup_file); } // ================================================================= // Protected Methods // ================================================================= // ================================================================= // Non inline accessors // ================================================================= Individual *Protein::indiv() const { return gen_unit_->indiv(); } GeneticUnit* Protein::get_gen_unit( void ) const { return gen_unit_; } } // namespace aevol aevol-5.0/src/libaevol/SmallInsertion.cpp0000644000175000017500000001022312724051151015434 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ============================================================================ // Includes // ============================================================================ #include "SmallInsertion.h" #include namespace aevol { // ============================================================================ // Definition of static attributes // ============================================================================ // ============================================================================ // Constructors // ============================================================================ SmallInsertion::SmallInsertion(const SmallInsertion& other) : pos_(other.pos_), length_(other.length_) { seq_ = new char[length_ + 1]; memcpy(seq_, other.seq_, length_ + 1); } SmallInsertion::SmallInsertion(int32_t pos, int32_t length, const char* seq) : pos_(pos), length_(length) { seq_ = new char[length_ + 1]; memcpy(seq_, seq, length_); seq_[length_] = '\0'; } // ============================================================================ // Destructor // ============================================================================ SmallInsertion::~SmallInsertion() noexcept { delete [] seq_; } // ============================================================================ // Operators // ============================================================================ /// Copy assignment SmallInsertion& SmallInsertion::operator=(const SmallInsertion& other) { pos_ = other.pos_; length_ = other.length_; seq_ = new char[length_ + 1]; memcpy(seq_, other.seq_, length_ + 1); return *this; } // ============================================================================ // Methods // ============================================================================ void SmallInsertion::save(gzFile backup_file) const { int8_t tmp_mut_type = S_INS; gzwrite(backup_file, &tmp_mut_type, sizeof(tmp_mut_type)); gzwrite(backup_file, &pos_, sizeof(pos_)); gzwrite(backup_file, &length_, sizeof(length_)); gzwrite(backup_file, seq_, length_ * sizeof(seq_[0])); } void SmallInsertion::load(gzFile backup_file) { gzread(backup_file, &pos_, sizeof(pos_)); gzread(backup_file, &length_, sizeof(length_)); seq_ = new char[length_ + 1]; gzread(backup_file, seq_, length_ * sizeof(seq_[0])); } void SmallInsertion::generic_description_string(char* str) const { sprintf(str, "%" PRId8 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId8 " %" PRId16 " %" PRId16 " %" PRId32 " %" PRId32, mut_type(), pos_, -1, -1, -1, -1, -1, -1, length_, -1); } // ============================================================================ // Non inline accessors // ============================================================================ } // namespace aevol aevol-5.0/src/libaevol/PhenotypicTargetHandler.h0000644000175000017500000002035212724051151016731 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_PHENOTYPIC_TARGET_HANDLER_H_ #define AEVOL_PHENOTYPIC_TARGET_HANDLER_H_ // ============================================================================ // Includes // ============================================================================ #include #include #include #include #include #include #include "PhenotypicTarget.h" #include "Gaussian.h" #include "ae_enums.h" #include "JumpingMT.h" #include "AbstractFuzzy.h" using std::list; namespace aevol { // ============================================================================ // Class declarations // ============================================================================ /** * Manages a phenotypic target and its "evolution" over time * * Handles a phenotypic target, the variation and/or noise that may be applied * to it as well as the set of possible phenotypic targets and the rules that * define how and when we switch from one to another */ class PhenotypicTargetHandler { public : // ========================================================================== // Constructors // ========================================================================== PhenotypicTargetHandler(); //< Default ctor PhenotypicTargetHandler(const PhenotypicTargetHandler&); //< Copy ctor PhenotypicTargetHandler(PhenotypicTargetHandler&&) = delete; //< Move ctor PhenotypicTargetHandler(gzFile backup_file); // ========================================================================== // Destructor // ========================================================================== virtual ~PhenotypicTargetHandler(); //< Destructor // ========================================================================== // Operators // ========================================================================== // ========================================================================== // Public Methods // ========================================================================== void BuildPhenotypicTarget(); virtual void ApplyVariation(); virtual void save(gzFile backup_file) const; virtual void load(gzFile backup_file); // ========================================================================== // Getters // ========================================================================== const PhenotypicTarget& phenotypic_target() const { return *phenotypic_target_; } double get_geometric_area() const { return phenotypic_target_->fuzzy()->get_geometric_area(); } double area_by_feature(int8_t feature) const { return phenotypic_target_->area_by_feature(feature); } const list& gaussians() const { return initial_gaussians_; } const PhenotypicTargetVariationMethod& var_method() const { return var_method_; } virtual double mean_environmental_area() const { return phenotypic_target_->area_by_feature(METABOLISM); } // ========================================================================== // Setters // ========================================================================== void set_gaussians(const list& gaussians) { current_gaussians_ = initial_gaussians_ = gaussians; } void set_sampling(int16_t val){ sampling_ = val; } virtual void set_segmentation(int8_t nb_segments, double* boundaries, PhenotypicFeature * features, bool separate_segments = false) { phenotypic_target_->set_segmentation(nb_segments, boundaries, features, separate_segments); } void set_var_method(PhenotypicTargetVariationMethod var_method) { var_method_ = var_method; } void set_var_prng(std::shared_ptr prng) { var_prng_ = prng; } void set_var_sigma(double sigma) { var_sigma_ = sigma; } void set_var_tau(int32_t tau) { var_tau_ = tau; } void set_var_sigma_tau(double sigma, int32_t tau) { var_sigma_ = sigma; var_tau_ = tau; } void set_noise_method(PhenotypicTargetNoiseMethod noise_method) { noise_method_ = noise_method; } void set_noise_prng(std::shared_ptr prng) { noise_prng_ = prng; } void set_noise_sigma(double sigma) { noise_sigma_ = sigma; } void set_noise_alpha(double alpha) { noise_alpha_ = alpha; } void set_noise_prob(double prob) { noise_prob_ = prob; } void set_noise_sampling_log(int8_t sampling_log) { noise_sampling_log_ = sampling_log; } protected : // ========================================================================== // Protected Methods // ========================================================================== void ApplyAutoregressiveMeanVariation(); void ApplyAutoregressiveHeightVariation(); // ========================================================================== // Attributes // ========================================================================== // ------------------------------------------------ Current Phenotypic Target std::unique_ptr phenotypic_target_; // ---------------------------------------------------------------- Gaussians /// Phenotypic target's constitutive Gaussians in their initial state std::list initial_gaussians_; /// Phenotypic target's constitutive Gaussians in their current state std::list current_gaussians_; // ----------------------------------------------------------------- Sampling /// Number of points to be generated from the gaussians. int16_t sampling_; // ---------------------------------------------------------------- Variation /// Variation method PhenotypicTargetVariationMethod var_method_; /// PRNG used for variation std::shared_ptr var_prng_; /// Autoregressive mean variation sigma parameter double var_sigma_; /// Autoregressive mean variation tau parameter int16_t var_tau_; // -------------------------------------------------------------------- Noise /// Current noise (pure noise that is added to the phenotypic target) AbstractFuzzy* cur_noise_ = NULL; /// PRNG used for noise std::shared_ptr noise_prng_; PhenotypicTargetNoiseMethod noise_method_; /// Alpha value (variance coefficient) double noise_alpha_; /// Variance of the noise double noise_sigma_; /// Probability of variation. double noise_prob_; /// Log2 of the number of points in the noise fuzzy_set int8_t noise_sampling_log_; }; // ============================================================================ // Inline functions' definition // ============================================================================ } // namespace aevol #endif // AEVOL_PHENOTYPIC_TARGET_HANDLER_H_ aevol-5.0/src/libaevol/Stats.h0000644000175000017500000001415612724051151013245 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** /*! \class Stats \brief Manage statistics files */ #ifndef AEVOL_STATS_H_ #define AEVOL_STATS_H_ // ================================================================= // Libraries // ================================================================= #include #include // ================================================================= // Project Files // ================================================================= #include #include #include #include #include "Individual.h" #include "ReplicationReport.h" namespace aevol { // ================================================================= // Class declarations // ================================================================= class ExpManager; class Stats { public : // ================================================================= // Constructors // ================================================================= Stats() = delete; Stats(const Stats&) = delete; Stats(const std::string prefix, const std::string postfix = "", bool best_indiv_only = false); Stats(ExpManager* exp_m, bool best_indiv_only = false, const std::string prefix = "stat", const std::string postfix = "", bool with_plasmids = false, bool compute_phen_contrib_by_GU = false); Stats(ExpManager* exp_m, int64_t time, bool best_indiv_only = false, const std::string prefix = "stat", const std::string postfix = "", bool addition_old_stats = true, bool delete_old_stats = true); // ================================================================= // Destructors // ================================================================= virtual ~Stats(); // ================================================================= // Accessors: getters // ================================================================= // ================================================================= // Accessors: setters // ================================================================= inline void set_exp_m(ExpManager * exp_m); // ================================================================= // Public Methods // ================================================================= void write_current_generation_statistics(); void write_statistics_of_this_indiv(Individual* indiv, ReplicationReport* replic_report); void flush(); void write_headers(bool ancstats_stats = false); void CreateTmpFiles(int64_t time); void Propagate(const std::string& destdir, int64_t propagated_timestep); void PromoteTmpFiles(); protected : // ================================================================= // Protected Methods // ================================================================= void init_data(); void set_file_names(const std::string prefix, const std::string postfix, bool best_indiv_only, bool with_plasmids = false, bool compute_phen_contrib_by_GU = false); void open_files(); inline void write_header(FILE* file_name, const char* header); inline void write_header(FILE* file_name, const char* header, int8_t key); // ================================================================= // Protected Attributes // ================================================================= ExpManager * exp_m_; // 3D tables of stat files (FILE*) and their names (char*) // Dimensions are given by: // * genetic unit (ALL_GU, CHROM or PLASMIDS) // * BEST or GLOB // * stat type (FITNESS_STATS, MUTATION_STATS, GENES_STATS, BP_STATS or REAR_STATS) // Files that are not wanted MUST have their name set to NULL. // The files themselves are also NULL because we don't fopen() them. FILE**** stat_files_; char**** stat_files_names_; }; // ===================================================================== // Accessors' definitions // ===================================================================== // ===================================================================== // Inline functions' definition // ===================================================================== inline void Stats::set_exp_m(ExpManager * exp_m) { exp_m_ = exp_m; } inline void Stats::write_header(FILE* file_name, const char* header) { if (file_name != NULL) fprintf(file_name, "# %s\n", header); } inline void Stats::write_header(FILE* file_name, const char* header, int8_t key) { if (file_name != NULL) fprintf(file_name, "# %2d. %s\n", key, header); } } // namespace aevol #endif // AEVOL_STATS_H_ aevol-5.0/src/libaevol/JumpingMT.h0000644000175000017500000001647412724051151014026 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_JUMPING_MT_H_ #define AEVOL_JUMPING_MT_H_ // ================================================================= // Libraries // ================================================================= #include #include #include #include #include #include // ================================================================= // Project Files // ================================================================= #include "SFMT-src-1.4/SFMT.h" #include "SFMT-src-1.4/jump/SFMT-jump.h" // ================================================================= // Class declarations // ================================================================= // MT_RAND_MAX = 2^32-1 #define MT_RAND_MAX 4294967295.0 #define MT_RAND_MAX_PLUS_1 4294967296.0 namespace aevol { class JumpingMT { public : // ================================================================= // Constructors // ================================================================= JumpingMT(const uint32_t& simple_seed); // Initialize with a simple uint32_t JumpingMT(const JumpingMT &model); // Create a copy of an existing generator JumpingMT(gzFile backup_file); // Load from a gz backup file // ================================================================= // Destructors // ================================================================= virtual ~JumpingMT(); // ================================================================= // Accessors: getters // ================================================================= // ================================================================= // Accessors: setters // ================================================================= // ================================================================= // Operators // ================================================================= // ================================================================= // Public Methods // ================================================================= inline double random(); // Double in [0, 1[ (uniform distribution) inline int8_t random(int8_t max); // ~ inline int16_t random(int16_t max); // ~ inline int32_t random(int32_t max); // ~ > Integer in [0, max[ (uniform distribution) inline int64_t random(int64_t max); // ~ int32_t binomial_random(int32_t nb, double prob); // Binomial drawing of parameters (nb, prob) double gaussian_random(); // Double following a Standard Normal distribution int8_t roulette_random(double* probs, int8_t nb_elts); // Roulette selection void multinomial_drawing (int32_t* destination, double* source, int32_t nb_drawings, int32_t colors); // Multinomial drawing of parameters (nb, {source[0], source[1], ... source[colors-1]}) void jump(); void save(gzFile backup_file) const; // ================================================================= // Public Attributes // ================================================================= static int32_t nb_jumps; static double jump_time; protected : // ================================================================= // Forbidden Constructors // ================================================================= JumpingMT() { printf("%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__); exit(EXIT_FAILURE); }; /*JumpingMT(const JumpingMT &model) { printf("%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__); exit(EXIT_FAILURE); };*/ // ================================================================= // Protected Methods // ================================================================= static double gammln(double X); // ================================================================= // Protected Attributes // ================================================================= sfmt_t* sfmt_; }; // ===================================================================== // Getters' definitions // ===================================================================== // ===================================================================== // Setters' definitions // ===================================================================== // ===================================================================== // Operators' definitions // ===================================================================== // ===================================================================== // Inline functions' definition // ===================================================================== /*! Draw a double precision real-number in [0, 1) with a uniform distribution */ inline double JumpingMT::random() { return sfmt_genrand_real2(sfmt_); } /*! Draw an 8-bit integer in [0, max[ with a uniform distribution */ inline int8_t JumpingMT::random(int8_t max) { return (int8_t) floor(((double)max) * sfmt_genrand_real2(sfmt_)); } /*! Draw an 16-bit integer in [0, max[ with a uniform distribution */ inline int16_t JumpingMT::random(int16_t max) { return (int16_t) floor(((double)max) * sfmt_genrand_real2(sfmt_)); } /*! Draw an 32-bit integer in [0, max[ with a uniform distribution */ inline int32_t JumpingMT::random(int32_t max) { return (int32_t) floor(((double)max) * sfmt_genrand_real2(sfmt_)); } /*! Draw an 64-bit integer in [0, max[ with a uniform distribution */ inline int64_t JumpingMT::random(int64_t max) { return (int64_t) floor(((double)max) * sfmt_genrand_real2(sfmt_)); } } // namespace aevol #endif // AEVOL_JUMPING_MT_H_ aevol-5.0/src/libaevol/IndividualFactory.cpp0000644000175000017500000002013012724051151016107 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ============================================================================ // Includes // ============================================================================ #include "IndividualFactory.h" #include namespace aevol { //############################################################################## // # // Class IndividualFactory # // # //############################################################################## // ============================================================================ // Definition of static attributes // ============================================================================ // ============================================================================ // Constructors // ============================================================================ // ============================================================================ // Destructor // ============================================================================ // ============================================================================ // Methods // ============================================================================ /** * Create an individual with random sequences */ Individual* IndividualFactory::create_random_individual( ExpManager* exp_m, int32_t id, std::shared_ptr param_mut, std::shared_ptr mut_prng, std::shared_ptr stoch_prng, const Habitat& habitat, double w_max, int32_t min_genome_length, int32_t max_genome_length, int32_t chromosome_initial_length, bool allow_plasmids, bool plasmid_initial_gene, int32_t plasmid_initial_length, char* strain_name, std::shared_ptr local_prng, bool better_than_flat) { // Create a genome-less individual with the provided parameters #ifndef __REGUL Individual *indiv = new Individual(exp_m, mut_prng, stoch_prng, param_mut, w_max, min_genome_length, max_genome_length, allow_plasmids, id, strain_name, 0); #else Individual_R* indiv = new Individual_R(exp_m, mut_prng, stoch_prng, param_mut, w_max, min_genome_length, max_genome_length, allow_plasmids, id, strain_name, 0); #endif // Give it a randomly generated genome indiv->add_GU(indiv, chromosome_initial_length, local_prng); // If it was requested that the generated individual be better than a flat // one, test whether it is and if not re-generate until the condition is // satisfied double env_metabolic_area; if (better_than_flat) { #ifdef __REGUL env_metabolic_area = dynamic_cast(const_cast(&habitat))->phenotypic_target_handler().mean_environmental_area(); #else env_metabolic_area = habitat.phenotypic_target_handler().mean_environmental_area(); #endif indiv->EvaluateInContext(habitat); //TESTING //exit(EXIT_FAILURE); double r_compare = round((indiv->dist_to_target_by_feature(METABOLISM)-env_metabolic_area) * 1E10) / 1E10; // indiv->dist_to_target_by_feature(METABOLISM) >= env_metabolic_area while (r_compare >= 0.0) { #ifdef __REGUL indiv->set_networked(false); #endif // Replace the former chromosome by a new random one and re-evaluate the // individual indiv->remove_GU(0); indiv->add_GU(indiv, chromosome_initial_length, local_prng); indiv->EvaluateInContext(habitat); //debug : // printf("Dist to target du nouveau clone : %f\n", indiv->dist_to_target_by_feature(METABOLISM)); r_compare = round((indiv->dist_to_target_by_feature(METABOLISM)-env_metabolic_area) * 1E10) / 1E10; } } if (allow_plasmids) // We create a plasmid { if (plasmid_initial_gene) { // The plasmid is generated independently from the chromosome indiv->add_GU(indiv, plasmid_initial_length, local_prng); if (better_than_flat) { indiv->EvaluateInContext(habitat); while (indiv->genetic_unit(1). dist_to_target_by_feature(METABOLISM) >= env_metabolic_area) { indiv->remove_GU(1); indiv->add_GU(indiv, plasmid_initial_length, local_prng); indiv->EvaluateInContext(habitat); } } } else { // The plasmid is a copy of the chromosome char* plasmid_genome = new char[chromosome_initial_length + 1]; strncpy(plasmid_genome, indiv->genetic_unit_list().back().sequence(), chromosome_initial_length + 1); indiv->add_GU(plasmid_genome, chromosome_initial_length); } } // Insert a few IS in the sequence /*if (ae_common::init_params->init_method() & WITH_INS_SEQ) { // Create a random sequence int32_t seq_len = 50; char* ins_seq = new char[seq_len+1]; int16_t nb_insert = 50; int16_t nb_invert = 50; for (int32_t i = 0 ; i < seq_len ; i++) { ins_seq[i] = '0' + ae_common::sim->prng->random(NB_BASE); } ins_seq[seq_len] = '\0'; // Insert the sequence at random positions Mutation* mut1 = NULL; for (int16_t i = 0 ; i < nb_insert ; i++) { mut1 = indiv->genetic_unit(0)->dna()->do_insertion(ins_seq, seq_len); delete mut1; } // Invert the sequence and insert it at random positions char* inverted_seq = new char[seq_len+1]; for (int32_t i = 0 ; i < seq_len ; i++) { inverted_seq[i] = (ins_seq[seq_len-1-i] == '1') ? '0' : '1'; } inverted_seq[seq_len] = '\0'; for (int16_t i = 0 ; i < nb_invert ; i++) { mut1 = indiv->genetic_unit(0)->dna()->do_insertion(inverted_seq, seq_len); delete mut1; } delete [] ins_seq; delete [] inverted_seq; }*/ // If the individual hasn't been evaluated yet, do it if (not better_than_flat) { indiv->EvaluateInContext(habitat); } // Compute the "good" individual's statistics indiv->compute_statistical_data(); return indiv; } // ============================================================================ // Non inline accessors // ============================================================================ } // namespace aevol aevol-5.0/src/libaevol/ae_logger.h0000644000175000017500000000367712724051151014101 00000000000000/* * ae_logger.h * * Created on: Jan 26, 2015 * Author: arrouan */ #ifndef AE_LOGGER_H_ #define AE_LOGGER_H_ #include #include #include #include #include #include #include #include using namespace std; enum logger_category { SELECTION = 0, TOTAL = 1 }; class ae_logger { public : static inline void init(string file); static inline void addLog(int category, string msg); static inline void addLog(int category, long int msg); static inline void flush(int generation); static unordered_map> logMap; static string logFile; static std::mutex loggerMtx; }; //int cpt = 0; void ae_logger::init(string file) { ae_logger::logFile = file; } void ae_logger::addLog(int category, string msg) { loggerMtx.lock(); ae_logger::logMap[category].insert(msg); loggerMtx.unlock(); } void ae_logger::addLog(int category, long int msg) { std::stringstream ss; ss << msg; string msg_str = ss.str(); loggerMtx.lock(); ae_logger::logMap[category].insert(msg_str); loggerMtx.unlock(); } void ae_logger::flush(int generation) { ofstream loggerFile; loggerFile.open(ae_logger::logFile,ios::out | ios::app ); // printf("CPT: %d\n",cpt);cpt=0; loggerMtx.lock(); for (int i = 0; i <= 28; i++) { switch (i) { case SELECTION: loggerFile << "SELECTION," << generation; for (auto it = logMap[i].begin(); it != logMap[i].end(); ++it) { loggerFile << "," << *it; } loggerFile << endl; logMap[i].clear(); break; case TOTAL: if (logMap[i].size() > 0) { loggerFile << "TOTAL," << generation; for (auto it = logMap[i].begin(); it != logMap[i].end(); ++it) { loggerFile << "," << *it; } loggerFile << endl; logMap[i].clear(); } break; } } loggerMtx.unlock(); } #endif /* AE_LOGGER_H_ */ aevol-5.0/src/libaevol/ParameterLine.cpp0000644000175000017500000000600212724051151015221 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ================================================================= // Libraries // ================================================================= #include #include #include // ================================================================= // Project Files // ================================================================= #include "ParameterLine.h" namespace aevol { // ================================================================= // Class declarations // ================================================================= //############################################################################## // # // Class ParameterLine # // # //############################################################################## // ================================================================= // Constructors // ================================================================= ParameterLine::ParameterLine() { nb_words = 0; } // ================================================================= // Destructors // ================================================================= // ================================================================= // Public Methods // ================================================================= // ================================================================= // Protected Methods // ================================================================= } // namespace aevol aevol-5.0/src/libaevol/MutationParams.cpp0000644000175000017500000003010412724051151015435 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ================================================================= // Libraries // ================================================================= // ================================================================= // Project Files // ================================================================= #include "MutationParams.h" #include "Alignment.h" namespace aevol { //############################################################################## // # // Class MutationParams # // # //############################################################################## // ================================================================= // Definition of static attributes // ================================================================= // ================================================================= // Constructors // ================================================================= MutationParams::MutationParams() { // --------------------------------------------------------- Mutation rates point_mutation_rate_ = 0.0; small_insertion_rate_ = 0.0; small_deletion_rate_ = 0.0; max_indel_size_ = 0; // -------------------------------------------- Rearrangements and Transfer with_4pts_trans_ = false; with_alignments_ = false; with_HT_ = false; repl_HT_with_close_points_ = false; HT_ins_rate_ = 0.0; HT_repl_rate_ = 0.0; repl_HT_detach_rate_ = 0.0; // ------------------------------ Rearrangement rates (without alignements) duplication_rate_ = 0.0; deletion_rate_ = 0.0; translocation_rate_ = 0.0; inversion_rate_ = 0.0; // --------------------------------- Rearrangement rates (with alignements) neighbourhood_rate_ = 0.0; duplication_proportion_ = 0.0; deletion_proportion_ = 0.0; translocation_proportion_ = 0.0; inversion_proportion_ = 0.0; // ------------------------------------------------------------ Alignements align_fun_shape_ = SIGMOID; align_sigm_lambda_ = 4; align_sigm_mean_ = 50; align_lin_min_ = 0; align_lin_max_ = 100; align_max_shift_ = 20; align_w_zone_h_len_ = 50; align_match_bonus_ = 1; align_mismatch_cost_ = 2; } MutationParams::MutationParams(const MutationParams & model) { // --------------------------------------------------------- Mutation rates point_mutation_rate_ = model.point_mutation_rate_; small_insertion_rate_ = model.small_insertion_rate_; small_deletion_rate_ = model.small_deletion_rate_; max_indel_size_ = model.max_indel_size_; // -------------------------------------------- Rearrangements and Transfer with_4pts_trans_ = model.with_4pts_trans_; with_alignments_ = model.with_alignments_; with_HT_ = model.with_HT_; repl_HT_with_close_points_ = model.repl_HT_with_close_points_; HT_ins_rate_ = model.HT_ins_rate_; HT_repl_rate_ = model.HT_repl_rate_; repl_HT_detach_rate_ = model.repl_HT_detach_rate_; // ------------------------------ Rearrangement rates (without alignements) duplication_rate_ = model.duplication_rate_; deletion_rate_ = model.deletion_rate_; translocation_rate_ = model.translocation_rate_; inversion_rate_ = model.inversion_rate_; // --------------------------------- Rearrangement rates (with alignements) neighbourhood_rate_ = model.neighbourhood_rate_; duplication_proportion_ = model.duplication_proportion_; deletion_proportion_ = model.deletion_proportion_; translocation_proportion_ = model.translocation_proportion_; inversion_proportion_ = model.inversion_proportion_; // ------------------------------------------------------------ Alignements align_fun_shape_ = model.align_fun_shape_; align_sigm_lambda_ = model.align_sigm_lambda_; align_sigm_mean_ = model.align_sigm_mean_; align_lin_min_ = model.align_lin_min_; align_lin_max_ = model.align_lin_max_; align_max_shift_ = model.align_max_shift_; align_w_zone_h_len_ = model.align_w_zone_h_len_; align_match_bonus_ = model.align_match_bonus_; align_mismatch_cost_ = model.align_mismatch_cost_; } MutationParams::MutationParams(gzFile backup_file) { // --------------------------------------------------------- Mutation rates gzread(backup_file, &point_mutation_rate_, sizeof(point_mutation_rate_)); gzread(backup_file, &small_insertion_rate_, sizeof(small_insertion_rate_)); gzread(backup_file, &small_deletion_rate_, sizeof(small_deletion_rate_)); gzread(backup_file, &max_indel_size_, sizeof(max_indel_size_)); // -------------------------------------------- Rearrangements and Transfer int8_t tmp; gzread(backup_file, &tmp, sizeof(tmp)); with_4pts_trans_ = (tmp != 0); gzread(backup_file, &tmp, sizeof(tmp)); with_alignments_ = (tmp != 0); gzread(backup_file, &tmp, sizeof(tmp)); with_HT_ = (tmp != 0); gzread(backup_file, &tmp, sizeof(tmp)); repl_HT_with_close_points_ = (tmp != 0); gzread(backup_file, &HT_ins_rate_, sizeof(HT_ins_rate_)); gzread(backup_file, &HT_repl_rate_, sizeof(HT_repl_rate_)); gzread(backup_file, &repl_HT_detach_rate_, sizeof(repl_HT_detach_rate_)); // ------------------------------ Rearrangement rates (without alignements) gzread(backup_file, &duplication_rate_, sizeof(duplication_rate_)); gzread(backup_file, &deletion_rate_, sizeof(deletion_rate_)); gzread(backup_file, &translocation_rate_, sizeof(translocation_rate_)); gzread(backup_file, &inversion_rate_, sizeof(inversion_rate_)); // --------------------------------- Rearrangement rates (with alignements) gzread(backup_file, &neighbourhood_rate_, sizeof(neighbourhood_rate_)); gzread(backup_file, &duplication_proportion_, sizeof(duplication_proportion_)); gzread(backup_file, &deletion_proportion_, sizeof(deletion_proportion_)); gzread(backup_file, &translocation_proportion_, sizeof(translocation_proportion_)); gzread(backup_file, &inversion_proportion_, sizeof(inversion_proportion_)); // ------------------------------------------------------------ Alignements gzread(backup_file, &align_fun_shape_, sizeof(align_fun_shape_)); gzread(backup_file, &align_sigm_lambda_, sizeof(align_sigm_lambda_)); gzread(backup_file, &align_sigm_mean_, sizeof(align_sigm_mean_)); gzread(backup_file, &align_lin_min_, sizeof(align_lin_min_)); gzread(backup_file, &align_lin_max_, sizeof(align_lin_max_)); gzread(backup_file, &align_max_shift_, sizeof(align_max_shift_)); gzread(backup_file, &align_w_zone_h_len_, sizeof(align_w_zone_h_len_)); gzread(backup_file, &align_match_bonus_, sizeof(align_match_bonus_)); gzread(backup_file, &align_mismatch_cost_, sizeof(align_mismatch_cost_)); //Alignment::align_fun_shape = align_fun_shape_; //Alignment::align_sigm_lambda = align_sigm_lambda_; //Alignment::align_sigm_mean = align_sigm_mean_; //Alignment::align_lin_min = align_lin_min_; //Alignment::align_lin_max = align_lin_max_; //Alignment::align_max_shift = align_max_shift_; //Alignment::align_w_zone_h_len = align_w_zone_h_len_; //Alignment::align_match_bonus = align_match_bonus_; //Alignment::align_mismatch_cost = align_mismatch_cost_; } // ================================================================= // Destructors // ================================================================= MutationParams::~MutationParams() { } // ================================================================= // Public Methods // ================================================================= void MutationParams::save(gzFile backup_file) const { // --------------------------------------------------------- Mutation rates gzwrite(backup_file, &point_mutation_rate_, sizeof(point_mutation_rate_)); gzwrite(backup_file, &small_insertion_rate_, sizeof(small_insertion_rate_)); gzwrite(backup_file, &small_deletion_rate_, sizeof(small_deletion_rate_)); gzwrite(backup_file, &max_indel_size_, sizeof(max_indel_size_)); // -------------------------------------------- Rearrangements and Transfer int8_t tmp = with_4pts_trans_ ? 1 : 0; gzwrite(backup_file, &tmp, sizeof(tmp)); tmp = with_alignments_ ? 1 : 0; gzwrite(backup_file, &tmp, sizeof(tmp)); tmp = with_HT_ ? 1 : 0; gzwrite(backup_file, &tmp, sizeof(tmp)); tmp = repl_HT_with_close_points_ ? 1 : 0; gzwrite(backup_file, &tmp, sizeof(tmp)); gzwrite(backup_file, &HT_ins_rate_, sizeof(HT_ins_rate_)); gzwrite(backup_file, &HT_repl_rate_, sizeof(HT_repl_rate_)); gzwrite(backup_file, &repl_HT_detach_rate_, sizeof(repl_HT_detach_rate_)); // ------------------------------ Rearrangement rates (without alignements) gzwrite(backup_file, &duplication_rate_, sizeof(duplication_rate_)); gzwrite(backup_file, &deletion_rate_, sizeof(deletion_rate_)); gzwrite(backup_file, &translocation_rate_, sizeof(translocation_rate_)); gzwrite(backup_file, &inversion_rate_, sizeof(inversion_rate_)); // --------------------------------- Rearrangement rates (with alignements) gzwrite(backup_file, &neighbourhood_rate_, sizeof(neighbourhood_rate_)); gzwrite(backup_file, &duplication_proportion_, sizeof(duplication_proportion_)); gzwrite(backup_file, &deletion_proportion_, sizeof(deletion_proportion_)); gzwrite(backup_file, &translocation_proportion_, sizeof(translocation_proportion_)); gzwrite(backup_file, &inversion_proportion_, sizeof(inversion_proportion_)); // ------------------------------------------------------------ Alignements gzwrite(backup_file, &align_fun_shape_, sizeof(align_fun_shape_)); gzwrite(backup_file, &align_sigm_lambda_, sizeof(align_sigm_lambda_)); gzwrite(backup_file, &align_sigm_mean_, sizeof(align_sigm_mean_)); gzwrite(backup_file, &align_lin_min_, sizeof(align_lin_min_)); gzwrite(backup_file, &align_lin_max_, sizeof(align_lin_max_)); gzwrite(backup_file, &align_max_shift_, sizeof(align_max_shift_)); gzwrite(backup_file, &align_w_zone_h_len_, sizeof(align_w_zone_h_len_)); gzwrite(backup_file, &align_match_bonus_, sizeof(align_match_bonus_)); gzwrite(backup_file, &align_mismatch_cost_, sizeof(align_mismatch_cost_)); } // ================================================================= // Protected Methods // ================================================================= // ================================================================= // Non inline accessors // ================================================================= } // namespace aevol aevol-5.0/src/libaevol/Alignment.cpp0000644000175000017500000002556612724051151014427 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ================================================================= // Includes // ================================================================= #include "Alignment.h" #include "Utils.h" #include "Individual.h" namespace aevol { // ############################################################################ // // Class Alignment // // ############################################################################ // ================================================================= // Definition of static attributes // ================================================================= // ================================================================= // Constructors // ================================================================= // ================================================================= // Destructors // ================================================================= // ================================================================= // Public Methods // ================================================================= VisAVis* Alignment::search_alignment_direct(const Dna* chrom_1, const int32_t seed_1, const Dna* chrom_2, const int32_t seed_2, const int16_t needed_score) { VisAVis* best_alignment = NULL; int16_t nb_diags = 2 * chrom_1->indiv()->align_max_shift() + 1; VisAVis* cur_vav = NULL; // TODO : As VisAVis now contains its score, we // should adapt the code to make it more integrated int16_t cur_score; // Zone 1 (Index on the chromosome) // First base in working zone 1 int32_t w_zone_1_first = seed_1 - chrom_1->indiv()->align_w_zone_h_len(); // Last base in working zone 1 int32_t w_zone_1_last = seed_1 + chrom_1->indiv()->align_w_zone_h_len(); // First base in extended zone 1 int32_t x_zone_1_first = w_zone_1_first - chrom_1->indiv()->align_max_shift(); // Zone 2 (Index on the chromosome) // First base in working zone 2 int32_t w_zone_2_first = seed_2 - chrom_2->indiv()->align_w_zone_h_len(); // Last base in working zone 2 int32_t w_zone_2_last = seed_2 + chrom_2->indiv()->align_w_zone_h_len(); // This doesn't represent any point of interest // in the sequence but will spare some calculation int32_t w_zone_2_shifted_first = w_zone_2_first + chrom_2->indiv()->align_max_shift(); // Parse diagonals for (int16_t cur_diag = 0 ; cur_diag < nb_diags ; cur_diag++) { // Initialize cur_vav according to the diagonal we are on if (cur_diag < chrom_1->indiv()->align_max_shift()) { cur_vav = new VisAVis(chrom_1, chrom_2, x_zone_1_first + cur_diag, w_zone_2_first, DIRECT); } else if (cur_diag > chrom_1->indiv()->align_max_shift()) { cur_vav = new VisAVis(chrom_1, chrom_2, w_zone_1_first, w_zone_2_shifted_first - cur_diag, DIRECT); } else { // Central diagonal cur_vav = new VisAVis(chrom_1, chrom_2, w_zone_1_first, w_zone_2_first, DIRECT); } // A sequence against itself is not an alignment if (chrom_1 == chrom_2 && Utils::mod(cur_vav->i_1_, chrom_1->length()) == Utils::mod(cur_vav->i_2_, chrom_2->length())) { delete cur_vav; continue; } cur_score = 0; // Parse current diagonal while (cur_vav->i_1_ <= w_zone_1_last || cur_vav->i_2_ <= w_zone_2_last) { // Re-initialize score and potential alignment starting point if // score <= 0 if (cur_score <= 0) { cur_score = 0; if (best_alignment != NULL) { best_alignment->copy(cur_vav); } else { best_alignment = new VisAVis(*cur_vav); } } // Update Score if (cur_vav->match()) { cur_score += chrom_1->indiv()->align_match_bonus(); // Check whether score is high enough to rearrange if (cur_score >= needed_score) { delete cur_vav; best_alignment->check_indices(); best_alignment->score_ = cur_score; return best_alignment; } } else { cur_score -= chrom_1->indiv()->align_mismatch_cost(); } // Step forward cur_vav->step_fwd(); } delete cur_vav; } if (best_alignment != NULL) { delete best_alignment; } return NULL; // Didn't find any alignment with sufficient score. } VisAVis* Alignment::search_alignment_indirect(const Dna* chrom_1, const int32_t seed_1, const Dna* chrom_2, const int32_t seed_2, const int16_t needed_score) { VisAVis * best_alignment = NULL; int16_t nb_diags = 2 * chrom_1->indiv()->align_max_shift() + 1; int16_t cur_score; VisAVis * cur_vav = NULL; // Zone 1 (Indice on the chromosome) // First base in working zone 1 int32_t w_zone_1_first = seed_1 - chrom_1->indiv()->align_w_zone_h_len(); // Last base in working zone 1 int32_t w_zone_1_last = seed_1 + chrom_1->indiv()->align_w_zone_h_len(); // First base in extended zone 1 int32_t x_zone_1_first = w_zone_1_first - chrom_1->indiv()->align_max_shift(); // Zone 2 (Indice on the chromosome) // ********** WARNING ********** // Because we are reading backwards, every read is shifted by -1. // // 0 1 2 3 4 5 6 7 8 9 // |_|_|_|_|_|_|_|_|_|_| On this sequence, if you consider index 5, // the nucleotide you need to consider // for a backwards read is seq[4], NOT seq[5]. // // This is managed by class VisAVis. // // a b c d e f g h i j Creating a new VisAVis(F, 5, LAGGING); // |_|_|_|_|_|_|_|_|_|_| and then asking: my_vis_a_vis->match() will // | | | | | | | | | | | compare seq1[F] and seq2[4] // 9 8 7 6 5 4 3 2 1 0 (i.e. its "real" vis_a_vis). // my_vis_a_vis->match() returns true // if (seq1[F] == complementary(seq2[4])) // // In this example and with a align_w_zone_h_len of 2 and a max_shift of 1, // the working_zone and extended_zone will be defined by // w_zone_1_first = d // (f-2) // w_zone_1_last = h // (f+2) // x_zone_1_first = c // (f-2-1) // w_zone_2_first = 7 // The "real" vis_a_vis for d (5+2) // w_zone_2_last = 3 // The "real" vis_a_vis for h (5-2) // w_zone_2_shifted_first = 4 // (5-1). // // It is worth noting that the working zone is defined as follows: // // d e f g h Hence, while 'd' and 'h' do correspond to the zone's // |_|_|_|_|_| first and last nucleotides' indices, // | | | | | | '7' and '3' are indeed shifted and it seems they don't // 6 5 4 3 2 correspond to anything. I should have coded the limits // (i.e. 'd' and 'i' + '7' and '2') in the first place... // // // First base in working zone 2 int32_t w_zone_2_first = seed_2 + chrom_2->indiv()->align_w_zone_h_len(); // Last base in working zone 2 int32_t w_zone_2_last = seed_2 - chrom_2->indiv()->align_w_zone_h_len(); // This doesn't represent any interesting point // in the sequence but will spare some calculation int32_t w_zone_2_shifted_first = w_zone_2_first - chrom_2->indiv()->align_max_shift(); // Parse diagonals for (int16_t cur_diag = 0 ; cur_diag < nb_diags ; cur_diag++) { // Initialize cur_vav according to the diagonal we are on if (cur_diag < chrom_1->indiv()->align_max_shift()) { cur_vav = new VisAVis(chrom_1, chrom_2, x_zone_1_first + cur_diag, w_zone_2_first, INDIRECT); } else if (cur_diag > chrom_1->indiv()->align_max_shift()) { cur_vav = new VisAVis(chrom_1, chrom_2, w_zone_1_first, w_zone_2_shifted_first + cur_diag, INDIRECT); } else { // Central diagonal cur_vav = new VisAVis(chrom_1, chrom_2, w_zone_1_first, w_zone_2_first, INDIRECT); } cur_score = 0; // Parse diagonal while (cur_vav->i_1_ <= w_zone_1_last || cur_vav->i_2_ >= w_zone_2_last) { // Re-initialize score and potential alignment starting point if // score <= 0 if (cur_score <= 0) { cur_score = 0; if (best_alignment != NULL) { best_alignment->copy(cur_vav); } else { best_alignment = new VisAVis(*cur_vav); } } // Update Score if (cur_vav->match()) { cur_score += chrom_1->indiv()->align_match_bonus(); // Check whether score is high enough to rearrange if (cur_score >= needed_score) { delete cur_vav; best_alignment->check_indices(); best_alignment->score_ = cur_score; return best_alignment; } } else { cur_score -= chrom_1->indiv()->align_mismatch_cost(); } // Step forward cur_vav->step_fwd(); } delete cur_vav; } if (best_alignment != NULL) { delete best_alignment; } return NULL; // Didn't find any alignment with sufficient score. } } // namespace aevol // ================================================================= // Protected Methods // ================================================================= aevol-5.0/src/libaevol/ReplicationReport.cpp0000644000175000017500000002306112724051151016142 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ================================================================= // Libraries // ================================================================= // ================================================================= // Project Files // ================================================================= #include "ReplicationReport.h" #include "DnaReplicationReport.h" #include "Mutation.h" #include "Individual.h" #include "AeTime.h" #include "Observable.h" namespace aevol { //############################################################################## // # // Class ReplicationReport # // # //############################################################################## // ================================================================= // Definition of static attributes // ================================================================= // ================================================================= // Constructors // ================================================================= ReplicationReport::ReplicationReport(Individual* indiv, const Individual* parent, Individual* donor /*= NULL*/) { indiv_ = indiv; id_ = indiv->id(); rank_ = indiv->rank(); parent_id_ = parent->id(); // donor_id_ is set further down genome_size_ = 0; metabolic_error_ = 0.0; nb_genes_activ_ = 0; nb_genes_inhib_ = 0; nb_non_fun_genes_ = 0; nb_coding_RNAs_ = 0; nb_non_coding_RNAs_ = 0; parent_metabolic_error_ = parent->dist_to_target_by_feature(METABOLISM); parent_secretion_error_ = parent->dist_to_target_by_feature(SECRETION); parent_genome_size_ = parent->total_genome_size(); mean_align_score_ = 0.0; if (donor == NULL) { donor_id_ = -1; donor_metabolic_error_ = 0.0; donor_secretion_error_ = 0.0; donor_genome_size_ = 0; } else { donor_id_ = donor->id(); donor_metabolic_error_ = donor->dist_to_target_by_feature(METABOLISM); donor_secretion_error_ = donor->dist_to_target_by_feature(SECRETION); donor_genome_size_ = donor->total_genome_size(); } } // Creates an independent copy of the original report ReplicationReport::ReplicationReport(const ReplicationReport& other) : dna_replic_report_(other.dna_replic_report_) { parent_id_ = other.parent_id_; donor_id_ = other.donor_id_; id_ = other.id_; rank_ = other.rank_; genome_size_ = other.genome_size_; metabolic_error_ = other.metabolic_error_; nb_genes_activ_ = other.nb_genes_activ_; nb_genes_inhib_ = other.nb_genes_inhib_; nb_non_fun_genes_ = other.nb_non_fun_genes_; nb_coding_RNAs_ = other.nb_coding_RNAs_; nb_non_coding_RNAs_ = other.nb_non_coding_RNAs_; parent_metabolic_error_ = other.parent_metabolic_error_; parent_secretion_error_ = other.parent_secretion_error_; donor_metabolic_error_ = other.donor_metabolic_error_; donor_secretion_error_ = other.donor_secretion_error_; parent_genome_size_ = other.parent_genome_size_; donor_genome_size_ = other.donor_genome_size_; mean_align_score_ = other.mean_align_score_; } ReplicationReport::ReplicationReport(gzFile tree_file, Individual* indiv) { indiv_ = indiv; gzread(tree_file, &id_, sizeof(id_)); gzread(tree_file, &rank_, sizeof(rank_)); gzread(tree_file, &parent_id_, sizeof(parent_id_)); gzread(tree_file, &donor_id_, sizeof(donor_id_)); gzread(tree_file, &genome_size_, sizeof(genome_size_)); gzread(tree_file, &metabolic_error_, sizeof(metabolic_error_)); gzread(tree_file, &nb_genes_activ_, sizeof(nb_genes_activ_)); gzread(tree_file, &nb_genes_inhib_, sizeof(nb_genes_inhib_)); gzread(tree_file, &nb_non_fun_genes_, sizeof(nb_non_fun_genes_)); gzread(tree_file, &nb_coding_RNAs_, sizeof(nb_coding_RNAs_)); gzread(tree_file, &nb_non_coding_RNAs_, sizeof(nb_non_coding_RNAs_)); dna_replic_report_.read_from_tree_file(tree_file); dna_replic_report_.compute_stats(); parent_metabolic_error_ = -1; parent_secretion_error_ = -1; donor_metabolic_error_ = -1; parent_genome_size_ = -1; donor_genome_size_ = -1; mean_align_score_ = 0.0; } // ================================================================= // Destructors // ================================================================= // ================================================================= // Public Methods // ================================================================= /** * Set the individual corresponding to this replication report and * the characteristics of its parent * * This should be called as soon as a replication is started (just after calling * the offspring constructor and before doing the mutations) */ void ReplicationReport::init(Individual* offspring, Individual* parent) { indiv_ = offspring; id_ = indiv_->id(); parent_id_ = parent->id(); genome_size_ = 0; metabolic_error_ = 0.0; nb_genes_activ_ = 0; nb_genes_inhib_ = 0; nb_non_fun_genes_ = 0; nb_coding_RNAs_ = 0; nb_non_coding_RNAs_ = 0; parent_metabolic_error_ = parent->dist_to_target_by_feature(METABOLISM); parent_secretion_error_ = parent->dist_to_target_by_feature(SECRETION); parent_genome_size_ = parent->total_genome_size(); mean_align_score_ = 0.0; // Set ourselves an observer of indiv_'s MUTATION and END_REPLICATION indiv_->addObserver(this, MUTATION); indiv_->addObserver(this, END_REPLICATION); } /** * Method called at the end of the replication of an individual. * Actions such as finalize the calculation of average values can be done here. */ void ReplicationReport::signal_end_of_replication(Individual* indiv) { // TODO tmp patch if (indiv_ == NULL) indiv_ = indiv; // Retrieve data from the individual genome_size_ = indiv_->total_genome_size(); metabolic_error_ = indiv_->dist_to_target_by_feature(METABOLISM); nb_genes_activ_ = indiv_->nb_genes_activ(); nb_genes_inhib_ = indiv_->nb_genes_inhib(); nb_non_fun_genes_ = indiv_->nb_functional_genes(); nb_coding_RNAs_ = indiv_->nb_coding_RNAs(); nb_non_coding_RNAs_ = indiv_->nb_non_coding_RNAs(); } /** * Method called at the end of a generation. * Actions such as update the individuals' ranks can be done here. */ void ReplicationReport::signal_end_of_generation() { rank_ = indiv_->rank(); } void ReplicationReport::write_to_tree_file(gzFile tree_file) const { // Store individual identifiers and rank gzwrite(tree_file, &id_, sizeof(id_)); assert(rank_ != -1); gzwrite(tree_file, &rank_, sizeof(rank_)); gzwrite(tree_file, &parent_id_, sizeof(parent_id_)); gzwrite(tree_file, &donor_id_, sizeof(donor_id_)); gzwrite(tree_file, &genome_size_, sizeof(genome_size_)); gzwrite(tree_file, &metabolic_error_, sizeof(metabolic_error_)); gzwrite(tree_file, &nb_genes_activ_, sizeof(nb_genes_activ_)); gzwrite(tree_file, &nb_genes_inhib_, sizeof(nb_genes_inhib_)); gzwrite(tree_file, &nb_non_fun_genes_, sizeof(nb_non_fun_genes_)); gzwrite(tree_file, &nb_coding_RNAs_, sizeof(nb_coding_RNAs_)); gzwrite(tree_file, &nb_non_coding_RNAs_, sizeof(nb_non_coding_RNAs_)); dna_replic_report_.write_to_tree_file(tree_file); } // ================================================================= // Protected Methods // ================================================================= // ================================================================= // Non inline accessors // ================================================================= void ReplicationReport::update(Observable& o, ObservableEvent e, void* arg) { switch (e) { case END_REPLICATION : signal_end_of_replication(dynamic_cast(&o)); break; case MUTATION : dna_replic_report_.add_mut(reinterpret_cast(arg)); break; default : Utils::ExitWithDevMsg("Event not handled", __FILE__, __LINE__); } } } // namespace aevol aevol-5.0/src/libaevol/Logging.cpp0000644000175000017500000003510212724051151014062 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ================================================================= // Libraries // ================================================================= // ================================================================= // Project Files // ================================================================= #include "Logging.h" #include "ExpSetup.h" namespace aevol { //############################################################################## // # // Class Logging # // # //############################################################################## // ================================================================= // Definition of static attributes // ================================================================= // ================================================================= // Constructors // ================================================================= Logging::Logging() { logs_ = 0; transfer_log_ = NULL; rear_log_ = NULL; barrier_log_ = NULL; //param_modification_log_ = NULL; } // ================================================================= // Destructors // ================================================================= Logging::~Logging() { if (logs_ & LOG_TRANSFER) { fclose(transfer_log_); } if (logs_ & LOG_REAR) { fclose(rear_log_); } if (logs_ & LOG_BARRIER) { fclose(barrier_log_); } /*if (logs_ & LOG_LOADS) { fclose(param_modification_log_); }*/ } // ================================================================= // Public Methods // ================================================================= /*void Logging::save(gzFile setup_file) const { gzwrite(backup_file, &logs_, sizeof(logs_)); }*/ void Logging::load(int8_t logs, int32_t num_gener) { char* line = new char[500]; logs_ = logs; // Prepare required log files if (logs_ & LOG_TRANSFER) { rename ("log_transfer.out", "log_transfer.out.old"); FILE* old_transfer_log = fopen("log_transfer.out.old", "r"); if (old_transfer_log == NULL) { printf("Error: Failed to open file \"log_transfer.out.old\"\n"); exit(EXIT_FAILURE); } transfer_log_ = fopen("log_transfer.out", "w"); if (transfer_log_ == NULL) { printf("Error: Failed to open file \"log_transfer.out\"\n"); exit(EXIT_FAILURE); } // Copy file headers if (fgets(line, 500, old_transfer_log) == NULL) { // TODO check for error } while (!feof(old_transfer_log) && line[0] == '#') { fputs(line, transfer_log_); if (fgets(line, 500, old_transfer_log) == NULL) { // TODO check for error } } // This is the empty line between the header and the values //fputs(line, transfer_log_); // Copy log entries until num_gener (excluded) while ((int32_t)atol(line) < num_gener && !feof(old_transfer_log)) { fputs(line, transfer_log_); if (fgets(line, 500, old_transfer_log) == NULL) { // TODO check for error } while(!feof(old_transfer_log) & (line[0] == '\t' || line[0] == ' ')) { fputs(line, transfer_log_); if (fgets(line, 500, old_transfer_log) == NULL) { // TODO check for error } } } fclose(old_transfer_log); remove("log_transfer.out.old"); } if (logs_ & LOG_REAR) { rename ("log_rear.out", "log_rear.out.old"); FILE* old_rear_log = fopen("log_rear.out.old", "r"); if (old_rear_log == NULL) { printf("Error: Failed to open file \"log_rear.out.old\"\n"); exit(EXIT_FAILURE); } rear_log_ = fopen("log_rear.out", "w"); if (rear_log_ == NULL) { printf("Error: Failed to open file \"log_rear.out\"\n"); exit(EXIT_FAILURE); } // Copy file headers if (fgets(line, 500, old_rear_log) == NULL) { // TODO check for error } while (!feof(old_rear_log) && line[0] == '#') { fputs(line, rear_log_); if (fgets(line, 500, old_rear_log) == NULL) { // TODO check for error } } // This is the empty line between the header and the values //fputs(line, rear_log_); // Copy log entries until num_gener (excluded) while ((int32_t)atol(line) < num_gener && !feof(old_rear_log)) { fputs(line, rear_log_); if (fgets(line, 500, old_rear_log) == NULL) { // TODO check for error } } fclose(old_rear_log); remove("log_rear.out.old"); } if (logs_ & LOG_BARRIER) { rename ("log_barrier.out", "log_barrier.out.old"); FILE* old_barrier_log = fopen("log_barrier.out.old", "r"); if (old_barrier_log == NULL) { printf("Error: Failed to open file \"log_barrier.out.old\"\n"); exit(EXIT_FAILURE); } barrier_log_ = fopen("log_barrier.out", "w"); if (barrier_log_ == NULL) { printf("Error: Failed to open file \"log_barrier.out\"\n"); exit(EXIT_FAILURE); } // Copy file headers if (fgets(line, 500, old_barrier_log) == NULL) { // TODO check for error } while (!feof(old_barrier_log) && line[0] == '#') { fputs(line, barrier_log_); if (fgets(line, 500, old_barrier_log) == NULL) { // TODO check for error } } // This is the empty line between the header and the values //fputs(line, barrier_log_); // Copy log entries until num_gener (excluded) while ((int32_t)atol(line) < num_gener && !feof(old_barrier_log)) { fputs(line, barrier_log_); if (fgets(line, 500, old_barrier_log) == NULL) { // TODO check for error } } fclose(old_barrier_log); remove("log_barrier.out.old"); } /*if (logs_ & LOG_LOADS) { rename ("log_param_modification.out", "log_param_modification.out.old"); FILE* old_param_modification_log = fopen("log_param_modification.out.old", "r"); if (old_param_modification_log == NULL) { printf("Error: Failed to open file \"log_param_modification.out.old\"\n"); exit(EXIT_FAILURE); } param_modification_log_ = fopen("log_param_modification.out", "w"); if (param_modification_log_ == NULL) { printf("Error: Failed to open file \"log_param_modification.out\"\n"); exit(EXIT_FAILURE); } //Copy file headers ret = fgets(line, 500, old_param_modification_log); while (!feof(old_param_modification_log) && line[0] == '#') { fputs(line, param_modification_log_); ret = fgets(line, 500, old_param_modification_log); } // This is the empty line between the header and the values //fputs(line, param_modification_log_); // Copy log entries until num_gener (excluded) while ((int32_t)atol(line) < num_gener && !feof(old_param_modification_log)) { fputs(line, param_modification_log_); ret = fgets(line, 500, old_param_modification_log); } fclose(old_param_modification_log); remove("log_param_modification.out.old"); }*/ delete [] line; } void Logging::print_to_file(FILE* file) const { fprintf(file, "logs : %" PRId8 "\n", logs_); } void Logging::set_logs(int8_t logs) { logs_ = logs; // Open required log files if (logs_ & LOG_TRANSFER) { transfer_log_ = fopen("log_transfer.out", "w"); if (transfer_log_ == NULL) { printf("Error: Failed to open file \"log_transfer.out\"\n"); exit(EXIT_FAILURE); } } if (logs_ & LOG_REAR) { rear_log_ = fopen("log_rear.out", "w"); if (rear_log_ == NULL) { printf("Error: Failed to open file \"log_rear.out\"\n"); exit(EXIT_FAILURE); } } if (logs_ & LOG_BARRIER) { barrier_log_ = fopen("log_barrier.out", "w"); if (barrier_log_ == NULL) { printf("Error: Failed to open file \"log_barrier.out\"\n"); exit(EXIT_FAILURE); } } /*if (logs_ & LOG_LOADS) { param_modification_log_ = fopen("log_param_modification.out", "w"); if (param_modification_log_ == NULL) { printf("Error: Failed to open file \"log_param_modification.out\"\n"); exit(EXIT_FAILURE); } }*/ this->write_headers(); } void Logging::flush() { if (logs_ & LOG_TRANSFER) { fflush(transfer_log_); } if (logs_ & LOG_REAR) { fflush(rear_log_); } if (logs_ & LOG_BARRIER) { fflush(barrier_log_); } /*if (logs_ & LOG_LOADS) { fflush(param_modification_log_); }*/ } // ================================================================= // Protected Methods // ================================================================= void Logging::write_headers() const { // ========== TRANSFER LOG ========== if (logs_ & LOG_TRANSFER) { fprintf(transfer_log_, "######################################################################\n"); fprintf(transfer_log_, "# Horizontal transfer log\n"); fprintf(transfer_log_, "#\n"); fprintf(transfer_log_, "# Log of every horizontal transfer that occured during the simulation\n"); fprintf(transfer_log_, "#\n"); fprintf(transfer_log_, "# 1. Generation\n"); fprintf(transfer_log_, "# 2. Index of the recepient\n"); fprintf(transfer_log_, "# 3. Index of the donor (generation n-1)\n"); fprintf(transfer_log_, "# 4. Type of transfer\n"); fprintf(transfer_log_, "# 5. Length of the transferred segment\n"); fprintf(transfer_log_, "# 6. Length of the replaced segment (if any)\n"); fprintf(transfer_log_, "# 7. Size of the genome before the transfer\n"); fprintf(transfer_log_, "# 8. Size of the genome after the transfer\n"); fprintf(transfer_log_, "# 9. Alignment 1 point 1\n"); fprintf(transfer_log_, "# 10. Alignment 1 point 2\n"); fprintf(transfer_log_, "# 11. Alignment 1 score\n"); fprintf(transfer_log_, "# 12. Alignment 2 point 1\n"); fprintf(transfer_log_, "# 13. Alignment 2 point 2\n"); fprintf(transfer_log_, "# 14. Alignment 2 score\n"); fprintf(transfer_log_, "#\n"); fprintf(transfer_log_, "######################################################################\n"); fprintf(transfer_log_, "#\n"); fprintf(transfer_log_, "# Header for R\n"); fprintf(transfer_log_, "gener recepient donor t_type seg_len replaced_len size_before size_after align1_pt1 align1_pt2 score1 align2_pt1 align2_pt2 score2\n"); fprintf(transfer_log_, "#\n"); } // ========== REAR LOG ========== if (logs_ & LOG_REAR) { fprintf(rear_log_, "######################################################################\n"); fprintf(rear_log_, "# Chromosomal rearrangement log\n"); fprintf(rear_log_, "#\n"); fprintf(rear_log_, "# Log of every rearrangement that occured during the simulation\n"); fprintf(rear_log_, "# (not just one lineage)\n"); fprintf(rear_log_, "#\n"); fprintf(rear_log_, "# 1. Generation\n"); fprintf(rear_log_, "# 2. Index of the individual that has undergone the rearrangement\n"); fprintf(rear_log_, "# 3. Type of rearrangement\n"); fprintf(rear_log_, "# 4. Length of the rearranged segment\n"); fprintf(rear_log_, "# 5. Size of the genome before the rearrangement\n"); fprintf(rear_log_, "# 6. Alignment score that was needed for this rearrangement to occur\n"); fprintf(rear_log_, "# 7. Second alignment score (translocation only)\n"); fprintf(rear_log_, "#\n"); fprintf(rear_log_, "######################################################################\n"); fprintf(rear_log_, "#\n"); fprintf(rear_log_, "# Header for R\n"); fprintf(rear_log_, "gener indiv r_type seg_len genome_size score1 score2\n"); fprintf(rear_log_, "#\n"); } // ========== BARRIER LOG ========== if (logs_ & LOG_BARRIER) { fprintf(barrier_log_, "######################################################################\n"); fprintf(barrier_log_, "# Genome size limits log\n"); fprintf(barrier_log_, "#\n"); fprintf(barrier_log_, "# An entry is written whenever a mutation would have produced a\n"); fprintf(barrier_log_, "# genome whose size wouldn't lie in [min, max].\n"); fprintf(barrier_log_, "# The corresponding mutation is \"cancelled\"\n"); fprintf(barrier_log_, "#\n"); fprintf(barrier_log_, "# 1. Generation\n"); fprintf(barrier_log_, "# 2. Index of the individual\n"); fprintf(barrier_log_, "# 3. Type of event\n"); fprintf(barrier_log_, "# 4. Segment length\n"); fprintf(barrier_log_, "# 5. Replaced segment length\n"); fprintf(barrier_log_, "# 6. GU size (before the event)\n"); fprintf(barrier_log_, "# 7. Genome size (before the event)\n"); fprintf(barrier_log_, "#\n"); fprintf(barrier_log_, "######################################################################\n"); } // ========== LOADS LOG ========== /*if (logs_ & LOG_LOADS) { fprintf(param_modification_log_, "######################################################################\n"); fprintf(param_modification_log_, "# Parameter modification log\n"); fprintf(param_modification_log_, "#\n"); fprintf(param_modification_log_, "# An entry is written whenever a parameter is modified by aevol_modify.\n"); fprintf(param_modification_log_, "######################################################################\n"); }*/ } } // namespace aevol aevol-5.0/src/libaevol/SmallDeletion.h0000644000175000017500000001020712724051151014674 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_SMALLDELETION_H_ #define AEVOL_SMALLDELETION_H_ // ============================================================================ // Includes // ============================================================================ #include #include "LocalMutation.h" namespace aevol { /** * */ class SmallDeletion : public LocalMutation { public : // ========================================================================== // Constructors // ========================================================================== SmallDeletion() = default; //< Default ctor SmallDeletion(const SmallDeletion&) = default; //< Copy ctor SmallDeletion(SmallDeletion&&) = default; //< Move ctor SmallDeletion(int32_t pos, int16_t length); virtual Mutation* Clone() const override { return new SmallDeletion(*this); }; // ========================================================================== // Destructor // ========================================================================== virtual ~SmallDeletion() noexcept = default; //< Destructor // ========================================================================== // Operators // ========================================================================== /// Copy assignment SmallDeletion& operator=(const SmallDeletion& other) = default; /// Move assignment SmallDeletion& operator=(SmallDeletion&& other) = delete; // ========================================================================== // Public Methods // ========================================================================== virtual void save(gzFile backup_file) const override; virtual void load(gzFile backup_file) override; void generic_description_string(char* str) const override; // ========================================================================== // Getters // ========================================================================== virtual MutationType mut_type() const override { return S_DEL; }; int32_t pos() const { return pos_; }; int16_t length() const { return length_; }; // ========================================================================== // Setters // ========================================================================== protected : // ========================================================================== // Protected Methods // ========================================================================== // ========================================================================== // Attributes // ========================================================================== int32_t pos_; int16_t length_; }; } // namespace aevol #endif //AEVOL_SMALLDELETION_H_ aevol-5.0/src/libaevol/Duplication.h0000644000175000017500000001064512724051151014421 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_DUPLICATION_H_ #define AEVOL_DUPLICATION_H_ // ============================================================================ // Includes // ============================================================================ #include "Rearrangement.h" #include "sys/types.h" namespace aevol { /** * */ class Duplication : public Rearrangement { public : // ========================================================================== // Constructors // ========================================================================== Duplication() = default; //< Default ctor Duplication(const Duplication&) = default; //< Copy ctor Duplication(Duplication&&) = delete; //< Move ctor Duplication(int32_t pos1, int32_t pos2, int32_t pos3, int32_t length, int16_t align_score = -1) : pos1_{pos1}, pos2_{pos2}, pos3_{pos3},length_{length}, align_score_{align_score} {} virtual Mutation* Clone() const override { return new Duplication(*this); }; // ========================================================================== // Destructor // ========================================================================== virtual ~Duplication() noexcept = default; //< Destructor // ========================================================================== // Operators // ========================================================================== /// Copy assignment Duplication& operator=(const Duplication& other) = default; /// Move assignment Duplication& operator=(Duplication&& other) = delete; // ========================================================================== // Public Methods // ========================================================================== virtual void save(gzFile backup_file) const override; virtual void load(gzFile backup_file) override; void generic_description_string(char* str) const override; // ========================================================================== // Getters // ========================================================================== virtual MutationType mut_type() const override { return DUPL; }; int32_t pos1() const { return pos1_; } int32_t pos2() const { return pos2_; } int32_t pos3() const { return pos3_; } int32_t length() const { return length_; } int16_t align_score() const { return align_score_; } // ========================================================================== // Setters // ========================================================================== protected : // ========================================================================== // Protected Methods // ========================================================================== // ========================================================================== // Attributes // ========================================================================== int32_t pos1_, pos2_, pos3_; int32_t length_; int16_t align_score_ = -1; }; } // namespace aevol #endif //AEVOL_DUPLICATION_H_ aevol-5.0/src/libaevol/DnaReplicationReport.h0000644000175000017500000000701412724051151016232 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_DNA_REPLICATION_REPORT_H_ #define AEVOL_DNA_REPLICATION_REPORT_H_ #include #include #include "Mutation.h" #include "LocalMutation.h" #include "HorizontalTransfer.h" #include "Rearrangement.h" namespace aevol { class Dna; class DnaReplicationReport { friend class Dna; public : // ================================================================= // Constructors // ================================================================= DnaReplicationReport() = default; DnaReplicationReport(const DnaReplicationReport&); DnaReplicationReport(DnaReplicationReport&&) = delete; // ================================================================= // Destructor // ================================================================= ~DnaReplicationReport() = default; // ========================================================================== // Operators // ========================================================================== /// Copy assignment DnaReplicationReport& operator=(const DnaReplicationReport& other) = delete; /// Move assignment DnaReplicationReport& operator=(DnaReplicationReport&& other) = delete; // Accessors const std::list>& mutations() const { return mutations_; }; const std::list>& rearrangements() const { return rearrangements_; }; const std::list>& HT() const { return ht_; }; int32_t nb(MutationType t) const; // Public Methods void compute_stats(); // useful when we inspect a tree file void add_mut(Mutation* mut); void add_local_mut(Mutation* mut); void add_rear(Mutation* mut); void add_HT(Mutation* mut); void write_to_tree_file(gzFile tree_file) const; void read_from_tree_file(gzFile tree_file); protected : /// Lists of mutations, rearrangements and undergone std::list> mutations_; std::list> rearrangements_; std::list> ht_; // Number of mutations/rearrangements/HT of each (simple) type undergone int32_t nb_mut_[10] = {0,0,0,0,0,0,0,0,0,0}; }; } // namespace aevol #endif // AEVOL_DNA_REPLICATION_REPORT_H_ aevol-5.0/src/libaevol/Observable.cpp0000644000175000017500000000516512724051151014566 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ============================================================================ // Includes // ============================================================================ #include "Observable.h" // ============================================================================ // Definition of static attributes // ============================================================================ // ============================================================================ // Constructors // ============================================================================ // ============================================================================ // Destructor // ============================================================================ // ============================================================================ // Methods // ============================================================================ /** * Notify all observers of event e providing optional argument */ void Observable::notifyObservers(ObservableEvent e, void* arg) { for (auto& o : observers_[e]) { o->update(*this, e, arg); } } // ============================================================================ // Non inline accessors // ============================================================================ aevol-5.0/src/libaevol/PointMutation.h0000644000175000017500000001005512724051151014753 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_POINTMUTATION_H_ #define AEVOL_POINTMUTATION_H_ // ============================================================================ // Includes // ============================================================================ #include #include "LocalMutation.h" namespace aevol { /** * */ class PointMutation : public LocalMutation { public : // ========================================================================== // Constructors // ========================================================================== PointMutation() = default; //< Default ctor PointMutation(const PointMutation&) = default; //< Copy ctor PointMutation(PointMutation&&) = delete; //< Move ctor PointMutation(int32_t pos); virtual Mutation* Clone() const override { return new PointMutation(*this); }; // ========================================================================== // Destructor // ========================================================================== virtual ~PointMutation() noexcept = default; //< Destructor // ========================================================================== // Operators // ========================================================================== /// Copy assignment PointMutation& operator=(const PointMutation& other) = default; /// Move assignment PointMutation& operator=(PointMutation&& other) = delete; // ========================================================================== // Public Methods // ========================================================================== virtual void save(gzFile backup_file) const override; virtual void load(gzFile backup_file) override; void generic_description_string(char* str) const override; // ========================================================================== // Getters // ========================================================================== virtual MutationType mut_type() const override { return SWITCH; }; int32_t pos() const { return pos_; } // ========================================================================== // Setters // ========================================================================== protected : // ========================================================================== // Protected Methods // ========================================================================== // ========================================================================== // Attributes // ========================================================================== int32_t pos_; }; } // namespace aevol #endif //AEVOL_POINTMUTATION_H_ aevol-5.0/src/libaevol/GridCell.cpp0000644000175000017500000001211312724051151014156 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ================================================================= // Includes // ================================================================= #include "GridCell.h" #if __cplusplus == 201103L #include "make_unique.h" #endif #include #include "Individual.h" #ifdef __X11 #include "Individual_X11.h" #endif #ifdef __REGUL #include "raevol/Individual_R.h" #include "raevol/Habitat_R.h" #endif using std::cout; using std::endl; namespace aevol { //############################################################################## // # // Class GridCell # // # //############################################################################## // ================================================================= // Definition of static attributes // ================================================================= // ================================================================= // Constructors // ================================================================= GridCell::GridCell(int16_t x, int16_t y, std::unique_ptr&& habitat, Individual* indiv, std::shared_ptr mut_prng, std::shared_ptr stoch_prng) { x_ = x; y_ = y; mut_prng_ = mut_prng; stoch_prng_ = stoch_prng; individual_ = indiv; habitat_ = std::move(habitat); } GridCell::GridCell(gzFile backup_file, ExpManager* exp_m, PhenotypicTargetHandler* phenotypic_target_handler) { load(backup_file, exp_m, phenotypic_target_handler); } // ================================================================= // Destructors // ================================================================= GridCell::~GridCell() { delete individual_; } // ================================================================= // Public Methods // ================================================================= void GridCell::ApplyHabitatVariation() { habitat_->ApplyVariation(); } void GridCell::save(gzFile backup_file, bool skip_phenotypic_target /*=false*/) const { gzwrite(backup_file, &x_, sizeof(x_)); gzwrite(backup_file, &y_, sizeof(y_)); mut_prng_->save(backup_file); stoch_prng_->save(backup_file); #ifndef __REGUL habitat_->save(backup_file, skip_phenotypic_target); individual_->save(backup_file); #else (dynamic_cast (habitat_.get()))->save(backup_file, skip_phenotypic_target); (dynamic_cast (individual_))->save(backup_file); #endif } void GridCell::load(gzFile backup_file, ExpManager * exp_m, PhenotypicTargetHandler* phenotypic_target_handler) { gzread(backup_file, &x_, sizeof(x_)); gzread(backup_file, &y_, sizeof(y_)); // Retrieve PRNGs mut_prng_ = std::make_shared(backup_file); stoch_prng_ = std::make_shared(backup_file); habitat_ = HabitatFactory::create_unique_habitat(backup_file, phenotypic_target_handler); // Create individual se charge de retourner un individual_R pour RAevol individual_ = Individual::CreateIndividual(exp_m, backup_file); individual_->set_mut_prng(mut_prng_); individual_->set_stoch_prng(stoch_prng_); individual_->set_grid_cell(this); } /// TODO std::shared_ptr GridCell::mut_prng() const { return mut_prng_; } /// TODO std::shared_ptr GridCell::stoch_prng() const { return stoch_prng_; } // ================================================================= // Protected Methods // ================================================================= } // namespace aevol aevol-5.0/src/libaevol/AbstractFuzzy.cpp0000644000175000017500000000010512724051151015302 00000000000000// // Created by arrouan on 30/07/15. // #include "AbstractFuzzy.h" aevol-5.0/src/libaevol/GeneticUnit.cpp0000644000175000017500000035374712724051151014734 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ================================================================= // Includes // ================================================================= #include "GeneticUnit.h" #include #include #include #include "FuzzyFactory.h" #include "ExpManager.h" #include "ExpSetup.h" #include "Codon.h" #include "Mutation.h" #include "ae_enums.h" #ifdef __REGUL #include "raevol/Individual_R.h" #else #include "Individual.h" #endif #include "Fuzzy.h" #include "PointMutation.h" #include "SmallDeletion.h" #include "SmallInsertion.h" #include "Duplication.h" #include "Deletion.h" #include "Translocation.h" #include "Inversion.h" #include "InsertionHT.h" #include "ReplacementHT.h" namespace aevol { // ================================================================= // Miscellaneous Functions // ================================================================= int compare_prot_pos(const void* pos, const void* prot) // This function has to be a plain int // to comply with the definition of bsearch() { if (((Protein*) prot)->shine_dal_pos() == *(int32_t*) pos) { return 0; } else { return 1; } } //############################################################################## // # // Class genetic_unit # // # //############################################################################## // ===================================================================== // Accessors' definitions // ===================================================================== ExpManager* GeneticUnit::exp_m() const { return exp_m_; } Individual* GeneticUnit::indiv() const { return indiv_; } Dna* GeneticUnit::dna() const { assert(dna_->length() != 0); return dna_; } const Promoters2Strands& GeneticUnit::rna_list() const { return rna_list_; } #ifndef __REGUL std::list& GeneticUnit::protein_list(Strand strand) { return protein_list_[strand]; } #else std::list& GeneticUnit::protein_list(Strand strand) { return protein_list_[strand]; } #endif void GeneticUnit::clear_protein_list(Strand strand) { protein_list_[strand].clear(); } AbstractFuzzy* GeneticUnit::activ_contribution() const { return activ_contribution_; } AbstractFuzzy* GeneticUnit::inhib_contribution() const { return inhib_contribution_; } AbstractFuzzy* GeneticUnit::phenotypic_contribution() const { assert(phenotypic_contribution_ != NULL); return phenotypic_contribution_; } /*! Returns the DNA sequence */ const char* GeneticUnit::sequence() const { return dna_->data(); } /*! Returns the DNA sequence length */ int32_t GeneticUnit::seq_length() const { return dna_->length(); } int32_t GeneticUnit::nb_coding_RNAs() const { return nb_coding_RNAs_; } int32_t GeneticUnit::nb_non_coding_RNAs() const { return nb_non_coding_RNAs_; } double GeneticUnit::overall_size_coding_RNAs() const { return overall_size_coding_RNAs_; } double GeneticUnit::av_size_coding_RNAs() const { if (nb_coding_RNAs_ != 0) { return overall_size_coding_RNAs_ / nb_coding_RNAs_; } else { return 0.0; } } double GeneticUnit::overall_size_non_coding_RNAs() const { return overall_size_non_coding_RNAs_; } double GeneticUnit::av_size_non_coding_RNAs() const { if (nb_non_coding_RNAs_ != 0) { return overall_size_non_coding_RNAs_ / nb_non_coding_RNAs_; } else { return 0.0; } } int32_t GeneticUnit::nb_genes_activ() const { return nb_genes_activ_; } int32_t GeneticUnit::nb_genes_inhib() const { return nb_genes_inhib_; } int32_t GeneticUnit::nb_functional_genes() const { return nb_fun_genes_; } int32_t GeneticUnit::nb_non_functional_genes() const { return nb_non_fun_genes_; } double GeneticUnit::overall_size_functional_genes() const { return overall_size_fun_genes_; } double GeneticUnit::av_size_functional_genes() const { if (nb_fun_genes_ != 0) { return overall_size_fun_genes_ / nb_fun_genes_; } else { return 0.0; } } double GeneticUnit::overall_size_non_functional_genes() const { return overall_size_non_fun_genes_; } double GeneticUnit::av_size_non_functional_genes() const { if (nb_non_fun_genes_ != 0) { return overall_size_non_fun_genes_ / nb_non_fun_genes_; } else { return 0.0; } } int32_t GeneticUnit::nb_bases_in_0_CDS() const { assert (non_coding_computed_); return nb_bases_in_0_CDS_; } int32_t GeneticUnit::nb_bases_in_0_functional_CDS() const { assert (non_coding_computed_); return nb_bases_in_0_functional_CDS_; } int32_t GeneticUnit::nb_bases_in_0_non_functional_CDS() const { assert (non_coding_computed_); return nb_bases_in_0_non_functional_CDS_; } int32_t GeneticUnit::nb_bases_in_0_RNA() const { assert (non_coding_computed_); return nb_bases_in_0_RNA_; } int32_t GeneticUnit::nb_bases_in_0_coding_RNA() const { assert (non_coding_computed_); return nb_bases_in_0_coding_RNA_; } int32_t GeneticUnit::nb_bases_in_0_non_coding_RNA() const { assert (non_coding_computed_); return nb_bases_in_0_non_coding_RNA_; } int32_t GeneticUnit::nb_bases_non_essential() const { assert (non_coding_computed_); return nb_bases_non_essential_; } int32_t GeneticUnit::nb_bases_non_essential_including_nf_genes() const { assert (non_coding_computed_); return nb_bases_non_essential_including_nf_genes_; } int32_t GeneticUnit::nb_bases_in_neutral_regions() const { assert (non_coding_computed_); return nb_bases_in_neutral_regions_; } int32_t GeneticUnit::nb_neutral_regions() const { assert (non_coding_computed_); return nb_neutral_regions_; } int32_t* GeneticUnit::beginning_neutral_regions() const { assert (non_coding_computed_); return beginning_neutral_regions_; } int32_t* GeneticUnit::end_neutral_regions() const { assert (non_coding_computed_); return end_neutral_regions_; } double GeneticUnit::modularity() const { return modularity_; } double GeneticUnit::dist_to_target_by_feature( PhenotypicFeature feature) const { assert(distance_to_target_computed_); return dist_to_target_by_feature_[feature]; } double GeneticUnit::fitness() const { assert(fitness_computed_); return fitness_; } double GeneticUnit::fitness_by_feature(PhenotypicFeature feature) const { assert(fitness_computed_); return fitness_by_feature_[feature]; } int32_t GeneticUnit::min_gu_length() const { return min_gu_length_; } int32_t GeneticUnit::max_gu_length() const { return max_gu_length_; } void GeneticUnit::set_min_gu_length(int32_t min_gu_length) { min_gu_length_ = min_gu_length; } void GeneticUnit::set_max_gu_length(int32_t max_gu_length) { max_gu_length_ = max_gu_length; } void GeneticUnit::set_exp_m(ExpManager* exp_m) { exp_m_ = exp_m; } // ===================================================================== // functions' definition // ===================================================================== void GeneticUnit::print_rnas() const { print_rnas(rna_list_); } /* static */ void GeneticUnit::print_rnas(const Promoters2Strands& rnas) { print_rnas(rnas[LEADING], LEADING); print_rnas(rnas[LAGGING], LAGGING); } /* static */ void GeneticUnit::print_rnas(const Promoters1Strand& rnas, Strand strand) { printf(" %s (%" PRId32 ")\n", strand == LEADING ? " LEADING " : "LAGGING", static_cast(rnas.size())); for (auto& rna: rnas) { assert(rna.strand() == strand); printf(" Promoter on %s at %" PRId32 "\n", strand == LEADING ? " LEADING " : "LAGGING", rna.promoter_pos()); } } bool GeneticUnit::is_start(Strand strand, int32_t index) const { return (codon(strand, index) == CODON_START); } bool GeneticUnit::is_stop(Strand strand, int32_t index) const { return (codon(strand, index) == CODON_STOP); } void GeneticUnit::remove_all_promoters() { rna_list_[LEADING].clear(); rna_list_[LAGGING].clear(); } void GeneticUnit::move_all_promoters_after(int32_t pos, int32_t delta_pos) { move_all_leading_promoters_after(pos, delta_pos); move_all_lagging_promoters_after(pos, delta_pos); } void GeneticUnit::extract_promoters_included_in(int32_t pos_1, int32_t pos_2, Promoters2Strands& extracted_promoters) { assert(pos_1 >= 0); assert(pos_1 < pos_2); assert(pos_2 <= dna_->length()); if (pos_2 - pos_1 < PROM_SIZE) { return; } extract_leading_promoters_starting_between(pos_1, pos_2 - PROM_SIZE + 1, extracted_promoters[LEADING]); extract_lagging_promoters_starting_between(pos_1 + PROM_SIZE - 1, pos_2, extracted_promoters[LAGGING]); } void GeneticUnit::extract_promoters_starting_between(int32_t pos_1, int32_t pos_2, Promoters2Strands& extracted_promoters) { extract_leading_promoters_starting_between(pos_1, pos_2, extracted_promoters[LEADING]); extract_lagging_promoters_starting_between(pos_1, pos_2, extracted_promoters[LAGGING]); } /*! \brief Remove those promoters that would be broken if the chromosome was cut at pos. Remove promoters that include BOTH the base before AND after pos (marked X in the cartoon below). If the genome is smaller than the size of a promoter, all the promoters will be removed. \verbatim ------------------------------------------------------- | | | | | X | X | | | | | | | | | ------------------------------------------------------- ^ ^ 0 pos \endverbatim */ void GeneticUnit::remove_promoters_around(int32_t pos) { if (dna_->length() >= PROM_SIZE) { remove_leading_promoters_starting_between(Utils::mod(pos - PROM_SIZE + 1, dna_->length()), pos); remove_lagging_promoters_starting_between(pos, Utils::mod(pos + PROM_SIZE - 1, dna_->length())); } else { remove_all_promoters(); } } /*! \brief Remove those promoters that would be broken if the sequence [pos_1 ; pos_2[ was deleted. Remove promoters that * include BOTH the base before AND after pos_1 (marked X in the cartoon below). * include BOTH the base before AND after pos_2 (marked Y in the cartoon below). * are completely contained between pos_1 and pos_2. If the remaining sequence, i.e. [pos_2 ; pos_1[ is smaller than the size of a promoter, all the promoters will be removed. \verbatim ------------------------------------------------------- | | | | | X | X | | | | Y | Y | | | | ------------------------------------------------------- ^ ^ ^ 0 pos_1 pos_2 \endverbatim */ void GeneticUnit::remove_promoters_around(int32_t pos_1, int32_t pos_2) { if (Utils::mod(pos_1 - pos_2, dna_->length()) >= PROM_SIZE) { remove_leading_promoters_starting_between(Utils::mod(pos_1 - PROM_SIZE + 1, dna_->length()), pos_2); remove_lagging_promoters_starting_between(pos_1, Utils::mod(pos_2 + PROM_SIZE - 1, dna_->length())); } else { remove_all_promoters(); } } /// Look for promoters that are astride pos and add them to the list /// of promoters (rna_list_). /// /// Look for promoters that include BOTH the base before AND after pos (marked X in the cartoon below). /// If the genome is smaller than the size of a promoter, no search is performed. /// /// \verbatim /// ------------------------------------------------------- /// | | | | | X | X | | | | | | | | | /// ------------------------------------------------------- /// ^ ^ /// 0 pos /// \endverbatim void GeneticUnit::look_for_new_promoters_around(int32_t pos) { assert(pos >= 0 && pos <= dna_->length()); if (dna_->length() >= PROM_SIZE) { look_for_new_leading_promoters_starting_between( Utils::mod(pos - PROM_SIZE + 1, dna_->length()), pos); look_for_new_lagging_promoters_starting_between( pos, Utils::mod(pos + PROM_SIZE - 1, dna_->length())); } } /// Look for promoters that contain at least 1 base lying in [pos_1 ; /// pos_2[ and add them to the list of promoters (rna_list_). /// /// Look for promoters that * include BOTH the base before AND after pos_1 (marked X in the cartoon below). /// * include BOTH the base before AND after pos_2 (marked Y in the cartoon below). /// * are completely contained between pos_1 and pos_2. /// If the genome is smaller than the size of a promoter, no search is performed. /// /// \verbatim /// ------------------------------------------------------- /// | | | | | X | X | | | | Y | Y | | | | /// ------------------------------------------------------- /// ^ ^ ^ /// 0 pos_1 pos_2 /// \endverbatim void GeneticUnit::look_for_new_promoters_around(int32_t pos_1, int32_t pos_2) { //~ if (Utils::mod(pos_1 - pos_2, dna_->length()) == PROM_SIZE - 1) //~ { //~ // We have to look at every possible position on the genome. //~ locate_promoters(); //~ } /*else*/ if (dna_->length() >= PROM_SIZE) { look_for_new_leading_promoters_starting_between( Utils::mod(pos_1 - PROM_SIZE + 1, dna_->length()), pos_2); look_for_new_lagging_promoters_starting_between(pos_1, Utils::mod( pos_2 + PROM_SIZE - 1, dna_->length())); } } void GeneticUnit::copy_promoters_starting_between(int32_t pos_1, int32_t pos_2, Promoters2Strands& new_promoter_lists) { copy_leading_promoters_starting_between(pos_1, pos_2, new_promoter_lists[LEADING]); copy_lagging_promoters_starting_between(pos_1, pos_2, new_promoter_lists[LAGGING]); } void GeneticUnit::copy_promoters_included_in(int32_t pos_1, int32_t pos_2, Promoters2Strands& new_promoter_lists) { if (Utils::mod(pos_2 - pos_1 - 1, dna_->length()) + 1 >= PROM_SIZE) { copy_leading_promoters_starting_between(pos_1, Utils::mod(pos_2 - PROM_SIZE + 1, dna_->length()), new_promoter_lists[LEADING]); copy_lagging_promoters_starting_between(Utils::mod(pos_1 + PROM_SIZE - 1, dna_->length()), pos_2, new_promoter_lists[LAGGING]); } } // ================================================================= // Definition of static attributes // ================================================================= // ================================================================= // Constructors // ================================================================= /*! \brief Create a new genetic unit for indiv with a random DNA sequence of length length Promoters will be looked for on the whole sequence but no further process will be performed. */ GeneticUnit::GeneticUnit(Individual* indiv, int32_t length, std::shared_ptr prng) { indiv_ = indiv; exp_m_ = indiv->exp_m(); transcribed_ = false; translated_ = false; phenotypic_contributions_computed_ = false; non_coding_computed_ = false; distance_to_target_computed_ = false; fitness_computed_ = false; min_gu_length_ = -1; max_gu_length_ = -1; dna_ = new Dna(this, length, prng); // Create empty fuzzy sets for the phenotypic contributions activ_contribution_ = FuzzyFactory::fuzzyFactory->create_fuzzy(); inhib_contribution_ = FuzzyFactory::fuzzyFactory->create_fuzzy(); phenotypic_contribution_ = NULL; // NB : phenotypic_contribution_ is only an indicative value, // it is not used for the whole phenotype computation // dist_to_target_per_segment_ depends on the segmentation of the environment // and will hence be newed at evaluation time dist_to_target_per_segment_ = NULL; dist_to_target_by_feature_ = new double[NB_FEATURES]; fitness_by_feature_ = new double[NB_FEATURES]; for (int8_t i = 0; i < NB_FEATURES; i++) { dist_to_target_by_feature_[i] = 0.0; fitness_by_feature_[i] = 0.0; } // Look for promoters locate_promoters(); init_statistical_data(); } /// Create a new genetic unit for `indiv` with sequence `seq` of size /// `length` [and containing promoters `prom_list`] /// /// Promoters will be looked for if prom_list is not provided (this /// may take some time). /// /// WARNING: /// seq will be used directly which means the caller must not delete it /// The same goes for prom_list if it is provided. GeneticUnit::GeneticUnit(Individual* indiv, char* seq, int32_t length, const Promoters2Strands& prom_list /* = {{},{}} */) { exp_m_ = indiv->exp_m(); indiv_ = indiv; transcribed_ = false; translated_ = false; phenotypic_contributions_computed_ = false; non_coding_computed_ = false; distance_to_target_computed_ = false; fitness_computed_ = false; min_gu_length_ = -1; max_gu_length_ = -1; dna_ = new Dna(this, seq, length); if (not prom_list[LEADING].empty() and not prom_list[LAGGING].empty()) { // if not default `prom_list` // Copy rna lists rna_list_ = prom_list; Dna::set_GU(rna_list_, this); } else { for (auto& strand: {LEADING, LAGGING}) assert(rna_list_[strand].empty()); // Look for promoters locate_promoters(); } // Create empty fuzzy sets for the phenotypic contributions activ_contribution_ = FuzzyFactory::fuzzyFactory->create_fuzzy(); inhib_contribution_ = FuzzyFactory::fuzzyFactory->create_fuzzy(); phenotypic_contribution_ = NULL; // NB : phenotypic_contribution_ is only an indicative value, // it is not used for the whole phenotype computation // Initialize all the fitness-related stuff dist_to_target_per_segment_ = NULL; dist_to_target_by_feature_ = new double[NB_FEATURES]; fitness_by_feature_ = new double[NB_FEATURES]; for (int8_t i = 0; i < NB_FEATURES; i++) { dist_to_target_by_feature_[i] = 0.0; fitness_by_feature_[i] = 0.0; } init_statistical_data(); } /*! \brief Copy constructor. Copies the DNA and recomputes all the rest. It is slower than copying as much as possible and regenerate only what is necessary but it works whatever the state of the model GU. */ GeneticUnit::GeneticUnit(Individual* indiv, const GeneticUnit& model) { exp_m_ = indiv->exp_m(); indiv_ = indiv; transcribed_ = false; translated_ = false; phenotypic_contributions_computed_ = false; non_coding_computed_ = false; distance_to_target_computed_ = model.distance_to_target_computed_; fitness_computed_ = model.fitness_computed_; min_gu_length_ = model.min_gu_length_; max_gu_length_ = model.max_gu_length_; // Copy DNA dna_ = new Dna(this, *(model.dna_)); // Create empty fuzzy sets for the phenotypic contributions activ_contribution_ = FuzzyFactory::fuzzyFactory->create_fuzzy(); inhib_contribution_ = FuzzyFactory::fuzzyFactory->create_fuzzy(); phenotypic_contribution_ = NULL; // NB : phenotypic_contribution_ is only an indicative value, not used for the whole phenotype computation dist_to_target_per_segment_ = NULL; dist_to_target_by_feature_ = new double [NB_FEATURES]; fitness_by_feature_ = new double [NB_FEATURES]; for ( int8_t i = 0 ; i < NB_FEATURES ; i++ ) { dist_to_target_by_feature_[i] = 0.0; fitness_by_feature_[i] = 0.0; } // Compute everything init_statistical_data(); locate_promoters(); do_transcription(); do_translation(); compute_phenotypic_contribution(); } /** * Reproduction constructor * * Create a new genetic unit copying the DNA sequence and the promoter list * from the provided `parent` */ GeneticUnit::GeneticUnit(Individual* indiv, const GeneticUnit* parent) { exp_m_ = indiv->exp_m(); indiv_ = indiv; transcribed_ = false; translated_ = false; phenotypic_contributions_computed_ = false; non_coding_computed_ = false; distance_to_target_computed_ = false; fitness_computed_ = false; min_gu_length_ = parent->min_gu_length_; max_gu_length_ = parent->max_gu_length_; // Copy DNA dna_ = new Dna(this, parent->dna_); // Copy promoter list (rna_list_) // Note that the length of the RNA will have to be recomputed (do_transcription) for (auto& strand: {LEADING, LAGGING}) { for (auto& rna: parent->rna_list_[strand]) { #ifndef __REGUL rna_list_[strand].emplace_back(this, rna); #else rna_list_[strand].emplace_back(this, rna); #endif } } // Create empty fuzzy sets for the phenotypic contributions activ_contribution_ = FuzzyFactory::fuzzyFactory->create_fuzzy(); inhib_contribution_ = FuzzyFactory::fuzzyFactory->create_fuzzy(); phenotypic_contribution_ = NULL; // NB : phenotypic_contribution_ is only an indicative value, not used for the whole phenotype computation // Initialize all the fitness-related stuff dist_to_target_per_segment_ = NULL; dist_to_target_by_feature_ = new double[NB_FEATURES]; fitness_by_feature_ = new double[NB_FEATURES]; for (int8_t i = 0; i < NB_FEATURES; i++) { dist_to_target_by_feature_[i] = 0.0; fitness_by_feature_[i] = 0.0; } init_statistical_data(); } GeneticUnit::GeneticUnit(Individual* indiv, gzFile backup_file) { exp_m_ = indiv->exp_m(); indiv_ = indiv; transcribed_ = false; translated_ = false; phenotypic_contributions_computed_ = false; non_coding_computed_ = false; distance_to_target_computed_ = false; fitness_computed_ = false; dna_ = new Dna(this, backup_file); gzread(backup_file, &min_gu_length_, sizeof(min_gu_length_)); gzread(backup_file, &max_gu_length_, sizeof(max_gu_length_)); // Create empty fuzzy sets for the phenotypic contributions activ_contribution_ = FuzzyFactory::fuzzyFactory->create_fuzzy(); inhib_contribution_ = FuzzyFactory::fuzzyFactory->create_fuzzy(); phenotypic_contribution_ = NULL; // NB : phenotypic_contribution_ is only an indicative value, not used for the whole phenotype computation // Initialize all the fitness-related stuff dist_to_target_per_segment_ = NULL; dist_to_target_by_feature_ = new double[NB_FEATURES]; fitness_by_feature_ = new double[NB_FEATURES]; for (int8_t i = 0; i < NB_FEATURES; i++) { dist_to_target_by_feature_[i] = 0.0; fitness_by_feature_[i] = 0.0; } // Look for promoters locate_promoters(); init_statistical_data(); } /*! \brief Create a new genetic unit for indiv with a sequence saved in a text file Promoters will be looked for on the whole sequence but no further process will be performed. */ GeneticUnit::GeneticUnit(Individual* indiv, char* organism_file_name) { exp_m_ = indiv->exp_m(); indiv_ = indiv; transcribed_ = false; translated_ = false; phenotypic_contributions_computed_ = false; non_coding_computed_ = false; distance_to_target_computed_ = false; fitness_computed_ = false; dna_ = new Dna(this, organism_file_name); // Create empty fuzzy sets for the phenotypic contributions activ_contribution_ = FuzzyFactory::fuzzyFactory->create_fuzzy(); inhib_contribution_ = FuzzyFactory::fuzzyFactory->create_fuzzy(); phenotypic_contribution_ = NULL; // NB : phenotypic_contribution_ is only an indicative value, // it is not used for the whole phenotype computation // Initialize all the fitness-related stuff dist_to_target_per_segment_ = NULL; dist_to_target_by_feature_ = new double[NB_FEATURES]; fitness_by_feature_ = new double[NB_FEATURES]; for (int8_t i = 0; i < NB_FEATURES; i++) { dist_to_target_by_feature_[i] = 0.0; fitness_by_feature_[i] = 0.0; } // Look for promoters locate_promoters(); init_statistical_data(); } // ================================================================= // Destructors // ================================================================= GeneticUnit::~GeneticUnit() { delete dna_; delete activ_contribution_; delete inhib_contribution_; if (phenotypic_contribution_ != NULL) delete phenotypic_contribution_; if (dist_to_target_per_segment_ != NULL) delete[] dist_to_target_per_segment_; assert(dist_to_target_by_feature_ != NULL); delete[] dist_to_target_by_feature_; assert(fitness_by_feature_ != NULL); delete[] fitness_by_feature_; delete[] beginning_neutral_regions_; delete[] end_neutral_regions_; } // ================================================================= // Public Methods // ================================================================= /// Look for promoters in the genome and create a new Rna in the /// corresponding strand's RNA list void GeneticUnit::locate_promoters() { // TODO vld 2015-04-14: make it return the generated rna-list rather // than alter the current one? int8_t dist; // Hamming distance of the sequence from the promoter consensus // Empty RNA list for (auto& strand: rna_list_) { strand.clear(); } if (dna_->length() < PROM_SIZE) { return; } for (int32_t i = 0; i < dna_->length(); i++) { #ifndef __REGUL if (is_promoter(LEADING, i, dist)) { // dist takes the hamming distance of the sequence from the consensus rna_list_[LEADING].emplace_back(this, LEADING, i, dist); } if (is_promoter(LAGGING, dna_->length() - i - 1, dist)) { rna_list_[LAGGING].emplace_back(this, LAGGING, dna_->length() - i - 1, dist); } #else if (is_promoter(LEADING, i, dist)) { Rna_R rna(this, LEADING, i, dist); rna_list_[LEADING].push_back(rna); } if (is_promoter(LAGGING, dna_->length() - i - 1, dist)) { Rna_R rna(this, LAGGING, dna_->length() - i - 1, dist); rna_list_[LAGGING].push_back(rna); } #endif } } void GeneticUnit::do_transcription() { if (transcribed_) return; transcribed_ = true; int32_t transcript_start = -1; int32_t genome_length = dna_->length(); // If the genome is not long enough to bear a promoter and a terminator, // we set all its RNAs to a length of -1 // (NB but a terminator can share code with the promoter, making it // possible for the genome to be no longer than the promoter) if (genome_length < PROM_SIZE) { for (auto& strand: rna_list_) for (auto& rna: strand) rna.set_transcript_length(-1); return; } for (auto& strand_id: {LEADING, LAGGING}) { auto& strand = rna_list_[strand_id]; for (auto rna = strand.begin(); rna != strand.end(); ++rna) { transcript_start = rna->first_transcribed_pos(); rna->set_transcript_length(-1); int32_t i; for (i = 0; i < genome_length; ++i) { if (is_terminator(strand_id, transcript_start + (strand_id == LEADING ? i : -i))) { // Found terminator => set transcript's length rna->set_transcript_length(i + TERM_SIZE); // Deduce the length of all the RNAs that share the same terminator // These are the RNAs whose promoter is entirely (and strictly) included // between the promoter and the terminator of the RNA we have just treated. // They are hence the RNAs whose promoter starts at most i bases after the // current rna's promoter for (auto rna2 = std::next(rna); rna2 != strand.end(); ++rna2) { // We know that if rna2 is after rna then: // - rna_2.pos > rna.pos for LEADING strand // - rna_2.pos < rna.pos for LAGGING strand // because the list is sorted. auto delta_pos = abs( rna2->promoter_pos() - rna->promoter_pos()); if (delta_pos <= i) { rna2->set_transcript_length(i - delta_pos + TERM_SIZE); } else { // The promoter of rna_2 is after (or contains a part of) the terminator of rna, // we will need to search its own terminator break; } } // Terminator found for this RNA, nothing else to do (for this RNA) break; } } if (i == genome_length) { // We have searched the whole genome and found no terminator for this promoter. // We consider that no RNA can actually be produced, hence we set the transcript // length to -1. This will prevent the search for coding sequences downstream of this promoter. // However, we do not destroy the Rna object, it must still be kept in memory and // transmitted to the offspring in case a mutation recreates a terminator. rna->set_transcript_length(-1); } } } } void GeneticUnit::do_translation() { if (translated_) { return; } translated_ = true; if (not transcribed_) { do_transcription(); } int32_t transcript_start = -1; int32_t transcript_length = -1; int32_t genome_length = dna_->length(); for (auto strand: {LEADING, LAGGING}) { for (auto& rna: rna_list_[strand]) { transcript_start = rna.first_transcribed_pos(); transcript_length = rna.transcript_length(); // Try every position where a translation process could occur // Minimum number of bases needed is SHINE_DAL_SIZE + SHINE_START_SPACER + 3 * CODON_SIZE // (3 codons for START + STOP + at least one amino-acid) for (int32_t i = 0; transcript_length - i >= DO_TRANSLATION_LOOP; ++i) { if (is_shine_dalgarno(strand, Utils::mod(transcript_start + (strand == LEADING ? i : -i), genome_length)) and is_start(strand, Utils::mod(transcript_start + (strand == LEADING ? 1 : -1) * (i + SHINE_DAL_SIZE + SHINE_START_SPACER), genome_length))) { // We found a translation initiation, we can now build the // protein until we find a STOP codon or until we reach the // end of the transcript (in which case the protein is not // valid) // First of all, we will check whether this CDS has already // been translated (because it is present on another RNA). // In that case, we don't need to tranlate it again, we only // need to increase the protein's concentration according to // the promoter transcription level int32_t shine_dal_pos = Utils::mod(transcript_start + (strand == LEADING ? i : -i), genome_length); auto& protein_strand = protein_list_[strand]; auto protein = find_if(protein_strand.begin(), protein_strand.end(), [shine_dal_pos](Protein& p) { return p.shine_dal_pos() == shine_dal_pos; }); if (protein != protein_strand.end()) { protein->add_RNA(&rna); rna.add_transcribed_protein(&*protein); } else { // Build codon list and make new protein when stop found int32_t j = i + SHINE_DAL_SIZE + SHINE_START_SPACER + CODON_SIZE; // next codon to examine std::list codon_list; while (transcript_length - j >= CODON_SIZE) { auto codon = new Codon(dna_, strand, Utils::mod(transcript_start + (strand == LEADING ? j : -j), genome_length)); if (codon->is_stop()) { if (not codon_list.empty()) { // at least one amino-acid // The protein is valid, create the corresponding object protein_strand.emplace_back(this, codon_list, strand, shine_dal_pos, &rna, indiv()->w_max()); auto& protein = protein_strand.back(); codon_list.clear(); // has been copied into `protein` rna.add_transcribed_protein(&protein); if (protein.is_functional()) { nb_fun_genes_++; overall_size_fun_genes_ += protein.length() * CODON_SIZE; if (protein.height() > 0) { nb_genes_activ_++; } else { nb_genes_inhib_++; } } else { nb_non_fun_genes_++; overall_size_non_fun_genes_ += (strand == LEADING) ? protein.length() * CODON_SIZE : (protein.length() + 2) * CODON_SIZE; } } delete codon; codon = nullptr; break; } else { codon_list.push_back(codon); codon = nullptr; // don't delete codon: recycled into the list } j += CODON_SIZE; } if (not codon_list.empty()) { for (auto& c: codon_list) delete c; } } } } // Statistics if (not rna.transcribed_proteins().empty()) { // coding RNA nb_coding_RNAs_++; overall_size_coding_RNAs_ += rna.transcript_length(); } else { // non-coding RNA nb_non_coding_RNAs_++; overall_size_non_coding_RNAs_ += rna.transcript_length(); } } } } void GeneticUnit::compute_phenotypic_contribution() { if (phenotypic_contributions_computed_) return; phenotypic_contributions_computed_ = true; if (!translated_) do_translation(); //printf("Prot list: %ld %ld\n",protein_list_[LEADING].size(),protein_list_[LEADING].size()); for (const auto& strand: protein_list_) // two strands: LEADING & LAGGING for (const auto& prot: strand) if (prot.is_functional()) { ((prot.height() > 0) ? activ_contribution_ : inhib_contribution_) ->add_triangle(prot.mean(), prot.width(), prot.height() * prot.concentration()); // printf("Add triangle : %f %f %f\n",prot.mean(), // prot.width(), // prot.height() * prot.concentration()); } // if (prot->height() > 0) // activ_contribution_->add_triangle(prot->mean(), // prot->width(), // prot->height() * prot->concentration()); // else // inhib_contribution_->add_triangle(prot->get_mean(), // prot->get_width(), // prot->get_height() * prot->get_concentration() ); // It is not necessary to add a lower bound to activ_contribution_ as there can be no negative y // The same goes for the upper bound for inhib_contribution_ activ_contribution_->clip(Fuzzy::max, Y_MAX ); inhib_contribution_->clip(Fuzzy::min, - Y_MAX ); activ_contribution_->simplify(); inhib_contribution_->simplify(); if ( exp_m_->output_m()->compute_phen_contrib_by_GU() ) { phenotypic_contribution_ = FuzzyFactory::fuzzyFactory->create_fuzzy(); phenotypic_contribution_->add( *activ_contribution_ ); phenotypic_contribution_->add( *inhib_contribution_ ); phenotypic_contribution_->simplify(); } } /*! \brief Compute the areas between the phenotype and the environment for each environmental segment. If the environment is not segmented, the total area is computed */ void GeneticUnit::compute_distance_to_target(const PhenotypicTarget& target) { if (distance_to_target_computed_) return; // distance_to_target_ has already been computed, nothing to do. distance_to_target_computed_ = true; compute_phenotypic_contribution(); // Compute the difference between the (whole) phenotype and the environment AbstractFuzzy* delta = FuzzyFactory::fuzzyFactory->create_fuzzy(*phenotypic_contribution_); delta->sub( *(target.fuzzy()) ); PhenotypicSegment** segments = target.segments(); // TODO We should take into account that we compute the areas in order (from the leftmost segment, rightwards) // => We shouldn't parse the whole list of points on the left of the segment we are considering (we have // already been through them!) if (dist_to_target_per_segment_ == NULL) { dist_to_target_per_segment_ = new double[target.nb_segments()]; // Can not be allocated in constructor because number of segments is then unknow } for (int8_t i = 0; i < target.nb_segments(); i++) { dist_to_target_per_segment_[i] = delta->get_geometric_area( segments[i]->start, segments[i]->stop); dist_to_target_by_feature_[segments[i]->feature] += dist_to_target_per_segment_[i]; } delete delta; } /*! \brief Compute a "proper" fitness value (one that increases when the individual is fitter). The behaviour of this function depends on many parameters and most notably on whether it is a "composite" fitness or not, and on the selection scheme. */ void GeneticUnit::compute_fitness(const PhenotypicTarget& target) { if (fitness_computed_) return; // Fitness has already been computed, nothing to do. fitness_computed_ = true; #ifdef NORMALIZED_FITNESS for (int8_t i = 0 ; i < NB_FEATURES ; i++) { if (target.area_by_feature(i)==0.) { fitness_by_feature_[i] = 0.; } else { fitness_by_feature_[i] = (target.area_by_feature(i) - dist_to_target_by_feature_[i]) / target.area_by_feature(i); if ((fitness_by_feature_[i] < 0.) && (i != METABOLISM)) // non-metabolic fitness can NOT be lower than zero (we do not want individual to secrete a negative quantity of public good) { fitness_by_feature_[i] = 0.; } } } if ((! indiv_->placed_in_population()) || (! exp_m_->with_secretion())) { fitness_ = fitness_by_feature_[METABOLISM]; } else { fitness_ = fitness_by_feature_[METABOLISM] * (1 + exp_m_->secretion_contrib_to_fitness() * (indiv_->grid_cell()->compound_amount() - exp_m_->secretion_cost() * fitness_by_feature_[SECRETION])); } if (exp_m_->selection_scheme() == FITNESS_PROPORTIONATE) // Then the exponential selection is integrated inside the fitness value { fitness_ = exp(-exp_m_->selection_pressure() * (1 - fitness_)); } #else for (int8_t i = 0; i < NB_FEATURES; i++) { if (i == SECRETION) { fitness_by_feature_[SECRETION] = exp(-exp_m_->selection_pressure() * dist_to_target_by_feature_[SECRETION]) - exp(-exp_m_->selection_pressure() * target.area_by_feature(SECRETION)); if (fitness_by_feature_[i] < 0) { fitness_by_feature_[i] = 0; } } else { fitness_by_feature_[i] = exp( -exp_m_->selection_pressure() * dist_to_target_by_feature_[i]); } } // Calculate combined, total fitness here! // Multiply the contribution of metabolism and the amount of compound in the environment if ((!indiv_->placed_in_population()) || (!exp_m_->with_secretion())) { fitness_ = fitness_by_feature_[METABOLISM]; } else { fitness_ = fitness_by_feature_[METABOLISM] * (1 + exp_m_->secretion_contrib_to_fitness() * indiv_->grid_cell()->compound_amount() - exp_m_->secretion_cost() * fitness_by_feature_[SECRETION]); } #endif } void GeneticUnit::reset_expression() { // useful if the DNA sequence has changed (cf post-treatment programs // which replay mutations) if ( activ_contribution_ != NULL ) { delete activ_contribution_; activ_contribution_ = FuzzyFactory::fuzzyFactory->create_fuzzy(); } if ( inhib_contribution_ != NULL ) { delete inhib_contribution_; inhib_contribution_ = FuzzyFactory::fuzzyFactory->create_fuzzy(); } transcribed_ = false; translated_ = false; phenotypic_contributions_computed_ = false; non_coding_computed_ = false; distance_to_target_computed_ = false; fitness_computed_ = false; if (phenotypic_contribution_ != NULL) { delete phenotypic_contribution_; // Not re-created now, will be conditionally allocated in compute_phenotypic_contribution phenotypic_contribution_ = NULL; } init_statistical_data(); } void GeneticUnit::print_coding_rnas() { for (int strand_id = LEADING; strand_id <= LAGGING; ++strand_id) { auto& strand = rna_list_[strand_id]; printf(" %s \n", StrandName[strand_id]); for (const auto& rna: strand) if (rna.is_coding()) { printf( "Promoter at %" PRId32 ", last transcribed position at %" PRId32 "\n", rna.promoter_pos(), rna.last_transcribed_pos()); } } } void GeneticUnit::print_proteins() const { printf(" LEADING (%" PRId32 ")\n", static_cast(protein_list_[LEADING].size())); for (const auto& prot: protein_list_[LEADING]) printf( " Gene on LEADING at %" PRId32 " (%" PRId32 ") (%f %f %f) (%f) %s\n", prot.shine_dal_pos(), prot.length(), prot.mean(), prot.width(), prot.height(), prot.concentration(), prot.is_functional() ? "functional" : "non functional"); printf(" LAGGING (%" PRId32 ")\n", static_cast(protein_list_[LAGGING].size())); for (const auto& prot: protein_list_[LAGGING]) printf( " Gene on LAGGING at %" PRId32 " (%" PRId32 ") (%f %f %f) (%f) %s\n", prot.shine_dal_pos(), prot.length(), prot.mean(), prot.width(), prot.height(), prot.concentration(), prot.is_functional() ? "functional" : "non functional"); } bool GeneticUnit::is_promoter(Strand strand, int32_t pos, int8_t& dist) const { //~ printf("=============================================== is_promoter\n"); //~ printf("pos : %" PRId32 "\n", pos); const char* genome = dna_->data(); int32_t len = dna_->length(); dist = 0; bool ret = true; if (strand == LEADING) { //~ printf("LEADING\n"); for (int16_t i = 0; i < PROM_SIZE; i++) { //~ printf( "LEADING\n" ); if (genome[Utils::mod((pos + i), len)] != PROM_SEQ[i]) { dist++; if (dist > PROM_MAX_DIFF) { //~ printf( "=============================================== END is_promoter\n" ); ret = false; } } } } else // (strand == LAGGING) { //~ printf("LAGGING\n"); for (int16_t i = 0; i < PROM_SIZE; i++) { //~ printf(" i : %"PRId32" dist : %"PRId8"\n", i, dist); if (genome[Utils::mod((pos - i), len)] == PROM_SEQ[i]) // == and not != because we are on the complementary strand... { dist++; if ( dist > PROM_MAX_DIFF ) { //~ printf( "=============================================== END is_promoter\n" ); ret = false; } } } } //~ printf( "=============================================== END is_promoter\n" ); return ret; } bool GeneticUnit::is_terminator(Strand strand, int32_t pos) const { const char* genome = dna_->data(); int32_t len = dna_->length(); if (strand == LEADING) { for (int16_t i = 0; i < TERM_STEM_SIZE; i++) { if (genome[Utils::mod(pos + i, len)] == genome[Utils::mod(pos + (TERM_SIZE - 1) - i, len)]) { return false; } } } else // (strand == LAGGING) { for (int16_t i = 0; i < TERM_STEM_SIZE; i++) { if (genome[Utils::mod(pos - i, len)] == genome[Utils::mod(pos - (TERM_SIZE - 1) + i, len)]) { return false; } } } return true; } bool GeneticUnit::is_shine_dalgarno(Strand strand, int32_t pos) const { const char* genome = dna_->data(); int32_t len = dna_->length(); if (strand == LEADING) { for (int8_t i = 0; i < SHINE_DAL_SIZE; i++) { if (genome[Utils::mod((pos + i), len)] != SHINE_DAL_SEQ[i]) { return false; } } } else // (strand == LAGGING) { for (int8_t i = 0; i < SHINE_DAL_SIZE; i++) { if (genome[Utils::mod((pos - i), len)] == SHINE_DAL_SEQ[i]) // == and not != because we are on the complementary strand... { return false; } } } return true; } int8_t GeneticUnit::codon(Strand strand, int32_t pos) const { const char* genome = dna_->data(); int32_t len = dna_->length(); int8_t codon = 0; if (strand == LEADING) { for (int8_t i = 0; i < CODON_SIZE; i++) { if (genome[Utils::mod((pos + i), len)] == '1') { codon += 1 << (CODON_SIZE - i - 1); //pow(2, CODON_SIZE - i - 1); } } } else // (strand == LAGGING) { for (int8_t i = 0; i < CODON_SIZE; i++) { if (genome[Utils::mod((pos - i), len)] != '1') // == and not != because we are on the complementary strand... { codon += 1 << (CODON_SIZE - i - 1); //pow(2, CODON_SIZE - i - 1); } } } return codon; } void GeneticUnit::compute_non_coding() { if (non_coding_computed_) return; non_coding_computed_ = true; // Create a table of bools initialized to false (non-coding) int32_t genome_length = dna_->length(); // Including Shine-Dalgarno, spacer, START and STOP bool* belongs_to_CDS; bool* belongs_to_functional_CDS; bool* belongs_to_non_functional_CDS; // non-functional CDSs are those that have a null area or that lack a kind of codons (M, W or H) // Including Promoters and terminators bool* belongs_to_RNA; bool* belongs_to_coding_RNA; bool* belongs_to_non_coding_RNA; // Genes + prom + term (but not UTRs) bool* is_essential_DNA; bool* is_essential_DNA_including_nf_genes; // Adds non-functional genes + promoters & terminators bool* is_not_neutral; // prom + term + everything in between (as opposed to neutral) belongs_to_CDS = new bool[genome_length]; belongs_to_functional_CDS = new bool[genome_length]; belongs_to_non_functional_CDS = new bool[genome_length]; belongs_to_RNA = new bool[genome_length]; belongs_to_coding_RNA = new bool[genome_length]; belongs_to_non_coding_RNA = new bool[genome_length]; is_essential_DNA = new bool[genome_length]; is_essential_DNA_including_nf_genes = new bool[genome_length]; is_not_neutral = new bool[genome_length]; memset(belongs_to_CDS, 0, genome_length); memset(belongs_to_functional_CDS, 0, genome_length); memset(belongs_to_non_functional_CDS, 0, genome_length); memset(belongs_to_RNA, 0, genome_length); memset(belongs_to_coding_RNA, 0, genome_length); memset(belongs_to_non_coding_RNA, 0, genome_length); memset(is_essential_DNA, 0, genome_length); memset(is_essential_DNA_including_nf_genes, 0, genome_length); memset(is_not_neutral, 0, genome_length); // Parse protein lists and mark the corresponding bases as coding for (auto strand: {LEADING, LAGGING}) { for (const auto& prot: protein_list_[strand]) { int32_t first; int32_t last; switch (strand) { case LEADING: first = prot.shine_dal_pos(); last = prot.last_STOP_base_pos(); break; case LAGGING: last = prot.shine_dal_pos(); first = prot.last_STOP_base_pos(); break; default: assert(false); // error: should never happen } if (first <= last) { for (int32_t i = first; i <= last; i++) { belongs_to_CDS[i] = true; if (prot.is_functional()) is_essential_DNA[i] = true; is_essential_DNA_including_nf_genes[i] = true; } } else { for (int32_t i = first; i < genome_length; i++) { belongs_to_CDS[i] = true; if (prot.is_functional()) is_essential_DNA[i] = true; is_essential_DNA_including_nf_genes[i] = true; } for (int32_t i = 0; i <= last; i++) { belongs_to_CDS[i] = true; if (prot.is_functional()) is_essential_DNA[i] = true; is_essential_DNA_including_nf_genes[i] = true; } } // Include the promoter and terminator to essential DNA // Mark everything between promoter and terminator as not neutral for (const auto& rna: prot.rna_list()) { int32_t prom_first; int32_t prom_last; int32_t term_first; int32_t term_last; int32_t rna_first; int32_t rna_last; if (strand == LEADING) { prom_first = rna->promoter_pos(); prom_last = Utils::mod(prom_first + PROM_SIZE - 1, dna_->length()); term_last = rna->last_transcribed_pos(); term_first = Utils::mod(term_last - TERM_SIZE + 1, dna_->length()); rna_first = prom_first; rna_last = term_last; } else { prom_last = rna->promoter_pos(); prom_first = Utils::mod(prom_last - PROM_SIZE + 1, dna_->length()); term_first = rna->last_transcribed_pos(); term_last = Utils::mod(term_first + TERM_SIZE - 1, dna_->length()); rna_first = term_first; rna_last = prom_last; } // Let us begin with "non-neutral" regions... if (rna_first <= rna_last) { for (int32_t i = rna_first; i <= rna_last; i++) { is_not_neutral[i] = true; } } else { for (int32_t i = rna_first; i < genome_length; i++) { is_not_neutral[i] = true; } for (int32_t i = 0; i <= rna_last; i++) { is_not_neutral[i] = true; } } // ...and go on with essential DNA if (prom_first <= prom_last) { for (int32_t i = prom_first; i <= prom_last; i++) { //~ printf("%ld ", i); if (prot.is_functional()) is_essential_DNA[i] = true; is_essential_DNA_including_nf_genes[i] = true; } } else { for (int32_t i = prom_first; i < genome_length; i++) { //~ printf("%ld ", i); if (prot.is_functional()) is_essential_DNA[i] = true; is_essential_DNA_including_nf_genes[i] = true; } for (int32_t i = 0; i <= prom_last; i++) { //~ printf("%ld ", i); if (prot.is_functional()) is_essential_DNA[i] = true; is_essential_DNA_including_nf_genes[i] = true; } } //~ printf("\n"); //~ printf("term "); if (term_first <= term_last) { for (int32_t i = term_first; i <= term_last; i++) { //~ printf("%ld ", i); if (prot.is_functional()) is_essential_DNA[i] = true; is_essential_DNA_including_nf_genes[i] = true; } } else { for (int32_t i = term_first; i < genome_length; i++) { //~ printf("%ld ", i); if (prot.is_functional()) is_essential_DNA[i] = true; is_essential_DNA_including_nf_genes[i] = true; } for (int32_t i = 0; i <= term_last; i++) { //~ printf("%ld ", i); if (prot.is_functional()) is_essential_DNA[i] = true; is_essential_DNA_including_nf_genes[i] = true; } } //~ printf("\n"); //~ getchar(); } if (prot.is_functional()) { if (first <= last) { for (int32_t i = first; i <= last; i++) { belongs_to_functional_CDS[i] = true; } } else { for (int32_t i = first; i < genome_length; i++) { belongs_to_functional_CDS[i] = true; } for (int32_t i = 0; i <= last; i++) { belongs_to_functional_CDS[i] = true; } } } else // degenerated protein { if (first <= last) { for (int32_t i = first; i <= last; i++) { belongs_to_non_functional_CDS[i] = true; } } else { for (int32_t i = first; i < genome_length; i++) { belongs_to_non_functional_CDS[i] = true; } for (int32_t i = 0; i <= last; i++) { belongs_to_non_functional_CDS[i] = true; } } } } } // Parse RNA lists and mark the corresponding bases as coding (only for the coding RNAs) // TODO vld: this block cries for refactoring for (int8_t strand = LEADING; strand <= LAGGING; strand++) { for (auto& rna: rna_list_[strand]) { int32_t first; int32_t last; if (strand == LEADING) { first = rna.promoter_pos(); last = rna.last_transcribed_pos(); } else { // (strand == LAGGING) first = rna.last_transcribed_pos(); last = rna.promoter_pos(); } assert(first < indiv_->amount_of_dna()); assert(last < indiv_->amount_of_dna()); if (first <= last) { for (int32_t i = first; i <= last; i++) { belongs_to_RNA[i] = true; } } else { for (int32_t i = first; i < genome_length; i++) belongs_to_RNA[i] = true; for (int32_t i = 0; i <= last; i++) belongs_to_RNA[i] = true; } if (not rna.transcribed_proteins().empty()) { // coding RNA if (first <= last) { for (int32_t i = first; i <= last; i++) belongs_to_coding_RNA[i] = true; } else { for (int32_t i = first; i < genome_length; i++) belongs_to_coding_RNA[i] = true; for (int32_t i = 0; i <= last; i++) belongs_to_coding_RNA[i] = true; } } else // non coding RNA { if (first <= last) { for (int32_t i = first; i <= last; i++) belongs_to_non_coding_RNA[i] = true; } else { for (int32_t i = first; i < genome_length; i++) belongs_to_non_coding_RNA[i] = true; for (int32_t i = 0; i <= last; i++) belongs_to_non_coding_RNA[i] = true; } } } } // Count non-coding bases nb_bases_in_0_CDS_ = 0; nb_bases_in_0_functional_CDS_ = 0; nb_bases_in_0_non_functional_CDS_ = 0; nb_bases_in_0_RNA_ = 0; nb_bases_in_0_coding_RNA_ = 0; nb_bases_in_0_non_coding_RNA_ = 0; nb_bases_non_essential_ = 0; nb_bases_non_essential_including_nf_genes_ = 0; nb_bases_in_neutral_regions_ = 0; nb_neutral_regions_ = 0; // We do not know how many neutral regions there will be, but // there should be less than nb_coding_RNAs_ + 1 // As we will see, there may be a shift in values so we take size nb_coding_RNAs_ + 2 int32_t* tmp_beginning_neutral_regions = new int32_t[nb_coding_RNAs_ + 2]; int32_t* tmp_end_neutral_regions = new int32_t[nb_coding_RNAs_ + 2]; memset(tmp_beginning_neutral_regions, -1, nb_coding_RNAs_ + 2); memset(tmp_end_neutral_regions, -1, nb_coding_RNAs_ + 2); for (int32_t i = 0; i < genome_length; i++) { if (belongs_to_CDS[i] == false) { nb_bases_in_0_CDS_++; } if (belongs_to_functional_CDS[i] == false) { nb_bases_in_0_functional_CDS_++; } if (belongs_to_non_functional_CDS[i] == false) { nb_bases_in_0_non_functional_CDS_++; } if (belongs_to_RNA[i] == false) { nb_bases_in_0_RNA_++; } if (belongs_to_coding_RNA[i] == false) { nb_bases_in_0_coding_RNA_++; } if (belongs_to_non_coding_RNA[i] == false) { nb_bases_in_0_non_coding_RNA_++; } if (is_essential_DNA[i] == false) { nb_bases_non_essential_++; } if (is_essential_DNA_including_nf_genes[i] == false) { nb_bases_non_essential_including_nf_genes_++; } if (is_not_neutral[i] == false) { nb_bases_in_neutral_regions_++; } if (i != 0) { if (is_not_neutral[i] != is_not_neutral[i - 1]) { if (is_not_neutral[i - 1] == true) // beginning of a neutral region { tmp_beginning_neutral_regions[nb_neutral_regions_] = i; } else // end of a neutral region { tmp_end_neutral_regions[nb_neutral_regions_] = i - 1; nb_neutral_regions_++; } } } else // i = 0 { // we arbitrarily set 0 as the beginning of a neutral region (linkage with end of genetic unit // will be done later) if (is_not_neutral[0] == false) { tmp_beginning_neutral_regions[nb_neutral_regions_] = 0; } } } // we have to treat specifically the last base of the genetic unit in order to link neutral regions // at the end and the beginning of genetic unit int32_t shift = 0; if (is_not_neutral[genome_length - 1] == false) { if (is_not_neutral[0] == true) // end of a neutral region { tmp_end_neutral_regions[nb_neutral_regions_] = genome_length - 1; nb_neutral_regions_++; } else // neutral region goes on after base 0, linkage to be done { if (nb_neutral_regions_ != 0) { tmp_end_neutral_regions[nb_neutral_regions_] = tmp_end_neutral_regions[0]; // the first neutral region is only a subpart of the last one, it should not be // taken into account. When we transfer values to the final array, we introduce a shift shift = 1; // we do not ++ nb_neutral_regions_ as it was already counted } else // no neutral region detected until now -> all the genetic unit is neutral { // as all the chromosome is neutral, we indicate 0 as the beginning of the region // and genome_length - 1 as its end tmp_end_neutral_regions[0] = genome_length - 1; nb_neutral_regions_++; } } } // now that we know how many neutral regions there are, we can transfer data to correctly sized arrays assert(nb_neutral_regions_ <= nb_coding_RNAs_ + 1); if (beginning_neutral_regions_ != NULL) { delete[] beginning_neutral_regions_; } if (end_neutral_regions_ != NULL) { delete[] end_neutral_regions_; } if (nb_neutral_regions_ > 0) // as unlikely as it seems, there may be no neutral region { beginning_neutral_regions_ = new int32_t[nb_neutral_regions_]; end_neutral_regions_ = new int32_t[nb_neutral_regions_]; // transfer from tmp to attributes for (int32_t i = 0; i < nb_neutral_regions_; i++) { beginning_neutral_regions_[i] = tmp_beginning_neutral_regions[i + shift]; end_neutral_regions_[i] = tmp_end_neutral_regions[i + shift]; } } else // nb_neutral_regions_ == 0 { beginning_neutral_regions_ = NULL; end_neutral_regions_ = NULL; } delete[] tmp_beginning_neutral_regions; delete[] tmp_end_neutral_regions; delete[] belongs_to_CDS; delete[] belongs_to_functional_CDS; delete[] belongs_to_non_functional_CDS; delete[] belongs_to_RNA; delete[] belongs_to_coding_RNA; delete[] belongs_to_non_coding_RNA; delete[] is_essential_DNA; delete[] is_essential_DNA_including_nf_genes; delete[] is_not_neutral; } /// /// /// `duplicated_promoters` is an output parameter, it should be initially empty void GeneticUnit::duplicate_promoters_included_in(int32_t pos_1, int32_t pos_2, Promoters2Strands& duplicated_promoters) { // 1) Get promoters to be duplicated Promoters2Strands retrieved_promoters = {{}, {}}; promoters_included_in(pos_1, pos_2, retrieved_promoters); // 2) Set RNAs' position as their position on the duplicated segment for (auto& strand: {LEADING, LAGGING}) { for (auto& rna: retrieved_promoters[strand]) { // Make a copy of current RNA inside container #ifndef __REGUL duplicated_promoters[strand].emplace_back(this, rna); #else Rna_R rna_r(this, rna); duplicated_promoters[strand].push_back(rna_r); #endif // Set RNA's position as it's position on the duplicated segment duplicated_promoters[strand].back().shift_position(-pos_1, dna_->length()); } } } void GeneticUnit::promoters_included_in(int32_t pos_1, int32_t pos_2, Promoters2Strands& promoters_list) { assert(pos_1 >= 0 && pos_1 <= dna_->length() && pos_2 >= 0 && pos_2 <= dna_->length()); if (pos_1 < pos_2) { int32_t seg_length = pos_2 - pos_1; if (seg_length >= PROM_SIZE) { promoters(LEADING, BETWEEN, pos_1, pos_2 - PROM_SIZE + 1, promoters_list[LEADING]); promoters(LAGGING, BETWEEN, pos_2, pos_1 + PROM_SIZE - 1, promoters_list[LAGGING]); } } else { int32_t seg_length = dna_->length() + pos_2 - pos_1; if (seg_length >= PROM_SIZE) { bool is_near_end_of_genome = (pos_1 + PROM_SIZE > dna_->length()); bool is_near_beginning_of_genome = (pos_2 - PROM_SIZE < 0); if (!is_near_end_of_genome && !is_near_beginning_of_genome) { promoters(LEADING, AFTER, pos_1, -1, promoters_list[LEADING]); promoters(LEADING, BEFORE, -1, pos_2 - PROM_SIZE + 1, promoters_list[LEADING]); promoters(LAGGING, AFTER, pos_2, -1, promoters_list[LAGGING]); promoters(LAGGING, BEFORE, -1, pos_1 + PROM_SIZE - 1, promoters_list[LAGGING]); } else if (!is_near_end_of_genome) // => && is_near_beginning_of_genome { // promoters(leading, between, pos_1, pos_2 + dna_->length() - PROM_SIZE + 1, // promoters_list[LEADING]); promoters(LEADING, BETWEEN, pos_1, pos_2 - PROM_SIZE + 1 + dna_->length(), promoters_list[LEADING]); promoters(LAGGING, AFTER, pos_2, -1, promoters_list[LAGGING]); promoters(LAGGING, BEFORE, -1, pos_1 + PROM_SIZE - 1, promoters_list[LAGGING]); } else if (!is_near_beginning_of_genome) // => && is_near_end_of_genome { promoters(LEADING, AFTER, pos_1, -1, promoters_list[LEADING]); promoters(LEADING, BEFORE, -1, pos_2 - PROM_SIZE + 1, promoters_list[LEADING]); promoters(LAGGING, BETWEEN, pos_2, pos_1 + PROM_SIZE - 1 - dna_->length(), promoters_list[LAGGING]); } else // is_near_end_of_genome && is_near_beginning_of_genome { // promoters(leading, between, pos_1, pos_2 + dna_->length() - PROM_SIZE + 1, // promoters_list[LEADING]); promoters(LEADING, BETWEEN, pos_1, pos_2 - PROM_SIZE + 1 + dna_->length(), promoters_list[LEADING]); promoters(LAGGING, BETWEEN, pos_2, pos_1 + PROM_SIZE - 1 - dna_->length(), promoters_list[LAGGING]); } } } } /** Get promoters whose starting position are between/before/after * pos_1 and pos_2. * * The promoters will be ordered with regard to the strand's reading direction */ void GeneticUnit::promoters(Strand strand_id, Position before_after_btw, // with regard to the strand's reading direction int32_t pos1, int32_t pos2, Promoters1Strand& promoters) { // TODO vld: First try, the parameter list could be cleverer. // TODO vld: These find_if puns are not very nice. Could just negate // return if LAGGING or something in that spirit. assert((before_after_btw == BETWEEN and pos1 >= 0 and pos2 >= 0 and pos1 <= dna_->length() and pos2 <= dna_->length()) or (before_after_btw == BEFORE and pos2 >= 0 and pos2 <= dna_->length()) or (before_after_btw == AFTER and pos1 >= 0 and pos1 <= dna_->length())); auto strand = rna_list_[strand_id]; auto it_begin = strand.begin(); auto it_end = strand.end(); if (before_after_btw != BEFORE) { it_begin = find_if(strand.begin(), strand.end(), [pos1, strand_id](Rna& p) { if (strand_id == LEADING) { return p.promoter_pos() >= pos1; } else { return p.promoter_pos() < pos1; } }); } if (before_after_btw != AFTER) { it_end = find_if(it_begin, strand.end(), [pos2, strand_id](Rna& p) { if (strand_id == LEADING) { return p.promoter_pos() >= pos2; } else { return p.promoter_pos() < pos2; } }); } promoters.insert(promoters.end(), it_begin, it_end); } /// Invert all the promoters of promoter_lists for a sequence of /// length seq_length. /*static*/ void GeneticUnit::invert_promoters(Promoters2Strands& promoter_lists, int32_t seq_length) { GeneticUnit::invert_promoters(promoter_lists, 0, seq_length); } /// Invert all the promoters of promoter_lists knowing that they /// represent the promoters of a subsequence beginning at pos_1 and /// ending at pos_2. /// /// WARNING : This function is pretty specific, make sure you /// understand its precise behaviour before using it. /*static*/ void GeneticUnit::invert_promoters(Promoters2Strands& promoter_lists, int32_t pos1, int32_t pos2) { assert(pos1 >= 0 && pos1 <= pos2); // Could check (pos2 < length) but another parameter would be necessary // Exchange LEADING and LAGGING lists promoter_lists[LEADING].swap(promoter_lists[LAGGING]); // Update the position and strand of each promoter to be inverted... for (auto& strand: {LEADING, LAGGING}) for (auto& rna: promoter_lists[strand]) { assert(rna.strand() != strand); // strands have just been swapped assert(rna.promoter_pos() >= pos1); assert(rna.promoter_pos() < pos2); rna.set_promoter_pos(pos1 + pos2 - rna.promoter_pos() - 1); rna.set_strand(strand); } } void GeneticUnit::invert_promoters_included_in(int32_t pos1, int32_t pos2) { assert(pos1 >= 0); assert(pos1 <= pos2); assert(pos2 <= dna_->length()); int32_t segment_length = pos2 - pos1; if (segment_length < PROM_SIZE) { return; } Promoters2Strands inverted_promoters = {{}, {}}; // 1) Extract the promoters completely included on the segment to be inverted extract_promoters_included_in(pos1, pos2, inverted_promoters); // 2) Invert segment's promoters GeneticUnit::invert_promoters(inverted_promoters, pos1, pos2); // 3) Reinsert the inverted promoters insert_promoters(inverted_promoters); } // TODO vld: should it append extracted promoters to extracted_promoters or replace its content void GeneticUnit::extract_leading_promoters_starting_between(int32_t pos_1, int32_t pos_2, Promoters1Strand& extracted_promoters) { assert(pos_1 >= 0); assert(pos_1 < pos_2); assert(pos_2 <= dna_->length()); // Find the first promoters in the interval auto& strand = rna_list_[LEADING]; auto first = find_if(strand.begin(), strand.end(), [pos_1](Rna& p) { return p.promoter_pos() >= pos_1; }); if (first == strand.end() or first->promoter_pos() >= pos_2) { return; } // Find the last promoters in the interval auto end = find_if(first, strand.end(), [pos_2](Rna& p) { return p.promoter_pos() >= pos_2; }); // Extract the promoters (remove them from the individual's list and put them in extracted_promoters) extracted_promoters.insert(extracted_promoters.end(), first, end); strand.erase(first, end); } void GeneticUnit::extract_lagging_promoters_starting_between(int32_t pos_1, int32_t pos_2, Promoters1Strand& extracted_promoters) { assert(pos_1 >= 0); assert(pos_1 < pos_2); assert(pos_2 <= dna_->length()); // Find the first promoters in the interval (if any) auto& strand = rna_list_[LAGGING]; auto first = find_if(strand.begin(), strand.end(), [pos_2](Rna& r) { return r.promoter_pos() < pos_2; }); if (first == strand.end() or first->promoter_pos() < pos_1) { return; } // Find the last promoters in the interval auto end = find_if(first, strand.end(), [pos_1](Rna& r) { return r.promoter_pos() < pos_1; }); // Extract the promoters (remove them from the individual's list and put the in extracted_promoters) extracted_promoters.insert(extracted_promoters.end(), first, end); strand.erase(first, end); } /// Shift all the promoters in by in a sequence of length . /// /// Every promoter in double stranded list will /// be shifted by , then a modulo will be /// applied /*static*/ void GeneticUnit::shift_promoters( Promoters2Strands& promoters_to_shift, int32_t delta_pos, int32_t seq_length) { for (auto& strand: {LEADING, LAGGING}) for (auto& rna: promoters_to_shift[strand]) rna.shift_position(delta_pos, seq_length); } /// Insert promoters in double stranded list `promoters_to_insert` into `this->rna_list_`. /// /// The promoters in must already be at their /// rightful position according to /// and the positions of the promoters from and /// rna_list_> must not be interlaced /// i.e. no promoter in rna_list_> must have a position in /// [first_prom_to_insert->pos ; last_prom_to_insert->pos] void GeneticUnit::insert_promoters(Promoters2Strands& promoters_to_insert) { // TODO vld: to be merged with insert_promoters_at(...) for (auto strand: {LEADING, LAGGING}) { if (promoters_to_insert[strand].size() <= 0) { continue; } // Get to the right position in individual's list (first promoter after the inserted segment) int32_t from_pos = promoters_to_insert[strand].back().promoter_pos(); auto pos = find_if(rna_list_[strand].begin(), rna_list_[strand].end(), [from_pos, strand](Rna& r) { if (strand == LEADING) { return r.promoter_pos() >= from_pos; } else { return r.promoter_pos() < from_pos; } }); // Insert the promoters in the individual's RNA list for (auto& to_insert: promoters_to_insert[strand]) // TODO vld: could be compacted in a unique emplace(pos, to_insert) ? if (pos != rna_list_[strand].end()) { rna_list_[strand].insert(pos, to_insert); } else { rna_list_[strand].push_back(to_insert); } } } /// Insert promoters in double stranded list `promoters_to_insert` /// into `this->rna_list_` at position `pos` /// /// The promoters in `promoters_to_insert` must be at their rightful /// position according to a stand-alone sequence (i.e. at a RELATIVE /// position). Their position will be updated automatically. void GeneticUnit::insert_promoters_at(Promoters2Strands& promoters_to_insert, int32_t pos) { for (auto strand: {LEADING, LAGGING}) { if (promoters_to_insert[strand].size() <= 0) { continue; } // Get to the right position in individual's list (first promoter after the inserted segment) auto first = find_if(rna_list_[strand].begin(), rna_list_[strand].end(), [pos, strand](Rna& r) { if (strand == LEADING) { return r.promoter_pos() >= pos; } else { return r.promoter_pos() < pos; } }); // Insert the promoters in the individual's RNA list for (auto& to_insert: promoters_to_insert[strand]) { // Update promoter position to_insert.shift_position(pos, dna_->length()); // Insert if (first != rna_list_[strand].end()) { rna_list_[strand].insert(first, to_insert); } else { rna_list_[strand].push_back(to_insert); } } } } /// Remove the RNAs of the LEADING strand whose starting positions lie /// in [pos_1 ; pos_2[ void GeneticUnit::remove_leading_promoters_starting_between(int32_t pos_1, int32_t pos_2) { assert(pos_1 >= 0); assert(pos_1 < dna_->length()); assert(pos_2 >= 0); assert(pos_2 <= dna_->length()); if (pos_1 > pos_2) { remove_leading_promoters_starting_after(pos_1); remove_leading_promoters_starting_before(pos_2); } else { auto& strand = rna_list_[LEADING]; // Delete RNAs until we pass pos_2 (or we reach the end of the list) // STL Warning: don't erase the current iterator in the for-loop! for (auto it = find_if(strand.begin(), strand.end(), [pos_1](Rna& r) { return r.promoter_pos() >= pos_1; }), nextit = it; it != strand.end() and it->promoter_pos() < pos_2; it = nextit) { nextit = next(it); strand.erase(it); } } } /// Remove the RNAs of the LAGGING strand whose starting positions lie /// in [pos_1 ; pos_2[ /// /// NOTE : A lagging promoter whose starting position is pos spans /// [pos-PROM_SIZE+1 ; pos], not [pos-PROM_SIZE ; pos[ /// /// Assuming (PROM_SIZE == 4), the LAGGING promoter whose starting /// position is pos spans the cells filled with X on the following /// cartoon: /// \verbatim /// ------------------------------- /// | | | X | X | X | X | | | /// ------------------------------- /// ^ /// pos /// \endverbatim void GeneticUnit::remove_lagging_promoters_starting_between(int32_t pos_1, int32_t pos_2) { assert(pos_1 >= 0 && pos_1 <= dna_->length() && pos_2 >= 0 && pos_2 <= dna_->length()); if (pos_1 == dna_->length()) pos_1 = 0; if (pos_2 == 0) pos_2 = dna_->length(); if (pos_1 > pos_2) { // vld: that's a weird case... really do this? used from remove_promoters_around() remove_lagging_promoters_starting_after(pos_1); remove_lagging_promoters_starting_before(pos_2); } else { auto& strand = rna_list_[LAGGING]; // Delete RNAs until we pass pos_1 (or we reach the end of the list) for (auto it = find_if(strand.begin(), strand.end(), [pos_2](Rna& r) { return r.promoter_pos() < pos_2; }), nextit = it; it != strand.end() and it->promoter_pos() >= pos_1; it = nextit) { nextit = next(it); strand.erase(it); } } } /// Remove the promoters from the LEADING strand whose starting /// positions are < pos void GeneticUnit::remove_leading_promoters_starting_before(int32_t pos) { assert(pos >= 0 && pos < dna_->length()); auto& strand = rna_list_[LEADING]; // Delete RNAs until we reach pos (or we reach the end of the list) for (auto it = strand.begin(), nextit = it; it != strand.end() and it->promoter_pos() < pos; it = nextit) { nextit = next(it); strand.erase(it); } } /// Remove the promoters from the LAGGING strand whose starting /// positions are < pos /// /// NOTE : A lagging promoter whose starting position is pos spans /// [pos-PROM_SIZE+1 ; pos], not [pos-PROM_SIZE ; pos[ /// /// Assuming (PROM_SIZE == 4), the LAGGING promoter whose starting /// position is pos spans the cells filled with X on the following /// cartoon: /// \verbatim /// ------------------------------- /// | | | X | X | X | X | | | /// ------------------------------- /// ^ /// pos /// \endverbatim void GeneticUnit::remove_lagging_promoters_starting_before(int32_t pos) { assert(pos >= 0 and pos < dna_->length()); auto& strand = rna_list_[LAGGING]; // Delete RNAs until we reach pos (or we reach the end of the list) // TODO: optimize by starting from the end (with reverse iterators) for (auto it = find_if(strand.begin(), strand.end(), [pos](Rna& r) { return r.promoter_pos() < pos; }), nextit = it; it != strand.end(); it = nextit) { nextit = next(it); strand.erase(it); } } /// Remove the promoters from the LEADING strand whose starting /// positions are >= pos void GeneticUnit::remove_leading_promoters_starting_after(int32_t pos) { assert(pos >= 0 && pos < dna_->length()); auto& strand = rna_list_[LEADING]; // TODO: optimize by starting from the end (with reverse iterators) for (auto it = find_if(strand.begin(), strand.end(), [pos](Rna& r) { return r.promoter_pos() >= pos; }), nextit = it; it != strand.end(); it = nextit) { nextit = next(it); strand.erase(it); } } /// Remove the promoters from the LAGGING strand whose starting /// positions are >= pos /// /// NOTE : A lagging promoter whose starting position is pos spans /// [pos-PROM_SIZE+1 ; pos], not [pos-PROM_SIZE ; pos[ /// /// Assuming (PROM_SIZE == 4), the LAGGING promoter whose starting /// position is pos spans the cells filled with X on the following /// cartoon: /// \verbatim /// ------------------------------- /// | | | X | X | X | X | | | /// ------------------------------- /// ^ /// pos /// \endverbatim void GeneticUnit::remove_lagging_promoters_starting_after(int32_t pos) { assert(pos < dna_->length() && pos >= 0); auto& strand = rna_list_[LAGGING]; // Delete RNAs until we pass pos (or we reach the end of the list) for (auto it = strand.begin(), nextit = it; it != strand.end() and it->promoter_pos() >= pos; it = nextit) { nextit = next(it); strand.erase(it); } } /// Look for new promoters on the LEADING strand whose starting /// positions would lie in [pos_1 ; pos_2[ void GeneticUnit::look_for_new_leading_promoters_starting_between(int32_t pos_1, int32_t pos_2) { assert(pos_1 >= 0 && pos_1 < dna_->length() && pos_2 >= 0 && pos_2 < dna_->length()); // When pos_1 > pos_2, we will perform the search in 2 steps. // As positions 0 and dna_->length() are equivalent, it's preferable to // keep 0 for pos_1 and dna_->length() for pos_2. if (pos_1 >= pos_2) { look_for_new_leading_promoters_starting_after(pos_1); look_for_new_leading_promoters_starting_before(pos_2); return; } int8_t dist; // Hamming distance of the sequence from the promoter consensus for (int32_t i = pos_1; i < pos_2; i++) { if (is_promoter(LEADING, i, dist)) // dist takes the hamming distance of the sequence from the consensus { //~ char tmp[255]; //~ memcpy(tmp, &dna_->data()[i], PROM_SIZE * sizeof(char)); //~ printf("new promoter found on the LEADING strand at position %"PRId32" : %s\n", i, tmp); // Look for the right place to insert the new promoter in the list auto& strand = rna_list_[LEADING]; auto first = find_if(strand.begin(), strand.end(), [i](Rna& r) { return r.promoter_pos() >= i; }); if (first == strand.end() or first->promoter_pos() != i) { #ifndef __REGUL rna_list_[LEADING].emplace(first, this, LEADING, i, dist); #else rna_list_[LEADING].emplace(first, this, LEADING, i, dist); #endif } } } } /*! \brief Look for new promoters on the LAGGING strand whose starting positions would lie in [pos_1 ; pos_2[ NOTE : A lagging promoter whose starting position is pos spans [pos-PROM_SIZE+1 ; pos], not [pos-PROM_SIZE ; pos[ Assuming (PROM_SIZE == 4), the LAGGING promoter whose starting position is pos spans the cells filled with X on the following cartoon: \verbatim ------------------------------- | | | X | X | X | X | | | ------------------------------- ^ pos \endverbatim */ void GeneticUnit::look_for_new_lagging_promoters_starting_between(int32_t pos_1, int32_t pos_2) { assert(pos_1 >= 0 && pos_1 < dna_->length() && pos_2 >= 0 && pos_2 < dna_->length()); // When pos_1 > pos_2, we will perform the search in 2 steps. // As positions 0 and dna_->length() are equivalent, it's preferable to // keep 0 for pos_1 and dna_->length() for pos_2. if (pos_1 >= pos_2) { look_for_new_lagging_promoters_starting_after(pos_1); look_for_new_lagging_promoters_starting_before(pos_2); return; } int8_t dist; // Hamming distance of the sequence from the promoter consensus for (int32_t i = pos_2 - 1; i >= pos_1; i--) { if (is_promoter(LAGGING, i, dist)) // dist takes the hamming distance of the sequence from the consensus { assert (i >= 0 && i < dna_->length()); // Look for the right place to insert the new promoter in the list auto& strand = rna_list_[LAGGING]; auto first = find_if(strand.begin(), strand.end(), [i](Rna& r) { return r.promoter_pos() <= i; }); if (first == strand.end() or first->promoter_pos() != i) { #ifndef __REGUL rna_list_[LAGGING].emplace(first, this, LAGGING, i, dist); #else rna_list_[LAGGING].emplace(first, this, LAGGING, i, dist); #endif // __REGUL } } } } /// Look for new promoters on the LEADING strand whose starting positions would be >= pos void GeneticUnit::look_for_new_leading_promoters_starting_after(int32_t pos) { assert(pos >= 0 && pos < dna_->length()); // Hamming distance of the sequence from the promoter consensus int8_t dist; // rna list node used to find the new promoter's place in the list for (int32_t i = pos; i < dna_->length(); i++) { if (is_promoter(LEADING, i, dist)) { // dist takes the hamming distance of the sequence from the consensus // Look for the right place to insert the new promoter in the list auto& strand = rna_list_[LEADING]; auto first = find_if(strand.begin(), strand.end(), [i](Rna& r) { return r.promoter_pos() >= i; }); if (first == strand.end() or first->promoter_pos() != i) { #ifndef __REGUL rna_list_[LEADING].emplace(first, this, LEADING, i, dist); #else rna_list_[LEADING].emplace(first, this, LEADING, i, dist); #endif } } } } /// Look for new promoters on the LAGGING strand whose starting /// positions would be >= pos /// /// NOTE : A lagging promoter whose starting position is pos spans /// [pos-PROM_SIZE+1 ; pos], not [pos-PROM_SIZE ; pos[ /// /// Assuming (PROM_SIZE == 4), the LAGGING promoter whose starting /// position is pos spans the cells filled with X on the following /// cartoon: /// \verbatim /// ------------------------------- /// | | | X | X | X | X | | | /// ------------------------------- /// ^ /// pos /// \endverbatim void GeneticUnit::look_for_new_lagging_promoters_starting_after(int32_t pos) { assert(pos >= 0 && pos < dna_->length()); // Hamming distance of the sequence from the promoter consensus int8_t dist; auto& strand = rna_list_[LAGGING]; auto first = strand.begin(); for (int32_t i = dna_->length() - 1; i >= pos; i--) { if (is_promoter(LAGGING, i, dist)) // dist takes the hamming distance of the sequence from the consensus { assert (i >= 0 && i < dna_->length()); // Look for the right place to insert the new promoter in the list first = find_if(first, strand.end(), [i](Rna& r) { return r.promoter_pos() <= i; }); if (first == strand.end() or first->promoter_pos() != i) { #ifndef __REGUL rna_list_[LAGGING].emplace(first, this, LAGGING, i, dist); #else rna_list_[LAGGING].emplace(first, this, LAGGING, i, dist); #endif } } } } /// Look for new promoters on the LEADING strand whose starting /// positions would be < pos void GeneticUnit::look_for_new_leading_promoters_starting_before(int32_t pos) { assert(pos >= 0 && pos < dna_->length()); // Hamming distance of the sequence from the promoter consensus int8_t dist; auto& strand = rna_list_[LEADING]; auto first = strand.begin(); // TODO vld: should it not be reset at each loop step? for (int32_t i = 0; i < pos; i++) { if (is_promoter(LEADING, i, dist)) // dist takes the hamming distance of the sequence from the consensus { // Look for the right place to insert the new promoter in the list first = find_if(first, strand.end(), [i](Rna& r) { return r.promoter_pos() >= i; }); if (first == strand.end() or first->promoter_pos() != i) { #ifndef __REGUL rna_list_[LEADING].emplace(first, this, LEADING, i, dist); #else rna_list_[LEADING].emplace(first, this, LEADING, i, dist); #endif } } } } /// Look for new promoters on the LAGGING strand whose starting positions would be < pos /// /// NOTE : A lagging promoter whose starting position is pos spans /// [pos-PROM_SIZE+1 ; pos], not [pos-PROM_SIZE ; pos[ /// /// Assuming (PROM_SIZE == 4), the LAGGING promoter whose starting /// position is pos spans the cells filled with X on the following /// cartoon: /// \verbatim /// ------------------------------- /// | | | X | X | X | X | | | /// ------------------------------- /// ^ /// pos /// \endverbatim void GeneticUnit::look_for_new_lagging_promoters_starting_before(int32_t pos) { assert(pos >= 0 && pos < dna_->length()); // Hamming distance of the sequence from the promoter consensus int8_t dist; // rna list node used to find the new promoter's place in the list auto& strand = rna_list_[LAGGING]; auto first = strand.begin(); for (int32_t i = pos - 1; i >= 0; i--) { if (is_promoter(LAGGING, i, dist)) // dist takes the hamming distance of the sequence from the consensus { assert (i >= 0 && i < dna_->length()); // Look for the right place to insert the new promoter in the list first = find_if(first, strand.end(), [i](Rna& r) { return r.promoter_pos() <= i; }); if (first == strand.end() or first->promoter_pos() != i) { #ifndef __REGUL rna_list_[LAGGING].emplace(first, this, LAGGING, i, dist); #else rna_list_[LAGGING].emplace(first, this, LAGGING, i, dist); #endif } } } } /// Shift (by delta_post) the positions of the promoters from the /// LEADING strand whose starting positions are >= pos. void GeneticUnit::move_all_leading_promoters_after(int32_t pos, int32_t delta_pos) { auto& strand = rna_list_[LEADING]; for (auto rna = find_if(strand.begin(), strand.end(), [pos](Rna& r) { return r.promoter_pos() >= pos; }); rna != strand.end(); ++rna) rna->shift_position(delta_pos, dna_->length()); } /// Shift (by delta_post) the positions of the promoters from the /// LAGGING strand whose starting positions are >= pos. /// /// NOTE : A lagging promoter whose starting position is pos spans /// [pos-PROM_SIZE+1 ; pos], not [pos-PROM_SIZE ; pos[ /// /// Assuming (PROM_SIZE == 4), the LAGGING promoter whose starting /// position is pos spans the cells filled with X on the following /// cartoon: /// \verbatim /// ------------------------------- /// | | | X | X | X | X | | | /// ------------------------------- /// ^ /// pos /// \endverbatim void GeneticUnit::move_all_lagging_promoters_after(int32_t pos, int32_t delta_pos) { auto& strand = rna_list_[LAGGING]; // Update RNAs until we pass pos (or we reach the end of the list) for (auto rna = strand.begin(); rna != strand.end() and rna->promoter_pos() >= pos; ++rna) rna->shift_position(delta_pos, dna_->length()); } /// Copy (into new_promoter_list) the promoters from the LEADING /// strand whose starting positions lie in [pos_1 ; pos_2[ void GeneticUnit::copy_leading_promoters_starting_between(int32_t pos_1, int32_t pos_2, Promoters1Strand& new_promoter_list ) { // 1) Go to first RNA to copy auto& strand = rna_list_[LEADING]; const auto& first = find_if(strand.begin(), strand.end(), [pos_1](Rna & r) { return r.promoter_pos() >= pos_1; }); // 2) Copy RNAs if ( pos_1 < pos_2 ) { // Copy from pos_1 to pos_2 for (auto rna = first; rna != strand.end() and rna->promoter_pos() < pos_2; ++rna) { #ifndef __REGUL new_promoter_list.emplace_back(this, *rna); #else Rna_R rna_r(this, *rna); new_promoter_list.push_back(rna_r); #endif } } else { // Copy from pos_1 to the end of the list for (auto rna = first; rna != strand.end(); ++rna) { #ifndef __REGUL new_promoter_list.emplace_back(this, *rna); #else Rna_R rna_r(this, *rna); new_promoter_list.push_back(rna_r); #endif } // Copy from the beginning of the list to pos_2 for (auto& rna: strand) { if (rna.promoter_pos() >= pos_2) break; #ifndef __REGUL new_promoter_list.emplace_back(this, rna); #else Rna_R rna_r(this, rna); new_promoter_list.push_back(rna_r); #endif } } } /// Copy (into new_promoter_list) the promoters from the LAGGING /// strand whose starting positions lie in [pos_1 ; pos_2[ /// /// NOTE : A lagging promoter whose starting position is pos spans /// [pos-PROM_SIZE+1 ; pos], not [pos-PROM_SIZE ; pos[ /// /// Assuming (PROM_SIZE == 4), the LAGGING promoter whose starting /// position is pos spans the cells filled with X on the following /// cartoon: /// \verbatim /// ------------------------------- /// | | | X | X | X | X | | | /// ------------------------------- /// ^ /// pos /// \endverbatim void GeneticUnit::copy_lagging_promoters_starting_between(int32_t pos_1, int32_t pos_2, Promoters1Strand& new_promoter_list) { // Go to first RNA to copy auto& strand = rna_list_[LAGGING]; const auto& first = find_if(strand.rbegin(), strand.rend(), [pos_1](Rna& r) { return r.promoter_pos() >= pos_1; }); // Copy RNAs if (pos_1 < pos_2) { // Copy from pos_1 to pos_2 for (auto rna = first; rna != strand.rend() and rna->promoter_pos() < pos_2; ++rna) new_promoter_list.emplace_front(this, *rna); } else { // Copy from pos_1 to the beginning of the list (we are going backwards) for (auto rna = first; rna != strand.rend(); ++rna) new_promoter_list.emplace_front(this, *rna); // Copy from the end of the list to pos_2 (we are going backwards) for (auto rna = strand.rbegin(); rna != strand.rend() and rna->promoter_pos() < pos_2; ++rna) new_promoter_list.emplace_front(this, *rna); } } void GeneticUnit::save(gzFile backup_file) const { dna_->save(backup_file); gzwrite(backup_file, &min_gu_length_, sizeof(min_gu_length_)); gzwrite(backup_file, &max_gu_length_, sizeof(max_gu_length_)); } int32_t GeneticUnit::nb_terminators() { int32_t nb_term = 0; if (dna_->length() >= TERM_SIZE) { for (int32_t i = 0; i < dna_->length(); i++) if (is_terminator(LEADING, i)) { // No need to count on both the // LEADING and the LAGGING // strand as terminators are // "shared" nb_term++; } } return nb_term; } #ifdef DEBUG /// Compare current rna_list_ with locate_promoters-generated rna_list_ void GeneticUnit::assert_promoters() { // Check that the lists are ordered correctly assert_promoters_order(); // Make a backup of the genetic unit's lists of RNAs auto backup = rna_list_; rna_list_ = {{}, {}}; locate_promoters(); // regenerate rna_list_ // Compare lists for (auto strand: {LEADING, LAGGING}) { if (backup[strand].size() != rna_list_[strand].size()) { printf("Individual %" PRId32 "\n", indiv_->id()); printf("***************** FOUND *******************"); print_rnas(backup[strand], strand); printf("***************** EXPECTED *******************"); print_rnas(rna_list_[strand], strand); printf("******************************************"); assert(false); } auto node_old = backup[strand].begin(); auto node_new = node_old; // just for the type for (node_old = backup[strand].begin(), node_new = rna_list_[strand].begin(); node_old != backup[strand].end(); // rna_list_ is the same size as backup ++node_old, ++node_new) { // TODO vld: to factor if (node_old->strand() != node_new->strand()) { printf("Individual %" PRId32 "\n", indiv_->id()); printf( "****************************** STRAND problem ******************************\n"); printf("should be : \n"); print_rnas(rna_list_); printf("is : \n"); print_rnas(backup); printf( "****************************************************************************\n"); printf(" %" PRId32 " (%s) : %f vs %" PRId32 " (%s) : %f\n", node_old->promoter_pos(), StrandName[strand], node_old->basal_level(), node_new->promoter_pos(), StrandName[strand], node_new->basal_level()); printf(" genome length : %" PRId32 "\n", dna_->length()); assert(node_old->strand() == node_new->strand()); } if (node_old->promoter_pos() != node_new->promoter_pos()) { printf("Individual %" PRId32 "\n", indiv_->id()); printf( "***************************** POSITION problem *****************************\n"); printf("should be : \n"); print_rnas(rna_list_); printf("is : \n"); print_rnas(backup); printf( "****************************************************************************\n"); printf(" %" PRId32 " (%s) : %f vs %" PRId32 " (%s) : %f\n", node_old->promoter_pos(), StrandName[strand], node_old->basal_level(), node_new->promoter_pos(), StrandName[strand], node_new->basal_level()); printf(" genome length : %" PRId32 "\n", dna_->length()); assert(node_old->promoter_pos() == node_new->promoter_pos()); } if (node_old->basal_level() != node_new->basal_level()) { printf("Individual %" PRId32 "\n", indiv_->id()); printf( "*************************** BASAL LEVEL problem ****************************\n"); printf("should be : \n"); print_rnas(rna_list_); printf("is : \n"); print_rnas(backup); printf( "****************************************************************************\n"); printf(" %" PRId32 " (%s) : %f vs %" PRId32 " (%s) : %f\n", node_old->promoter_pos(), StrandName[strand], node_old->basal_level(), node_new->promoter_pos(), StrandName[strand], node_new->basal_level()); printf(" genome length : %" PRId32 "\n", dna_->length()); assert(node_old->basal_level() == node_new->basal_level()); } } } rna_list_[LEADING].clear(); rna_list_[LAGGING].clear(); rna_list_ = backup; } void GeneticUnit::assert_promoters_order() { for (auto strand: {LEADING, LAGGING}) { if (rna_list_[strand].size() < 2) { continue; } for (auto it = rna_list_[strand].begin(); next(it) != rna_list_[strand].end(); ++it) { if ((strand == LEADING and it->promoter_pos() >= next(it)->promoter_pos()) or (strand == LAGGING and it->promoter_pos() <= next(it)->promoter_pos())) { printf("Individual %" PRId32 "\n", indiv_->id()); printf( "********************** ORDER problem (%s) ***********************\n", StrandName[strand]); print_rnas(); printf( "****************************************************************************\n"); assert(false); } } } } #endif /// Retrieve for each base if it belongs or not to coding RNA. /// /// \return Boolean table of sequence length size with for each base if it belongs or not to coding RNA bool* GeneticUnit::is_belonging_to_coding_RNA() { int32_t genome_length = dna_->length(); bool* belongs_to_coding_RNA = new bool[genome_length]; memset(belongs_to_coding_RNA, 0, genome_length); // Parse RNA lists and mark the corresponding bases as coding (only for the coding RNAs) for (int8_t strand = LEADING; strand <= LAGGING; strand++) { for (auto& rna: rna_list_[strand]) { int32_t first; int32_t last; if (strand == LEADING) { first = rna.promoter_pos(); last = rna.last_transcribed_pos(); } else // (strand == LAGGING) { last = rna.promoter_pos(); first = rna.last_transcribed_pos(); } if (not rna.transcribed_proteins().empty()) // coding RNA { if (first <= last) { for (int32_t i = first; i <= last; i++) { belongs_to_coding_RNA[i] = true; } } else { for (int32_t i = first; i < genome_length; i++) { belongs_to_coding_RNA[i] = true; } for (int32_t i = 0; i <= last; i++) { belongs_to_coding_RNA[i] = true; } } } } } return belongs_to_coding_RNA; } /** * Remove the bases that are not in coding RNA * * Remove the bases that are not in coding RNA and test at each loss that fitness is not changed */ void GeneticUnit::remove_non_coding_bases() { // TODO Restore method (deal with checking that the fitness remains untouched) // Environment* env = exp_m_->env() ; // // reset_expression(); // locate_promoters(); // distance_to_target_computed_ = false; // fitness_computed_ = false; // compute_phenotypic_contribution(); // if(exp_m_->output_m()->compute_phen_contrib_by_GU()) // { // compute_distance_to_target(env); // } // compute_fitness(env); // double initial_fitness = fitness(); // // int32_t genome_length = dna_->length(); // bool* belongs_to_coding_RNA = is_belonging_to_coding_RNA(); // // int32_t non_coding_bases_nb = nb_bases_in_0_coding_RNA(); // int32_t start = 0; // int32_t end = 0; // // // for (int32_t i = genome_length-1 ; i >= 0 ; i--) // { // if (belongs_to_coding_RNA[i] == false) // { // end = i+1; // while((i-1) >=0 && belongs_to_coding_RNA[(i-1)] == false) // { // i--; // } // start = i; // dna_->remove(start,end); // // locate_promoters(); // reset_expression(); // distance_to_target_computed_ = false; // fitness_computed_ = false; // compute_phenotypic_contribution(); // if(exp_m_->output_m()->compute_phen_contrib_by_GU()) // { // compute_distance_to_target(env); // } // compute_fitness(env); // assert(fitness()==initial_fitness); // // non_coding_computed_ = false; // non_coding_bases_nb = nb_bases_in_0_coding_RNA(); // } // } // // locate_promoters(); // reset_expression(); // distance_to_target_computed_ = false; // fitness_computed_ = false; // compute_phenotypic_contribution(); // if(exp_m_->output_m()->compute_phen_contrib_by_GU()) // { // compute_distance_to_target(env); // } // compute_fitness(env); // assert(fitness()==initial_fitness); // // non_coding_computed_ = false; // non_coding_bases_nb = nb_bases_in_0_coding_RNA(); // assert(non_coding_bases_nb==0); // // delete [] belongs_to_coding_RNA; } /** * Double the bases that are not in coding RNA * * Double the bases that are not in coding RNA by addition of random bases and test at each addition that fitness is not changed */ void GeneticUnit::double_non_coding_bases() { // TODO Restore method (deal with checking that the fitness remains untouched) // Environment* env = exp_m_->env() ; // // reset_expression(); // locate_promoters(); // distance_to_target_computed_ = false; // fitness_computed_ = false; // compute_phenotypic_contribution(); // if(exp_m_->output_m()->compute_phen_contrib_by_GU()) // { // compute_distance_to_target(env); // } // compute_fitness(env); // double initial_fitness = fitness(); // // int32_t genome_length = dna_->length(); // bool* belongs_to_coding_RNA = is_belonging_to_coding_RNA(); // // non_coding_computed_ = false; // int32_t inital_non_coding_bases_nb = nb_bases_in_0_coding_RNA(); // int32_t start = 0; // int32_t end = 0; // int32_t length = 0; // int32_t pos = 0; // char * random_portion = NULL; // bool insertion_ok = false; // int32_t non_coding_bases_nb_before_fitness = nb_bases_in_0_coding_RNA(); // int32_t non_coding_bases_nb_after_fitness = nb_bases_in_0_coding_RNA(); // // int32_t non_coding_bases_nb = nb_bases_in_0_coding_RNA(); // // for (int32_t i = genome_length-1 ; i >= 0 ; i--) // { // if (belongs_to_coding_RNA[i] == false) // { // end = i+1; // while((i-1) >=0 && belongs_to_coding_RNA[(i-1)] == false) // { // i--; // } // start = i; // length = end-start; // // insertion_ok = false; // while(not insertion_ok) // { // random_portion = new char [length+1]; // for (int32_t j = 0 ; j < length ; j++) // { // random_portion[j] = '0' + indiv_->mut_prng()->random(NB_BASE); // } // random_portion[length] = 0; // pos = indiv_->mut_prng()->random(length)+start; // dna_->insert(pos, random_portion); // // non_coding_computed_ = false; // non_coding_bases_nb_before_fitness = nb_bases_in_0_coding_RNA(); // // locate_promoters(); // reset_expression(); // distance_to_target_computed_ = false; // fitness_computed_ = false; // compute_phenotypic_contribution(); // if(exp_m_->output_m()->compute_phen_contrib_by_GU()) // { // compute_distance_to_target(env); // } // compute_fitness(env); // assert(fitness()==initial_fitness); // // non_coding_computed_ = false; // non_coding_bases_nb_after_fitness = nb_bases_in_0_coding_RNA(); // // if (non_coding_bases_nb_before_fitness != non_coding_bases_nb_after_fitness) // { // dna_->remove(pos, pos + length); // } // else // { // insertion_ok = true; // } // // } // non_coding_computed_ = false; // // delete [] random_portion; // random_portion = NULL; // } // } // // locate_promoters(); // reset_expression(); // distance_to_target_computed_ = false; // fitness_computed_ = false; // compute_phenotypic_contribution(); // if(exp_m_->output_m()->compute_phen_contrib_by_GU()) // { // compute_distance_to_target(env); // } // compute_fitness(env); // assert(fitness()==initial_fitness); // // non_coding_computed_ = false; // non_coding_bases_nb = nb_bases_in_0_coding_RNA(); // assert(non_coding_bases_nb == 2*inital_non_coding_bases_nb); // // delete [] belongs_to_coding_RNA; } // This is an auxiliary function for the method ae_genetic_unit::compute_nb_of_affected_genes. // The gene should go from 'first' to 'last' in the clockwise sense, implying that 'first' should be: // - the beginning of the promoter if the gene is on the leading strand // - or the end of the terminator if the gene is on the lagging strand. static bool breakpoint_inside_gene(int32_t pos_brkpt, int32_t first, int32_t last) { if (first < last) // most frequent case { if ((first <= pos_brkpt) && (pos_brkpt <= last)) { return true; } else { return false; } } else // special case where the RNA overlaps ori { if ((first <= pos_brkpt) || (pos_brkpt <= last)) { return true; } else { return false; } } } // This is an auxiliary function for the method ae_genetic_unit::compute_nb_of_affected_genes. // It return true if the gene is totally included in the segment [pos1, pos2]. // The gene should go from 'first' to 'last' in the clockwise sense, implying that 'first' should be: // - the beginning of the promoter if the gene is on the leading strand // - or the end of the terminator if the gene is on the lagging strand. static bool gene_totally_in_segment(int32_t pos1, int32_t pos2, int32_t first, int32_t last) { if ((first < last) && (pos1 <= pos2)) { if (((first >= pos1) && (first <= pos2)) && ((last >= pos1) && (last <= pos2))) { return true; } else { return false; } } else if ((first < last) && (pos1 > pos2)) // mut seg in 2 pieces but not the gene { if ((first >= pos1) || (last <= pos2)) // the gene is either completely in [pos1, genlen-1] or completely in [0, pos2] { return true; } else { return false; } } else if ((first > last) && (pos1 <= pos2)) // gene in two pieces but not mut seg, the gene cannot be totally included { return false; } else // both mut seg and the gene are in 2 pieces { if ((first >= pos1) && (last <= pos2)) { return true; } else { return false; } } } // WARNING: This method works properly only in the case of a single genetic unit (no plasmid). // Translocations between different genetic units is not managed. void GeneticUnit::compute_nb_of_affected_genes(const Mutation* mut, int& nb_genes_at_breakpoints, int& nb_genes_in_segment, int& nb_genes_in_replaced_segment) { nb_genes_at_breakpoints = 0; nb_genes_in_segment = 0; nb_genes_in_replaced_segment = 0; int32_t genlen = seq_length(); // length of the genetic unit, in bp int32_t pos0 = -1, pos1 = -1, pos2 = -1, pos3 = -1, mutlength = -1; int32_t pos3donor = -1; char* seq = NULL; int32_t first, last; MutationType type = mut->mut_type(); switch (type) { case SWITCH: pos0 = dynamic_cast(mut)->pos(); mutlength = 1; break; case S_INS : { const auto* s_ins = dynamic_cast(mut); pos0 = s_ins->pos(); mutlength = s_ins->length(); break; } case S_DEL : { const auto* s_del = dynamic_cast(mut); pos0 = s_del->pos(); mutlength = s_del->length(); break; } case DUPL : { const auto& dupl = dynamic_cast(mut); pos1 = dupl->pos1(); pos2 = Utils::mod(dupl->pos2() - 1, genlen); pos0 = dupl->pos3(); mutlength = dupl->length(); } case DEL : { const auto& del = dynamic_cast(mut); pos1 = del->pos1(); pos2 = Utils::mod(del->pos2() - 1, genlen); mutlength = del->length(); break; } case TRANS : { const auto& trans = dynamic_cast(mut); pos1 = trans->pos1(); pos2 = Utils::mod(trans->pos2() - 1, genlen); pos3 = trans->pos3(); pos0 = trans->pos4(); mutlength = trans->length(); break; } case INV : { const auto& inv = dynamic_cast(mut); pos1 = inv->pos1(); pos2 = Utils::mod(inv->pos2() - 1, genlen); mutlength = inv->length(); break; } case INS_HT: { const auto& ins_ht = dynamic_cast(mut); pos0 = ins_ht->exogenote_pos();// TODO weird ! pos3donor = ins_ht->receiver_pos();// TODO weird ! mutlength = ins_ht->length(); seq = ins_ht->seq(); // Make a temporary genetic unit and translate it to count how many genes were on the exogenote GeneticUnit* tmpunit = new GeneticUnit(indiv_, seq, mutlength); tmpunit->do_transcription(); tmpunit->do_translation(); nb_genes_in_segment = tmpunit->nb_coding_RNAs(); // Check whether the pos3donor breakpoint killed one or several of those genes, in that case decrement nb_genes_in_segment for (auto& strand: tmpunit->rna_list_) for (auto& rna: strand) { if (not rna.is_coding()) { continue; } first = rna.promoter_pos(); last = rna.last_transcribed_pos(); if (breakpoint_inside_gene(pos3donor, first, last)) { nb_genes_in_segment--; } } delete tmpunit; seq = NULL; break; } case REPL_HT: { const auto& repl_ht = dynamic_cast(mut); pos1 = repl_ht->receiver_pos1(); pos2 = Utils::mod(repl_ht->receiver_pos2() - 1, genlen); mutlength = repl_ht->length(); seq = repl_ht->seq(); // Make a temporary genetic unit and translate it to count how many genes were on the donor segment GeneticUnit* tmpunit = new GeneticUnit(indiv_, seq, mutlength); tmpunit->do_transcription(); tmpunit->do_translation(); nb_genes_in_segment = tmpunit->nb_coding_RNAs(); // Remove the genes that overlap ori in this temporary unit, as the transferred segment was actually linear for (auto& strand: tmpunit->rna_list_) for (auto& rna: strand) { if (not rna.is_coding()) { continue; } first = rna.promoter_pos(); last = rna.last_transcribed_pos(); if (first > last) { nb_genes_in_segment--; } } delete tmpunit; seq = NULL; break; } default: fprintf(stderr, "Error: unknown mutation type in ae_genetic_unit::compute_nb_of_affected_genes.\n"); } for (auto strand: {LEADING, LAGGING}) for (auto& rna: rna_list_[strand]) { if (rna.is_coding() == false) continue; switch (strand) { case LEADING: first = rna.promoter_pos(); last = rna.last_transcribed_pos(); break; case LAGGING: first = rna.last_transcribed_pos(); last = rna.promoter_pos(); }; // TODO vld: reoder lines (if invariant) in cases DUPL and // DEL/INV and merge with S_DEL thanks to fallthrough (etc) switch (type) { case SWITCH: // fall through case S_INS: // fall through case INSERT: // fall through case INS_HT: // fall through case S_DEL: if (breakpoint_inside_gene(pos0, first, last)) { nb_genes_at_breakpoints++; } break; case DUPL: if (gene_totally_in_segment(pos1, pos2, first, last)) { nb_genes_in_segment++; } if (breakpoint_inside_gene(pos0, first, last)) { nb_genes_at_breakpoints++; } break; case DEL: case INV: if (gene_totally_in_segment(pos1, pos2, first, last)) { nb_genes_in_segment++; } if (breakpoint_inside_gene(pos1, first, last)) { nb_genes_at_breakpoints++; } else if (breakpoint_inside_gene(pos2, first, last)) { nb_genes_at_breakpoints++; } // else because the gene must not be counted twice if both p1 and p2 are in the same gene break; case TRANS: if (gene_totally_in_segment(pos1, pos2, first, last)) nb_genes_in_segment++; if (breakpoint_inside_gene(pos1, first, last)) nb_genes_at_breakpoints++; // beginning of the excised segment else if (breakpoint_inside_gene(pos2, first, last)) nb_genes_at_breakpoints++; // end of the excised segment else if (breakpoint_inside_gene(pos3, first, last)) nb_genes_at_breakpoints++; // breakpoint inside the segment for the reinsertion else if (breakpoint_inside_gene(pos0, first, last)) nb_genes_at_breakpoints++; // reinsertion point in the genetic unit break; case REPL_HT: if (gene_totally_in_segment(pos1, pos2, first, last)) nb_genes_in_replaced_segment++; // the whole gene sequence was replaced by the donor DNA if (breakpoint_inside_gene(pos1, first, last)) nb_genes_at_breakpoints++; // the gene was disrupted by the breakpoint p1 else if (breakpoint_inside_gene(pos2, first, last)) nb_genes_at_breakpoints++; // the gene was disrupted by the breakpoint p2 break; default: // Only simple mutation types are considered. break; } } // if (type == REPL_HT) printf("%d genes in the replaced segment, %d in the donor\n", nb_genes_in_replaced_segment, nb_genes_in_segment); if (seq != NULL) delete[] seq; } // ================================================================= // Protected Methods // ================================================================= void GeneticUnit::init_statistical_data( void) // TODO : integrate into compute_statistical_data { //~ nb_promoters_[LEADING] = 0; //~ nb_promoters_[LAGGING] = 0; //~ nb_genes_[LEADING] = 0; //~ nb_genes_[LAGGING] = 0; //~ average_gene_size_ = 0; //~ average_functional_gene_size_ = 0; //~ nb_coding_bp_ = 0; //~ clustering_ = 0; nb_coding_RNAs_ = 0; nb_non_coding_RNAs_ = 0; overall_size_coding_RNAs_ = 0; overall_size_non_coding_RNAs_ = 0; nb_genes_activ_ = 0; nb_genes_inhib_ = 0; nb_fun_genes_ = 0; nb_non_fun_genes_ = 0; overall_size_fun_genes_ = 0; overall_size_non_fun_genes_ = 0; nb_bases_in_0_CDS_ = -1; nb_bases_in_0_functional_CDS_ = -1; nb_bases_in_0_non_functional_CDS_ = -1; nb_bases_in_0_RNA_ = -1; nb_bases_in_0_coding_RNA_ = -1; nb_bases_in_0_non_coding_RNA_ = -1; nb_bases_non_essential_ = -1; nb_bases_non_essential_including_nf_genes_ = -1; modularity_ = -1; beginning_neutral_regions_ = NULL; end_neutral_regions_ = NULL; } void GeneticUnit::clear_transcribed_proteins() { for (auto strand: {LEADING, LAGGING}) { for (auto& rna: rna_list_[strand]) rna.clear_transcribed_proteins(); protein_list_[strand].clear(); } } } // namespace aevol aevol-5.0/src/libaevol/ae_string.h0000644000175000017500000001125112724051151014113 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_STRING_H_ #define AEVOL_STRING_H_ // ================================================================= // Libraries // ================================================================= #include #include #include #include #include #include #include // ================================================================= // Project Files // ================================================================= #include "Utils.h" #include "JumpingMT.h" namespace aevol { // ================================================================= // Class declarations // ================================================================= #define BLOCK_SIZE INT32_C(1024) class ae_string { public : // ================================================================= // Constructors // ================================================================= ae_string(); ae_string(const ae_string &model); ae_string(int32_t length, std::shared_ptr prng); ae_string(const char* seq, int32_t length); ae_string(char* seq, int32_t length, bool use_seq); explicit ae_string(gzFile backup_file); explicit ae_string(char* organism_file_name); // ================================================================= // Destructors // ================================================================= virtual ~ae_string(); // ================================================================= // Accessors // ================================================================= const char* data() const {return data_;} int32_t length() const {return length_;} inline void set_data(char* data, int32_t length = -1); // ================================================================= // Public Methods // ================================================================= void remove(int32_t first, int32_t last); void insert(int32_t pos, const char* seq, int32_t seq_length = -1); void replace(int32_t pos, char* seq, int32_t seq_length = -1); void save(gzFile backup_file); protected : // ================================================================= // Protected Methods // ================================================================= static inline int32_t nb_blocks(int32_t length); // ================================================================= // Protected Attributes // ================================================================= char* data_; int32_t length_; int32_t nb_blocks_; }; // ===================================================================== // Accessors' definitions // ===================================================================== void ae_string::set_data(char* data, int32_t length /* = -1 */) { if (data_ != NULL) { delete [] data_; data_ = NULL; } data_ = data; length_ = (length != -1) ? length : strlen(data_); nb_blocks_ = nb_blocks(length_); } // ===================================================================== // Inline functions' definition // ===================================================================== int32_t ae_string::nb_blocks(int32_t length) { return length/BLOCK_SIZE + 1; } } // namespace aevol #endif // AEVOL_STRING_H_ aevol-5.0/src/libaevol/Fuzzy.h0000644000175000017500000001527312724051151013277 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_FUZZY_H_ #define AEVOL_FUZZY_H_ #include #include "macros.h" #include "Point.h" #include "AbstractFuzzy.h" namespace aevol { /// Triangular fuzzy sets. /// /// This class provides management tools for "fuzzy sets" abscissa are /// bound between X_MIN and X_MAX (defined in macros.h) A "fuzzy /// set" should always have at least two points of abscissa X_MIN and /// X_MAX. /// /// A fuzzy set holds elements in a set X together with a probability /// function X → [0,1] which tells how likely element x ∈ X beholds to /// the fuzzy set. With these triangular fuzzy sets, the probability /// function is a finite sum of isosceles triangles. /// /// The current class models fuzzy sets over range X = [X_MIN; X_MAX] /// by representing the probability function as the list of singular /// points on its graph. /// /// \verbatim /// \\code{.unparsed} /// ^ /// y2 +... X .... /// |... / \ .... /// y6 +... / \ X .... /// |... / \ / \ .... /// y4 +... / \ X / \ .... /// |... / \ / \ / \ .... /// y3,y9+... / X \ / \ X .... /// |... / \ / \ / \ .... /// y5 +... / X \ / \ .... /// |... / \ / \ .... /// 0 +--X----X---------|-----|-|---|-----|-------X-----X-------X----X---> /// X_MIN x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 X_MAX /// \\endcode /// \endverbatim /// fs.points_ would hold the list {(X_MIN,0),(x1,y1),...,(x10,y10)(X_MAX,0)} /// /// \invariant{`points_.size()` ≥ 2} /// \invariant{`points_.begin()->x == X_MIN`} /// \invariant{`prev(points_.end())->x == X_MAX`} /// \invariant{`is_increasing()`} class Fuzzy : public AbstractFuzzy { public: // ========================================================================== // Constructors // ========================================================================== Fuzzy(): points_({Point(X_MIN, 0.0), Point(X_MAX, 0.0)}) {}; Fuzzy(const Fuzzy& f): points_(f.points_) {}; Fuzzy(const gzFile backup) { load(backup); }; // ========================================================================== // Destructor // ========================================================================== virtual ~Fuzzy() {}; // ========================================================================== // Public Methods // ========================================================================== void save(gzFile backup) const; void load(gzFile backup); void reset(); void simplify(); void add_triangle(double mean, double width, double height); void add(const AbstractFuzzy& f); void sub(const AbstractFuzzy& f); void add_point(double x, double y); void clip(clipping_direction direction, double bound); // TODO: should be made protected std::list::iterator create_interpolated_point(double x); // ========================================================================== // Getters // ========================================================================== const std::list& points() const {return points_;} double get_geometric_area() const; double get_geometric_area(std::list::const_iterator begin, std::list::const_iterator end) const; double get_geometric_area(double start_segment, double end_segment) const; double y(double x, std::list::const_iterator begin) const; double y(double x) const; // get_x should be moved out of fuzzy class as it really applies to pair of points double x(const Point& left, const Point& right, double y) const; bool is_identical_to(const AbstractFuzzy& fs, double tolerance) const; void print() const; void clear(); // ========================================================================== // Setters // ========================================================================== // ========================================================================== // Operators // ========================================================================== protected: // ========================================================================== // Protected Methods // ========================================================================== bool invariant() const { return points_.size() >= 2 and points_.begin()->x == X_MIN and prev(points_.end())->x == X_MAX and is_increasing(); }; bool is_increasing() const; // ========================================================================== // Attributes // ========================================================================== std::list points_; std::list::iterator create_interpolated_point( double x, std::list::iterator start); }; double trapezoid_area(const Point& p1, const Point& p2); } // namespace aevol #endif // AEVOL_FUZZY_H_ aevol-5.0/src/libaevol/Duplication.cpp0000644000175000017500000000666512724051151014763 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ============================================================================ // Includes // ============================================================================ #include "Duplication.h" namespace aevol { // ============================================================================ // Definition of static attributes // ============================================================================ // ============================================================================ // Constructors // ============================================================================ // ============================================================================ // Destructor // ============================================================================ // ============================================================================ // Methods // ============================================================================ void Duplication::save(gzFile backup_file) const { int8_t tmp_mut_type = DUPL; gzwrite(backup_file, &tmp_mut_type, sizeof(tmp_mut_type)); gzwrite(backup_file, &pos1_, sizeof(pos1_)); gzwrite(backup_file, &pos2_, sizeof(pos2_)); gzwrite(backup_file, &pos3_, sizeof(pos3_)); gzwrite(backup_file, &length_, sizeof(length_)); gzwrite(backup_file, &align_score_, sizeof(align_score_)); } void Duplication::load(gzFile backup_file) { gzread(backup_file, &pos1_, sizeof(pos1_)); gzread(backup_file, &pos2_, sizeof(pos2_)); gzread(backup_file, &pos3_, sizeof(pos3_)); gzread(backup_file, &length_, sizeof(length_)); gzread(backup_file, &align_score_, sizeof(align_score_)); } void Duplication::generic_description_string(char* str) const { sprintf(str, "%" PRId8 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId8 " %" PRId16 " %" PRId16 " %" PRId32 " %" PRId32, mut_type(), pos1(), pos2(), pos3(), -1, -1, align_score(), -1, length_, -1); } // ============================================================================ // Non inline accessors // ============================================================================ } // namespace aevol aevol-5.0/src/libaevol/NonCodingMetrics.h0000644000175000017500000001563612724051151015360 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_NON_CODING_STATS_H_ #define AEVOL_NON_CODING_STATS_H_ // ============================================================================ // Includes // ============================================================================ #include #include #include #include #include "GeneticUnit.h" namespace aevol { // ============================================================================ // Class declarations // ============================================================================ // TODO Not used ? class NonCodingMetrics { friend Individual; public : // ========================================================================== // Constructors // ========================================================================== NonCodingMetrics() = default; //< Default ctor NonCodingMetrics(const NonCodingMetrics&) = default; //< Copy ctor NonCodingMetrics(NonCodingMetrics&&) = default; //< Move ctor // ========================================================================== // Destructor // ========================================================================== virtual ~NonCodingMetrics() = default; //< Destructor // ========================================================================== // Getters // ========================================================================== int32_t nb_bases_in_0_CDS() const { return nb_bases_in_0_CDS_; }; int32_t nb_bases_in_0_functional_CDS() const { return nb_bases_in_0_functional_CDS_; }; int32_t nb_bases_in_0_non_functional_CDS() const { return nb_bases_in_0_non_functional_CDS_; }; int32_t nb_bases_in_0_RNA() const { return nb_bases_in_0_RNA_; }; int32_t nb_bases_in_0_coding_RNA() const { return nb_bases_in_0_coding_RNA_; }; int32_t nb_bases_in_0_non_coding_RNA() const { return nb_bases_in_0_non_coding_RNA_; }; int32_t nb_bases_in_neutral_regions() const { return nb_bases_in_neutral_regions_; }; int32_t nb_neutral_regions() const { return nb_neutral_regions_; }; // ========================================================================== // Setters // ========================================================================== // ========================================================================== // Operators // ========================================================================== // ========================================================================== // Public Methods // ========================================================================== inline void Accumulate(const GeneticUnit& gen_unit); protected : // ========================================================================== // Protected Methods // ========================================================================== // ========================================================================== // Attributes // ========================================================================== /// Number of bases that are not included in any gene int32_t nb_bases_in_0_CDS_; /// Number of bases that are not included in any functional gene int32_t nb_bases_in_0_functional_CDS_; /// Number of bases that are not included in any degenerated gene int32_t nb_bases_in_0_non_functional_CDS_; /// Number of bases that are not included in any RNA int32_t nb_bases_in_0_RNA_; /// Number of bases that are not included in any coding RNA /// (RNAs containing at least one CDS) int32_t nb_bases_in_0_coding_RNA_; /// Number of bases that are not included in any non coding RNA int32_t nb_bases_in_0_non_coding_RNA_; /// Number of bases that are in a neutral region /// A base is considered neutral when neither itself NOR its corresponding base on the other /// strand belongs to a coding promoter->terminator region (both included) int32_t nb_bases_in_neutral_regions_; /// Number of neutral regions int32_t nb_neutral_regions_; }; // ============================================================================ // Getters' definitions // ============================================================================ // ============================================================================ // Setters' definitions // ============================================================================ // ============================================================================ // Operators' definitions // ============================================================================ // ============================================================================ // Inline functions' definition // ============================================================================ void NonCodingMetrics::Accumulate(const GeneticUnit& gen_unit) { nb_bases_in_0_CDS_ += gen_unit.nb_bases_in_0_CDS(); nb_bases_in_0_functional_CDS_ += gen_unit.nb_bases_in_0_functional_CDS(); nb_bases_in_0_non_functional_CDS_ += gen_unit.nb_bases_in_0_non_functional_CDS(); nb_bases_in_0_RNA_ += gen_unit.nb_bases_in_0_RNA(); nb_bases_in_0_coding_RNA_ += gen_unit.nb_bases_in_0_coding_RNA(); nb_bases_in_0_non_coding_RNA_ += gen_unit.nb_bases_in_0_non_coding_RNA(); nb_bases_in_neutral_regions_ += gen_unit.nb_bases_in_neutral_regions(); nb_neutral_regions_ += gen_unit.nb_neutral_regions(); } } // namespace aevol #endif // AEVOL_NON_CODING_STATS_H_ aevol-5.0/src/libaevol/Makefile.am0000644000175000017500000001057512724051151014033 00000000000000############################################ # Variables # ############################################ AM_CPPFLAGS = $(AEVOLCPPFLAGS) AM_CXXFLAGS = $(AEVOLCXXFLAGS) AM_LDFLAGS = $(AEVOLLDFLAGS) SUBDIRS = SFMT-src-1.4 . ######################## # Set library to build # ######################## noinst_LIBRARIES = libaevol.a ############################################ # C99 exact-width integer specific support # ############################################ # __STDC_FORMAT_MACROS allows us to use exact-width integer format specifiers e.g. PRId32 (for printf etc) # __STDC_CONSTANT_MACROS allows us to define exact-width integer macros with e.g. INT32_C( ) # __STDC_LIMIT_MACROS allows us to use exact-width integer limit macros with e.g. INT32_MAX AM_CPPFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS common_headers = \ AbstractFuzzy.h \ aevol.h \ Alignment.h \ Codon.h \ Dna.h \ Dump.h \ ae_enums.h \ PhenotypicSegment.h \ ExpManager.h \ ExpSetup.h \ Fuzzy.h \ FuzzyFactory.h \ Gaussian.h \ GeneticUnit.h \ GridCell.h \ GzHelpers.h \ HybridFuzzy.h \ Individual.h \ IndividualFactory.h \ Logging.h \ macros.h \ Mutation.h \ LocalMutation.h \ PointMutation.h \ SmallInsertion.h \ SmallDeletion.h \ Rearrangement.h \ Duplication.h \ Deletion.h \ Translocation.h \ Inversion.h \ HorizontalTransfer.h \ InsertionHT.h \ ReplacementHT.h \ Observable.h \ ObservableEvent.h \ Observer.h \ OutputManager.h \ MutationParams.h \ Phenotype.h \ PhenotypicTarget.h \ PhenotypicTargetHandler.h \ Point.h \ Protein.h \ JumpingMT.h \ JumpPoly.h \ ReplicationReport.h \ DnaReplicationReport.h \ Rna.h \ Stats.h \ StatRecord.h \ NonCodingMetrics.h \ Metrics.h \ ae_string.h \ Tree.h \ Utils.h \ VisAVis.h \ Selection.h \ Habitat.h \ ParamLoader.h \ ParameterLine.h \ World.h \ AeTime.h \ World.h \ make_unique.h \ ae_logger.h \ HabitatFactory.h common_sources = \ Alignment.cpp \ Codon.cpp \ Dna.cpp \ Dump.cpp \ ExpManager.cpp \ ExpSetup.cpp \ GeneticUnit.cpp \ GridCell.cpp \ Individual.cpp \ IndividualFactory.cpp \ Logging.cpp \ Mutation.cpp \ PointMutation.cpp \ SmallInsertion.cpp \ SmallDeletion.cpp \ Duplication.cpp \ Deletion.cpp \ Translocation.cpp \ Inversion.cpp \ InsertionHT.cpp \ ReplacementHT.cpp \ Observable.cpp \ OutputManager.cpp \ MutationParams.cpp \ PhenotypicTarget.cpp \ PhenotypicTargetHandler.cpp \ Point.cpp \ Protein.cpp \ JumpingMT.cpp \ ReplicationReport.cpp \ DnaReplicationReport.cpp \ Rna.cpp \ Stats.cpp \ StatRecord.cpp \ ae_string.cpp \ Tree.cpp \ Utils.cpp \ VisAVis.cpp \ Selection.cpp \ AbstractFuzzy.cpp \ HybridFuzzy.cpp \ FuzzyFactory.cpp \ Fuzzy.cpp \ Habitat.cpp \ ParamLoader.cpp \ ParameterLine.cpp \ AeTime.cpp \ World.cpp \ HabitatFactory.cpp raevol_headers = \ raevol/Individual_R.h \ raevol/Protein_R.h \ raevol/Rna_R.h \ raevol/PhenotypicTargetHandler_R.h \ raevol/Habitat_R.h \ raevol/PhenotypicTarget_R.h raevol_sources = \ raevol/Individual_R.cpp \ raevol/Protein_R.cpp \ raevol/Rna_R.cpp \ raevol/PhenotypicTargetHandler_R.cpp \ raevol/Habitat_R.cpp \ raevol/PhenotypicTarget_R.cpp raevol_X11_headers = \ raevol/Individual_R_X11.h raevol_X11_sources = \ raevol/Individual_R_X11.cpp X11_headers = \ Individual_X11.h \ ExpManager_X11.h \ X11Window.h X11_sources = \ Individual_X11.cpp \ ExpManager_X11.cpp \ X11Window.cpp # The target_CPPFLAGS for each target may look useless, it is here to force automake to create # prefixed object files so that we don't use an object file built for another set of macrodefinitions # e.g. We don't want to use an object file created with NO_X when building the X11 lib if WITH_X if WITH_RAEVOL #libaevol_a_HEADERS += $(common_headers) $(X11_headers) $(raevol_headers) $(raevol_X11_headers) libaevol_a_SOURCES = $(common_sources) $(X11_sources) $(raevol_sources) $(raevol_X11_sources) libaevol_a_SOURCES += $(common_headers) $(X11_headers) $(raevol_headers) $(raevol_X11_headers) else #libaevol_a_HEADERS = $(common_headers) $(X11_headers) libaevol_a_SOURCES = $(common_sources) $(X11_sources) libaevol_a_SOURCES += $(common_headers) $(X11_headers) endif else # WITHOUT_X if WITH_RAEVOL #libaevol_a_HEADERS = $(common_headers) $(raevol_headers) libaevol_a_SOURCES = $(common_sources) $(raevol_sources) libaevol_a_SOURCES += $(common_headers) $(raevol_headers) else #libaevol_a_HEADERS = $(common_headers) libaevol_a_SOURCES = $(common_sources) libaevol_a_SOURCES += $(common_headers) endif endif # X aevol-5.0/src/libaevol/MutationParams.h0000644000175000017500000004304112724051151015106 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_MUTATION_PARAMS_H_ #define AEVOL_MUTATION_PARAMS_H_ // ================================================================= // Libraries // ================================================================= #include #include // ================================================================= // Project Files // ================================================================= #include #include #include #include #include "ae_enums.h" namespace aevol { // ================================================================= // Class declarations // ================================================================= class MutationParams { public : // ================================================================= // Constructors // ================================================================= MutationParams(); MutationParams(const MutationParams & model); MutationParams(gzFile backup_file); // ================================================================= // Destructors // ================================================================= virtual ~MutationParams(); // ================================================================= // Accessors: getters // ================================================================= // --------------------------------------------------------- Mutation rates inline double point_mutation_rate() const; inline double small_insertion_rate() const; inline double small_deletion_rate() const; inline int16_t max_indel_size() const; // -------------------------------------------- Rearrangements and Transfer inline bool with_4pts_trans() const; inline bool with_alignments() const; inline bool with_HT() const; inline bool repl_HT_with_close_points() const; inline double HT_ins_rate() const; inline double HT_repl_rate() const; inline double repl_HT_detach_rate() const; // ------------------------------ Rearrangement rates (without alignements) inline double duplication_rate() const; inline double deletion_rate() const; inline double translocation_rate() const; inline double inversion_rate() const; // --------------------------------- Rearrangement rates (with alignements) inline double neighbourhood_rate() const; inline double duplication_proportion() const; inline double deletion_proportion() const; inline double translocation_proportion() const; inline double inversion_proportion() const; // ------------------------------------------------------------ Alignements inline AlignmentFunctionShape align_fun_shape() const; inline double align_sigm_lambda() const; inline int16_t align_sigm_mean() const; inline int16_t align_lin_min() const; inline int16_t align_lin_max() const; // Maximum shift of one seq on the other inline int16_t align_max_shift() const; // Work zone half length inline int16_t align_w_zone_h_len() const; // Corresponding residues match bonus inline int16_t align_match_bonus() const; // Corresponding residues mismatch cost inline int16_t align_mismatch_cost() const; // ================================================================= // Accessors: setters // ================================================================= // --------------------------------------------------------- Mutation rates inline void set_point_mutation_rate(double point_mutation_rate); inline void set_small_insertion_rate(double small_insertion_rate); inline void set_small_deletion_rate(double small_deletion_rate); inline void set_max_indel_size(int16_t max_indel_size); // -------------------------------------------- Rearrangements and Transfer inline void set_with_4pts_trans(bool with_4pts_trans); inline void set_with_alignments(bool with_alignments); inline void set_with_HT(bool with_HT); inline void set_repl_HT_with_close_points(bool repl_HT_with_close_points); inline void set_HT_ins_rate(double HT_ins_rate); inline void set_HT_repl_rate(double HT_repl_rate); inline void set_repl_HT_detach_rate(double repl_HT_detach_rate); // ------------------------------ Rearrangement rates (without alignements) inline void set_duplication_rate(double duplication_rate); inline void set_deletion_rate(double deletion_rate); inline void set_translocation_rate(double translocation_rate); inline void set_inversion_rate(double inversion_rate); // --------------------------------- Rearrangement rates (with alignements) inline void set_neighbourhood_rate(double neighbourhood_rate); inline void set_duplication_proportion(double duplication_proportion); inline void set_deletion_proportion(double deletion_proportion); inline void set_translocation_proportion(double translocation_proportion); inline void set_inversion_proportion(double inversion_proportion); // ------------------------------------------------------------ Alignements inline void set_align_fun_shape(AlignmentFunctionShape align_fun_shape); inline void set_align_sigm_lambda(double align_sigm_lambda); inline void set_align_sigm_mean(int16_t align_sigm_mean); inline void set_align_lin_min(int16_t align_lin_min); inline void set_align_lin_max(int16_t align_lin_max); inline void set_align_max_shift(int16_t align_max_shift); inline void set_align_w_zone_h_len(int16_t align_w_zone_h_len); inline void set_align_match_bonus(int16_t align_match_bonus); inline void set_align_mismatch_cost(int16_t align_mismatch_cost); // ================================================================= // Operators // ================================================================= // ================================================================= // Public Methods // ================================================================= void save(gzFile backup_file) const; // ================================================================= // Public Attributes // ================================================================= protected : // ================================================================= // Forbidden Constructors // ================================================================= /*MutationParams() { printf("%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__); exit(EXIT_FAILURE); }; MutationParams(const MutationParams &model) { printf("%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__); exit(EXIT_FAILURE); };*/ // ================================================================= // Protected Methods // ================================================================= // ================================================================= // Protected Attributes // ================================================================= // --------------------------------------------------------- Mutation rates double point_mutation_rate_; double small_insertion_rate_; double small_deletion_rate_; int16_t max_indel_size_; // -------------------------------------------- Rearrangements and Transfer bool with_4pts_trans_; bool with_alignments_; bool with_HT_; bool repl_HT_with_close_points_; double HT_ins_rate_; double HT_repl_rate_; double repl_HT_detach_rate_; // ------------------------------ Rearrangement rates (without alignements) double duplication_rate_; double deletion_rate_; double translocation_rate_; double inversion_rate_; // --------------------------------- Rearrangement rates (with alignements) double neighbourhood_rate_; double duplication_proportion_; double deletion_proportion_; double translocation_proportion_; double inversion_proportion_; // ------------------------------------------------------------ Alignements AlignmentFunctionShape align_fun_shape_; double align_sigm_lambda_; int16_t align_sigm_mean_; int16_t align_lin_min_; int16_t align_lin_max_; int16_t align_max_shift_; // Maximum shift of one seq on the other int16_t align_w_zone_h_len_; // Work zone half length int16_t align_match_bonus_; // Corresponding residues match bonus int16_t align_mismatch_cost_; // Corresponding residues mismatch cost }; // ===================================================================== // Getters' definitions // ===================================================================== // ------------------------------------------------------------- Mutation rates inline double MutationParams::point_mutation_rate() const { return point_mutation_rate_; } inline double MutationParams::small_insertion_rate() const { return small_insertion_rate_; } inline double MutationParams::small_deletion_rate() const { return small_deletion_rate_; } inline int16_t MutationParams::max_indel_size() const { return max_indel_size_; } // ------------------------------------------------ Rearrangements and Transfer inline bool MutationParams::with_4pts_trans() const { return with_4pts_trans_; } inline bool MutationParams::with_alignments() const { return with_alignments_; } inline bool MutationParams::with_HT() const { return with_HT_; } inline bool MutationParams::repl_HT_with_close_points() const { return repl_HT_with_close_points_; } inline double MutationParams::HT_ins_rate() const { return HT_ins_rate_; } inline double MutationParams::HT_repl_rate() const { return HT_repl_rate_; } inline double MutationParams::repl_HT_detach_rate() const { return repl_HT_detach_rate_; } // ---------------------------------- Rearrangement rates (without alignements) inline double MutationParams::duplication_rate() const { return duplication_rate_; } inline double MutationParams::deletion_rate() const { return deletion_rate_; } inline double MutationParams::translocation_rate() const { return translocation_rate_; } inline double MutationParams::inversion_rate() const { return inversion_rate_; } // ------------------------------------- Rearrangement rates (with alignements) inline double MutationParams::neighbourhood_rate() const { return neighbourhood_rate_; } inline double MutationParams::duplication_proportion() const { return duplication_proportion_; } inline double MutationParams::deletion_proportion() const { return deletion_proportion_; } inline double MutationParams::translocation_proportion() const { return translocation_proportion_; } inline double MutationParams::inversion_proportion() const { return inversion_proportion_; } // ---------------------------------------------------------------- Alignements inline AlignmentFunctionShape MutationParams::align_fun_shape() const { return align_fun_shape_; } inline double MutationParams::align_sigm_lambda() const { return align_sigm_lambda_; } inline int16_t MutationParams::align_sigm_mean() const { return align_sigm_mean_; } inline int16_t MutationParams::align_lin_min() const { return align_lin_min_; } inline int16_t MutationParams::align_lin_max() const { return align_lin_max_; } inline int16_t MutationParams::align_max_shift() const { return align_max_shift_; } inline int16_t MutationParams::align_w_zone_h_len() const { return align_w_zone_h_len_; } inline int16_t MutationParams::align_match_bonus() const { return align_match_bonus_; } inline int16_t MutationParams::align_mismatch_cost() const { return align_mismatch_cost_; } // ===================================================================== // Setters' definitions // ===================================================================== // ------------------------------------------------------------- Mutation rates inline void MutationParams::set_point_mutation_rate(double point_mutation_rate) { point_mutation_rate_ = point_mutation_rate; } inline void MutationParams::set_small_insertion_rate(double small_insertion_rate) { small_insertion_rate_ = small_insertion_rate; } inline void MutationParams::set_small_deletion_rate(double small_deletion_rate) { small_deletion_rate_ = small_deletion_rate; } inline void MutationParams::set_max_indel_size(int16_t max_indel_size) { max_indel_size_ = max_indel_size; } // ------------------------------------------------ Rearrangements and Transfer inline void MutationParams::set_with_4pts_trans(bool with_4pts_trans) { with_4pts_trans_ = with_4pts_trans; } inline void MutationParams::set_with_alignments(bool with_alignments) { with_alignments_ = with_alignments; } inline void MutationParams::set_with_HT(bool with_HT) { with_HT_ = with_HT; } inline void MutationParams::set_repl_HT_with_close_points(bool repl_HT_with_close_points) { repl_HT_with_close_points_ = repl_HT_with_close_points; } inline void MutationParams::set_HT_ins_rate(double HT_ins_rate) { HT_ins_rate_ = HT_ins_rate; } inline void MutationParams::set_HT_repl_rate(double HT_repl_rate) { HT_repl_rate_ = HT_repl_rate; } inline void MutationParams::set_repl_HT_detach_rate(double repl_HT_detach_rate) { repl_HT_detach_rate_ = repl_HT_detach_rate; } // ---------------------------------- Rearrangement rates (without alignements) inline void MutationParams::set_duplication_rate(double duplication_rate) { duplication_rate_ = duplication_rate; } inline void MutationParams::set_deletion_rate(double deletion_rate) { deletion_rate_ = deletion_rate; } inline void MutationParams::set_translocation_rate(double translocation_rate) { translocation_rate_ = translocation_rate; } inline void MutationParams::set_inversion_rate(double inversion_rate) { inversion_rate_ = inversion_rate; } // ------------------------------------- Rearrangement rates (with alignements) inline void MutationParams::set_neighbourhood_rate(double neighbourhood_rate) { neighbourhood_rate_ = neighbourhood_rate; } inline void MutationParams::set_duplication_proportion(double duplication_proportion) { duplication_proportion_ = duplication_proportion; } inline void MutationParams::set_deletion_proportion(double deletion_proportion) { deletion_proportion_ = deletion_proportion; } inline void MutationParams::set_translocation_proportion(double translocation_proportion) { translocation_proportion_ = translocation_proportion; } inline void MutationParams::set_inversion_proportion(double inversion_proportion) { inversion_proportion_ = inversion_proportion; } // ---------------------------------------------------------------- Alignements inline void MutationParams::set_align_fun_shape( AlignmentFunctionShape align_fun_shape) { align_fun_shape_ = align_fun_shape; } inline void MutationParams::set_align_sigm_lambda(double align_sigm_lambda) { align_sigm_lambda_ = align_sigm_lambda; } inline void MutationParams::set_align_sigm_mean(int16_t align_sigm_mean) { align_sigm_mean_ = align_sigm_mean; } inline void MutationParams::set_align_lin_min(int16_t align_lin_min) { align_lin_min_ = align_lin_min; } inline void MutationParams::set_align_lin_max(int16_t align_lin_max) { align_lin_max_ = align_lin_max; } inline void MutationParams::set_align_max_shift(int16_t align_max_shift) { align_max_shift_ = align_max_shift; } inline void MutationParams::set_align_w_zone_h_len(int16_t align_w_zone_h_len) { align_w_zone_h_len_ = align_w_zone_h_len; } inline void MutationParams::set_align_match_bonus(int16_t align_match_bonus) { align_match_bonus_ = align_match_bonus; } inline void MutationParams::set_align_mismatch_cost(int16_t align_mismatch_cost) { align_mismatch_cost_ = align_mismatch_cost; } // ===================================================================== // Operators' definitions // ===================================================================== // ===================================================================== // Inline functions' definition // ===================================================================== } // namespace aevol #endif // AEVOL_MUTATION_PARAMS_H_ aevol-5.0/src/libaevol/Codon.cpp0000644000175000017500000000664112724051151013544 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ================================================================= // Includes // ================================================================= #include "Codon.h" #include #include "Utils.h" namespace aevol { // ############################################################################ // // Class Codon // // ############################################################################ // ================================================================= // Definition of static attributes // ================================================================= // ================================================================= // Constructors // ================================================================= Codon::Codon() { value_ = -1; } Codon::Codon(const Codon &model) { value_ = model.value_; } Codon::Codon(int8_t value) { value_ = value; } Codon::Codon(Dna * dna, Strand strand, int32_t index) { const char* gen = dna->data(); int32_t len = dna->length(); value_ = 0; if (strand == LEADING) { for (int8_t i = 0 ; i < CODON_SIZE ; i++) { if (gen[Utils::mod((index+i), len)] == '1') { value_ += 1 << (CODON_SIZE - i - 1); } } } else { // (strand == LAGGING) for (int8_t i = 0 ; i < CODON_SIZE ; i++) { if (gen[Utils::mod((index-i), len)] != '1') { value_ += 1 << (CODON_SIZE - i - 1); } } } } Codon::Codon(gzFile backup_file) { gzread(backup_file, &value_, sizeof(value_)); } // ================================================================= // Destructors // ================================================================= Codon::~Codon() = default; // ================================================================= // Public Methods // ================================================================= void Codon::save(gzFile backup_file) { gzwrite(backup_file, &value_, sizeof(value_)); } // ================================================================= // Protected Methods // ================================================================= } // namespace aevol aevol-5.0/src/libaevol/GridCell.h0000644000175000017500000001517412724051151013635 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_GRID_CELL_H_ #define AEVOL_GRID_CELL_H_ // ================================================================= // Libraries // ================================================================= #include #include #include #include #include // ================================================================= // Project Files // ================================================================= #include "Individual.h" #include "HabitatFactory.h" #ifndef __REGUL #include "Habitat.h" #else #include "raevol/Habitat_R.h" #endif namespace aevol { // ================================================================= // Class declarations // ================================================================= class ExpManager; class GridCell { public : // ================================================================= // Constructors // ================================================================= GridCell() = delete; GridCell(const GridCell &) = delete; GridCell(int16_t x, int16_t y, std::unique_ptr&& habitat, Individual * indiv, std::shared_ptr mut_prng, std::shared_ptr stoch_prng); GridCell(gzFile backup_file, ExpManager * exp_m, PhenotypicTargetHandler* phenotypic_target_handler); // ================================================================= // Destructors // ================================================================= virtual ~GridCell(); // ================================================================= // Accessors: getters // ================================================================= inline int16_t x() const {return x_;}; inline int16_t y() const {return y_;}; inline double compound_amount() const; inline Individual * individual() const; inline double secreted_amount() const; inline double metabolic_fitness() const; inline double total_fitness() const; const Habitat& habitat() const { return *habitat_; } const PhenotypicTarget& phenotypic_target() const { return habitat_->phenotypic_target(); } std::shared_ptr mut_prng() const; std::shared_ptr stoch_prng() const; // ================================================================= // Accessors: setters // ================================================================= inline void set_compound_amount(double compound_amount); inline void set_individual(Individual * indiv); inline void set_mut_prng(std::shared_ptr prng); inline void set_stoch_prng(std::shared_ptr prng); // ================================================================= // Public Methods // ================================================================= void ApplyHabitatVariation(); void save(gzFile backup_file, bool skip_phenotypic_target = false) const; void load(gzFile backup_file, ExpManager * exp_m, PhenotypicTargetHandler* phenotypic_target_handler); protected : // ================================================================= // Protected Methods // ================================================================= // ================================================================= // Protected Attributes // ================================================================= // Position on the grid int16_t x_; int16_t y_; // Pointer to the individual in this cell Individual* individual_ = NULL; std::unique_ptr habitat_ = nullptr; std::shared_ptr mut_prng_ = nullptr; std::shared_ptr stoch_prng_ = nullptr; }; // ===================================================================== // Getters' definitions // ===================================================================== inline double GridCell::compound_amount() const { return habitat_->compound_amount(); } inline Individual *GridCell::individual() const { return individual_; } inline double GridCell::secreted_amount() const { return individual_->fitness_by_feature(SECRETION); } inline double GridCell::metabolic_fitness() const { return individual_->fitness_by_feature(METABOLISM); } inline double GridCell::total_fitness() const { return individual_->fitness(); } // ===================================================================== // Setters' definitions // ===================================================================== inline void GridCell::set_compound_amount(double compound_amount) { habitat_->set_compound_amount(compound_amount); } inline void GridCell::set_individual(Individual * indiv) { individual_ = indiv; if (individual_->grid_cell() != this) { individual_->set_grid_cell(this); } } inline void GridCell::set_mut_prng(std::shared_ptr prng) { mut_prng_ = prng; } inline void GridCell::set_stoch_prng(std::shared_ptr prng) { stoch_prng_ = prng; } // ===================================================================== // Inline functions' definition // ===================================================================== } // namespace aevol #endif // AEVOL_GRID_CELL_H_ aevol-5.0/src/libaevol/Logging.h0000644000175000017500000001426212724051151013533 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_LOGS_H_ #define AEVOL_LOGS_H_ // ================================================================= // Libraries // ================================================================= #include #include // ================================================================= // Project Files // ================================================================= #include #include #include #include #include "ae_enums.h" namespace aevol { // ================================================================= // Class declarations // ================================================================= class Logging { public : // ================================================================= // Constructors // ================================================================= Logging(); // ================================================================= // Destructors // ================================================================= virtual ~Logging(); // ================================================================= // Accessors // ================================================================= inline FILE* log(LogType log_type) const; inline int8_t logs() const; inline bool is_logged(LogType log_type) const; // ================================================================= // Operators // ================================================================= // ================================================================= // Public Methods // ================================================================= //void save(gzFile backup_file) const; void load(int8_t logs, int32_t num_gener); void print_to_file(FILE* file) const; void set_logs(int8_t logs); void flush(); // ================================================================= // Public Attributes // ================================================================= protected : // ================================================================= // Forbidden Constructors // ================================================================= /* Logging() { printf("ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__); exit(EXIT_FAILURE); }; Logging(const Logging &model) { printf("ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__); exit(EXIT_FAILURE); };*/ // ================================================================= // Protected Methods // ================================================================= void write_headers() const; // ================================================================= // Protected Attributes // ================================================================= int8_t logs_; // Which logs are "turned on" (bitmap) FILE* transfer_log_; FILE* rear_log_; FILE* barrier_log_; //FILE* param_modification_log_; }; // ===================================================================== // Accessors' definitions // ===================================================================== inline FILE*Logging::log(LogType log_type) const { switch (log_type) { case LOG_TRANSFER : { return transfer_log_; } case LOG_REAR : { return rear_log_; } case LOG_BARRIER : { return barrier_log_; } /*case LOG_LOADS : { return param_modification_log_; }*/ default: { printf("ERROR: unknown log_type in file %s : l%d\n", __FILE__, __LINE__); exit(EXIT_FAILURE); } } } inline int8_t Logging::logs() const { return logs_; } inline bool Logging::is_logged(LogType log_type) const { switch (log_type) { case LOG_TRANSFER : { return (logs_ & LOG_TRANSFER); } case LOG_REAR : { return (logs_ & LOG_REAR); } case LOG_BARRIER : { return (logs_ & LOG_BARRIER); } /*case LOG_LOADS : { return (logs_ & LOG_LOADS); }*/ default: { printf("ERROR: unknown log_type in file %s : l%d\n", __FILE__, __LINE__); exit(EXIT_FAILURE); } } } // ===================================================================== // Operators' definitions // ===================================================================== // ===================================================================== // Inline functions' definition // ===================================================================== } // namespace aevol #endif // AEVOL_LOGS_H_ aevol-5.0/src/libaevol/Deletion.h0000644000175000017500000001027712724051151013712 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_DELETION_H_ #define AEVOL_DELETION_H_ // ============================================================================ // Includes // ============================================================================ #include "Rearrangement.h" namespace aevol { /** * */ class Deletion : public Rearrangement { public : // ========================================================================== // Constructors // ========================================================================== Deletion() = default; //< Default ctor Deletion(const Deletion&) = default; //< Copy ctor Deletion(Deletion&&) = delete; //< Move ctor Deletion(int32_t pos1, int32_t pos2, int32_t length, int16_t align_score = -1); virtual Mutation* Clone() const override {return new Deletion(*this);} // ========================================================================== // Destructor // ========================================================================== virtual ~Deletion() noexcept = default; //< Destructor // ========================================================================== // Operators // ========================================================================== /// Copy assignment Deletion& operator=(const Deletion& other) = default; /// Move assignment Deletion& operator=(Deletion&& other) = delete; // ========================================================================== // Public Methods // ========================================================================== virtual void save(gzFile backup_file) const override; virtual void load(gzFile backup_file) override; void generic_description_string(char* str) const override; // ========================================================================== // Getters // ========================================================================== virtual MutationType mut_type() const override {return DEL;} int32_t pos1() const { return pos1_; } int32_t pos2() const { return pos2_; } int32_t length() const { return length_; } int16_t align_score() const { return align_score_; } // ========================================================================== // Setters // ========================================================================== protected : // ========================================================================== // Protected Methods // ========================================================================== // ========================================================================== // Attributes // ========================================================================== int32_t pos1_, pos2_; int32_t length_; int16_t align_score_ = -1; }; } // namespace aevol #endif // AEVOL_DELETION_H_ aevol-5.0/src/libaevol/ExpManager_X11.cpp0000644000175000017500000011670112730777745015206 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ================================================================= // Libraries // ================================================================= #include #include #include #include #include // ================================================================= // Project Files // ================================================================= #include "ExpManager_X11.h" #include "World.h" #include "Point.h" #include "X11Window.h" #include "Fuzzy.h" #include "HybridFuzzy.h" #ifdef __REGUL #include "raevol/Individual_R_X11.h" #include "HybridFuzzy.h" #else #include "Individual_X11.h" #endif namespace aevol { // XCheckMaskEvent() doesn't get ClientMessage Events so use XCheckIfEvent() // with this Predicate function as a work-around (ClientMessage events // are needed in order to catch "WM_DELETE_WINDOW") static Bool AlwaysTruePredicate (Display*, XEvent*, char*) { return True; } //############################################################################## // # // Class ExpManager_X11 # // # //############################################################################## // ================================================================= // Definition of static attributes // ================================================================= #ifdef __REGUL #define NB_WIN INT32_C(9) // Number of windows that can be showed => CDS, RNA, phenotype, ... #else #define NB_WIN INT32_C(9) // Number of windows that can be showed => CDS, RNA, phenotype, ... #endif // ================================================================= // Constructors // ================================================================= ExpManager_X11::ExpManager_X11() : ExpManager() { // Basic initializations win_ = NULL; win_size_ = NULL; win_pos_ = NULL; win_name_ = NULL; display_on_ = false; handle_display_on_off_ = false; // Initialize XLib stuff display_ = XOpenDisplay(NULL); if (display_ == NULL) { printf("ERROR:\tCould not open connection to X server.\n"); printf("\tIf you are using aevol through SSH, you may use ssh -X.\n"); exit(EXIT_FAILURE); } screen_ = XDefaultScreen(display_); atoms_ = new Atom[2]; atoms_[0] = XInternAtom(display_, "WM_DELETE_WINDOW", False); atoms_[1] = XInternAtom(display_, "WM_PROTOCOLS", False); set_codes(); } // ================================================================= // Destructor // ================================================================= ExpManager_X11::~ExpManager_X11() { delete [] key_codes_; delete [] atoms_; for (int8_t i = 0 ; i < NB_WIN ; i++) { if (win_ != NULL) { if (win_[i] != NULL) delete win_[i]; } if (win_size_ != NULL) { if (win_size_[i] != NULL) delete [] win_size_[i]; } if (win_pos_ != NULL) { if (win_pos_[i] != NULL) delete [] win_pos_[i]; } } if (win_ != NULL) delete [] win_; XCloseDisplay(display_); if (win_name_ != NULL) delete [] win_name_; if (win_size_ != NULL) delete [] win_size_; if (win_pos_ != NULL) delete [] win_pos_; } // ================================================================= // Public Methods // ================================================================= void ExpManager_X11::display() { // --------------------- // 1) Handle user events // --------------------- if (display_on_) handle_events(); // -------------------------------------------------- // 2) Handle signal that toggle the display on or off // -------------------------------------------------- if (handle_display_on_off_) { handle_display_on_off_ = false; if (display_on_) // Display was "on", close all windows // (after saving their current size and position) { for (int8_t num_win = 0 ; num_win < NB_WIN ; num_win++) { if (win_[num_win] != NULL) { // 1) Save current window position and size Window aWindow; // Unused int x_return, y_return; int dest_x_return, dest_y_return; unsigned int border_width_return, depth_return; // Unused XGetGeometry(display_, win_[num_win]->window(), &aWindow, &x_return, &y_return, &win_size_[num_win][0], &win_size_[num_win][1], &border_width_return, &depth_return); XTranslateCoordinates(display_, win_[num_win]->window(), DefaultRootWindow(display_), 0, 0, &dest_x_return, &dest_y_return, &aWindow); win_pos_[num_win][0] = dest_x_return - x_return; win_pos_[num_win][1] = dest_y_return - y_return; // 2) Delete window delete win_[num_win]; win_[num_win] = NULL; } } XFlush(display_); delete win_; win_ = NULL; display_on_ = false; } else // Display was "off", open windows { show_window_ |= 1; new_show_window_ = show_window_; // If it's the first time the display is switched on, initialize it. if (win_ == NULL) initialize(); for (int8_t i = 0 ; i < NB_WIN ; i++) { if (show_window(i)) { win_[i] = new X11Window(display_, screen_, atoms_, win_pos_[i][0], win_pos_[i][1], win_size_[i][0], win_size_[i][1], win_name_[i]); } } display_on_ = true; } } // ---------- // 3) Display // ---------- if (display_on_) { for (int8_t i = 0 ; i < NB_WIN ; i++) { if (show_window(i)) { if (new_show_window(i)) { draw_window(i); } else { refresh_window(i); } } } // Refresh all windows XFlush(display_); } } void ExpManager_X11::handle_events() { XEvent event; int8_t win_number; // XCheckMaskEvent() doesn't get ClientMessage Events so use XCheckIfEvent() // with the custom AlwaysTruePredicate function as a work-around (ClientMessage // events are needed in order to catch "WM_DELETE_WINDOW") int iCurrEvent = 0; int iIgnoreNoise = 0; while(XCheckIfEvent(display_, &event, AlwaysTruePredicate, 0)) { iCurrEvent ++; win_number = identify_window(event.xany.window); if(win_number == -1) continue; // We discard this event because it occurred on a destroyed window // (e.g. the user pressed F3 and then moved or resized the window, // before the window was destroyed) switch(event.type) { case ConfigureNotify : { win_[win_number]->resize(event.xconfigure.width, event.xconfigure.height); //~ win_[win_number]->repos(event.xconfigure.x, event.xconfigure.y); // Mark window as having to be entirely redrawn new_show_window_ |= 1 << win_number; break; } case MapNotify : { draw_window(win_number); break; } case Expose: { if(iCurrEvent > iIgnoreNoise) { draw_window(win_number); iIgnoreNoise = iCurrEvent + XQLength(display_); } break; } case ClientMessage : { if (((Atom) event.xclient.data.l[0]) == atoms_[0]) // The user closed the window by clicking on the cross { // 1) Save current window position and size Window aWindow; // Unused int x_return, y_return; int dest_x_return, dest_y_return; unsigned int border_width_return, depth_return; // Unused XGetGeometry(display_, win_[win_number]->window(), &aWindow, &x_return, &y_return, &win_size_[win_number][0], &win_size_[win_number][1], &border_width_return, &depth_return); XTranslateCoordinates(display_, win_[win_number]->window(), DefaultRootWindow(display_), 0, 0, &dest_x_return, &dest_y_return, &aWindow); win_pos_[win_number][0] = dest_x_return - x_return; win_pos_[win_number][1] = dest_y_return - y_return; // 2) Delete window and mark as "not to be shown" delete win_[win_number]; win_[win_number] = NULL; show_window_ &= ~(1 << win_number); // 3) If it was the main that was closed, turn display off. if (win_number == 0) { handle_display_on_off_ = true; } } break; } case KeyPress : { // Not sure a switch would work on any platform => use ifs instead if (event.xkey.keycode == key_codes_[KEY_F1] || event.xkey.keycode == key_codes_[KEY_F2] || event.xkey.keycode == key_codes_[KEY_F3] || event.xkey.keycode == key_codes_[KEY_F4] || event.xkey.keycode == key_codes_[KEY_F5] || event.xkey.keycode == key_codes_[KEY_F6]) { int8_t num_win; // Not sure a switch would work on any platform => use ifs instead if (event.xkey.keycode == key_codes_[KEY_F1]) num_win = 1; else if (event.xkey.keycode == key_codes_[KEY_F2]) num_win = 2; else if (event.xkey.keycode == key_codes_[KEY_F3]) num_win = 3; else if (event.xkey.keycode == key_codes_[KEY_F4]) num_win = 4; else if (event.xkey.keycode == key_codes_[KEY_F5]) num_win = 5; else num_win = 6; // case where (event.xkey.keycode == key_codes_[KEY_F6]) if (show_window(num_win)) { // 1) Save current window position and size Window aWindow; // Unused int x_return, y_return; int dest_x_return, dest_y_return; unsigned int border_width_return, depth_return; // Unused XGetGeometry(display_, win_[num_win]->window(), &aWindow, &x_return, &y_return, &win_size_[num_win][0], &win_size_[num_win][1], &border_width_return, &depth_return); XTranslateCoordinates(display_, win_[num_win]->window(), DefaultRootWindow(display_), 0, 0, &dest_x_return, &dest_y_return, &aWindow); win_pos_[num_win][0] = dest_x_return - x_return; win_pos_[num_win][1] = dest_y_return - y_return; // 2) Delete window and mark as "not to be shown" delete win_[num_win]; win_[num_win] = NULL; show_window_ &= ~(1 << num_win); } else { win_[num_win] = new X11Window(display_, screen_, atoms_, win_pos_[num_win][0], win_pos_[num_win][1], win_size_[num_win][0], win_size_[num_win][1], win_name_[num_win]); new_show_window_ |= 1 << num_win; show_window_ |= new_show_window_; draw_window(num_win); } } else if (event.xkey.keycode == key_codes_[KEY_P]) { printf(" P A U S E D \n"); bool pause_key = false; while (! pause_key) { if (XCheckIfEvent(display_, &event, AlwaysTruePredicate, 0)) { if (event.xkey.keycode == key_codes_[KEY_P]) { pause_key = true; } } } } else if ((event.xkey.state & ControlMask) && (event.xkey.keycode == key_codes_[KEY_Q])) { printf(" Q U I T R E Q U E S T E D\n"); quit_signal_received_ = true; // We do not exit here, because it is cleaner to let the main program // interpret the signal and call the destructor of the simulation. // This ensures that the connection to the X server will be closed // in a clean way, which is much better if we want to run other // X applications afterwards! } break; } default : { // printf("event not handled \n"); break; } } } } void ExpManager_X11::toggle_display_on_off() { // Mark action to be done handle_display_on_off_ = true; } void ExpManager_X11::display(X11Window * win, const AbstractFuzzy& fuzz, color_map color, bool fill /*= false*/, bool bold /*= false*/) { double y_min = Y_MIN - 0.1 * Y_MAX; // Yields a bottom margin double y_max = Y_MAX * 1.1; // Yields a top margin double delta_x = X_MAX - X_MIN; double delta_y = y_max - y_min; int16_t cur_x; int16_t cur_y; int16_t next_x; int16_t next_y; if (exp_s_->get_fuzzy_flavor() == 0) { const Fuzzy fuzzy = (Fuzzy&)(fuzz); for (list::const_iterator p = fuzzy.points().begin(); p != prev(fuzzy.points().end()); ++p) { list::const_iterator q = next(p); // Display segment [p, q] cur_x = ((p->x - X_MIN) / delta_x) * win->width(); cur_y = (1 - ((p->y - y_min) / delta_y)) * win->height(); next_x = ((q->x - X_MIN) / delta_x) * win->width(); next_y = (1 - ((q->y - y_min) / delta_y)) * win->height(); if (fill) { char* fill_color; for (int16_t i = cur_x; i < next_x; i++) { fill_color = X11Window::color( ((double) i / win->width()) * (X_MAX - X_MIN)); win->draw_line(i, (1 - ((0 - y_min) / delta_y)) * win->height(), i, cur_y + (((i - cur_x) * (next_y - cur_y)) / (next_x - cur_x)), fill_color); delete[] fill_color; } } win->draw_line(cur_x, cur_y, next_x, next_y, color, bold); } } else { const HybridFuzzy fuzzy = (HybridFuzzy&)(fuzz); double hi,hi1; for (int i = 0; i < fuzzy.get_pheno_size() - 1; i++) { hi= (((double)i) / fuzzy.get_pheno_size()); hi1= (((double)i+1) / fuzzy.get_pheno_size()); // Display segment [cur_point, next_point] cur_x = ( (hi - X_MIN) / delta_x ) * win->width(); cur_y = ( 1 - ((fuzzy.points()[i] - y_min) / delta_y) ) * win->height(); next_x = ( ((hi1) - X_MIN) / delta_x ) * win->width(); next_y = ( 1 - ((fuzzy.points()[i+1] - y_min) / delta_y) ) * win->height(); if (fuzzy.points()[i] >= 0 && fuzzy.points()[i+1] >= 0) { win->draw_line( cur_x, cur_y, next_x, next_y, color, bold ); if ( fill ) { char* fill_color; for ( int16_t i = cur_x ; i < next_x ; i++ ) { fill_color = X11Window::color( ((double)i / win->width()) * (X_MAX - X_MIN) ); win->draw_line( i, ( 1 - ((0 - y_min) / delta_y) ) * win->height(), i, cur_y + (((i - cur_x) * (next_y - cur_y)) / (next_x - cur_x)) , fill_color ); delete [] fill_color; } } } else if (fuzzy.points()[i] < 0 && fuzzy.points()[i+1] < 0) { win->draw_line( cur_x, cur_y, next_x, next_y, color, bold ); if ( fill ) { char* fill_color; for ( int16_t i = cur_x ; i < next_x ; i++ ) { fill_color = X11Window::color( ((double)i / win->width()) * (X_MAX - X_MIN) ); win->draw_line( i, ( 1 - ((0 - y_min) / delta_y) ) * win->height(), i, cur_y + (((i - cur_x) * (next_y - cur_y)) / (next_x - cur_x)) , fill_color ); delete [] fill_color; } } } else { double p1 = (fuzzy.points()[i+1] - fuzzy.points()[i]) / (hi1 - hi); double d1 = fuzzy.points()[i] - (p1 * hi); double x_at_0 = 0; if (fuzzy.points()[i] == 0.0) x_at_0 = hi; else if (fuzzy.points()[i+1] == 0.0) x_at_0 = hi1; else x_at_0 = ( (- d1) / p1 ); win->draw_line( cur_x, cur_y, x_at_0, 0, color, bold ); if ( fill ) { char* fill_color; for ( int16_t i = cur_x ; i < x_at_0 ; i++ ) { fill_color = X11Window::color( ((double)i / win->width()) * (X_MAX - X_MIN) ); win->draw_line( i, ( 1 - ((0 - y_min) / delta_y) ) * win->height(), i, cur_y + (((i - cur_x) * (0 - cur_y)) / (x_at_0 - cur_x)) , fill_color ); delete [] fill_color; } } win->draw_line( x_at_0, 0, next_x, next_y, color, bold ); if ( fill ) { char* fill_color; for ( int16_t i = x_at_0 ; i < next_x ; i++ ) { fill_color = X11Window::color( ((double)i / win->width()) * (X_MAX - X_MIN) ); win->draw_line( i, ( 1 - ((0 - y_min) / delta_y) ) * win->height(), i, 0 + (((i - x_at_0) * (next_y - 0)) / (next_x - x_at_0)) , fill_color ); delete [] fill_color; } } } } } } void ExpManager_X11::display_3D(X11Window * win, const AbstractFuzzy& fuzz, color_map color, int x0 , int y0, bool fill /*= false*/ ) { double y_min = Y_MIN - 0.1 * Y_MAX; // Yields a bottom margin double y_max = Y_MAX * 1.1; // Yields a top margin double delta_x = X_MAX - X_MIN; double delta_y = y_max - y_min; int16_t cur_x; int16_t cur_y; int16_t next_x; int16_t next_y; if (exp_s_->get_fuzzy_flavor() == 0) { const Fuzzy fuzzy = (Fuzzy&)(fuzz); for (list::const_iterator p = fuzzy.points().begin(); p != prev(fuzzy.points().end()); ++p) { list::const_iterator q = next(p); // Display segment [p, q] cur_x = ((p->x - X_MIN) / delta_x) * win->width(); cur_y = (1 - ((p->y - y_min) / delta_y)) * win->height(); next_x = ((q->x - X_MIN) / delta_x) * win->width(); next_y = (1 - ((q->y - y_min) / delta_y)) * win->height(); if (fill) { char* fill_color; for (int16_t i = cur_x; i < next_x; i++) { fill_color = X11Window::color( ((double) i / win->width()) * (X_MAX - X_MIN)); win->draw_line(i + x0, (1 - ((0 - y_min) / delta_y)) * win->height(), i + x0, y0 + cur_y + (((i - cur_x) * (next_y - cur_y)) / (next_x - cur_x)), fill_color); delete[] fill_color; } } win->draw_line(cur_x + x0, cur_y + y0, next_x + x0, next_y + y0, color); } } else { // ae_list_node* node = _points->get_first(); // ae_point_2d* cur_point = NULL; // ae_point_2d* next_point = NULL; double hi; double hi1; const HybridFuzzy fuzzy = (HybridFuzzy&)(fuzz); int pheno_size = fuzzy.get_pheno_size(); for (int j = 0; j < (pheno_size - 1); j++) { hi = (((double) j) / pheno_size); hi1 = (((double) j + 1) / pheno_size); // Display segment [cur_point, next_point] cur_x = ((hi - X_MIN) / delta_x) * win->width(); cur_y = (1 - ((fuzzy.points()[j] - y_min) / delta_y)) * win->height(); next_x = (((hi1) - X_MIN) / delta_x) * win->width(); next_y = (1 - ((fuzzy.points()[j + 1] - y_min) / delta_y)) * win->height(); /*if (fill) printf("Indiv "); else printf("Env "); printf("Curve seg %f %f %f %f\n",hi,hi1,fuzzy.points()[j],fuzzy.points()[j+1]); */ if (fuzzy.points()[j] >= 0 && fuzzy.points()[j + 1] >= 0) { if (fill) { char* fill_color; for (int16_t i = cur_x; i < next_x; i++) { fill_color = X11Window::color( ((double) i / win->width()) * (X_MAX - X_MIN)); win->draw_line(i + x0, (1 - ((0 - y_min) / delta_y)) * win->height() + y0, i + x0, y0 + cur_y + (((i - cur_x) * (next_y - cur_y)) / (next_x - cur_x)), fill_color); delete[] fill_color; } } win->draw_line(cur_x + x0, cur_y + y0, next_x + x0, next_y + y0, color); } else if (fuzzy.points()[j] < 0 && fuzzy.points()[j + 1] < 0) { if (fill) { char* fill_color; for (int16_t i = cur_x; i < next_x; i++) { fill_color = X11Window::color( ((double) i / win->width()) * (X_MAX - X_MIN)); win->draw_line(i + x0, (1 - ((0 - y_min) / delta_y)) * win->height() + y0, i + x0, y0 + cur_y + (((i - cur_x) * (next_y - cur_y)) / (next_x - cur_x)), fill_color); delete[] fill_color; } } win->draw_line(cur_x + x0, cur_y + y0, next_x + x0, next_y + y0, color); } else { double p1 = (fuzzy.points()[j + 1] - fuzzy.points()[j]) / (hi1 - hi); double d1 = fuzzy.points()[j] - (p1 * hi); double x_at_0 = 0; if (fuzzy.points()[j] == 0.0) x_at_0 = hi; else if (fuzzy.points()[j + 1] == 0.0) x_at_0 = hi1; else x_at_0 = ((-d1) / p1); if (fill) { char* fill_color; for (int16_t i = cur_x; i < x_at_0; i++) { fill_color = X11Window::color( ((double) i / win->width()) * (X_MAX - X_MIN)); win->draw_line(i + x0, (1 - ((0 - y_min) / delta_y)) * win->height() + y0, i + x0, y0 + cur_y + (((i - cur_x) * (0 - cur_y)) / (x_at_0 - cur_x)), fill_color); delete[] fill_color; } } win->draw_line(cur_x + x0, cur_y + y0, x_at_0 + x0, y0, color); if (fill) { char* fill_color; for (int16_t i = x_at_0; i < next_x; i++) { fill_color = X11Window::color( ((double) i / win->width()) * (X_MAX - X_MIN)); win->draw_line(i + x0, (1 - ((0 - y_min) / delta_y)) * win->height() + y0, i + x0, y0 + 0 + (((i - x_at_0) * (next_y - 0)) / (next_x - x_at_0)), fill_color); delete[] fill_color; } } win->draw_line(x_at_0 + x0, y0, next_x + x0, next_y + y0, color); } } } } // Display a grid of values void ExpManager_X11::display_grid(X11Window * win, double** cell_grid) { // printf("display grid\n"); char t[40]; constexpr int nb_colors = 50; sprintf(t, "Generation = %" PRId64, AeTime::time()); win->draw_string(15, 15, t); const int grid_width_ = grid_width(); const int grid_height_ = grid_height(); int nb_slots_in_a_row = (int) grid_height_; int slot_width = 200/nb_slots_in_a_row; int x1 = 50 + 50 + slot_width/2; int y1 = 75 + 50 + slot_width/2; // create the colormap colors to be used for grid plotting int cell_size = 5; // draw the color scale for fitness int y_step_size = grid_height_ *cell_size/nb_colors; for (int i = 0; i < nb_colors; i++) { win->fill_rectangle(x1 - 30, y1 - 80 + y_step_size * i, cell_size * 5, y_step_size, col_map_[nb_colors-1-i]); } // find min/max of the matrix double grid_max = 0; double grid_min = 1000000; for (int x = 0 ; x < grid_width_; x++) { for (int y = 0 ; y < grid_height_; y++) { if (cell_grid[x][y] > grid_max) {grid_max = cell_grid[x][y];} if (cell_grid[x][y] < grid_min) {grid_min = cell_grid[x][y];} } } double col_sec_interval = (grid_max - grid_min) / nb_colors; char scale_txt[40]; sprintf(scale_txt,"%.2e", grid_max); win->draw_string(x1-80, y1-80,scale_txt); sprintf(scale_txt,"%.2e", grid_min); win->draw_string(x1-80, y1-80+ grid_height_ *cell_size,scale_txt); for (int x = 0; x < grid_width_; x++) { for (int y = 0; y < grid_height_; y++) { char * col_string; // calculate the color int new_col; if (col_sec_interval == 0) { new_col = 0; } else { // We have to take care of the limit case when // (cell_grid[x][y] == grid_max) which would yield (new_col == nb_colors) // which is out of bounds new_col = std::min( static_cast(floor((cell_grid[x][y] - grid_min) / col_sec_interval)), nb_colors -1); } col_string = col_map_[new_col]; // draw a colored rectangle for each cell win->fill_rectangle(x1 + 50 + x*cell_size, y1 - 80 + y*cell_size, cell_size, cell_size, col_string); } } } // ================================================================= // Protected Methods // ================================================================= void ExpManager_X11::initialize(bool with_grid /*= false*/, bool with_plasmids /*= false*/) { // Initialize window structures win_ = new X11Window * [NB_WIN]; win_size_ = new unsigned int* [NB_WIN]; win_pos_ = new int* [NB_WIN]; for (int8_t i = 0 ; i < NB_WIN ; i++) { win_[i] = NULL; // Default values win_size_[i] = new unsigned int[2]; win_size_[i][0] = 300; win_size_[i][1] = 300; win_pos_[i] = new int[2]; win_pos_[i][0] = 0; win_pos_[i][1] = 0; } // Set phenotype window width win_size_[1][0] = 600; // Set CDS and RNA window width if (with_plasmids) { win_size_[2][0] = 600; win_size_[3][0] = 600; } // Set initial positions if screen is large enough if (with_plasmids && with_grid) { //if (XDisplayWidth(display_, screen_) >= 900 && XDisplayHeight(display_, screen_) >= 650) { win_pos_[0][0] = 0; win_pos_[0][1] = 0; win_pos_[1][0] = 300; win_pos_[1][1] = 0; win_pos_[2][0] = 0; win_pos_[2][1] = 350; win_pos_[3][0] = 0; win_pos_[3][1] = 700; } } else if (with_plasmids) { //if (XDisplayWidth(display_, screen_) >= 900 && XDisplayHeight(display_, screen_) >= 650) { win_pos_[0][0] = 0; win_pos_[0][1] = 0; win_pos_[1][0] = 300; win_pos_[1][1] = 0; win_pos_[2][0] = 0; win_pos_[2][1] = 350; win_pos_[3][0] = 0; win_pos_[3][1] = 700; } } else if (with_grid) { //if (XDisplayWidth(display_, screen_) >= 900 && XDisplayHeight(display_, screen_) >= 650) { win_pos_[0][0] = 0; win_pos_[0][1] = 0; win_pos_[1][0] = 300; win_pos_[1][1] = 0; win_pos_[2][0] = 0; win_pos_[2][1] = 350; win_pos_[3][0] = 300; win_pos_[3][1] = 350; } } else // (! with_plasmids && ! with_grid) { //if (XDisplayWidth(display_, screen_) >= 900 && XDisplayHeight(display_, screen_) >= 650) { win_pos_[0][0] = 0; win_pos_[0][1] = 0; win_pos_[1][0] = 300; win_pos_[1][1] = 0; win_pos_[2][0] = 0; win_pos_[2][1] = 350; win_pos_[3][0] = 300; win_pos_[3][1] = 350; } } // Visible windows at the beginning of the run if (with_grid) { #ifdef __REGUL show_window_ = 0x01FF; #else show_window_ = 0x007F; // hex for bin 1111111 => show first 7 windows #endif } else { #ifdef __REGUL show_window_ = 0x01E3; #else show_window_ = 0x000F; // hex for bin 1111 => show first 4 windows #endif } new_show_window_ = show_window_; win_name_ = new char*[NB_WIN]; if (with_grid) win_name_[0] = (char*) "Population grid"; else win_name_[0] = (char*) "Population"; win_name_[1] = (char*) "Phenotypic profile"; win_name_[2] = (char*) "Genes"; win_name_[3] = (char*) "RNAs"; win_name_[4] = (char*) "Secreted compound present"; win_name_[5] = (char*) "Metabolic fitness"; win_name_[6] = (char*) "Current secretion"; win_name_[7] = (char*) "Regulation network"; win_name_[8] = (char*) "Protein concentrations"; compute_colormap(); } int8_t ExpManager_X11::identify_window(Window winID) { for (int8_t i = 0 ; i < NB_WIN ; i++) { if (win_[i] != NULL) { if (win_[i]->window() == winID) return i; } } return -1; } void ExpManager_X11::draw_window(int8_t win_number) { if (win_[win_number] == NULL) { fprintf(stderr, "Error: cannot draw this window, it doesn't exist.\n"); return; } X11Window * cur_win = win_[win_number]; switch (win_number) { case 0: { break; } case 1: { cur_win->blacken(); // Display colour bar char* color; for (int16_t i = 0 ; i < cur_win->width() ; i++) { color = X11Window::color(((double)i / cur_win->width()) * (X_MAX - X_MIN)); //~ cur_win->draw_line(i, 0, i, cur_win->height() / 20, color); cur_win->draw_line(i, cur_win->height() * 19 / 20, i, cur_win->height(), color); delete [] color; } break; } case 2: { break; } case 3: { break; } // Amount of secreted compound present at each grid location case 4: { break; } // Metabolic fitness grid case 5: { break; } // Current secretion (how much is secreted by each organism) case 6: { break; } #ifdef __REGUL case 7: { break; } case 8: { break; } #endif } refresh_window(win_number); new_show_window_ &= ~(1 << win_number); XFlush(display_); } void ExpManager_X11::refresh_window(int8_t win_number) { if (win_[win_number] == NULL) { fprintf(stderr, "Error: cannot draw this window, it doesn't exist.\n"); return; } X11Window * cur_win = win_[win_number]; switch (win_number) { // Main window (population) case 0 : { cur_win->blacken(); double** grid = world()->total_fitness_grid(); display_grid(cur_win, grid); // Has been allocated in ae_spatial_structure::total_fitness_grid() for (int16_t x = 0 ; x < grid_width() ; x++) { delete [] grid[x]; } delete [] grid; break; } // Display phenotypes and phenotypic target case 1 : { // Blacken all the window except the colour bar cur_win->fill_rectangle(0, 0, cur_win->width(), cur_win->height() * 19 / 20, BLACK); // Get phenotypic target shorthand const PhenotypicTarget& phenotypic_target = best_indiv()->phenotypic_target(); // Mark all the non-metabolic segments (paint them in grey) if (phenotypic_target.nb_segments() > 1) { PhenotypicSegment ** segments = phenotypic_target.segments(); for (size_t i = 0 ; i < static_cast(phenotypic_target.nb_segments()) ; i++) { if (segments[i]->feature != METABOLISM) { if (segments[i]->feature == NEUTRAL) { cur_win->fill_rectangle(cur_win->width() * segments[i]->start / (X_MAX-X_MIN), 0.0, cur_win->width() * (segments[i]->stop - segments[i]->start) / (X_MAX-X_MIN), cur_win->height() * 19 / 20, DARKER_GREY); } else { cur_win->fill_rectangle(cur_win->width() * segments[i]->start / (X_MAX-X_MIN), 0.0, cur_win->width() * (segments[i]->stop - segments[i]->start) / (X_MAX-X_MIN), cur_win->height() * 19 / 20, GREY); } } } } // Display all the phenotypes (blue) for (const auto& indiv: indivs()) { #ifndef __REGUL display(cur_win, *(indiv->phenotype()), BLUE); if (indiv->allow_plasmids()) { display(cur_win, *(indiv->genetic_unit(0).phenotypic_contribution()), YELLOW); display(cur_win, *(indiv->genetic_unit(1).phenotypic_contribution()), GREEN); } #else /*Individual_R_X11* indiv_r = dynamic_cast(indiv); display(cur_win, *(indiv_r->get_phenotype()), BLUE); if (indiv_r->get_allow_plasmids()) { display(cur_win, *(indiv_r->get_genetic_unit(0).get_phenotypic_contribution()), YELLOW); display(cur_win, *(indiv_r->get_genetic_unit(1).get_phenotypic_contribution()), GREEN); }*/ #endif } // Display best indiv's phenotype (white) #ifndef __REGUL display(cur_win, *(best_indiv()->phenotype()), WHITE, true); display(cur_win, *(phenotypic_target.fuzzy()), RED, false, true); #else Individual_R_X11* indiv_r = dynamic_cast(best_indiv()); indiv_r->display_phenotype(cur_win, dynamic_cast(best_indiv()->grid_cell()->habitat())); //display_3D(cur_win, *(indiv_r->get_phenotype()), WHITE, true); #endif // Display phenotypic target (red) } break; // Display genes case 2 : { cur_win->blacken(); Individual_X11 * indiv = dynamic_cast(best_indiv()); indiv->display_cdss(cur_win); } break; // Display RNAs case 3 : { cur_win->blacken(); Individual_X11 * indiv = dynamic_cast(best_indiv()); indiv->display_rnas(cur_win); } break; // Display the amount of secreted compound present at each location case 4 : { cur_win->blacken(); display_grid(cur_win, world()->secretion_present_grid()); } break; // Display the metabolic fitness grid case 5 : { cur_win->blacken(); display_grid(cur_win, world()->metabolic_fitness_grid()); } break; // display current secretion (how much is secreted by each organism) case 6: { cur_win->blacken(); display_grid(cur_win, world()->secreted_amount_grid()); } break; #ifdef __REGUL case 7: { cur_win->blacken(); dynamic_cast(best_indiv())->display_regulation( cur_win ); break; } case 8: { cur_win->blacken(); dynamic_cast(best_indiv())->display_concentrations( cur_win ); break; } #endif } XFlush(display_); } void ExpManager_X11::set_codes() { key_codes_ = new KeyCode[50]; assert(key_codes_); key_codes_[KEY_ESCAPE] = XKeysymToKeycode(display_, XK_Escape); key_codes_[KEY_F1] = XKeysymToKeycode(display_, XK_F1); key_codes_[KEY_F2] = XKeysymToKeycode(display_, XK_F2); key_codes_[KEY_F3] = XKeysymToKeycode(display_, XK_F3); key_codes_[KEY_F4] = XKeysymToKeycode(display_, XK_F4); key_codes_[KEY_F5] = XKeysymToKeycode(display_, XK_F5); key_codes_[KEY_F6] = XKeysymToKeycode(display_, XK_F6); key_codes_[KEY_F7] = XKeysymToKeycode(display_, XK_F7); key_codes_[KEY_F8] = XKeysymToKeycode(display_, XK_F8); key_codes_[KEY_F9] = XKeysymToKeycode(display_, XK_F9); key_codes_[KEY_F10] = XKeysymToKeycode(display_, XK_F10); key_codes_[KEY_F11] = XKeysymToKeycode(display_, XK_F11); key_codes_[KEY_F12] = XKeysymToKeycode(display_, XK_F12); key_codes_[KEY_A] = XKeysymToKeycode(display_, XK_A); key_codes_[KEY_Q] = XKeysymToKeycode(display_, XK_Q); key_codes_[KEY_W] = XKeysymToKeycode(display_, XK_W); key_codes_[KEY_Z] = XKeysymToKeycode(display_, XK_Z); key_codes_[KEY_S] = XKeysymToKeycode(display_, XK_S); key_codes_[KEY_X] = XKeysymToKeycode(display_, XK_X); key_codes_[KEY_E] = XKeysymToKeycode(display_, XK_E); key_codes_[KEY_D] = XKeysymToKeycode(display_, XK_D); key_codes_[KEY_C] = XKeysymToKeycode(display_, XK_C); key_codes_[KEY_R] = XKeysymToKeycode(display_, XK_R); key_codes_[KEY_F] = XKeysymToKeycode(display_, XK_F); key_codes_[KEY_V] = XKeysymToKeycode(display_, XK_V); key_codes_[KEY_T] = XKeysymToKeycode(display_, XK_T); key_codes_[KEY_G] = XKeysymToKeycode(display_, XK_G); key_codes_[KEY_B] = XKeysymToKeycode(display_, XK_B); key_codes_[KEY_Y] = XKeysymToKeycode(display_, XK_Y); key_codes_[KEY_H] = XKeysymToKeycode(display_, XK_H); key_codes_[KEY_N] = XKeysymToKeycode(display_, XK_N); key_codes_[KEY_U] = XKeysymToKeycode(display_, XK_U); key_codes_[KEY_J] = XKeysymToKeycode(display_, XK_J); key_codes_[KEY_I] = XKeysymToKeycode(display_, XK_I); key_codes_[KEY_K] = XKeysymToKeycode(display_, XK_K); key_codes_[KEY_O] = XKeysymToKeycode(display_, XK_O); key_codes_[KEY_L] = XKeysymToKeycode(display_, XK_L); key_codes_[KEY_P] = XKeysymToKeycode(display_, XK_P); key_codes_[KEY_M] = XKeysymToKeycode(display_, XK_M); key_codes_[KEY_1] = XKeysymToKeycode(display_, XK_1); key_codes_[KEY_2] = XKeysymToKeycode(display_, XK_2); key_codes_[KEY_3] = XKeysymToKeycode(display_, XK_3); key_codes_[KEY_4] = XKeysymToKeycode(display_, XK_4); key_codes_[KEY_5] = XKeysymToKeycode(display_, XK_5); key_codes_[KEY_6] = XKeysymToKeycode(display_, XK_6); key_codes_[KEY_7] = XKeysymToKeycode(display_, XK_7); key_codes_[KEY_8] = XKeysymToKeycode(display_, XK_8); key_codes_[KEY_9] = XKeysymToKeycode(display_, XK_9); } void ExpManager_X11::compute_colormap() { col_map_ = { (char*)"RGBi:0.0/0.0/1.0", (char*)"RGBi:0.0/0.025/1.0", (char*)"RGBi:0.0/0.05/1.0", (char*)"RGBi:0.0/0.10/1.0", (char*)"RGBi:0.0/0.15/1.0", (char*)"RGBi:0.0/0.2/1.0", (char*)"RGBi:0.0/0.25/1.0", (char*)"RGBi:0.0/0.3/1.0", (char*)"RGBi:0.0/0.35/1.0", (char*)"RGBi:0.0/0.4/1.0", (char*)"RGBi:0.0/0.45/1.0", (char*)"RGBi:0.0/0.5/1.0", (char*)"RGBi:0.0/0.55/1.0", (char*)"RGBi:0.0/0.6/1.0", (char*)"RGBi:0.0/0.65/1.0", (char*)"RGBi:0.0/0.7/1.0", (char*)"RGBi:0.0/0.75/1.0", (char*)"RGBi:0.0/0.8/1.0", (char*)"RGBi:0.0/0.85/1.0", (char*)"RGBi:0.0/0.9/1.0", (char*)"RGBi:0.0/1.0/1.0", (char*)"RGBi:0.0/1.0/0.9", (char*)"RGBi:0.0/1.0/0.8", (char*)"RGBi:0.0/1.0/0.7", (char*)"RGBi:0.0/1.0/0.6", (char*)"RGBi:0.0/1.0/0.5", (char*)"RGBi:0.0/1.0/0.4", (char*)"RGBi:0.0/1.0/0.3", (char*)"RGBi:0.0/1.0/0.2", (char*)"RGBi:0.0/1.0/0.1", (char*)"RGBi:0.0/1.0/0.0", (char*)"RGBi:0.1/1.0/0.0", (char*)"RGBi:0.2/1.0/0.0", (char*)"RGBi:0.3/1.0/0.0", (char*)"RGBi:0.4/1.0/0.0", (char*)"RGBi:0.5/1.0/0.0", (char*)"RGBi:0.6/1.0/0.0", (char*)"RGBi:0.7/1.0/0.0", (char*)"RGBi:0.8/1.0/0.0", (char*)"RGBi:0.9/1.0/0.0", (char*)"RGBi:1.0/0.9/0.0", (char*)"RGBi:1.0/0.8/0.0", (char*)"RGBi:1.0/0.7/0.0", (char*)"RGBi:1.0/0.6/0.0", (char*)"RGBi:1.0/0.5/0.0", (char*)"RGBi:1.0/0.4/0.0", (char*)"RGBi:1.0/0.3/0.0", (char*)"RGBi:1.0/0.2/0.0", (char*)"RGBi:1.0/0.1/0.0", (char*)"RGBi:1.0/0.0/0.0", }; } } // namespace aevol aevol-5.0/src/libaevol/X11Window.cpp0000644000175000017500000005220112724051151014234 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ================================================================= // Libraries // ================================================================= #include #include #include #include #include #include #include // ================================================================= // Project Files // ================================================================= #include "X11Window.h" #include "ExpSetup.h" namespace aevol { // ================================================================= // Basic X11/Xlib notions // ================================================================= // // THE DISPLAY // // The major notion of using Xlib is the X display. This is a structure // representing the connection we have open with a given X server. It // hides a queue of messages coming from the server, and a queue of // pending requests that our client intends to send to the server. // In Xlib, this structure is named 'Display'. When we open a connection // to an X server, the library returns a pointer to such a structure. // Later, we supply this pointer to any Xlib function that should send // messages to the X server or receive messages from this server. // // // THE WINDOWS // // X11 relies on a hierarchical model of rectangular areas called "Windows". // // 1. Each Window can be included in another Window (its parent) and may include // other Windows (its children). Windows sharing the same owner are called // siblings. // 2. The screen itself is a Window (the Root Window) that contains all Windows. // 3. A window can be above or behind a sibling Window. The Window which is above // hides partly or completely the other one. // 4. Any drawing made in a Window is automatically "cut", meaning that only the // part of the drawing which is inside the Window is drawn. // 5. A Window can be hidden or displayed ("mapped"). The drawing instructions // made on an unmapped Window are ignored. By default, newly created windows // are not mapped on the screen - they are invisible. In order to make a // window visible, we must use the XMapWindow() function. // 6. Each event (keyboard, mouse) is aimed at a specific Window. // 7. A Window does not memorize its content. Each time it must be re-displayed, // it gets an Expose event, and the content must be redrawn as a response to // this event. // // // THE GC (GRAPHICS CONTEXT) // // When we perform various drawing operations (graphics, text, etc), we may // specify various options for controlling how the data will be drawn - what // foreground and background colors to use, how line edges will be connected, // what font to use when drawing some text, etc). In order to avoid the need // to supply zillions of parameters to each drawing function, a graphical context // structure, of type 'GC' is used. We set the various drawing options in this // structure, and then pass a pointer to this structure to any drawing routines. // This is rather handy, as we often needs to perform several drawing requests // with the same options. Thus, we would initialize a graphical context, set the // desired options, and pass this GC structure to all drawing functions. // Allocating a new GC is done using the XCreateGC() function. // GC XCreateGC(Display *display, Drawable d, uint32_t valuemask, // XGCValues *values) // Since a graphics context has zillions of attributes, and since often we want // to define only few of them, we need to be able to tell the XCreateGC() which // attributes we want to set. This is what the "valuemask" variable is for. // We then use the "values" variable to specify actual values for the attributes // we defined in the "valuesmask". The rest of the attributes of this GC will // be set to their default values. Once we created a graphics context, we can // use it in drawing functions. We can also modify its parameters using various // functions (e.g. XSetForeground to change the foreground color of the GC). // // // THE EVENTS // // A structure of type 'XEvent' is used to pass events received from the X server. // Xlib supports a large amount of event types. The XEvent structure contains the // type of event received, as well as the data associated with the event (e.g. // position on the screen where the event was generated, mouse button associated // with the event, region of screen associated with a 'redraw' event, etc). The way // to read the event's data depends on the event type. Thus, an XEvent structure // contains a C language union of all possible event types (if you're not sure what // C unions are, it is time to check your favourite C language manual...). Thus, // we could have an XExpose event, an XButton event, an XMotion event, etc. // After a program creates a window (or several windows), it should tell the X // server what types of events it wishes to receive for this window. By default, // no events are sent to the program. This is done for optimizing the server-to-client // connection (i.e. why send a program (that might even be running at the other // side of the globe) an event it is not interested in?). It may register for // various mouse (also called "pointer") events, keyboard events, expose events, etc. // In Xlib, we use the XSelectInput() function to register for events. This function // accepts 3 parameters - the display structure, an ID of a window, and a mask of // the event types it wishes to get. //############################################################################## // # // Class X11Window # // # //############################################################################## // ================================================================= // Definition of static attributes // ================================================================= // ================================================================= // Constructors // ================================================================= X11Window::X11Window() { } X11Window::X11Window(Display* display, int8_t screen, Atom* atoms, uint16_t x, uint16_t y, uint16_t width, uint16_t height, const char* caption) { width_ = width; height_ = height; display_ = display; screen_ = screen; XSetWindowAttributes win_attributes; win_attributes.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask; win_attributes.background_pixel = XBlackPixel(display_, screen_); window_ = XCreateWindow(display_, DefaultRootWindow(display_), x, y, width_, height_, 0, CopyFromParent, CopyFromParent, CopyFromParent, CWBackPixel|CWEventMask, &win_attributes); // NB: the 7th parameter is the width of the window's border, it has nothing to do with // the border appended by the window manager, so this is most often set to zero. // Define the title & iconname of the window XSetStandardProperties(display_, window_, caption, caption, None, NULL, 0, NULL); // We want to get MapNotify events, KeyPress events... XSelectInput(display_, window_, StructureNotifyMask | ExposureMask | KeyPressMask); // Create graphical contexts uint32_t whiteColor = WhitePixel(display_, screen_); XGCValues values; values.line_width = 1; values.foreground = pixel(display_, screen_, (char*)"white", whiteColor); values.background = pixel(display_, screen_, (char*)"black", whiteColor); gcWhite_ = XCreateGC(display_, window_, GCForeground|GCBackground|GCLineWidth, &values); values.foreground = pixel(display_, screen_, (char*)"black",whiteColor); values.background = pixel(display_, screen_, (char*)"white",whiteColor); gcBlack_ = XCreateGC(display_, window_, GCForeground|GCBackground|GCLineWidth, &values); values.foreground = pixel(display_, screen_, (char*)"red", whiteColor); values.background = pixel(display_, screen_, (char*)"black",whiteColor); gcRed_ = XCreateGC(display_, window_, GCForeground|GCBackground|GCLineWidth, &values); values.foreground = pixel(display_, screen_, (char*)"green",whiteColor); values.background = pixel(display_, screen_, (char*)"green",whiteColor); gcGreen_ = XCreateGC(display_, window_, GCForeground|GCBackground|GCLineWidth, &values); values.foreground = pixel(display_, screen_, (char*)"blue", whiteColor); values.background = pixel(display_, screen_, (char*)"black",whiteColor); gcBlue_ = XCreateGC(display_, window_, GCForeground|GCBackground|GCLineWidth, &values); values.foreground = pixel(display_, screen_, (char*)"orange",whiteColor); values.background = pixel(display_, screen_, (char*)"orange",whiteColor); gcOrange_ = XCreateGC(display_, window_, GCForeground|GCBackground|GCLineWidth, &values); values.foreground = pixel(display_, screen_, (char*)"yellow",whiteColor); values.background = pixel(display_, screen_, (char*)"yellow",whiteColor); gcYellow_ = XCreateGC(display_, window_, GCForeground|GCBackground|GCLineWidth, &values); values.foreground = pixel(display_, screen_, (char*)"lightgrey",whiteColor); values.background = pixel(display_, screen_, (char*)"lightgrey",whiteColor); gcLightGrey_ = XCreateGC(display_, window_, GCForeground|GCBackground|GCLineWidth, &values); values.foreground = pixel(display_, screen_, (char*)"darkgrey", whiteColor); values.background = pixel(display_, screen_, (char*)"darkgrey", whiteColor); gcDarkGrey_ = XCreateGC(display_, window_, GCForeground|GCBackground|GCLineWidth, &values); values.foreground = pixel(display_, screen_, (char*)"grey15", whiteColor); values.background = pixel(display_, screen_, (char*)"grey15", whiteColor); gcDarkerGrey_ = XCreateGC(display_, window_, GCForeground|GCBackground|GCLineWidth, &values); values.foreground = pixel(display_, screen_, (char*)"grey",whiteColor); values.background = pixel(display_, screen_, (char*)"grey",whiteColor); gcGrey_ = XCreateGC(display_, window_, GCForeground|GCBackground|GCLineWidth, &values); XMapWindow(display_, window_); XMoveWindow(display_, window_, x, y); XFlush(display_); // Necessary to handle window closing XSetWMProtocols(display_, window_, atoms, 2); } // ================================================================= // Destructors // ================================================================= X11Window::~X11Window() { XFreeGC(display_, gcWhite_); XFreeGC(display_, gcBlack_); XFreeGC(display_, gcRed_); XFreeGC(display_, gcGreen_); XFreeGC(display_, gcBlue_); XFreeGC(display_, gcOrange_); XFreeGC(display_, gcYellow_); XFreeGC(display_, gcGrey_); XFreeGC(display_, gcLightGrey_); XFreeGC(display_, gcDarkGrey_); XFreeGC(display_, gcDarkerGrey_); XDestroyWindow(display_, window_); } // ================================================================= // Public Methods // ================================================================= void X11Window::resize(unsigned int width, unsigned int height) { width_ = width; height_ = height; } void X11Window::draw_string(int16_t x, int16_t y, char * str) { XDrawImageString(display_, window_, gcWhite_, x, y, str, strlen(str)); } void X11Window::draw_line(int16_t x1, int16_t y1, int16_t x2, int16_t y2, color_map color, bool bold /*= false*/) { GC* gc = NULL; // Determine which GC to use switch (color) { case WHITE : gc = &gcWhite_; break; case BLACK : gc = & gcBlack_; break; case RED : gc = & gcRed_; break; case GREEN : gc = & gcGreen_; break; case BLUE : gc = & gcBlue_; break; case ORANGE : gc = & gcOrange_; break; case YELLOW : gc = & gcYellow_; break; case GREY : gc = & gcGrey_; break; case LIGHT_GREY : gc = & gcLightGrey_; break; case DARK_GREY : gc = & gcDarkGrey_; break; case DARKER_GREY : gc = & gcDarkerGrey_; break; } // Draw line (lines if bold) XDrawLine(display_, window_, *gc, x1, y1, x2, y2); if (bold) { XDrawLine(display_, window_, *gc, x1-1, y1, x2-1, y2); XDrawLine(display_, window_, *gc, x1+1, y1, x2+1, y2); } } void X11Window::draw_line(int16_t x1, int16_t y1, int16_t x2, int16_t y2, char* color, bool bold /*= false*/) { // Create custom GC XGCValues values; values.foreground = pixel(display_, screen_, color, WhitePixel(display_,screen_)); values.background = pixel(display_, screen_, color, WhitePixel(display_,screen_)); GC tmp_gc = XCreateGC(display_, window_, GCForeground|GCBackground, &values); // Draw line (lines if bold) XDrawLine(display_, window_, tmp_gc, x1, y1, x2, y2); if (bold) { XDrawLine(display_, window_, tmp_gc, x1-1, y1, x2-1, y2); XDrawLine(display_, window_, tmp_gc, x1+1, y1, x2+1, y2); } XFreeGC(display_, tmp_gc); } void X11Window::draw_circle(int16_t x, int16_t y, int16_t diam) { XDrawArc(display_, window_, gcWhite_, x, y, diam, diam, 0, 64*360); } void X11Window::draw_arc(int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2) { XDrawArc(display_, window_, gcWhite_, x, y, diam, diam, 64*angle1, 64*angle2); } void X11Window::draw_arc(int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2, char* color) { XGCValues values; values.line_width = 2; values.foreground = pixel(display_, screen_, color, WhitePixel(display_,screen_)); values.background = pixel(display_, screen_, color, WhitePixel(display_,screen_)); GC tmp_gc = XCreateGC(display_, window_, GCForeground|GCBackground|GCLineWidth, &values); XDrawArc(display_, window_, tmp_gc, x, y, diam, diam, 64*angle1, 64*angle2); XFreeGC(display_, tmp_gc); } void X11Window::draw_arc_64(int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2) { XDrawArc(display_, window_, gcWhite_, x, y, diam, diam, angle1, angle2); } void X11Window::draw_arc_64(int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2, char* color) { XGCValues values; values.line_width = 2; values.foreground = pixel(display_, screen_, color, WhitePixel(display_,screen_)); values.background = pixel(display_, screen_, color, WhitePixel(display_,screen_)); GC tmp_gc = XCreateGC(display_, window_, GCForeground|GCBackground|GCLineWidth, &values); XDrawArc(display_, window_, tmp_gc, x, y, diam, diam, angle1, angle2); XFreeGC(display_, tmp_gc); } void X11Window::fill_arc(int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2) { XFillArc(display_, window_, gcWhite_, x, y, diam, diam, 64*angle1, 64*angle2); } void X11Window::fill_arc(int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2, char* color) { XGCValues values; values.line_width = 2; values.foreground = pixel(display_, screen_, color, WhitePixel(display_,screen_)); values.background = pixel(display_, screen_, color, WhitePixel(display_,screen_)); GC tmp_gc = XCreateGC(display_, window_, GCForeground|GCBackground|GCLineWidth, &values); XFillArc(display_, window_, tmp_gc, x, y, diam, diam, 64*angle1, 64*angle2); XFreeGC(display_, tmp_gc); } void X11Window::fill_arc_64(int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2) { XFillArc(display_, window_, gcWhite_, x, y, diam, diam, angle1, angle2); } void X11Window::fill_arc_64(int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2, char* color) { XGCValues values; values.line_width = 2; values.foreground = pixel(display_, screen_, color, WhitePixel(display_,screen_)); values.background = pixel(display_, screen_, color, WhitePixel(display_,screen_)); GC tmp_gc = XCreateGC(display_, window_, GCForeground|GCBackground|GCLineWidth, &values); XFillArc(display_, window_, tmp_gc, x, y, diam, diam, angle1, angle2); XFreeGC(display_, tmp_gc); } void X11Window::fill_rectangle(int16_t x, int16_t y, int16_t width, int16_t height, color_map color) { switch (color) { case WHITE : XFillRectangle(display_, window_, gcWhite_, x, y, width, height); break; case BLACK : XFillRectangle(display_, window_, gcBlack_, x, y, width, height); break; case RED : XFillRectangle(display_, window_, gcRed_, x, y, width, height); break; case GREEN : XFillRectangle(display_, window_, gcGreen_, x, y, width, height); break; case BLUE : XFillRectangle(display_, window_, gcBlue_, x, y, width, height); break; case ORANGE : XFillRectangle(display_, window_, gcOrange_, x, y, width, height); break; case YELLOW : XFillRectangle(display_, window_, gcYellow_, x, y, width, height); break; case GREY : XFillRectangle(display_, window_, gcGrey_, x, y, width, height); break; case LIGHT_GREY : XFillRectangle(display_, window_, gcLightGrey_, x, y, width, height); break; case DARK_GREY : XFillRectangle(display_, window_, gcDarkGrey_, x, y, width, height); break; case DARKER_GREY : XFillRectangle(display_, window_, gcDarkerGrey_, x, y, width, height); break; } } void X11Window::fill_rectangle(int16_t x, int16_t y, int16_t width, int16_t height, char* color) { XGCValues values; values.foreground = pixel(display_, screen_, color, WhitePixel(display_,screen_)); values.background = pixel(display_, screen_, color, WhitePixel(display_,screen_)); GC tmp_gc = XCreateGC(display_, window_, GCForeground|GCBackground, &values); XFillRectangle(display_, window_, tmp_gc, x, y, width, height); XFreeGC(display_, tmp_gc); } char*X11Window::color(double mean) { int16_t red, green, blue; double mean_range = X_MAX - X_MIN; double mean_range_5 = X_MIN + mean_range / 5; double mean_range_2_5 = X_MIN + 2 * mean_range / 5; double mean_range_3_5 = X_MIN + 3 * mean_range / 5; double mean_range_4_5 = X_MIN + 4 * mean_range / 5; if (mean < mean_range_5) { red = 0; green = 255 * (1.0 - ((mean_range_5 - mean) / mean_range_5)); blue = 255; } else if (mean < mean_range_2_5) { red = 0; green = 255; blue = 255 * ((mean_range_2_5 - mean) / mean_range_5); } else if (mean < mean_range_3_5) { red = 255 * (1.0 - ((mean_range_3_5 - mean) / mean_range_5)); green = 255; blue = 0; } else if (mean < mean_range_4_5) { red = 255; green = 255 * ((mean_range_4_5 - mean) / mean_range_5); blue = 0; } else { red = 255; green = 0; blue = 255 * (1.0 - ((mean_range - mean) / mean_range_5)); } char* color = new char[8]; sprintf(color, "#%02x%02x%02x", red, green, blue); return color; } // ================================================================= // Protected Methods // ================================================================= uint32_t X11Window::pixel(Display *display, int8_t screen, char *color_name, uint32_t default_color) { // hacked on 2014-12-05 because XQuarz and Yosemite make XAllocColor veeery slow // dirty memoization workaround: display and screen are assumed to be constant // costs 21Kb of RAM on basic example (according to the measure given before the return) static std::unordered_map color_memo; // if color_name is already recorded, compute and record it if (color_memo.find(color_name) == color_memo.end()) { XColor color; if (XParseColor(display, DefaultColormap(display,screen), color_name, &color) == 0) { fprintf(stderr, "Invalid color: %s\n", color_name); return default_color; } if (XAllocColor(display, DefaultColormap(display,screen), &color) == 0) { fprintf(stderr, "Could not allocate color %s\n", color_name); return default_color; } color_memo[color_name] = color.pixel; } // printf("ram used: %lu bytes\n", sizeof(color_memo) + color_memo.size() * (sizeof(std::string) + sizeof(unsigned long))); return color_memo[color_name]; } } // namespace aevol aevol-5.0/src/libaevol/Protein.h0000644000175000017500000001573012724051151013566 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_PROTEIN_H_ #define AEVOL_PROTEIN_H_ // ================================================================= // Libraries // ================================================================= #include #include // ================================================================= // Project Files // ================================================================= #include #include #include #include #include "macros.h" #include "Dna.h" #include "Codon.h" namespace aevol { // ================================================================= // Class declarations // ================================================================= class Individual; class Rna; class Protein { public : // ================================================================= // Constructors // ================================================================= Protein() = delete; Protein(const Protein &model) = delete; Protein(GeneticUnit* gen_unit, const Protein &model); Protein(GeneticUnit* gen_unit, const std::list& codon_list, Strand strand, int32_t shine_dal_pos, Rna * rna, double w_max); Protein( const std::list codon_list, double concentration, double w_max); //Protein(Protein* parent); Protein(gzFile backup_file); // ================================================================= // Destructors // ================================================================= virtual ~Protein(); // ================================================================= // Accessors // ================================================================= GeneticUnit* get_gen_unit( void ) const; inline std::list AA_list() const; inline Strand strand() const; inline const std::list rna_list() const; inline int32_t shine_dal_pos() const; inline int32_t first_translated_pos() const; inline int32_t last_translated_pos() const; int32_t last_STOP_base_pos() const; inline double mean() const; inline double width() const; // returns the half-width inline double height() const; inline int32_t length() const; // Number of Amino-Acids (not including START and STOP) inline double concentration() const; inline bool is_functional() const; Individual * indiv() const; // ================================================================= // Public Methods // ================================================================= void add_RNA(Rna * rna); char* AA_sequence(char separator = ' ') const; // WARNING : creates a new char[...] (up to you to delete it!) virtual void save(gzFile backup_file); // ================================================================= // Public Attributes // ================================================================= double concentration_; protected : // ================================================================= // Protected Methods // ================================================================= // ================================================================= // Protected Attributes // ================================================================= GeneticUnit* gen_unit_; Strand strand_; std::list rna_list_; // RNAs transcribing this protein int32_t shine_dal_pos_; // Index of the corresponding shine dalgarno sequence in the genome int32_t first_translated_pos_; // Index of the first base following the START codon int32_t last_translated_pos_; // Index of the last base before the STOP codon int32_t length_; // Number of Amino-Acids (START and STOP codon do NOT produce AAs) bool is_functional_; std::list AA_list_; // Phenotypic contribution (triangle) parameters double mean_; double width_; // in fact, half-width double height_; }; // ===================================================================== // Accessors definitions // ===================================================================== inline Strand Protein::strand() const { return strand_; } inline const std::list Protein::rna_list() const { return rna_list_; } int32_t Protein::shine_dal_pos() const { return shine_dal_pos_; } int32_t Protein::first_translated_pos() const { return first_translated_pos_; } int32_t Protein::last_translated_pos() const { return last_translated_pos_; } double Protein::mean() const { return mean_; } double Protein::width() const { return width_; } double Protein::height() const { return height_; } int32_t Protein::length() const { return length_; } double Protein::concentration() const { return concentration_; } bool Protein::is_functional() const { return is_functional_; } std::list Protein::AA_list() const { return AA_list_; } // ===================================================================== // Inline functions' definition // ===================================================================== } // namespace aevol #endif // AEVOL_PROTEIN_H_ aevol-5.0/src/libaevol/HabitatFactory.cpp0000644000175000017500000000252512724051151015403 00000000000000// // Created by arrouan on 19/11/15. // #include "HabitatFactory.h" namespace aevol { std::unique_ptr HabitatFactory::create_unique_habitat(Habitat& habitat, bool share_phenotypic_target) { #ifndef __REGUL #if __cplusplus == 201103L return make_unique (habitat, share_phenotypic_target); #else return std::make_unique (habitat, share_phenotypic_target); #endif #else #if __cplusplus == 201103L return make_unique (dynamic_cast(habitat), share_phenotypic_target); #else return std::make_unique (dynamic_cast(habitat), share_phenotypic_target); #endif #endif } std::unique_ptr HabitatFactory::create_unique_habitat(gzFile backup_file, PhenotypicTargetHandler* phenotypic_target_handler) { #ifndef __REGUL #if __cplusplus == 201103L return make_unique(backup_file, phenotypic_target_handler); #else return std::make_unique(backup_file, phenotypic_target_handler); #endif #else #if __cplusplus == 201103L return make_unique(backup_file, dynamic_cast(phenotypic_target_handler)); #else return std::make_unique(backup_file, dynamic_cast(phenotypic_target_handler)); #endif #endif } } aevol-5.0/src/libaevol/Individual_X11.h0000644000175000017500000001143712724051151014667 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_INDIVIDUAL_X11_H_ #define AEVOL_INDIVIDUAL_X11_H_ // ================================================================= // Libraries // ================================================================= #include #include #include #include // ================================================================= // Project Files // ================================================================= #include "Individual.h" #include "X11Window.h" namespace aevol { // ================================================================= // Class declarations // ================================================================= class Individual_X11 : public virtual Individual { public : // ================================================================= // Constructors // ================================================================= Individual_X11(ExpManager * exp_manager, gzFile backup_file); //Individual_X11(const Individual_X11 &model, bool replication_report_copy); Individual_X11(const Individual_X11& other); Individual_X11(ExpManager * exp_m, std::shared_ptr mut_prng, std::shared_ptr stoch_prng, std::shared_ptr param_mut, double w_max, int32_t min_genome_length, int32_t max_genome_length, bool allow_plasmids, int32_t id, const char* strain_name, int32_t age); Individual_X11(Individual_X11 * const parent, int32_t id, std::shared_ptr mut_prng, std::shared_ptr stoch_prng); Individual_X11() = delete; // forbidden constructor // ================================================================= // Destructors // ================================================================= virtual ~Individual_X11(); // ================================================================= // Accessors // ================================================================= // ================================================================= // Public Methods // ================================================================= virtual void display(); virtual void display_cdss(X11Window * win); virtual void display_rnas(X11Window * win); // ================================================================= // Public Attributes // ================================================================= protected : // ================================================================= // Protected Methods // ================================================================= void reset_sectors(); void add_layer(); void init_occupied_sectors(); // ================================================================= // Protected Attributes // ================================================================= // These are used to manage overlapping CDS and RNA display int16_t outmost_layer_; bool* occupied_sectors_[2][100]; // TODO : find a way to manage this table's size properly? }; // ===================================================================== // Accessors definitions // ===================================================================== } // namespace aevol #endif // AEVOL_INDIVIDUAL_X11_H_ aevol-5.0/src/libaevol/Stats.cpp0000644000175000017500000011160412724051151013574 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ================================================================= // Includes // ================================================================= #include "Stats.h" #include #include #include #include #include #include #include "StatRecord.h" #include "ExpManager.h" #include "ExpSetup.h" #include "Individual.h" #include "GeneticUnit.h" #ifdef __REGUL #include "raevol/Protein_R.h" #endif using std::string; namespace aevol { //############################################################################## // # // Class Stats # // # //############################################################################## // ================================================================= // Definition of static attributes // ================================================================= // ================================================================= // Constructors // ================================================================= /** * This is a temporary patch for experiment propagation, it shall become * obsolete or need to be adapted when in/out dirs are managed properly */ Stats::Stats(const string prefix, const string postfix /*= ""*/, bool best_indiv_only /*= false*/) { init_data(); set_file_names(prefix, postfix, best_indiv_only); } /** * Create a NEW stat manager */ Stats::Stats(ExpManager * exp_m, bool best_indiv_only /*= false*/, const string prefix /*= "stat"*/, const string postfix /*= ""*/, bool with_plasmids /*= false*/, bool compute_phen_contrib_by_GU /*= false*/) { exp_m_ = exp_m; init_data(); set_file_names(prefix, postfix, best_indiv_only, with_plasmids, compute_phen_contrib_by_GU); open_files(); write_headers(); } /** * Create a stat manager to append to existing stats */ Stats::Stats(ExpManager * exp_m, int64_t time, bool best_indiv_only/* = false */, const string prefix /*= "stat"*/, const string postfix /*= ""*/, bool addition_old_stats /* = true */, bool delete_old_stats /* = true */) { exp_m_ = exp_m; init_data(); set_file_names(prefix, postfix, best_indiv_only); if (addition_old_stats) { CreateTmpFiles(time); PromoteTmpFiles(); } else { // ancstat case open_files(); write_headers(true); } // Flush the new stat files flush(); } // ================================================================= // Destructors // ================================================================= Stats::~Stats() { for (int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++) { for (int8_t best_or_glob = 0 ; best_or_glob < NB_BEST_OR_GLOB ; best_or_glob++) { for (int8_t stat_type = 0 ; stat_type < NB_STATS_TYPES ; stat_type++) { if(stat_files_names_[chrom_or_GU][best_or_glob][stat_type] != nullptr) { if (stat_files_[chrom_or_GU][best_or_glob][stat_type] != nullptr) { fclose(stat_files_[chrom_or_GU][best_or_glob][stat_type]); stat_files_[chrom_or_GU][best_or_glob][stat_type] = nullptr; } delete [] stat_files_names_[chrom_or_GU][best_or_glob][stat_type]; stat_files_names_[chrom_or_GU][best_or_glob][stat_type] = nullptr; } } delete [] stat_files_[chrom_or_GU][best_or_glob]; stat_files_[chrom_or_GU][best_or_glob] = nullptr; delete [] stat_files_names_[chrom_or_GU][best_or_glob]; stat_files_names_[chrom_or_GU][best_or_glob] = nullptr; } delete [] stat_files_[chrom_or_GU]; stat_files_[chrom_or_GU] = nullptr; delete [] stat_files_names_[chrom_or_GU]; stat_files_names_[chrom_or_GU] = nullptr; } delete [] stat_files_; stat_files_ = nullptr; delete [] stat_files_names_; stat_files_names_ = nullptr; } // ================================================================= // Public Methods // ================================================================= inline double sqr(double x) { return x*x; } inline double rsqr(double x) { return (x < 0.00000001) ? 0. : sqrt(x); } void Stats::write_headers(bool ancstats_stats /* = false */) { // Column key in the stat files int8_t key; // -------------------------------------- // Write headers in FITNESS_STATS files // -------------------------------------- for (int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++) { if(ancstats_stats) { write_header(stat_files_[chrom_or_GU][BEST][FITNESS_STATS], "----------------------------------------"); write_header(stat_files_[chrom_or_GU][BEST][FITNESS_STATS], " Lineage individuals fitness statistics "); write_header(stat_files_[chrom_or_GU][BEST][FITNESS_STATS], "----------------------------------------"); write_header(stat_files_[chrom_or_GU][BEST][FITNESS_STATS], ""); } else { if (stat_files_names_[chrom_or_GU][BEST][FITNESS_STATS] != nullptr) { write_header(stat_files_[chrom_or_GU][BEST][FITNESS_STATS], "---------------------------------------"); write_header(stat_files_[chrom_or_GU][BEST][FITNESS_STATS], " Fittest individual fitness statistics "); write_header(stat_files_[chrom_or_GU][BEST][FITNESS_STATS], "---------------------------------------"); write_header(stat_files_[chrom_or_GU][BEST][FITNESS_STATS], ""); } if (stat_files_names_[chrom_or_GU][GLOB][FITNESS_STATS] != nullptr) { write_header(stat_files_[chrom_or_GU][GLOB][FITNESS_STATS], "------------------------------------------------"); write_header(stat_files_[chrom_or_GU][GLOB][FITNESS_STATS], " Average fitness statistics over the population "); write_header(stat_files_[chrom_or_GU][GLOB][FITNESS_STATS], "------------------------------------------------"); write_header(stat_files_[chrom_or_GU][GLOB][FITNESS_STATS], ""); } if (stat_files_names_[chrom_or_GU][SDEV][FITNESS_STATS] != nullptr) { write_header(stat_files_[chrom_or_GU][SDEV][FITNESS_STATS], "------------------------------------------------------------"); write_header(stat_files_[chrom_or_GU][SDEV][FITNESS_STATS], " Standard deviation, fitness statistics over the population "); write_header(stat_files_[chrom_or_GU][SDEV][FITNESS_STATS], "------------------------------------------------------------"); write_header(stat_files_[chrom_or_GU][SDEV][FITNESS_STATS], ""); } if (stat_files_names_[chrom_or_GU][SKEW][FITNESS_STATS] != nullptr) { write_header(stat_files_[chrom_or_GU][SKEW][FITNESS_STATS], "--------------------------------------------------"); write_header(stat_files_[chrom_or_GU][SKEW][FITNESS_STATS], " Skewness statistics, fitness over the population "); write_header(stat_files_[chrom_or_GU][SKEW][FITNESS_STATS], "--------------------------------------------------"); write_header(stat_files_[chrom_or_GU][SKEW][FITNESS_STATS], ""); } } for (int8_t best_or_glob = 0 ; best_or_glob < NB_BEST_OR_GLOB ; best_or_glob++) { if (stat_files_names_[chrom_or_GU][best_or_glob][FITNESS_STATS] != nullptr) { assert(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS] != nullptr); key = 1; write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Generation", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Population size", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Fitness", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Genome size (amount of DNA)", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Metabolic error", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Parent's metabolic error", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Metabolic fitness", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Secretion error", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Parent's secretion error", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Secretion fitness", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Amount of compound present in the grid-cell", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Int probe", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Double probe", key++); #ifdef __REGUL write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Number of links in the regulation graph", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Number of positive links in the regulation graph", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Number of negative links in the regulation graph", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Average value of links in the regulation graph", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Average value of positive links in the regulation graph", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Average value of negative links in the regulation graph", key++); #endif write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], ""); } } } // --------------------------------------- // Write headers in MUTATION_STATS files // --------------------------------------- for (int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++) { if(ancstats_stats) { write_header(stat_files_[chrom_or_GU][BEST][MUTATION_STATS], "-----------------------------------------"); write_header(stat_files_[chrom_or_GU][BEST][MUTATION_STATS], " Lineage individuals mutation statistics "); write_header(stat_files_[chrom_or_GU][BEST][MUTATION_STATS], "-----------------------------------------"); write_header(stat_files_[chrom_or_GU][BEST][MUTATION_STATS], ""); } else { if (stat_files_names_[chrom_or_GU][BEST][MUTATION_STATS] != nullptr) { write_header(stat_files_[chrom_or_GU][BEST][MUTATION_STATS], "----------------------------------------"); write_header(stat_files_[chrom_or_GU][BEST][MUTATION_STATS], " Fittest individual mutation statistics "); write_header(stat_files_[chrom_or_GU][BEST][MUTATION_STATS], "----------------------------------------"); write_header(stat_files_[chrom_or_GU][BEST][MUTATION_STATS], ""); } if (stat_files_names_[chrom_or_GU][GLOB][MUTATION_STATS] != nullptr) { write_header(stat_files_[chrom_or_GU][GLOB][MUTATION_STATS], "-------------------------------------------------"); write_header(stat_files_[chrom_or_GU][GLOB][MUTATION_STATS], " Average mutation statistics over the population "); write_header(stat_files_[chrom_or_GU][GLOB][MUTATION_STATS], "-------------------------------------------------"); write_header(stat_files_[chrom_or_GU][GLOB][MUTATION_STATS], ""); } } for (int8_t best_or_glob = 0 ; best_or_glob < NB_BEST_OR_GLOB ; best_or_glob++) { if (stat_files_names_[chrom_or_GU][best_or_glob][MUTATION_STATS] != nullptr) { assert(stat_files_[chrom_or_GU][best_or_glob][MUTATION_STATS] != nullptr); key = 1; write_header(stat_files_[chrom_or_GU][best_or_glob][MUTATION_STATS], "Generation", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][MUTATION_STATS], "Number of local mutations undergone", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][MUTATION_STATS], "Number of chromosomic rearrangements undergone", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][MUTATION_STATS], "Number of switch undergone", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][MUTATION_STATS], "Number of indels undergone", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][MUTATION_STATS], "Number of duplications undergone", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][MUTATION_STATS], "Number of deletions undergone", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][MUTATION_STATS], "Number of translocations undergone", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][MUTATION_STATS], "Number of inversions undergone", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][MUTATION_STATS], ""); } } } // --------------------------------------- // Write headers in GENES_STATS files // --------------------------------------- for (int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++) { if(ancstats_stats) { write_header(stat_files_[chrom_or_GU][BEST][GENES_STATS], "-------------------------------------"); write_header(stat_files_[chrom_or_GU][BEST][GENES_STATS], " Lineage individuals gene statistics "); write_header(stat_files_[chrom_or_GU][BEST][GENES_STATS], "-------------------------------------"); write_header(stat_files_[chrom_or_GU][BEST][GENES_STATS], ""); } else { if (stat_files_names_[chrom_or_GU][BEST][GENES_STATS] != nullptr) { write_header(stat_files_[chrom_or_GU][BEST][GENES_STATS], "------------------------------------"); write_header(stat_files_[chrom_or_GU][BEST][GENES_STATS], " Fittest individual gene statistics "); write_header(stat_files_[chrom_or_GU][BEST][GENES_STATS], "------------------------------------"); write_header(stat_files_[chrom_or_GU][BEST][GENES_STATS], ""); } if (stat_files_names_[chrom_or_GU][GLOB][GENES_STATS] != nullptr) { write_header(stat_files_[chrom_or_GU][GLOB][GENES_STATS], "---------------------------------------------"); write_header(stat_files_[chrom_or_GU][GLOB][GENES_STATS], " Average gene statistics over the population "); write_header(stat_files_[chrom_or_GU][GLOB][GENES_STATS], "---------------------------------------------"); write_header(stat_files_[chrom_or_GU][GLOB][GENES_STATS], ""); } } for (int8_t best_or_glob = 0 ; best_or_glob < NB_BEST_OR_GLOB ; best_or_glob++) { if (stat_files_names_[chrom_or_GU][best_or_glob][GENES_STATS] != nullptr) { assert(stat_files_[chrom_or_GU][best_or_glob][GENES_STATS] != nullptr); key = 1; write_header(stat_files_[chrom_or_GU][best_or_glob][GENES_STATS], "Generation", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][GENES_STATS], "Number of coding RNAs (at least one gene on RNA)", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][GENES_STATS], "Number of non-coding RNAs", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][GENES_STATS], "Average size of coding RNAs (at least one gene on RNA)", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][GENES_STATS], "Average size of non-coding RNAs", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][GENES_STATS], "Number of functional genes", key++); // Non functional genes are those with width_ == 0 or height_ == 0 or those that lack one kind of codons (M, W or H) write_header(stat_files_[chrom_or_GU][best_or_glob][GENES_STATS], "Nb of non functional genes", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][GENES_STATS], "Average size of functional genes", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][GENES_STATS], "Average size of non functional genes (WARNING : bias towards 0)", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][GENES_STATS], ""); } } } // --------------------------------------- // Write headers in BP_STATS files // --------------------------------------- for (int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++) { if(ancstats_stats) { write_header(stat_files_[chrom_or_GU][BEST][BP_STATS], "-------------------------------------------"); write_header(stat_files_[chrom_or_GU][BEST][BP_STATS], " Lineage individuals non-coding statistics "); write_header(stat_files_[chrom_or_GU][BEST][BP_STATS], "-------------------------------------------"); write_header(stat_files_[chrom_or_GU][BEST][BP_STATS], ""); } else { if (stat_files_names_[chrom_or_GU][BEST][BP_STATS] != nullptr) { write_header(stat_files_[chrom_or_GU][BEST][BP_STATS], "------------------------------------------"); write_header(stat_files_[chrom_or_GU][BEST][BP_STATS], " Fittest individual non-coding statistics "); write_header(stat_files_[chrom_or_GU][BEST][BP_STATS], "------------------------------------------"); write_header(stat_files_[chrom_or_GU][BEST][BP_STATS], ""); } if (stat_files_names_[chrom_or_GU][GLOB][BP_STATS] != nullptr) { write_header(stat_files_[chrom_or_GU][GLOB][BP_STATS], "---------------------------------------------------"); write_header(stat_files_[chrom_or_GU][GLOB][BP_STATS], " Average non-coding statistics over the population "); write_header(stat_files_[chrom_or_GU][GLOB][BP_STATS], "---------------------------------------------------"); write_header(stat_files_[chrom_or_GU][GLOB][BP_STATS], ""); write_header(stat_files_[chrom_or_GU][GLOB][BP_STATS], " This data is not available"); write_header(stat_files_[chrom_or_GU][GLOB][BP_STATS], " Computing bp stats for all individuals is extremely costly computationaly"); write_header(stat_files_[chrom_or_GU][GLOB][BP_STATS], ""); // Mark file as "not to be written into" and close it delete [] stat_files_names_[chrom_or_GU][GLOB][BP_STATS]; stat_files_names_[chrom_or_GU][GLOB][BP_STATS] = nullptr; fclose(stat_files_[chrom_or_GU][GLOB][BP_STATS]); stat_files_[chrom_or_GU][GLOB][BP_STATS] = nullptr; } } for (int8_t best_or_glob = 0 ; best_or_glob < NB_BEST_OR_GLOB ; best_or_glob++) { if (stat_files_names_[chrom_or_GU][best_or_glob][BP_STATS] != nullptr) { assert(stat_files_[chrom_or_GU][best_or_glob][BP_STATS] != nullptr); key = 1; write_header(stat_files_[chrom_or_GU][best_or_glob][BP_STATS], "Generation", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][BP_STATS], "Number of bp not included in any CDS", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][BP_STATS], "Number of bp not included in any functional CDS", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][BP_STATS], "Number of bp not included in any non functional CDS", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][BP_STATS], "Number of bp not included in any RNA", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][BP_STATS], "Number of bp not included in any coding RNA", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][BP_STATS], "Number of bp not included in any non coding RNA", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][BP_STATS], "Number of non essential bp", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][BP_STATS], "Number of non essential bp including non fonctional genes", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][BP_STATS], ""); write_header(stat_files_[chrom_or_GU][best_or_glob][BP_STATS], "NOTE: a bp is considered \"essential\" when it is part of any [functional] CDS"); write_header(stat_files_[chrom_or_GU][best_or_glob][BP_STATS], " or any promoter or terminator corresponding to an RNA transcribing a [functional] CDS."); write_header(stat_files_[chrom_or_GU][best_or_glob][BP_STATS], ""); } } } // --------------------------------------- // Write headers in REAR_STATS files // --------------------------------------- for (int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++) { if(ancstats_stats) { write_header(stat_files_[chrom_or_GU][BEST][REAR_STATS], "----------------------------------------------"); write_header(stat_files_[chrom_or_GU][BEST][REAR_STATS], " Lineage individuals rearrangement statistics "); write_header(stat_files_[chrom_or_GU][BEST][REAR_STATS], "----------------------------------------------"); write_header(stat_files_[chrom_or_GU][BEST][REAR_STATS], ""); } else { if (stat_files_names_[chrom_or_GU][BEST][REAR_STATS] != nullptr) { write_header(stat_files_[chrom_or_GU][BEST][REAR_STATS], "---------------------------------------------"); write_header(stat_files_[chrom_or_GU][BEST][REAR_STATS], " Fittest individual rearrangement statistics "); write_header(stat_files_[chrom_or_GU][BEST][REAR_STATS], "---------------------------------------------"); write_header(stat_files_[chrom_or_GU][BEST][REAR_STATS], ""); } if (stat_files_names_[chrom_or_GU][GLOB][REAR_STATS] != nullptr) { write_header(stat_files_[chrom_or_GU][GLOB][REAR_STATS], "------------------------------------------------------"); write_header(stat_files_[chrom_or_GU][GLOB][REAR_STATS], " Average rearrangement statistics over the population "); write_header(stat_files_[chrom_or_GU][GLOB][REAR_STATS], "------------------------------------------------------"); write_header(stat_files_[chrom_or_GU][GLOB][REAR_STATS], ""); } } for (int8_t best_or_glob = 0 ; best_or_glob < NB_BEST_OR_GLOB ; best_or_glob++) { if (stat_files_names_[chrom_or_GU][best_or_glob][REAR_STATS] != nullptr) { assert(stat_files_[chrom_or_GU][best_or_glob][REAR_STATS] != nullptr); key = 1; write_header(stat_files_[chrom_or_GU][best_or_glob][REAR_STATS], "Generation", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][REAR_STATS], "Actual duplication rate", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][REAR_STATS], "Actual deletion rate", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][REAR_STATS], "Actual translocation rate", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][REAR_STATS], "Actual inversion rate", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][REAR_STATS], "Average alignment score (needed score)", key++); write_header(stat_files_[chrom_or_GU][best_or_glob][REAR_STATS], ""); } } } flush(); } void Stats::write_current_generation_statistics() { StatRecord** stat_records; Individual* best_indiv = exp_m_->best_indiv(); ReplicationReport* best_replic_report = exp_m_->tree() ? exp_m_->tree()->report_by_index(AeTime::time(), best_indiv->id()) : nullptr; std::list> annotated_indivs = exp_m_->indivs_annotated(); for (int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++) { if ((not exp_m_->output_m()->compute_phen_contrib_by_GU()) && chrom_or_GU > ALL_GU) continue; stat_records = new StatRecord* [NB_BEST_OR_GLOB]; // WARNING: stat_record initialization order matters: SKEW computation // relies on SDEV being computed stat_records[BEST] = new StatRecord(exp_m_->exp_s(), best_indiv, best_replic_report, (chrom_or_gen_unit) chrom_or_GU); stat_records[GLOB] = new StatRecord(exp_m_->exp_s(), annotated_indivs, (chrom_or_gen_unit) chrom_or_GU); stat_records[SDEV] = new StatRecord(exp_m_->exp_s(), annotated_indivs, stat_records[GLOB], (chrom_or_gen_unit) chrom_or_GU); stat_records[SKEW] = new StatRecord(exp_m_->exp_s(), annotated_indivs, stat_records[GLOB], stat_records[SDEV], (chrom_or_gen_unit) chrom_or_GU); for (int8_t best_or_glob = 0 ; best_or_glob < NB_BEST_OR_GLOB ; best_or_glob++) { for (int8_t stat_type = 0 ; stat_type < NB_STATS_TYPES ; stat_type++) { if (stat_files_names_[chrom_or_GU][best_or_glob][stat_type] != nullptr) { stat_records[best_or_glob]-> write_to_file(stat_files_[chrom_or_GU][best_or_glob][stat_type], (stats_type) stat_type); } } delete stat_records[best_or_glob]; } delete [] stat_records; } } void Stats::write_statistics_of_this_indiv(Individual * indiv, ReplicationReport* replic_report) { StatRecord * stat_record; for (int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++) { stat_record = new StatRecord(exp_m_->exp_s(), indiv, replic_report, (chrom_or_gen_unit) chrom_or_GU, true); for (int8_t stat_type = 0 ; stat_type < NB_STATS_TYPES ; stat_type++) { if (stat_files_names_[chrom_or_GU][BEST][stat_type] != nullptr) { assert(stat_files_[chrom_or_GU][BEST][stat_type] != nullptr); stat_record->write_to_file(stat_files_[chrom_or_GU][BEST][stat_type], (stats_type) stat_type); } } delete stat_record; } } void Stats::flush() { for (int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++) { for (int8_t best_or_glob = 0 ; best_or_glob < NB_BEST_OR_GLOB ; best_or_glob++) { for (int8_t stat_type = 0 ; stat_type < NB_STATS_TYPES ; stat_type++) { if (stat_files_names_[chrom_or_GU][best_or_glob][stat_type] != nullptr) { assert(stat_files_[chrom_or_GU][best_or_glob][stat_type] != nullptr); fflush(stat_files_[chrom_or_GU][best_or_glob][stat_type]); } } } } } // ================================================================= // Protected Methods // ================================================================= /** * Allocate memory and initialize file handlers and file names to nullptr */ void Stats::init_data() { stat_files_ = new FILE***[NB_CHROM_OR_GU]; stat_files_names_ = new char***[NB_CHROM_OR_GU]; for (int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++) { stat_files_[chrom_or_GU] = new FILE**[NB_BEST_OR_GLOB]; stat_files_names_[chrom_or_GU] = new char**[NB_BEST_OR_GLOB]; for (int8_t best_or_glob = 0 ; best_or_glob < NB_BEST_OR_GLOB ; best_or_glob++) { stat_files_[chrom_or_GU][best_or_glob] = new FILE*[NB_STATS_TYPES]; stat_files_names_[chrom_or_GU][best_or_glob] = new char*[NB_STATS_TYPES]; for (int8_t stat_type = 0 ; stat_type < NB_STATS_TYPES ; stat_type++) { stat_files_[chrom_or_GU][best_or_glob][stat_type] = nullptr; stat_files_names_[chrom_or_GU][best_or_glob][stat_type] = nullptr; } } } } /** * Construct file names */ // NB: Here is where we "choose" which files we will write. // Files that are not wanted must be left with a nullptr name // (don't new char[] them) // There is an exception though: for the non-coding file for the population, // we will give it a name temporarily so that we can write the warning // headers. Once this is done, the name will be deleted to mark the file as // "not to be written into" // void Stats::set_file_names(const string prefix, const string postfix, bool best_indiv_only, bool with_plasmids /*= false*/, bool compute_phen_contrib_by_GU /*= false*/) { // 1) Create stats directory int status; status = mkdir(STATS_DIR, 0755); if ((status == -1) && (errno != EEXIST)) { err(EXIT_FAILURE, STATS_DIR); } const char* chrom_or_gu_name[NB_CHROM_OR_GU] = {"", "_chromosome", "_plasmids"}; const char* best_or_glob_name[NB_BEST_OR_GLOB] = {"_best", "_glob", "_sdev", "_skew"}; const char* stat_type_name[NB_STATS_TYPES] = {"_fitness" ,"_mutation", "_genes", "_bp", "_rear"}; for (int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++) { // If plasmids are not allowed, don't issue "chromosome" and // "plasmids" files if (not with_plasmids && chrom_or_GU > 0) continue; // Idem if COMPUTE_PHEN_CONTRIB_BY_GU not set if ((not compute_phen_contrib_by_GU && chrom_or_GU > ALL_GU)) continue; for (int8_t best_or_glob = 0 ; best_or_glob < NB_BEST_OR_GLOB ; best_or_glob++) { if (best_indiv_only && best_or_glob != BEST) continue; for (int8_t stat_type = 0 ; stat_type < NB_STATS_TYPES ; stat_type++) { // // We don't want REAR_STATS when rearrangements are done without // alignments // if (stat_type == REAR_STATS && ! exp_m_->with_alignments()) // continue; // For now, we only want sdev and skew for fitness data if (best_or_glob > GLOB && stat_type > FITNESS_STATS) continue; if ((chrom_or_GU != ALL_GU || best_or_glob != GLOB) && stat_type > REAR_STATS) continue; stat_files_names_[chrom_or_GU][best_or_glob][stat_type] = new char[255]; // Construct the correct name if (best_indiv_only) { sprintf(stat_files_names_[chrom_or_GU][best_or_glob][stat_type], STATS_DIR"/%s%s%s%s.out", prefix.c_str(), stat_type_name[stat_type], chrom_or_gu_name[chrom_or_GU], postfix.c_str()); } else { sprintf(stat_files_names_[chrom_or_GU][best_or_glob][stat_type], STATS_DIR"/%s%s%s%s%s.out", prefix.c_str(), stat_type_name[stat_type], chrom_or_gu_name[chrom_or_GU], best_or_glob_name[best_or_glob], postfix.c_str()); } } } } } /** * Open files that have a non nullptr name */ void Stats::open_files() { for (int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++) { for (int8_t best_or_glob = 0 ; best_or_glob < NB_BEST_OR_GLOB ; best_or_glob++) { for (int8_t stat_type = 0 ; stat_type < NB_STATS_TYPES ; stat_type++) { if (stat_files_names_[chrom_or_GU][best_or_glob][stat_type] != nullptr) { stat_files_[chrom_or_GU][best_or_glob][stat_type] = fopen(stat_files_names_[chrom_or_GU][best_or_glob][stat_type], "w"); } } } } } /** * Create partial copies (up to a given timestep) of all stat files */ void Stats::CreateTmpFiles(int64_t time) { char* old_file_name; // Syntaxic sugar for stat_files_names_[][][] FILE* old_file; char* new_file_name = new char[100]; FILE* new_file; char line[500]; for (int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++) { for (int8_t best_or_glob = 0 ; best_or_glob < NB_BEST_OR_GLOB ; best_or_glob++) { for (int8_t stat_type = 0 ; stat_type < NB_STATS_TYPES ; stat_type++) { old_file_name = stat_files_names_[chrom_or_GU][best_or_glob][stat_type]; if (old_file_name != nullptr) { sprintf(new_file_name, "%s.tmp", old_file_name); old_file = fopen(old_file_name, "r"); new_file = fopen(new_file_name, "w"); // Copy file header if (fgets(line, 500, old_file) == nullptr) { // TODO check for error } while (!feof(old_file) && line[0] == '#') { fputs(line, new_file); if (fgets(line, 500, old_file) == nullptr) { // TODO check for error } } // Copy stats until time (included) while ((int64_t)atol(line) <= time && !feof(old_file)) { fputs(line, new_file); if (fgets(line, 500, old_file)) { // TODO check for error } } fclose(old_file); fclose(new_file); } } } } delete [] new_file_name; } /** * This is a temporary patch for experiment propagation, it shall become * obsolete when in/out dirs are managed properly */ void Stats::Propagate(const std::string& destdir, int64_t propagated_timestep) { char* old_file_name; // Syntaxic sugar for stat_files_names_[][][] FILE* old_file; char* new_file_name = new char[255]; FILE* new_file; char line[500]; for (int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++) { for (int8_t best_or_glob = 0 ; best_or_glob < NB_BEST_OR_GLOB ; best_or_glob++) { for (int8_t stat_type = 0 ; stat_type < NB_STATS_TYPES ; stat_type++) { old_file_name = stat_files_names_[chrom_or_GU][best_or_glob][stat_type]; if (old_file_name != nullptr) { sprintf(new_file_name, "%s/%s", destdir.c_str(), old_file_name); old_file = fopen(old_file_name, "r"); new_file = fopen(new_file_name, "w"); // Copy file header if (fgets(line, 500, old_file) == nullptr) { // TODO check for error } while (!feof(old_file) && line[0] == '#') { fputs(line, new_file); if (fgets(line, 500, old_file) == nullptr) { // TODO check for error } } // Flush stats until timestep while ((int64_t)atol(line) < propagated_timestep && !feof(old_file)) { if (fgets(line, 500, old_file)) { // TODO check for error } } // Write the line for propagated_timestep // after replacing the timestep with 0 char new_line[strlen(line)+1]; sprintf(new_line, "0%s", strchr(line, ' ')); fputs(new_line, new_file); fclose(old_file); fclose(new_file); } } } } delete [] new_file_name; } /** * Replace all the stat files by their tmp counterpart */ void Stats::PromoteTmpFiles() { char* cur_file_name; // Syntaxic sugar for stat_files_names_[][][] char* tmp_file_name = new char[100]; for (int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++) { for (int8_t best_or_glob = 0 ; best_or_glob < NB_BEST_OR_GLOB ; best_or_glob++) { for (int8_t stat_type = 0 ; stat_type < NB_STATS_TYPES ; stat_type++) { cur_file_name = stat_files_names_[chrom_or_GU][best_or_glob][stat_type]; if (cur_file_name != nullptr) { sprintf(tmp_file_name, "%s.tmp", cur_file_name); remove(cur_file_name); int renameOK = rename(tmp_file_name, cur_file_name); if (renameOK != 0) Utils::ExitWithUsrMsg(string("could not rename file ") + tmp_file_name + " into " + cur_file_name); // Reopen file if (stat_files_[chrom_or_GU][best_or_glob][stat_type] != nullptr) fclose(stat_files_[chrom_or_GU][best_or_glob][stat_type]); stat_files_[chrom_or_GU][best_or_glob][stat_type] = fopen(cur_file_name, "a"); } } } } delete [] tmp_file_name; } } // namespace aevol aevol-5.0/src/libaevol/Translocation.cpp0000644000175000017500000001025012724051151015311 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ============================================================================ // Includes // ============================================================================ #include "Translocation.h" namespace aevol { // ============================================================================ // Definition of static attributes // ============================================================================ // ============================================================================ // Constructors // ============================================================================ Translocation::Translocation(int32_t pos1, int32_t pos2, int32_t pos3, int32_t pos4, int32_t length, bool invert, int16_t align_score_1, int16_t align_score_2) : pos1_(pos1), pos2_(pos2), pos3_(pos3), pos4_(pos4), length_(length), invert_(invert), align_score_1_(align_score_1), align_score_2_(align_score_2) { } // ============================================================================ // Destructor // ============================================================================ // ============================================================================ // Methods // ============================================================================ void Translocation::save(gzFile backup_file) const { int8_t tmp_mut_type = TRANS; gzwrite(backup_file, &tmp_mut_type, sizeof(tmp_mut_type)); gzwrite(backup_file, &pos1_, sizeof(pos1_)); gzwrite(backup_file, &pos2_, sizeof(pos2_)); gzwrite(backup_file, &pos3_, sizeof(pos3_)); gzwrite(backup_file, &pos4_, sizeof(pos4_)); gzwrite(backup_file, &length_, sizeof(length_)); gzwrite(backup_file, &invert_, sizeof(invert_)); gzwrite(backup_file, &align_score_1_, sizeof(align_score_1_)); gzwrite(backup_file, &align_score_2_, sizeof(align_score_2_)); } void Translocation::load(gzFile backup_file) { gzread(backup_file, &pos1_, sizeof(pos1_)); gzread(backup_file, &pos2_, sizeof(pos2_)); gzread(backup_file, &pos3_, sizeof(pos3_)); gzread(backup_file, &pos4_, sizeof(pos4_)); gzread(backup_file, &length_, sizeof(length_)); gzread(backup_file, &invert_, sizeof(invert_)); gzread(backup_file, &align_score_1_, sizeof(align_score_1_)); gzread(backup_file, &align_score_2_, sizeof(align_score_2_)); } void Translocation::generic_description_string(char* str) const { sprintf(str, "%" PRId8 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId8 " %" PRId16 " %" PRId16 " %" PRId32 " %" PRId32, mut_type(), pos1(), pos2(), pos3(), pos4(), invert_ ? 1 : 0, align_score_1(), align_score_2(), length_, -1); } // ============================================================================ // Non inline accessors // ============================================================================ } // namespace aevol aevol-5.0/src/libaevol/Gaussian.h0000644000175000017500000001246612724051151013723 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_GAUSSIAN_H_ #define AEVOL_GAUSSIAN_H_ // ================================================================= // Libraries // ================================================================= #include #include #include namespace aevol { // ================================================================= // Project Files // ================================================================= // ================================================================= // Class declarations // ================================================================= class Gaussian { public : // ================================================================= // Constructors // ================================================================= Gaussian(double height, double mean, double width) : height_{height}, mean_{mean}, width_{width} {} Gaussian(const Gaussian& model) : height_{model.height_}, mean_{model.mean_}, width_{model.width_} {} Gaussian(gzFile backup_file); // ================================================================= // Destructor // ================================================================= virtual ~Gaussian() {} // ================================================================= // Accessors // ================================================================= double height() const { return height_; } double mean() const { return mean_; } double width() const { return width_; } void set_height(double height) { height_ = height; } void set_mean(double mean) { mean_ = mean; } // ================================================================= // Public Methods // ================================================================= double compute_y(double x) const { return height_ * exp(-(x- mean_)*(x- mean_) / (2* width_ * width_)); } void save(gzFile backup_file) const; // ================================================================= // Public Attributes // ================================================================= protected : // ================================================================= // Forbidden Constructors // ================================================================= Gaussian() = delete; // ================================================================= // Protected Methods // ================================================================= // ================================================================= // Protected Attributes // ================================================================= double height_; double mean_; double width_; // In fact half-width to the inflexion points }; // ===================================================================== // Constructors // ===================================================================== inline Gaussian::Gaussian(gzFile backup_file) { gzread(backup_file, &height_, sizeof(height_)); gzread(backup_file, &mean_, sizeof(mean_)); gzread(backup_file, &width_, sizeof(width_)); } // ===================================================================== // Destructor // ===================================================================== // ===================================================================== // Accessors' definitions // ===================================================================== // ===================================================================== // functions' definition // ===================================================================== inline void Gaussian::save(gzFile backup_file) const { gzwrite(backup_file, &height_, sizeof(height_)); gzwrite(backup_file, &mean_, sizeof(mean_)); gzwrite(backup_file, &width_, sizeof(width_)); } } // namespace aevol #endif // AEVOL_GAUSSIAN_H_ aevol-5.0/src/libaevol/GzHelpers.h0000644000175000017500000000562312724051151014051 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_GZHELPERS_H_ #define AEVOL_GZHELPERS_H_ #include // =========================================================================== // Public Methods // =========================================================================== enum class GzAction {READ, WRITE}; // begin variadic template gzwrite(...) // Base case for the next template. // Useless by itself. Not intented to be called directly. void gz(GzAction action, gzFile file) { return; } /// Read/write variables to gzip file /// \param `action` tells whether to read or write /// \param `file` an open gzip file /// \param `field` the field to be written /// \param `fields_list` the remaining fields /// The function is simply called like: `gz(action, file, x, y, z, t)`. /// Warning: as it is currently written, this template overrides any /// call to gzwrite, which causes writing the length of the field to the file. template void gz(GzAction action, gzFile file, Field& field, Args&&... fields_list) { // This switch is unfortunate especially since the alternatives are pretty much the same. // But there is a subtle difference that prevented me from a trivial factorization: // gzwrite takes a _const_ void pointer as second argument. switch (action) { case GzAction::READ: ::gzread(file, &field, sizeof(field)); break; case GzAction::WRITE: ::gzwrite(file, &field, sizeof(field)); break; } gz(action, file, fields_list...); } // end variadic template gzwrite template void gzwrite(Args... args) { gz(GzAction::WRITE, args...); } template void gzread(Args&&... args) { gz(GzAction::READ, args...); } #endif //AEVOL_GZHELPERS_H_ aevol-5.0/src/libaevol/Utils.cpp0000644000175000017500000000771512724051151013605 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ============================================================================ // Includes // ============================================================================ #include "Utils.h" #include "JumpingMT.h" using std::string; using std::cout; using std::endl; namespace aevol { //############################################################################## // // Class Utils // //############################################################################## // ============================================================================ // Definition of static attributes // ============================================================================ // ============================================================================ // Constructors // ============================================================================ // ============================================================================ // Destructor // ============================================================================ // ============================================================================ // Methods // ============================================================================ /** * Compute value(t+1) with the provided parameters and prng * * value(t+1) = value(t)*(1-1/tau) + ssd/tau*sqrt(2*tau-1)*normal_random() */ void Utils::ApplyAutoregressiveStochasticProcess(double& value, double sigma, int16_t tau, JumpingMT& prng) { value = value * (1.0 - 1.0/tau) + (sigma/tau) * sqrt(2*tau- 1.0) * prng.gaussian_random(); } /** * Print an error message and exit (with error status) * * \param msg message to be printed * \param file should be __FILE__ * \param line should be __LINE__ */ void Utils::ExitWithDevMsg(const std::string& msg, const std::string& file, int line) { cout << file << ":" << line << ": error: " << msg << endl; exit(EXIT_FAILURE); } /** * Print an error message and exit (with error status) * * \param msg message to be printed * \param bin the binary that caused the error */ void Utils::ExitWithUsrMsg(const string& msg) { cout << "error: " << msg << endl; exit(EXIT_FAILURE); } /** * Print aevol version number */ void Utils::PrintAevolVersion() { printf("aevol %s\n", VERSION); } // ============================================================================ // Non inline accessors // ============================================================================ } // namespace aevol aevol-5.0/src/libaevol/Habitat.cpp0000644000175000017500000001044212724051151014050 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ============================================================================ // Includes // ============================================================================ #if __cplusplus == 201103L #include "make_unique.h" #endif #include "Habitat.h" #include using std::cout; using std::endl; namespace aevol { //############################################################################## // # // Class Habitat # // # //############################################################################## // ============================================================================ // Definition of static attributes // ============================================================================ // ============================================================================ // Constructors // ============================================================================ Habitat::Habitat() { compound_amount_ = 0.0; phenotypic_target_handler_ = new PhenotypicTargetHandler(); } Habitat::Habitat(const Habitat& rhs, bool share_phenotypic_target) { assert(share_phenotypic_target); compound_amount_ = rhs.compound_amount_; phenotypic_target_handler_ = rhs.phenotypic_target_handler_; } Habitat::Habitat(gzFile backup_file, PhenotypicTargetHandler* phenotypic_target_handler) { load(backup_file, phenotypic_target_handler); } // ============================================================================ // Destructor // ============================================================================ // ============================================================================ // Methods // ============================================================================ void Habitat::ApplyVariation() { //printf("Appel au apply_variation de habitat\n"); phenotypic_target_handler_->ApplyVariation(); } void Habitat::save(gzFile backup_file, bool skip_phenotypic_target /*=false*/) const { //printf("Appel a la sauvegarde de Habitat\n"); gzwrite(backup_file, &compound_amount_, sizeof(compound_amount_)); if (not skip_phenotypic_target) phenotypic_target_handler_->save(backup_file); } void Habitat::load(gzFile backup_file, PhenotypicTargetHandler* phenotypic_target_handler) { //printf("Appel au chargement de Habitat\n"); gzread(backup_file, &compound_amount_, sizeof(compound_amount_)); if (phenotypic_target_handler == nullptr) phenotypic_target_handler_ = new PhenotypicTargetHandler(backup_file); else phenotypic_target_handler_ = phenotypic_target_handler; } // ============================================================================ // Non inline accessors // ============================================================================ } // namespace aevol aevol-5.0/src/libaevol/Codon.h0000644000175000017500000000735712724051151013216 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_CODON_H_ #define AEVOL_CODON_H_ // ================================================================= // Includes // ================================================================= #include #include #include #include #include "Dna.h" #include "macros.h" namespace aevol { // ================================================================= // Class declarations // ================================================================= class Codon { public : // ================================================================= // Constructors // ================================================================= Codon(); explicit Codon(const Codon &model); explicit Codon(int8_t value); Codon(Dna* genome, Strand strand, int32_t index); explicit Codon(gzFile backup_file); // ================================================================= // Destructors // ================================================================= virtual ~Codon(); // ================================================================= // Accessors // ================================================================= int8_t value() { return value_; } // ================================================================= // Public Methods // ================================================================= bool is_start() { return value_ == CODON_START; } bool is_stop() { return value_ == CODON_STOP; } Codon* copy() { return new Codon(value_); } // TODO(dpa) use copy ctor instead! void save(gzFile backup_file); protected : // ================================================================= // Protected Methods // ================================================================= // ================================================================= // Protected Attributes // ================================================================= int8_t value_; }; // ===================================================================== // Accessors' definitions // ===================================================================== // ===================================================================== // Inline functions' definition // ===================================================================== } // namespace aevol #endif // AEVOL_CODON_H_ aevol-5.0/src/libaevol/Inversion.cpp0000644000175000017500000000701012724051151014445 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ============================================================================ // Includes // ============================================================================ #include "Inversion.h" namespace aevol { // ============================================================================ // Definition of static attributes // ============================================================================ // ============================================================================ // Constructors // ============================================================================ Inversion::Inversion(int32_t pos1, int32_t pos2, int32_t length, int16_t align_score) : pos1_(pos1), pos2_(pos2), length_(length), align_score_(align_score) { } // ============================================================================ // Destructor // ============================================================================ // ============================================================================ // Methods // ============================================================================ void Inversion::save(gzFile backup_file) const { int8_t tmp_mut_type = INV; gzwrite(backup_file, &tmp_mut_type, sizeof(tmp_mut_type)); gzwrite(backup_file, &pos1_, sizeof(pos1_)); gzwrite(backup_file, &pos2_, sizeof(pos2_)); gzwrite(backup_file, &length_, sizeof(length_)); gzwrite(backup_file, &align_score_, sizeof(align_score_)); } void Inversion::load(gzFile backup_file) { gzread(backup_file, &pos1_, sizeof(pos1_)); gzread(backup_file, &pos2_, sizeof(pos2_)); gzread(backup_file, &length_, sizeof(length_)); gzread(backup_file, &align_score_, sizeof(align_score_)); } void Inversion::generic_description_string(char* str) const { sprintf(str, "%" PRId8 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId8 " %" PRId16 " %" PRId16 " %" PRId32 " %" PRId32, mut_type(), pos1(), pos2(), -1, -1, -1, align_score_, -1, length_, -1); } // ============================================================================ // Non inline accessors // ============================================================================ } // namespace aevol aevol-5.0/src/libaevol/ExpManager.h0000644000175000017500000002433212724051151014173 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ================================================================= // Includes // ================================================================= #ifndef AEVOL_EXP_MANAGER_H_ #define AEVOL_EXP_MANAGER_H_ #include #include #include #include #include #include "AeTime.h" #include "JumpingMT.h" #include "ExpSetup.h" #include "OutputManager.h" #include "World.h" #include "Observer.h" #include "ObservableEvent.h" namespace aevol { // ================================================================= // Class declarations // ================================================================= /// Allows for high-level experiment management. (This is Aevol's top-level class.) /// /// An experiment manager allows one to... manage an experiment. /// It owns a population and an experimental_setup that can be loaded from a /// pair of aevol binary files (pop and exp_setup) class ExpManager : public Observer { public: // ======================================================================= // Constructors // ======================================================================= ExpManager(); // ======================================================================= // Destructors // ======================================================================= virtual ~ExpManager(); // ======================================================================= // Algorithms // ======================================================================= // ======================================================================= // Accessors: getters // ======================================================================= ExpSetup* exp_s() const { return exp_s_; } Selection* sel() const { return exp_s()->sel(); } OutputManager* output_m() const { return output_m_; } bool quit_signal_received() const { return quit_signal_received_; } double selection_pressure() const { return sel()->selection_pressure(); } // Spatial structure World* world() const { return world_; } int16_t grid_width() const { return world()->width(); } int16_t grid_height() const { return world()->height(); } GridCell*** grid() const { return world()->grid(); } // Global settings double repl_HT_detach_rate() const { return exp_s()->repl_HT_detach_rate(); } // The ability to own a plasmid is a property of the individuals (allow_plasmids_) because it is used during mutations. // However, the experimental setup's member variable with_plasmids_ indicates whether plasmids are used // because the replication and loading/writting processes need this information. // For now when plasmids are used each individual has one and only one plasmid (so these variables should always be // equal), this may change in the future, though. // Member variable with_plasmids_HT_ has been removed because the ability to transfer is evolvable and may thus depend // on the plasmid itself bool with_plasmids() const { return exp_s()->with_plasmids(); } double prob_plasmid_HT() const { return exp_s()->prob_plasmid_HT(); } double tune_donor_ability() const { return exp_s()->tune_donor_ability(); } double tune_recipient_ability() const { return exp_s()->tune_recipient_ability(); } bool swap_GUs() const { return exp_s()->swap_GUs(); } bool with_secretion() const { return exp_s()->with_secretion(); } double secretion_contrib_to_fitness() const { return exp_s()->secretion_contrib_to_fitness(); } double secretion_cost() const { return exp_s()->secretion_cost(); } // Accessors to population stuff std::list indivs() const { return world()->indivs(); } std::list> indivs_annotated() const; int32_t nb_indivs() const { return world()->nb_indivs(); } Individual* best_indiv() const { return world()->best_indiv(); } Individual* indiv_by_id(int32_t id) const; Individual* indiv_by_rank(int32_t rank) const; // Accessors to output manager stuff int64_t backup_step() const { return output_m()->backup_step(); } bool record_tree() const { return output_m()->record_tree(); } int32_t tree_step() const { return static_cast(output_m()->tree_step()); } Tree* tree() const { return output_m()->tree(); } bool regul_or_not() const { return regul_or_not_; } // ======================================================================= // Accessors: setters // ======================================================================= void set_t_end(int64_t t_end) { t_end_ = t_end; } void set_HT_ins_rate(double HT_ins_rate) { exp_s_->set_HT_ins_rate(HT_ins_rate); } void set_HT_repl_rate(double HT_repl_rate) { exp_s_->set_HT_repl_rate(HT_repl_rate); } // ======================================================================= // Operators // ======================================================================= // ======================================================================= // Public Methods // ======================================================================= void InitializeWorld(int16_t grid_width, int16_t grid_height, std::shared_ptr prng, std::shared_ptr mut_prng, std::shared_ptr stoch_prng, Habitat& habitat, bool share_phenotypic_target); void Save() const; void WriteSetupFiles() const; void WriteDynamicFiles() const; void Propagate(char* outdir) const; void load(int64_t first_gener, bool verbose = false, bool to_be_run = true) { load(".", first_gener, verbose, to_be_run); } void load(const char* dir, int64_t t0, bool verbose = false, bool to_be_run = true); /// Load an experiment with default files from the current directory void load(int64_t t0, char* exp_s_file, char* exp_backup_file, char* sp_struct_file, char* out_p_file, bool verbose = false, bool to_be_run = true); void run_evolution(); virtual void display() { } void update_best(); void FillGridWithClones(Individual& dolly) { world_->FillGridWithClones(dolly); } void update(Observable& o, ObservableEvent e, void* arg) override { } protected: // ======================================================================= // Protected Methods // ======================================================================= void step_to_next_generation(); void load(gzFile& exp_s_file, gzFile& exp_backup_file, gzFile& sp_struct_file, gzFile& out_p_file, bool verbose = false, bool to_be_run = true); void create_missing_directories(const char* dir = ".") const; void open_backup_files(gzFile& sel_file, gzFile& sp_struct_file, int64_t t, const char mode[3], const char* dir = ".") const; void close_backup_files(gzFile& sel_file, gzFile& sp_struct_file) const; void open_setup_files(gzFile& exp_s_gzfile, gzFile& out_p_gzfile, int64_t t, const char mode[3], const char* dir = ".") const; void close_setup_files(gzFile& exp_s_gzfile, gzFile& out_p_gzfile) const; // ======================================================================= // Protected Attributes // ======================================================================= /// Experimental setup ExpSetup* exp_s_; /// Spatial structure World* world_; /// Output manager OutputManager* output_m_; /// Time step up to which we want to simulate int64_t t_end_; /// Should the simulation be stopped? Set to true when ctrl-Q is received. /// Will cause the simulation to be ended after the current time step is completed. bool quit_signal_received_; bool regul_or_not_; }; // =========================================================================== // Getters' definitions // =========================================================================== // =========================================================================== // Setters' definitions // =========================================================================== // =========================================================================== // Operators' definitions // =========================================================================== // =========================================================================== // Inline methods' definition // =========================================================================== } // namespace aevol #endif // AEVOL_EXP_MANAGER_H_ aevol-5.0/src/libaevol/Observer.h0000644000175000017500000000717712724051151013743 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_OBSERVER_H_ #define AEVOL_OBSERVER_H_ // ============================================================================ // Includes // ============================================================================ #include "ObservableEvent.h" class Observable; /** * */ class Observer { public : // ========================================================================== // Constructors // ========================================================================== Observer() = default; //< Default ctor Observer(const Observer&) = delete; //< Copy ctor Observer(Observer&&) = delete; //< Move ctor // ========================================================================== // Destructor // ========================================================================== virtual ~Observer() = default; //< Destructor // ========================================================================== // Operators // ========================================================================== Observer& operator=(const Observer& other); //< Copy assignment Observer& operator=(const Observer&& other); //< Move assignment // ========================================================================== // Public Methods // ========================================================================== /// This method is called whenever the observed object is changed. virtual void update(Observable& o, ObservableEvent e, void* arg) = 0; // ========================================================================== // Getters // ========================================================================== // ========================================================================== // Setters // ========================================================================== protected : // ========================================================================== // Protected Methods // ========================================================================== // ========================================================================== // Attributes // ========================================================================== }; #endif // AEVOL_OBSERVER_H_ aevol-5.0/src/libaevol/OutputManager.cpp0000644000175000017500000001721112724051151015270 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ================================================================= // Includes // ================================================================= #include "OutputManager.h" #include #include #include #include #include #include "ExpManager.h" #include "AeTime.h" using std::string; using std::endl; namespace aevol { //############################################################################## // # // Class OutputManager # // # //############################################################################## // ================================================================= // Definition of static attributes // ================================================================= // ================================================================= // Constructors // ================================================================= OutputManager::OutputManager(ExpManager * exp_m) { exp_m_ = exp_m; stats_ = nullptr; tree_ = nullptr; dump_ = nullptr; compute_phen_contrib_by_GU_ = false; record_tree_ = false; make_dumps_ = false; dump_step_ = 0; logs_ = new Logging(); } // ================================================================= // Destructors // ================================================================= OutputManager::~OutputManager() { delete stats_; delete tree_; delete dump_; delete logs_; } // ================================================================= // Public Methods // ================================================================= void OutputManager::InitStats() { stats_ = new Stats(exp_m_); } void OutputManager::WriteSetupFile(gzFile setup_file) const { // Write the backup steps gzwrite(setup_file, &backup_step_, sizeof(backup_step_)); gzwrite(setup_file, &big_backup_step_, sizeof(big_backup_step_)); // Stats gzwrite(setup_file, &compute_phen_contrib_by_GU_, sizeof(compute_phen_contrib_by_GU_)); // Tree int8_t record_tree = record_tree_; gzwrite(setup_file, &record_tree, sizeof(record_tree)); if (record_tree_) { auto tmp_tree_step = tree_->tree_step(); gzwrite(setup_file, &tmp_tree_step, sizeof(tmp_tree_step)); } // Dumps int8_t make_dumps = make_dumps_; gzwrite(setup_file, &make_dumps, sizeof(make_dumps)); gzwrite(setup_file, &dump_step_, sizeof(dump_step_)); // Logs int8_t logs = logs_->logs(); gzwrite(setup_file, &logs, sizeof(logs)); } /** * This is a temporary patch for experiment propagation, it shall become * obsolete or need to be adapted when in/out dirs are managed properly */ void OutputManager::PropagateStats(const std::string& outdir, int64_t propagated_timestep) const { Stats stats("stat"); stats.Propagate(outdir, propagated_timestep); } void OutputManager::load(gzFile setup_file, bool verbose, bool to_be_run) { // Write the backup steps gzread(setup_file, &backup_step_, sizeof(backup_step_)); gzread(setup_file, &big_backup_step_, sizeof(big_backup_step_)); // Stats if (to_be_run) { delete stats_; stats_ = new Stats(exp_m_, AeTime::time()); } gzread(setup_file, &compute_phen_contrib_by_GU_, sizeof(compute_phen_contrib_by_GU_)); // Tree int8_t record_tree; gzread(setup_file, &record_tree, sizeof(record_tree)); record_tree_ = record_tree; if (record_tree_) { int32_t tmp_tree_step; gzread(setup_file, &tmp_tree_step, sizeof(tmp_tree_step)); tree_ = new Tree(exp_m_, tmp_tree_step); } // Dumps int8_t make_dumps; gzread(setup_file, &make_dumps, sizeof(make_dumps)); make_dumps_ = make_dumps; gzread(setup_file, &dump_step_, sizeof(dump_step_)); if(make_dumps_) { dump_ = new Dump(exp_m_); } // Logs int8_t logs; gzread(setup_file, &logs, sizeof(logs)); if (to_be_run) { logs_->load(logs, AeTime::time()); } } void OutputManager::write_current_generation_outputs() const { // Write stats stats_->write_current_generation_statistics(); // Manage tree if (record_tree_ && AeTime::time() > 0 && (AeTime::time() % tree_->tree_step() == 0)) { write_tree(); } // Write backup if (AeTime::time() % backup_step_ == 0) { stats_->flush(); exp_m_->WriteDynamicFiles(); WriteLastGenerFile(); } // Write dumps if (make_dumps_) { if(AeTime::time() % dump_step_ == 0) { dump_->write_current_generation_dump(); } } } // TODO we need an output_dir attribute in this class ! void OutputManager::WriteLastGenerFile(const string& output_dir) const { std::ofstream last_gener_file(output_dir + "/" + LAST_GENER_FNAME, std::ofstream::out); if (last_gener_file.fail()) { Utils::ExitWithUsrMsg(string("could not open file ") + LAST_GENER_FNAME); } else { last_gener_file << AeTime::time() << endl; last_gener_file.close(); } } // TODO we need an input_dir attribute in this class ! int64_t OutputManager::last_gener() { int64_t time; FILE* lg_file = fopen(LAST_GENER_FNAME, "r"); if (lg_file != NULL) { if (fscanf(lg_file, "%" PRId64 "\n", &time) == EOF) { Utils::ExitWithDevMsg("failed to read last generation", __FILE__, __LINE__); } fclose(lg_file); } return time; } // ================================================================= // Protected Methods // ================================================================= void OutputManager::write_tree() const { // Create the tree directory if it doesn't exist int status; status = mkdir(TREE_DIR, 0755); if ((status == -1) && (errno != EEXIST)) { err(EXIT_FAILURE, "Impossible to create the directory %s", TREE_DIR); } char tree_file_name[50]; sprintf(tree_file_name, "tree/tree_" TIMESTEP_FORMAT ".ae", AeTime::time()); gzFile tree_file = gzopen( tree_file_name, "w" ); // Write phylogenetic data (tree) tree_->write_to_tree_file(tree_file); gzclose(tree_file); } // ================================================================= // Non inline accessors // ================================================================= } // namespace aevol aevol-5.0/src/libaevol/ParameterLine.h0000644000175000017500000000766612724051151014707 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_PARAMETER_LINE_H_ #define AEVOL_PARAMETER_LINE_H_ // ================================================================= // Libraries // ================================================================= #include #include namespace aevol { // ================================================================= // Project Files // ================================================================= // ================================================================= // Class declarations // ================================================================= class ParameterLine { public : // ================================================================= // Constructors // ================================================================= ParameterLine(); // ================================================================= // Destructors // ================================================================= // ================================================================= // Accessors // ================================================================= // ================================================================= // Public Methods // ================================================================= // ================================================================= // Public Attributes // ================================================================= int16_t nb_words; char words[50][255]; protected : // ================================================================= // Forbidden Constructors // ================================================================= // ================================================================= // Protected Methods // ================================================================= // ================================================================= // Protected Attributes // ================================================================= }; // ===================================================================== // Accessors definitions // ===================================================================== // ===================================================================== // Inline functions' definition // ===================================================================== } // namespace aevol #endif // AEVOL_PARAMETER_LINE_H_ aevol-5.0/src/libaevol/World.h0000644000175000017500000002242712724051151013236 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_WORLD_H_ #define AEVOL_WORLD_H_ // ============================================================================ // Includes // ============================================================================ #include #include #include #include #include #include #include "GridCell.h" namespace aevol { // ================================================================= // Class declarations // ================================================================= class ExpManager; class World { public : // ================================================================= // Constructors // ================================================================= World() = default; World(const World &) = delete; // ================================================================= // Destructors // ================================================================= virtual ~World(); // ================================================================= // Accessors: getters // ================================================================= // PRNGs std::shared_ptr prng() const; std::shared_ptr mut_prng() const; std::shared_ptr stoch_prng() const; std::list indivs() const; inline int32_t nb_indivs() const; inline Individual* best_indiv() const; int16_t width() const {return width_;}; int16_t height() const {return height_;}; inline int32_t partial_mix_nb_permutations() const; GridCell *** grid() const {return grid_;}; inline GridCell* grid(int16_t x, int16_t y) const; inline Individual* indiv_at(int16_t x, int16_t y) const; Individual* indiv_by_id(int32_t id) const; Individual* indiv_by_rank(int32_t rank) const; inline double** secretion_present_grid() const; inline double** secreted_amount_grid() const; inline double** metabolic_fitness_grid() const; inline double** total_fitness_grid() const; bool phenotypic_target_shared() const { return phenotypic_target_shared_; } PhenotypicTargetHandler* phenotypic_target_handler() const { return phenotypic_target_handler_; } // ================================================================= // Accessors: setters // ================================================================= // PRNGs inline void set_prng(std::shared_ptr prng); void set_mut_prng(std::shared_ptr prng); void set_stoch_prng(std::shared_ptr prng); inline void set_is_well_mixed(bool is_well_mixed); inline void set_partial_mix_nb_permutations(int32_t nb_permutations); inline void set_secretion_degradation_prop(double degradation_prop); inline void set_secretion_diffusion_prop(double diffusion_prop); inline void set_best(int16_t x, int16_t y); // ================================================================= // Operators // ================================================================= // ================================================================= // Public Methods // ================================================================= void InitGrid(int16_t width, int16_t height, Habitat& habitat, bool share_phenotypic_target); void PlaceIndiv(Individual * indiv, int16_t x, int16_t y); void FillGridWithClones(Individual & dolly); void evaluate_individuals(); void update_secretion_grid(); void MixIndivs(); void update_best(); void ApplyHabitatVariation(); void save(gzFile backup_file) const; void load(gzFile backup_file, ExpManager * exp_man); void set_phen_target_prngs(std::shared_ptr var_prng, std::shared_ptr noise_prng); protected : // ================================================================= // Protected Methods // ================================================================= void MallocGrid(); void WellMixIndivs(); void PartiallyMixIndivs(); void backup_stoch_prng(); // ================================================================= // Protected Attributes // ================================================================= std::shared_ptr prng_ = nullptr; std::shared_ptr mut_prng_ = nullptr; std::shared_ptr stoch_prng_ = nullptr; std::unique_ptr stoch_prng_bak_ = nullptr; int16_t width_ = -1; int16_t height_ = -1; int16_t x_best = -1; int16_t y_best = -1; GridCell*** grid_ = nullptr; GridCell** grid_1d_ = nullptr; bool is_well_mixed_ = false; int32_t partial_mix_nb_permutations_ = 0; bool phenotypic_target_shared_ = true; PhenotypicTargetHandler* phenotypic_target_handler_ = NULL; double secretion_diffusion_prop_ = -1; double secretion_degradation_prop_ = -1; }; // ===================================================================== // Getters' definitions // ===================================================================== inline int32_t World::nb_indivs() const { return width_ * height_; } inline Individual *World::best_indiv() const { return grid_[x_best][y_best]->individual(); } inline int32_t World::partial_mix_nb_permutations() const { return partial_mix_nb_permutations_; } inline GridCell *World::grid(int16_t x, int16_t y) const { return grid_[x][y]; } inline Individual *World::indiv_at(int16_t x, int16_t y) const { return grid_[x][y]->individual(); } inline double**World::secretion_present_grid() const { double** ret = new double*[width_]; for (int16_t x = 0; x < width_ ; x++) { ret[x] = new double[height_]; for (int16_t y = 0; y < height_ ; y++) { ret[x][y] = grid_[x][y]->compound_amount(); } } return ret; } inline double**World::secreted_amount_grid() const { double** ret = new double*[width_]; for (int16_t x = 0 ; x < width_ ; x++) { ret[x] = new double[height_]; for (int16_t y = 0; y < height_ ; y++) { ret[x][y] = grid_[x][y]->secreted_amount(); } } return ret; } inline double**World::metabolic_fitness_grid() const { double** ret = new double*[width_]; for (int16_t x = 0 ; x < width_ ; x++) { ret[x] = new double[height_]; for (int16_t y = 0; y < height_ ; y++) { ret[x][y] = grid_[x][y]->metabolic_fitness(); } } return ret; } inline double**World::total_fitness_grid() const { double** ret = new double*[width_]; for (int16_t x = 0 ; x < width_ ; x++) { ret[x] = new double[height_]; for (int16_t y = 0; y < height_ ; y++) { ret[x][y] = grid_[x][y]->total_fitness(); } } return ret; } // ===================================================================== // Setters' definitions // ===================================================================== inline void World::set_prng(std::shared_ptr prng) { prng_ = prng; } inline void World::set_is_well_mixed(bool is_well_mixed) { is_well_mixed_ = is_well_mixed; } inline void World::set_partial_mix_nb_permutations(int32_t nb_permutations) { partial_mix_nb_permutations_ = nb_permutations; } inline void World::set_secretion_degradation_prop(double degradation_prop) { secretion_degradation_prop_=degradation_prop; } inline void World::set_secretion_diffusion_prop(double diffusion_prop) { secretion_diffusion_prop_=diffusion_prop; } inline void World::set_best(int16_t x, int16_t y) { x_best = x; y_best = y; } // ===================================================================== // Operators' definitions // ===================================================================== // ===================================================================== // Inline functions' definition // ===================================================================== } // namespace aevol #endif // AEVOL_WORLD_H_ aevol-5.0/src/libaevol/ReplicationReport.h0000644000175000017500000002022012724051151015601 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_REPLICATION_REPORT_H_ #define AEVOL_REPLICATION_REPORT_H_ // ================================================================= // Includes // ================================================================= #include #include #include #include #include #include "DnaReplicationReport.h" #include "ae_enums.h" #include "Observer.h" #include "ObservableEvent.h" #include "Individual.h" namespace aevol { // ================================================================= // Class declarations // ================================================================= class Individual; class ReplicationReport : public Observer { public : // ================================================================= // Constructors // ================================================================= ReplicationReport() = default; ReplicationReport(Individual* indiv, const Individual* parent, Individual* donor = NULL); // Creates a completely independent copy of the original report ReplicationReport(const ReplicationReport& other); ReplicationReport(gzFile tree_file, Individual * indiv); // ================================================================= // Destructors // ================================================================= virtual ~ReplicationReport() = default; // ================================================================= // Accessors // ================================================================= inline Individual * indiv() const; int32_t id() { return id_; }; int32_t rank() { return rank_; }; inline int32_t genome_size() const; inline int32_t parent_id() const; inline double parent_metabolic_error() const; inline double parent_secretion_error() const; inline int32_t parent_genome_size() const; inline double mean_align_score() const; inline int32_t donor_id() const; inline double donor_metabolic_error() const; inline int32_t donor_genome_size() const; int32_t nb(MutationType t) const { return dna_replic_report_.nb(t); } // TODO re-constify // => const DnaReplicationReport& dna_replic_report() const DnaReplicationReport& dna_replic_report() { return dna_replic_report_; } void set_indiv(Individual * indiv); inline void set_parent_id(int32_t parent_id); inline void set_parent_metabolic_error(double parent_metabolic_error); inline void set_parent_secretion_error(double parent_secretion_error); inline void set_parent_genome_size(int32_t parent_genome_size); inline void set_donor_id(int32_t donor_id); inline void set_donor_metabolic_error(double donor_metabolic_error); inline void set_donor_secretion_error(double donor_secretion_error); inline void set_donor_genome_size(int32_t donor_genome_size); // ================================================================= // Public Methods // ================================================================= void init(Individual* offspring, Individual* parent); void signal_end_of_replication(Individual* indiv); void signal_end_of_generation(); void write_to_tree_file(gzFile tree_file) const; void update(Observable& o, ObservableEvent e, void* arg) override; protected : // ================================================================= // Protected Methods // ================================================================= // ================================================================= // Protected Attributes // ================================================================= Individual* indiv_ = nullptr; int32_t id_ = -1; int32_t parent_id_ = -1; int32_t rank_ = -1; int32_t genome_size_ = -1; double metabolic_error_ = -1; int16_t nb_genes_activ_ = -1; int16_t nb_genes_inhib_ = -1; int16_t nb_non_fun_genes_ = -1; int16_t nb_coding_RNAs_ = -1; int16_t nb_non_coding_RNAs_ = -1; // List of each genetic unit's replication report DnaReplicationReport dna_replic_report_; double parent_metabolic_error_ = -1; double parent_secretion_error_ = -1; int32_t parent_genome_size_ = -1; int32_t donor_id_ = -1; double donor_metabolic_error_ = -1; double donor_secretion_error_ = -1; int32_t donor_genome_size_ = -1; // CK: I think that the attributes below are obsolete // (HT events are now stored in the ae_dna_replic_reports) double mean_align_score_; }; // ===================================================================== // Accessors' definitions // ===================================================================== inline Individual *ReplicationReport::indiv() const { return indiv_; } inline int32_t ReplicationReport::genome_size() const { return genome_size_; } int32_t ReplicationReport::parent_id() const { return parent_id_; } double ReplicationReport::parent_metabolic_error() const { return parent_metabolic_error_; } double ReplicationReport::parent_secretion_error() const { return parent_secretion_error_; } int32_t ReplicationReport::parent_genome_size() const { return parent_genome_size_; } inline int32_t ReplicationReport::donor_id() const { return donor_id_; } inline double ReplicationReport::donor_metabolic_error() const { return donor_metabolic_error_; } inline int32_t ReplicationReport::donor_genome_size() const { return donor_genome_size_; } inline double ReplicationReport::mean_align_score() const { return mean_align_score_; } inline void ReplicationReport::set_indiv(Individual * indiv) { indiv_ = indiv; } void ReplicationReport::set_parent_id(int32_t parent_id) { parent_id_ = parent_id; } void ReplicationReport::set_parent_metabolic_error(double parent_metabolic_error) { parent_metabolic_error_ = parent_metabolic_error; } void ReplicationReport::set_parent_secretion_error(double parent_secretion_error) { parent_secretion_error_ = parent_secretion_error; } void ReplicationReport::set_parent_genome_size(int32_t parent_genome_size) { parent_genome_size_ = parent_genome_size; } inline void ReplicationReport::set_donor_id(int32_t donor_id) { donor_id_ = donor_id; } inline void ReplicationReport::set_donor_metabolic_error(double donor_metabolic_error) { donor_metabolic_error_ = donor_metabolic_error; } inline void ReplicationReport::set_donor_secretion_error(double donor_secretion_error) { donor_secretion_error_ = donor_secretion_error; } inline void ReplicationReport::set_donor_genome_size(int32_t donor_genome_size) { donor_genome_size_ = donor_genome_size; } } // namespace aevol #endif // AEVOL_REPLICATION_REPORT_H_ aevol-5.0/src/libaevol/Observable.h0000644000175000017500000000760412724051151014233 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_OBSERVABLE_H_ #define AEVOL_OBSERVABLE_H_ // ============================================================================ // Includes // ============================================================================ #include "ObservableEvent.h" #include "Observer.h" #include #include using std::list; using std::map; /** * */ class Observable { public : // ========================================================================== // Constructors // ========================================================================== Observable() = default; //< Default ctor Observable(const Observable&) = delete; //< Copy ctor Observable(Observable&&) = delete; //< Move ctor // ========================================================================== // Destructor // ========================================================================== virtual ~Observable() = default; //< Destructor // ========================================================================== // Operators // ========================================================================== Observable& operator=(const Observable& other); //< Copy assignment Observable& operator=(const Observable&& other); //< Move assignment // ========================================================================== // Public Methods // ========================================================================== void addObserver(Observer* o, ObservableEvent e) { observers_[e].emplace_back(o); }; void deleteObserver(Observer* o, ObservableEvent e) { observers_[e].remove(o); }; void notifyObservers(ObservableEvent e, void* arg = nullptr); // ========================================================================== // Getters // ========================================================================== // ========================================================================== // Setters // ========================================================================== protected : // ========================================================================== // Protected Methods // ========================================================================== // ========================================================================== // Attributes // ========================================================================== map > observers_; }; #endif // AEVOL_OBSERVABLE_H_ aevol-5.0/src/libaevol/make_unique.h0000644000175000017500000000301212724051151014437 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_MAKE_UNIQUE_H #define AEVOL_MAKE_UNIQUE_H #if __cplusplus == 201103L #include #include #include #include template std::unique_ptr make_unique(Args&& ...args) { return std::unique_ptr(new T(std::forward(args)...)); } #endif #endif //AEVOL_MAKE_UNIQUE_H aevol-5.0/src/libaevol/ReplacementHT.h0000644000175000017500000001171712724051151014642 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_REPLACEMENT_HT_H_ #define AEVOL_REPLACEMENT_HT_H_ // ============================================================================ // Includes // ============================================================================ #include "HorizontalTransfer.h" #include "VisAVis.h" namespace aevol { /** * */ class ReplacementHT : public HorizontalTransfer { public : // ========================================================================== // Constructors // ========================================================================== ReplacementHT() = default; //< Default ctor ReplacementHT(const ReplacementHT&) = default; //< Copy ctor ReplacementHT(ReplacementHT&&) = delete; //< Move ctor ReplacementHT(const VisAVis& align1, const VisAVis& align2, int32_t length, int32_t replaced_seq_length, char* seq, int32_t donor_id); virtual Mutation* Clone() const override { return new ReplacementHT(*this); }; // ========================================================================== // Destructor // ========================================================================== virtual ~ReplacementHT() noexcept; //< Destructor // ========================================================================== // Operators // ========================================================================== /// Copy assignment ReplacementHT& operator=(const ReplacementHT& other) = default; /// Move assignment ReplacementHT& operator=(ReplacementHT&& other) = delete; // ========================================================================== // Public Methods // ========================================================================== virtual void save(gzFile backup_file) const override; virtual void load(gzFile backup_file) override; void generic_description_string(char* str) const override; // ========================================================================== // Getters // ========================================================================== virtual MutationType mut_type() const override { return REPL_HT; }; int32_t donor_pos1() const { return align1_.i_2(); } int32_t donor_pos2() const { return align2_.i_2(); } int32_t receiver_pos1() const { return align1_.i_1(); } int32_t receiver_pos2() const { return align2_.i_1(); } AlignmentSense sense() const { return align2_.sense(); } char* seq() const { return seq_; } int32_t length() const { return length_; } // ========================================================================== // Setters // ========================================================================== protected : // ========================================================================== // Protected Methods // ========================================================================== // ========================================================================== // Attributes // ========================================================================== /** * Alignments between the receiver and the donor * * The first point of each alignment corresponds to the receiver, the sequence * that will be replaced lies between align1_->i1 and align2_->i1. It will be * replaced by the seq. btw align1_->i2 and align2_->i2 on the donor. */ VisAVis align1_, align2_; int32_t length_; int32_t replaced_seq_length_; char* seq_ = nullptr; int32_t donor_id_ = -1; }; } // namespace aevol #endif //AEVOL_REPLACEMENT_HT_H_ aevol-5.0/src/libaevol/Phenotype.h0000644000175000017500000000342512724051151014117 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_PHENOTYPE_H_ #define AEVOL_PHENOTYPE_H_ // ================================================================= // Libraries // ================================================================= #include // ================================================================= // Project Files // ================================================================= #include "AbstractFuzzy.h" namespace aevol { // A phenotype is nothing more than a fuzzy set using Phenotype = AbstractFuzzy; } // namespace aevol #endif // AEVOL_PHENOTYPE_H_ aevol-5.0/src/libaevol/ae_enums.h0000644000175000017500000000476112724051151013744 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_ENUMS_H_ #define AEVOL_ENUMS_H_ namespace aevol { enum AlignmentFunctionShape { LINEAR = 0, SIGMOID = 1 }; enum PhenotypicFeature { NEUTRAL = 0, METABOLISM = 1, SECRETION = 2, DONOR = 3, RECIPIENT = 4 }; // This is used to know how many possible features exist to make them easy to // parse // TODO This is bad !!! #define NB_FEATURES 5 enum PhenotypicTargetVariationMethod { NO_VAR = 0, AUTOREGRESSIVE_MEAN_VAR = 1, AUTOREGRESSIVE_HEIGHT_VAR = 2, LOCAL_GAUSSIANS_VAR = 3, SWITCH_IN_A_LIST = 4 }; enum PhenotypicTargetNoiseMethod { NO_NOISE = 0, FRACTAL = 1 }; enum GenomeInitializationMethod { ONE_GOOD_GENE = 0x01, CLONE = 0x02, WITH_INS_SEQ = 0x04 }; enum AlignmentSense { DIRECT = 0, INDIRECT = 1, BOTH_SENSES = 2 }; enum SelectionScheme { RANK_LINEAR = 0, RANK_EXPONENTIAL = 1, FITNESS_PROPORTIONATE = 2, FITTEST = 3 }; enum LogType { LOG_TRANSFER = 0x01, LOG_REAR = 0x02, LOG_BARRIER = 0x04, LOG_LOADS = 0x08 }; enum Strand { LEADING = 0, LAGGING = 1 }; constexpr const char* StrandName[] = { "LEADING", "LAGGING" }; enum Position { BEFORE, BETWEEN, AFTER }; } // namespace aevol #endif // AEVOL_ENUMS_H_ aevol-5.0/src/libaevol/macros.h0000644000175000017500000001004612724051151013425 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #include #ifndef AEVOL_MACROS_H_ #define AEVOL_MACROS_H_ constexpr int8_t NB_BASE = 2; // WARNING: // A lot of stuff has been optimized for binary genomes // Changing the value of NB_BASE implies verifying the existing code // and make changes where necessary // NB The following strings are not easily replaced with `constexpr // const char*` because they are meant to be concatenated by the // preprocessor. // Backup directories and file name formats #define TIMESTEP_FORMAT "%09" PRId64 // Experimental Setup #define EXP_S_DIR "exp_setup" #define EXP_S_FNAME_BASE "exp_setup_" TIMESTEP_FORMAT #define EXP_S_FNAME_FORMAT EXP_S_DIR "/" EXP_S_FNAME_BASE ".ae" #define EXP_S_CONST_FNAME_BASE "exp_setup_const" #define EXP_S_CONST_FNAME_FORMAT EXP_S_DIR "/" EXP_S_CONST_FNAME_BASE ".ae" // Output Profile #define OUT_P_DIR "output_profile" #define OUT_P_FNAME_BASE "output_profile" #define OUT_P_FNAME_FORMAT OUT_P_DIR "/" OUT_P_FNAME_BASE ".ae" #define OUT_P_CUR_FNAME "output_profile.ae" // Spatial Structure #define WORLD_DIR "world" #define WORLD_FNAME_BASE "world_" TIMESTEP_FORMAT #define WORLD_FNAME_FORMAT WORLD_DIR "/" WORLD_FNAME_BASE".ae" // Stats #define STATS_DIR "stats" // Tree #define TREE_DIR "tree" // Last gener file constexpr auto LAST_GENER_FNAME = "last_gener.txt"; // Best last organism file #define BEST_LAST_ORG_FNAME "best_last_org.txt" #define FIXED_POPULATION_SIZE // Some calculation can be spared if we know that the size of the population is fixed constexpr int8_t PROM_SIZE = 22; constexpr auto PROM_SEQ = "0101011001110010010110"; constexpr int8_t PROM_MAX_DIFF = 4; constexpr int8_t TERM_STEM_SIZE = 4; constexpr int8_t TERM_LOOP_SIZE = 3; constexpr int8_t TERM_SIZE = 2 * TERM_STEM_SIZE + TERM_LOOP_SIZE; constexpr int8_t SHINE_DAL_SIZE = 6; constexpr const char* SHINE_DAL_SEQ = "011011"; constexpr int8_t SHINE_START_SPACER = 4; constexpr int8_t CODON_SIZE = 3; constexpr int8_t CODON_START = 0b000; constexpr int8_t CODON_STOP = 0b001; constexpr int8_t CODON_M0 = 0b100; constexpr int8_t CODON_M1 = 0b101; constexpr int8_t CODON_W0 = 0b010; constexpr int8_t CODON_W1 = 0b011; constexpr int8_t CODON_H0 = 0b110; constexpr int8_t CODON_H1 = 0b111; constexpr int32_t DO_TRANSLATION_LOOP = SHINE_DAL_SIZE + SHINE_START_SPACER + 3 * CODON_SIZE; #ifdef __REGUL constexpr int8_t MAX_CODON = 1 << CODON_SIZE; constexpr int8_t QUADON_SIZE = 4; constexpr int8_t MAX_QUADON = 1 << QUADON_SIZE; #endif constexpr double X_MIN = 0.0; constexpr double X_MAX = 1.0; constexpr double Y_MIN = 0.0; constexpr double Y_MAX = 1.0; constexpr double H_MIN = -1.0; constexpr double H_MAX = 1.0; constexpr double W_MIN = 0.0; // W_MAX is defined through a parameter constexpr int8_t SC_MATCH_BONUS = 1; constexpr int8_t SC_MISMATCH_COST = 2; #endif // AEVOL_MACROS_H_ aevol-5.0/src/libaevol/Inversion.h0000644000175000017500000001037012724051151014115 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_INVERSION_H_ #define AEVOL_INVERSION_H_ // ============================================================================ // Includes // ============================================================================ #include "Rearrangement.h" namespace aevol { /** * */ class Inversion : public Rearrangement{ public : // ========================================================================== // Constructors // ========================================================================== Inversion() = default; //< Default ctor Inversion(const Inversion&) = default; //< Copy ctor Inversion(Inversion&&) = delete; //< Move ctor Inversion(int32_t pos1, int32_t pos2, int32_t length, int16_t align_score = -1); virtual Mutation* Clone() const override { return new Inversion(*this); }; // ========================================================================== // Destructor // ========================================================================== virtual ~Inversion() noexcept = default; //< Destructor // ========================================================================== // Operators // ========================================================================== /// Copy assignment Inversion& operator=(const Inversion& other) = default; /// Move assignment Inversion& operator=(Inversion&& other) = delete; // ========================================================================== // Public Methods // ========================================================================== virtual void save(gzFile backup_file) const override; virtual void load(gzFile backup_file) override; void generic_description_string(char* str) const override; // ========================================================================== // Getters // ========================================================================== virtual MutationType mut_type() const override { return INV; }; int32_t pos1() const { return pos1_; } int32_t pos2() const { return pos2_; } int32_t length() const { return length_; } int16_t align_score() const { return align_score_; } // ========================================================================== // Setters // ========================================================================== protected : // ========================================================================== // Protected Methods // ========================================================================== // ========================================================================== // Attributes // ========================================================================== int32_t pos1_, pos2_; int32_t length_; int16_t align_score_ = -1; }; } // namespace aevol #endif //AEVOL_INVERSION_H_ aevol-5.0/src/libaevol/aevol.h0000644000175000017500000000502212724051151013245 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_AEVOL_H_ #define AEVOL_AEVOL_H_ #include "ae_enums.h" #include "ae_string.h" #include "Utils.h" #include "Alignment.h" #include "Codon.h" #include "Dna.h" #include "DnaReplicationReport.h" #include "Dump.h" #include "ExpManager.h" #include "ExpSetup.h" #include "ParameterLine.h" #include "Fuzzy.h" #include "HybridFuzzy.h" #include "Gaussian.h" #include "GeneticUnit.h" #include "GridCell.h" #include "Habitat.h" #include "IndividualFactory.h" #include "Individual.h" #include "Metrics.h" #include "JumpingMT.h" #include "JumpPoly.h" #include "Logging.h" #include "macros.h" #include "Mutation.h" #include "PointMutation.h" #include "SmallInsertion.h" #include "SmallDeletion.h" #include "Duplication.h" #include "Deletion.h" #include "Translocation.h" #include "Inversion.h" #include "MutationParams.h" #include "NonCodingMetrics.h" #include "OutputManager.h" #include "ParamLoader.h" #include "Phenotype.h" #include "PhenotypicSegment.h" #include "PhenotypicTarget.h" #include "PhenotypicTargetHandler.h" #include "Point.h" #include "Protein.h" #include "ReplicationReport.h" #include "Rna.h" #include "Selection.h" #include "StatRecord.h" #include "Stats.h" #include "AeTime.h" #include "Tree.h" #include "VisAVis.h" #include "World.h" #ifdef __X11 #include "ExpManager_X11.h" #include "Individual_X11.h" #include "X11Window.h" #endif #endif // AEVOL_AEVOL_H_ aevol-5.0/src/libaevol/VisAVis.cpp0000644000175000017500000000661412724051151014026 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ================================================================= // Libraries // ================================================================= // ================================================================= // Project Files // ================================================================= #include "VisAVis.h" namespace aevol { // ############################################################################ // // Class VisAVis // // ############################################################################ // ================================================================= // Definition of static attributes // ================================================================= // ================================================================= // Constructors // ================================================================= VisAVis::VisAVis(const Dna* chrom_1, const Dna* chrom_2, int32_t i_1, int32_t i_2, AlignmentSense sense /*= DIRECT*/) { chrom_1_ = chrom_1; chrom_2_ = chrom_2; i_1_ = i_1; i_2_ = i_2; sense_ = sense; score_ = 0; } VisAVis::VisAVis(const VisAVis & orig) { chrom_1_ = orig.chrom_1_; chrom_2_ = orig.chrom_2_; i_1_ = orig.i_1_; i_2_ = orig.i_2_; sense_ = orig.sense_; score_ = orig.score_; } //~ VisAVis::VisAVis(const VisAVis* orig) //~ { //~ chrom_1_ = orig->chrom_1_; //~ chrom_2_ = orig->chrom_2_; //~ i_1_ = orig->i_1_; //~ i_2_ = orig->i_2_; //~ sense_ = orig->sense_; //~ } // ================================================================= // Destructors // ================================================================= VisAVis::~VisAVis() { } // ================================================================= // Public Methods // ================================================================= // ================================================================= // Protected Methods // ================================================================= } // namespace aevol aevol-5.0/src/libaevol/PointMutation.cpp0000644000175000017500000000607112724051151015311 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ============================================================================ // Includes // ============================================================================ #include "PointMutation.h" namespace aevol { // ============================================================================ // Definition of static attributes // ============================================================================ // ============================================================================ // Constructors // ============================================================================ PointMutation::PointMutation(int32_t pos) : pos_(pos) {} // ============================================================================ // Destructor // ============================================================================ // ============================================================================ // Methods // ============================================================================ void PointMutation::save(gzFile backup_file) const { int8_t tmp_mut_type = SWITCH; gzwrite(backup_file, &tmp_mut_type, sizeof(tmp_mut_type)); gzwrite(backup_file, &pos_, sizeof(pos_)); } void PointMutation::load(gzFile backup_file) { gzread(backup_file, &pos_, sizeof(pos_)); } void PointMutation::generic_description_string(char* str) const { sprintf(str, "%" PRId8 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId8 " %" PRId16 " %" PRId16 " %" PRId32 " %" PRId32, mut_type(), pos_, -1, -1, -1, -1, -1, -1, -1, -1); } // ============================================================================ // Non inline accessors // ============================================================================ } // namespace aevol aevol-5.0/src/libaevol/Habitat.h0000644000175000017500000001345412724051151013523 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_HABITAT_H_ #define AEVOL_HABITAT_H_ // ============================================================================ // Includes // ============================================================================ #include #include #include #include #include #include #include "PhenotypicTargetHandler.h" namespace aevol { // ============================================================================ // Class declarations // ============================================================================ class Habitat { public : // ========================================================================== // Constructors // ========================================================================== Habitat(); //< Default ctor Habitat(const Habitat&) = delete; //< Copy ctor Habitat(Habitat&&) = delete; //< Move ctor Habitat(const Habitat&, bool share_phenotypic_target); Habitat(gzFile backup_file, PhenotypicTargetHandler* phenotypic_target_handler); // ========================================================================== // Destructor // ========================================================================== virtual ~Habitat() = default; //< Destructor // ========================================================================== // Operators // ========================================================================== Habitat& operator=(const Habitat&) = default; Habitat& operator=(Habitat&&) = default; // ========================================================================== // Public Methods // ========================================================================== virtual void ApplyVariation(); void save(gzFile backup_file, bool skip_phenotypic_target = false) const; void load(gzFile backup_file, PhenotypicTargetHandler* phenotypic_target_handler); // ========================================================================== // Getters // ========================================================================== double compound_amount() const {return compound_amount_;}; const PhenotypicTarget& phenotypic_target() const { return phenotypic_target_handler_->phenotypic_target(); } virtual const PhenotypicTargetHandler& phenotypic_target_handler() const { return *phenotypic_target_handler_; } virtual PhenotypicTargetHandler& phenotypic_target_handler_nonconst() const { return *phenotypic_target_handler_; } double mean_environmental_area() const { return phenotypic_target_handler_->mean_environmental_area(); } // ========================================================================== // Setters // ========================================================================== void set_compound_amount(double compound_amount) { compound_amount_ = compound_amount; }; protected : // ========================================================================== // Protected Methods // ========================================================================== // ========================================================================== // Attributes // ========================================================================== // Amount of secreted compound currently present in the grid cell double compound_amount_; /** Handler for the phenotypic target and its "evolution" over time */ PhenotypicTargetHandler* phenotypic_target_handler_; }; // ============================================================================ // Getters' definitions // ============================================================================ // ============================================================================ // Setters' definitions // ============================================================================ // ============================================================================ // Operators' definitions // ============================================================================ // ============================================================================ // Inline functions' definition // ============================================================================ } // namespace aevol #endif // AEVOL_HABITAT_H_ aevol-5.0/src/libaevol/DnaReplicationReport.cpp0000644000175000017500000002224612724051151016571 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #include #include #include #include #if __cplusplus == 201103L #include "make_unique.h" #endif #include "DnaReplicationReport.h" #include "InsertionHT.h" #include "ReplacementHT.h" #include "Mutation.h" #include "Duplication.h" #include "Translocation.h" #include "Inversion.h" #include "Deletion.h" #include "SmallDeletion.h" #include "PointMutation.h" #include "SmallInsertion.h" namespace aevol { DnaReplicationReport::DnaReplicationReport(const DnaReplicationReport& other) { for (auto& ht : other.ht_) add_HT(ht->Clone()); for (auto& rear : other.rearrangements_) add_rear(rear->Clone()); for (auto& mut : other.mutations_) add_local_mut(mut->Clone()); } int32_t DnaReplicationReport::nb(MutationType t) const { switch (t) { case S_MUT: assert(mutations_.size() == static_cast(nb_mut_[SWITCH] + nb_mut_[S_INS] + nb_mut_[S_DEL])); return mutations_.size(); case REARR: assert(rearrangements_.size() == static_cast(nb_mut_[DUPL] + nb_mut_[DEL] + nb_mut_[TRANS] + nb_mut_[INV])); return rearrangements_.size(); case H_T: assert(ht_.size() == static_cast(nb_mut_[INS_HT] + nb_mut_[REPL_HT])); return ht_.size(); case INDEL: return nb_mut_[S_INS] + nb_mut_[S_DEL]; default: // Simple mutation type. return nb_mut_[t]; }; } void DnaReplicationReport::add_mut(Mutation* mut) { if (mut->is_local_mut()) { add_local_mut(mut); } else if (mut->is_rear()) { add_rear(mut); } else if (mut->is_ht()) { add_HT(mut); } } void DnaReplicationReport::add_local_mut(Mutation* mut) { assert(mut->is_local_mut()); std::unique_ptr cmut = nullptr; switch(mut->mut_type()) { case SWITCH: #if __cplusplus == 201103L cmut = make_unique(static_cast(*mut)); #else cmut = std::make_unique(static_cast(*mut)); #endif break; case S_DEL: #if __cplusplus == 201103L cmut = make_unique(static_cast(*mut)); #else cmut = std::make_unique(static_cast(*mut)); #endif break; case S_INS: #if __cplusplus == 201103L cmut = make_unique(static_cast(*mut)); #else cmut = std::make_unique(static_cast(*mut)); #endif break; default: #if __cplusplus == 201103L cmut = make_unique(static_cast(*mut)); #else cmut = std::make_unique(static_cast(*mut)); #endif break; } mutations_.push_back(std::move(cmut)); nb_mut_[mut->mut_type()]++; } void DnaReplicationReport::add_rear(Mutation* mut) { assert(mut->is_rear()); std::unique_ptr cmut = nullptr; switch(mut->mut_type()) { case DUPL: #if __cplusplus == 201103L cmut = make_unique(static_cast(*mut)); #else cmut = std::make_unique(static_cast(*mut)); #endif break; case DEL: #if __cplusplus == 201103L cmut = make_unique(static_cast(*mut)); #else cmut = std::make_unique(static_cast(*mut)); #endif break; case TRANS: #if __cplusplus == 201103L cmut = make_unique(static_cast(*mut)); #else cmut = std::make_unique(static_cast(*mut)); #endif break; case INV: #if __cplusplus == 201103L cmut = make_unique(static_cast(*mut)); #else cmut = std::make_unique(static_cast(*mut)); #endif break; default: #if __cplusplus == 201103L cmut = make_unique(static_cast(*mut)); #else cmut = std::make_unique(static_cast(*mut)); #endif break; } rearrangements_.push_back(std::move(cmut)); nb_mut_[mut->mut_type()]++; } void DnaReplicationReport::add_HT(Mutation* mut) { assert(mut->is_ht()); std::unique_ptr cmut = nullptr; switch(mut->mut_type()) { case INS_HT: #if __cplusplus == 201103L cmut = make_unique(static_cast(*mut)); #else cmut = std::make_unique(static_cast(*mut)); #endif break; case REPL_HT: #if __cplusplus == 201103L cmut = make_unique(static_cast(*mut)); #else cmut = std::make_unique(static_cast(*mut)); #endif break; default: #if __cplusplus == 201103L cmut = make_unique(static_cast(*mut)); #else cmut = std::make_unique(static_cast(*mut)); #endif break; } ht_.push_back(std::move(cmut)); nb_mut_[mut->mut_type()]++; } /// Useful when we inspect a tree file /// because stats are not saved in the file. void DnaReplicationReport::compute_stats() { nb_mut_[SWITCH] = 0; nb_mut_[S_INS] = 0; nb_mut_[S_DEL] = 0; nb_mut_[DUPL] = 0; nb_mut_[DEL] = 0; nb_mut_[TRANS] = 0; nb_mut_[INV] = 0; nb_mut_[INS_HT] = 0; nb_mut_[REPL_HT]= 0; for (const auto& ht : ht_) { assert(ht->mut_type() == INS_HT or ht->mut_type() == REPL_HT); nb_mut_[ht->mut_type()]++; } for (const auto& rear : rearrangements_) { assert(rear->mut_type() == DUPL or rear->mut_type() == DEL or rear->mut_type() == TRANS or rear->mut_type() == INV); nb_mut_[rear->mut_type()]++; } for (const auto& mut : mutations_) { assert(mut->mut_type() == SWITCH or mut->mut_type() == S_INS or mut->mut_type() == S_DEL); nb_mut_[mut->mut_type()]++; } } void DnaReplicationReport::write_to_tree_file(gzFile tree_file) const { // Write the mutations and rearrangements undergone during replication // Store HT int32_t nb_HT = nb(H_T); gzwrite(tree_file, &nb_HT, sizeof(nb_HT)); for (const auto& ht : ht_) { switch(ht->mut_type()) { case INS_HT: ht->save(tree_file); break; case REPL_HT: ht->save(tree_file); break; default: ht->save(tree_file); break; } } // Store rearrangements int32_t nb_rears = nb(REARR); gzwrite(tree_file, &nb_rears, sizeof(nb_rears)); for (const auto& rear : rearrangements_) { switch(rear->mut_type()) { case DUPL: rear->save(tree_file); break; case DEL: rear->save(tree_file); break; case TRANS: rear->save(tree_file); break; case INV: rear->save(tree_file); break; default: rear->save(tree_file); break; } } // Store mutations int32_t nb_muts = nb(S_MUT); gzwrite(tree_file, &nb_muts, sizeof(nb_muts)); for (const auto& mut : mutations_) switch(mut->mut_type()) { case SWITCH: mut->save(tree_file); break; case S_DEL: mut->save(tree_file); break; case S_INS: mut->save(tree_file); break; default: mut->save(tree_file); break; } } void DnaReplicationReport::read_from_tree_file(gzFile tree_file) { int32_t nb_rears, nb_muts, nb_HT; gzread(tree_file, &nb_HT, sizeof(nb_HT)); for (int i = 0 ; i < nb_HT ; i++) add_HT(Mutation::Load(tree_file)); gzread(tree_file, &nb_rears, sizeof(nb_rears)); for (int i = 0 ; i < nb_rears ; i++) add_rear(Mutation::Load(tree_file)); gzread(tree_file, &nb_muts, sizeof(nb_muts)); for(int i = 0 ; i < nb_muts ; i++) add_mut(Mutation::Load(tree_file)); } } // namespace aevol aevol-5.0/src/libaevol/Selection.cpp0000644000175000017500000006420212724051151014424 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ================================================================= // Includes // ================================================================= #include "Selection.h" #include #ifdef _OPENMP #include #endif #ifdef __TBB #include #include #endif #if __cplusplus == 201103L #include "make_unique.h" #endif #include "ExpManager.h" #include "VisAVis.h" #ifdef __NO_X #ifndef __REGUL #include "Individual.h" #else #include "raevol/Individual_R.h" #endif #elif defined __X11 #ifndef __REGUL #include "Individual_X11.h" #else #include "raevol/Individual_R_X11.h" #endif #endif namespace aevol { //############################################################################## // // Class Selection // //############################################################################## // ================================================================= // Definition of static attributes // ================================================================= // ================================================================= // Constructors // ================================================================= Selection::Selection(ExpManager* exp_m) { exp_m_ = exp_m; // ----------------------------------------- Pseudo-random number generator prng_ = NULL; // -------------------------------------------------------------- Selection selection_scheme_ = RANK_EXPONENTIAL; selection_pressure_ = 0.998; // --------------------------- Probability of reproduction of each organism prob_reprod_ = NULL; } // ================================================================= // Destructors // ================================================================= Selection::~Selection() { delete [] prob_reprod_; } // ================================================================= // Public Methods // ================================================================= void Selection::step_to_next_generation() { // To create the new generation, we must create nb_indivs new individuals // (offspring) and "kill" the existing ones. // The number of offspring on a given individual will be given by a stochastic // process biased on it's fitness value (the selection process). // There are 3 possible selection schemes : // * Linear Ranking // * Exponential Ranking // * Fitness proportionate // // Whichever method is chosen, we will // 1) Compute the probability of reproduction of each individual in the population // 2) Simulate the stochastic process by a multinomial drawing (based upon the probabilities computed in 1) // 3) Make the selected individuals reproduce, thus creating the new generation // 4) Replace the current generation by the newly created one. // 5) Sort the newly created population* if (prng_ == NULL) { printf("%s:%d: error: PRNG not initialized.\n", __FILE__, __LINE__); exit(EXIT_FAILURE); } // ------------------------------------------------------------------------------- // 1) Compute the probability of reproduction of each individual in the population // ------------------------------------------------------------------------------- #ifndef FIXED_POPULATION_SIZE #error this method is not ready for variable population size compute_local_prob_reprod(); #else // The function compute_local_prob_reprod creates and fills the array prob_reprod_, which is telling us the probability of being picked for reproduction according to the rank of an individual in its neighboorhood. // It is only usefull when selection is rank based. When selection scheme is FITNESS_PROPORTIONATE, we do not need to call it. // It shoud only be called once in the simulation and not at each generation. So if prob_reprod_ already exists we do not need to call it. if ((selection_scheme_ != FITNESS_PROPORTIONATE) && (prob_reprod_ == NULL)) { compute_local_prob_reprod(); } #endif if (prng_ == NULL) { printf("%s:%d: error: PRNG not initialized.\n", __FILE__, __LINE__); exit(EXIT_FAILURE); } // Create proxies World* world = exp_m_->world(); int16_t grid_width = world->width(); int16_t grid_height = world->height(); GridCell*** pop_grid = exp_m_->grid(); // create a temporary grid to store the reproducers Individual *** reproducers = new Individual ** [grid_width]; for (int16_t i = 0 ; i < grid_width ; i++) { reproducers[i] = new Individual* [grid_height]; } // Do local competitions for (int16_t x = 0 ; x < grid_width ; x++) { for (int16_t y = 0 ; y < grid_height ; y++) { reproducers[x][y] = do_local_competition(x, y); } } // TODO : Why is that not *after* the creation of the new population ? // Add the compound secreted by the individuals if (exp_m_->with_secretion()) { for (int16_t x = 0 ; x < grid_width ; x++) { for (int16_t y = 0 ; y < grid_height ; y++) { pop_grid[x][y]->set_compound_amount( pop_grid[x][y]->compound_amount() + pop_grid[x][y]->individual()->fitness_by_feature(SECRETION)); } } // Diffusion and degradation of compound in the habitat world->update_secretion_grid(); } // Create the new generation std::list old_generation = exp_m_->indivs();; #ifndef __TBB std::list new_generation; #ifdef _OPENMP #pragma omp parallel for collapse(2) schedule(dynamic) #endif for (int16_t x = 0 ; x < grid_width ; x++) for (int16_t y = 0 ; y < grid_height ; y++) do_replication(reproducers[x][y], x * grid_height + y, x, y); for (int16_t x = 0 ; x < grid_width ; x++) for (int16_t y = 0 ; y < grid_height ; y++) new_generation.emplace_back(pop_grid[x][y]->individual()); #else std::vector new_generation; tbb::task_group tgroup; for (int16_t x = 0 ; x < grid_width ; x++) for (int16_t y = 0 ; y < grid_height ; y++) tgroup.run([=] {do_replication(reproducers[x][y], x * grid_height + y, x, y);}); tgroup.wait(); for (int16_t x = 0 ; x < grid_width ; x++) for (int16_t y = 0 ; y < grid_height ; y++) new_generation.push_back(pop_grid[x][y]->get_individual()); #endif // delete the temporary grid and the parental generation for (int16_t x = 0 ; x < grid_width ; x++) { delete [] reproducers[x]; } delete [] reproducers; for (auto indiv : old_generation) { delete indiv; } // Compute the rank of each individual #ifndef __TBB new_generation.sort([](Individual* lhs, Individual* rhs) { return lhs->fitness() < rhs->fitness(); }); #else tbb::parallel_sort(new_generation.begin(),new_generation.end(), [](Individual* lhs, Individual* rhs) { return lhs->get_fitness() < rhs->get_fitness(); }); #endif int rank = 1; for (Individual* indiv : new_generation) { indiv->set_rank(rank++); } // randomly migrate some organisms, if necessary world->MixIndivs(); PerformPlasmidTransfers(); // Update the best individual exp_m_->update_best(); // Notify observers of the end of the generation notifyObservers(END_GENERATION); } void Selection::PerformPlasmidTransfers() { if (exp_m_->with_plasmids() && ((exp_m_->prob_plasmid_HT() != 0.0) || (exp_m_->tune_donor_ability() != 0.0) || (exp_m_->tune_recipient_ability() != 0.0))) { // Create proxies World* world = exp_m_->world(); int16_t grid_width = world->width(); int16_t grid_height = world->height(); int16_t x_offset, y_offset, new_x, new_y; // Shuffle the grid: int16_t total_size = ((grid_width)*(grid_height)); int16_t** shuffled_table = new int16_t* [total_size]; for (int16_t z = 0 ; z < total_size ; z++) { shuffled_table[z] = new int16_t[2]; int16_t quotient = z / grid_width; int16_t remainder = z % grid_width; shuffled_table[z][0] = (int16_t) remainder; shuffled_table[z][1] = (int16_t) quotient; } for (int16_t z = 0 ;z < total_size - 1 ; z++) { int16_t rand_nb = prng_->random((int16_t) (total_size-z)); int16_t* tmp=shuffled_table[z+rand_nb]; shuffled_table[z+rand_nb]=shuffled_table[z]; shuffled_table[z]=tmp; } // First transfer all the plasmids, but just add them at the end of the list of the GUs for (int16_t z = 0 ; z < total_size ; z++) { // for each individual x int16_t x=shuffled_table[z][0]; int16_t y=shuffled_table[z][1]; for (int16_t n = 0 ; n < 9 ; n++) { // for each neighbour n of x x_offset = (n / 3) - 1; y_offset = (n % 3) - 1; new_x = (x+x_offset+grid_width) % grid_width; new_y = (y+y_offset+grid_height) % grid_height; if ((new_x != x)||(new_y != y)) { double ptransfer = exp_m_->prob_plasmid_HT() + exp_m_->tune_donor_ability() * world->indiv_at(x, y)->fitness_by_feature(DONOR) + exp_m_->tune_recipient_ability() * world->indiv_at(new_x, new_y)->fitness_by_feature(RECIPIENT) ; if (prng_->random() < ptransfer) { // will x give a plasmid to n ? if (exp_m_->swap_GUs()) { world->indiv_at(new_x, new_y)->inject_2GUs(world->indiv_at(x, y)); } else { world->indiv_at(new_x, new_y)->inject_GU(world->indiv_at(x, y)); } } } } } for(int16_t z=0;z indiv_at(x, y)->nb_genetic_units() > 2); world->indiv_at(x, y)->drop_nested_genetic_units(); if (reevaluate) world->indiv_at(x, y)->Reevaluate(); } } } } /*! */ void Selection::write_setup_file(gzFile exp_setup_file) const { // ---------------------------------------------------- Selection Parameters int8_t tmp_sel_scheme = selection_scheme_; gzwrite(exp_setup_file, &tmp_sel_scheme, sizeof(tmp_sel_scheme)); gzwrite(exp_setup_file, &selection_pressure_, sizeof(selection_pressure_)); } /*! */ void Selection::save(gzFile& backup_file) const { if (prng_ == NULL) { printf("%s:%d: error: PRNG not initialized.\n", __FILE__, __LINE__); exit(EXIT_FAILURE); } // ----------------------------------------- Pseudo-random number generator prng_->save(backup_file); } void Selection::load(gzFile& exp_setup_file, gzFile& backup_file, bool verbose) { // ---------------------------------------------------- Selection parameters int8_t tmp_sel_scheme; gzread(exp_setup_file, &tmp_sel_scheme, sizeof(tmp_sel_scheme)); selection_scheme_ = (SelectionScheme) tmp_sel_scheme; gzread(exp_setup_file, &selection_pressure_, sizeof(selection_pressure_)); // ----------------------------------------- Pseudo-random number generator #if __cplusplus == 201103L prng_ = make_unique(backup_file); #else prng_ = std::make_unique(backup_file); #endif } // ================================================================= // Protected Methods // ================================================================= void Selection::compute_prob_reprod() { // non spatially structured only if (prob_reprod_ != NULL) { // TODO remove delete [] prob_reprod_; } int32_t nb_indivs = exp_m_->nb_indivs(); prob_reprod_ = new double[nb_indivs]; if (selection_scheme_ == RANK_LINEAR) { // The probability of reproduction for an individual is given by // (2-SP + 2 * (SP-1) * (R-1)/(N-1)) / N // With : // SP : selective pressure. Linear ranking allows values of SP in [1.0, 2.0]. // R : the rank of the individual in the population (1 for the worst individual) // N : the number of individuals in the population // // We can transform this expression into (2-SP)/N + ((2*(SP-1)) / (N*(N-1))) * (R-1) // Furthermore, (R-1) is given directly by (the index of our probability table) // // probs[0] will hence be given by (2-SP)/N // probs[i+1] can then be expressed by probs[i] + (2*(SP-1)) / (N*(N-1)) double increment = (2 * (selection_pressure_-1)) / (nb_indivs * (nb_indivs-1)); prob_reprod_[0] = (2 - selection_pressure_) / nb_indivs; for (int32_t i = 1 ; i < nb_indivs ; i++) { prob_reprod_[i] = prob_reprod_[i-1] + increment; } // No need to normalize: The sum is always 1 for linear ranking } else if (selection_scheme_ == RANK_EXPONENTIAL) { // The probability of reproduction for an individual is given by // ((SP-1) * SP^(N-R)) / (SP^N - 1) // Which is equivalent to // ((SP-1) * SP^N) / ((SP^N - 1) * SP^R) // With : // SP : selective pressure. Exponential ranking allows values of SP in ]0.0, 1.0[ // R : the rank of the individual in the population (1 for the worst individual) // N : the number of individuals in the population // // NB : The only rank-dependent term is SP^R // // Because we don't allow ex-aequo, // probs[i+1] can hence be expressed as (probs[i] / SP) // We will hence compute probs[0] with the original formula and infer the remaining values double SP_N = pow(selection_pressure_, nb_indivs); // SP^N prob_reprod_[0] = ((selection_pressure_ - 1) * SP_N) / ((SP_N - 1) * selection_pressure_); for (int32_t i = 1 ; i < nb_indivs ; i++) { prob_reprod_[i] = prob_reprod_[i-1] / selection_pressure_; } // No need to normalize: We don't allow ex-aequo } else if (selection_scheme_ == FITNESS_PROPORTIONATE) { // The probability of reproduction for an individual is given by // exp(-SP * gap) / sum of this measure on all individuals // SP : selective pressure. Fitness proportionate allows values of SP in ]0, +inf[ // The closer SP to 0, the closer the selection to being linear. double* fitnesses = new double[nb_indivs]; double sum = 0; size_t i = 0; for (const auto& indiv: exp_m_->indivs()) { fitnesses[i] = indiv->fitness(); sum += fitnesses[i]; ++i; } for (int32_t i = 0 ; i < nb_indivs ; i++) { prob_reprod_[i] = fitnesses[i] / sum; } delete [] fitnesses; } else if (selection_scheme_ == FITTEST) { printf("ERROR, fittest selection scheme is meant to be used for spatially structured populations %s:%d\n", __FILE__, __LINE__); exit(EXIT_FAILURE); } else { printf("ERROR, invalid selection scheme in file %s:%d\n", __FILE__, __LINE__); exit(EXIT_FAILURE); } } void Selection::compute_local_prob_reprod() { int16_t neighborhood_size = 9; if (prob_reprod_ != NULL) { printf ("Warning, already defined %s:%d\n", __FILE__, __LINE__); delete [] prob_reprod_; } prob_reprod_ = new double[neighborhood_size]; if (selection_scheme_ == RANK_LINEAR) { double increment = (2 * (selection_pressure_-1)) / (neighborhood_size * (neighborhood_size-1)); double init_prob = (2 - selection_pressure_) / neighborhood_size; for (int16_t i = 0 ; i < neighborhood_size ; i++) { prob_reprod_[i] = init_prob + increment * i; } } else if (selection_scheme_ == RANK_EXPONENTIAL) { double SP_N = pow(selection_pressure_, neighborhood_size); prob_reprod_[0] = ((selection_pressure_ - 1) * SP_N) / ((SP_N - 1) * selection_pressure_); for (int16_t i = 1 ; i < neighborhood_size ; i++) { prob_reprod_[i] = prob_reprod_[i-1] / selection_pressure_; } } else if (selection_scheme_ == FITTEST) { for (int16_t i = 0 ; i < neighborhood_size-1 ; i++) { prob_reprod_[i] = 0.; } prob_reprod_[neighborhood_size-1] = 1.; } else if (selection_scheme_ == FITNESS_PROPORTIONATE) { printf("ERROR, this function is not intented to be use with this selection scheme %s:%d\n", __FILE__, __LINE__); exit(EXIT_FAILURE); } else { printf("ERROR, invalid selection scheme in file %s:%d\n", __FILE__, __LINE__); exit(EXIT_FAILURE); } } Individual* Selection::do_replication(Individual* parent, int32_t index) { //Individual* new_indiv = NULL; // =========================================================================== // Copy parent // =========================================================================== #ifdef __NO_X #ifndef __REGUL Individual* new_indiv = new Individual(parent, index, parent->mut_prng(), parent->stoch_prng() ); #else Individual_R* new_indiv = new Individual_R(dynamic_cast(parent), index, parent->mut_prng(), parent->stoch_prng() ); #endif #elif defined __X11 #ifndef __REGUL Individual_X11* new_indiv = new Individual_X11(dynamic_cast(parent), index, parent->mut_prng(), parent->stoch_prng() ); #else Individual_R_X11* new_indiv = new Individual_R_X11(dynamic_cast(parent), index, parent->mut_prng(), parent->stoch_prng() ); #endif #endif // Notify observers that a new individual was created from { Individual* msg[2] = {new_indiv, parent}; notifyObservers(NEW_INDIV, msg); } // Perform transfer, rearrangements and mutations if (not new_indiv->allow_plasmids()) { const GeneticUnit* chromosome = &new_indiv->genetic_unit_list().front(); chromosome->dna()->perform_mutations(parent->id()); } else { // For each GU, apply mutations // Randomly determine the order in which the GUs will undergo mutations bool inverse_order = (prng_->random((int32_t) 2) < 0.5); if (not inverse_order) { // Apply mutations in normal GU order for (const auto& gen_unit: new_indiv->genetic_unit_list()) { gen_unit.dna()->perform_mutations(parent->id()); } } else { // Apply mutations in inverse GU order const auto& gul = new_indiv->genetic_unit_list(); for (auto gen_unit = gul.crbegin(); gen_unit != gul.crend(); ++gen_unit) { gen_unit->dna()->perform_mutations(parent->id()); } } } return new_indiv; } Individual* Selection::do_replication(Individual* parent, int32_t index, int16_t x, int16_t y) { Individual* new_indiv = do_replication(parent, index); // Set the new individual's location on the grid exp_m_->world()->PlaceIndiv(new_indiv, x, y); // Evaluate new individual new_indiv->Evaluate(); // Compute statistics new_indiv->compute_statistical_data(); // Tell observers the replication is finished new_indiv->notifyObservers(END_REPLICATION, nullptr); return new_indiv; } Individual *Selection::do_local_competition (int16_t x, int16_t y) { // This function uses the array prob_reprod_ when selection scheme is // RANK_LINEAR, RANK_EXPONENTIAL, or FITTEST. For these selection schemes, // the function compute_local_prob_reprod (creating the array prob_reprod_) // must have been called before. // When selection scheme is FITNESS_PROPORTIONATE, this function only uses // the fitness values World* world = exp_m_->world(); int16_t neighborhood_size = 9; int16_t grid_width = world->width(); int16_t grid_height = world->height(); int16_t cur_x; int16_t cur_y; // Build a temporary local array of fitness values double * local_fit_array = new double[neighborhood_size]; double * sort_fit_array = new double[neighborhood_size]; int16_t * initial_location = new int16_t[neighborhood_size]; double * probs = new double[neighborhood_size]; int16_t count = 0; double sum_local_fit = 0.0; for (int8_t i = -1 ; i < 2 ; i++) { for (int8_t j = -1 ; j < 2 ; j++) { cur_x = (x + i + grid_width) % grid_width; cur_y = (y + j + grid_height) % grid_height; local_fit_array[count] = world->indiv_at(cur_x, cur_y)->fitness(); sort_fit_array[count] = local_fit_array[count]; initial_location[count] = count; sum_local_fit += local_fit_array[count]; count++; } } // Do the competitions between the individuals, based on one of the 4 methods: // 1. Rank linear // 2. Rank exponential // 3. Fitness proportionate // 4. Fittest individual // Any rank based selection switch (selection_scheme_) { case RANK_LINEAR : case RANK_EXPONENTIAL : case FITTEST : { assert(prob_reprod_); // First we sort the local fitness values using bubble sort : // we sort by increasing order, so the first element will have the worst fitness. bool swaped = true; int16_t loop_length = 8; double tmp_holder; int16_t tmp_holder2; while (swaped == true) { swaped = false; for (int16_t i = 0 ; i < loop_length ; i++) { //if the first is higher than the second, exchange them if (sort_fit_array[i] > sort_fit_array[i+1]) { tmp_holder = sort_fit_array[i]; sort_fit_array[i] = sort_fit_array[i+1]; sort_fit_array[i+1] = tmp_holder; tmp_holder2 = initial_location[i]; initial_location[i] = initial_location[i+1]; initial_location[i+1] = tmp_holder2; swaped = true; } } loop_length = loop_length - 1; } // Then we use the already computed probabilities for (int16_t i = 0 ; i < neighborhood_size ; i++) { probs[initial_location[i]] = prob_reprod_[i]; } break; } // Fitness proportionate selection case FITNESS_PROPORTIONATE : { for(int16_t i = 0 ; i < neighborhood_size ; i++) { probs[i] = local_fit_array[i]/sum_local_fit; } break; } default : { printf("ERROR, invalid selection scheme in file %s:%d\n", __FILE__, __LINE__); exit(EXIT_FAILURE); } } // pick one organism to reproduce, based on probs[] calculated above, using roulette selection int8_t found_org = prng_->roulette_random(probs, 9); int16_t x_offset = (found_org / 3) - 1; int16_t y_offset = (found_org % 3) - 1; delete [] local_fit_array; delete [] sort_fit_array; delete [] initial_location; delete [] probs; return world->indiv_at((x+x_offset+grid_width) % grid_width, (y+y_offset+grid_height) % grid_height); } #ifdef __TBB Individual* Selection::do_replication_tbb(Individual* parent, int32_t index, int16_t x /*= -1 */, int16_t y /*= -1 */ ) { // =========================================================================== // 1) Copy parent // =========================================================================== #ifdef __NO_X #ifndef __REGUL Individual* new_indiv = new Individual(parent, index, parent->get_mut_prng(), parent->get_stoch_prng() ); #else Individual_R* new_indiv = new Individual_R(dynamic_cast(parent), index, parent->get_mut_prng(), parent->get_stoch_prng() ); #endif #elif defined __X11 #ifndef __REGUL Individual_X11* new_indiv = new Individual_X11(dynamic_cast(parent), index, parent->get_mut_prng(), parent->get_stoch_prng() ); #else Individual_R_X11* new_indiv = new Individual_R_X11(dynamic_cast(parent), index, parent->get_mut_prng(), parent->get_stoch_prng() ); #endif #endif // Notify observers that a new individual was created from { Individual* msg[2] = {new_indiv, parent}; notifyObservers(NEW_INDIV, msg); } // Set the new individual's location on the grid _exp_m->world()->PlaceIndiv(new_indiv, x, y); // Perform transfer, rearrangements and mutations if (not new_indiv->get_allow_plasmids()) { const GeneticUnit* chromosome = &new_indiv->get_genetic_unit_list().front(); chromosome->get_dna()->perform_mutations(parent->get_id()); } else { // For each GU, apply mutations // Randomly determine the order in which the GUs will undergo mutations bool inverse_order = (new_indiv->get_mut_prng()->random((int32_t) 2) < 0.5); if (not inverse_order) { // Apply mutations in normal GU order for (const auto& gen_unit: new_indiv->get_genetic_unit_list()) { gen_unit.get_dna()->perform_mutations(parent->get_id() ); } } else { // Apply mutations in inverse GU order const auto& gul = new_indiv->get_genetic_unit_list(); for (auto gen_unit = gul.crbegin(); gen_unit != gul.crend(); ++gen_unit) { gen_unit->get_dna()->perform_mutations(parent->get_id()); } } } // Evaluate new individual new_indiv->Evaluate(); // Compute statistics new_indiv->compute_statistical_data(); // Tell observers the replication is finished new_indiv->notifyObservers(END_REPLICATION, nullptr); return new_indiv; } #endif // ================================================================= // Non inline accessors // ================================================================= } // namespace aevol aevol-5.0/src/libaevol/AeTime.cpp0000644000175000017500000000572012724051151013643 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ================================================================= // Libraries // ================================================================= // ================================================================= // Project Files // ================================================================= #include "AeTime.h" namespace aevol { // ############################################################################ // // Class AeTime // // ############################################################################ // ================================================================= // Definition of static attributes // ================================================================= int64_t AeTime::time_ = 0; // ================================================================= // Constructors // ================================================================= // ================================================================= // Destructors // ================================================================= // ================================================================= // Public Methods // ================================================================= // ================================================================= // Protected Methods // ================================================================= // ================================================================= // Non inline accessors // ================================================================= int64_t time() { return AeTime::time(); } } // namespace aevol aevol-5.0/src/libaevol/ExpSetup.h0000644000175000017500000003057112735461414013734 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_EXP_SETUP_H_ #define AEVOL_EXP_SETUP_H_ // ================================================================= // Includes // ================================================================= #include #include #include #include "Selection.h" #include "Stats.h" #include "Logging.h" #include "Tree.h" #include "Dump.h" #include "JumpingMT.h" namespace aevol { // =========================================================================== // Class declarations // =========================================================================== class ParamLoader; class ExpSetup { friend class ExpManager; public: // ======================================================================= // Constructors // ======================================================================= ExpSetup() = delete; ExpSetup(const ExpSetup&) = delete; ExpSetup(ExpManager* exp_m); // ======================================================================= // Destructors // ======================================================================= virtual ~ExpSetup() { delete sel_; } // ======================================================================= // Accessors: getters // ======================================================================= inline int get_fuzzy_flavor( void ) const; // ----------------------------------------------------- Selection context Selection * sel() const { return sel_; } // --------------------------------------------------------------- Transfer double repl_HT_detach_rate() const { return repl_HT_detach_rate_; } // --------------------------------------------------------------- Plasmids // See comments in ExpManager.h on how plasmids are handled bool with_plasmids() const { return with_plasmids_; } double prob_plasmid_HT() const { return prob_plasmid_HT_; } double tune_donor_ability() const { return tune_donor_ability_; } double tune_recipient_ability() const { return tune_recipient_ability_; } bool swap_GUs() const { return swap_GUs_; } // -------------------------------------------------------------- Secretion bool with_secretion() const { return with_secretion_; } double secretion_contrib_to_fitness() const { return secretion_contrib_to_fitness_; } double secretion_cost() const { return secretion_cost_; } #ifdef __REGUL inline bool get_with_heredity( void ) const; inline double get_degradation_rate( void ) const; inline int get_nb_degradation_step( void ) const; inline double get_protein_presence_limit( void ) const; inline double get_hill_shape( void ) const; inline double get_hill_shape_n( void ) const; inline double get_hill_shape_theta( void ) const; inline int get_nb_indiv_age( void ) const; std::set* get_list_eval_step( void ) const { return _list_eval_step; } #endif bool first_regul() const { return first_regul_; } // ======================================================================= // Accessors: setters // ======================================================================= inline void set_fuzzy_flavor( int fuzzy_flavor ); // --------------------------------------------------------------- Transfer void set_with_HT(bool with_HT) { with_HT_ = with_HT; } void set_repl_HT_with_close_points(bool repl_HT_with_close_points) { repl_HT_with_close_points_ = repl_HT_with_close_points; } void set_HT_ins_rate(double HT_ins_rate) { HT_ins_rate_ = HT_ins_rate; } void set_HT_repl_rate(double HT_repl_rate) { HT_repl_rate_ = HT_repl_rate; } void set_repl_HT_detach_rate(double repl_HT_detach_rate) { repl_HT_detach_rate_ = repl_HT_detach_rate; } // --------------------------------------------------------------- Plasmids void set_with_plasmids(bool with_p) { with_plasmids_ = with_p; } void set_prob_plasmid_HT(double prob_p_HT) { prob_plasmid_HT_ = prob_p_HT; } void set_tune_donor_ability(double tune_donor_ability) { tune_donor_ability_ = tune_donor_ability; } void set_tune_recipient_ability(double tune_recipient_ability) { tune_recipient_ability_ = tune_recipient_ability; } void set_donor_cost(double donor_cost) { donor_cost_ = donor_cost; } void set_recipient_cost(double recipient_cost) { recipient_cost_ = recipient_cost; } void set_swap_GUs(bool swap_GUs) { swap_GUs_ = swap_GUs; } // -------------------------------------------------------------- Secretion void set_with_secretion(bool with_secretion) { with_secretion_ = with_secretion; } void set_secretion_contrib_to_fitness(double secretion_contrib) { secretion_contrib_to_fitness_ = secretion_contrib; } void set_secretion_cost(double secretion_cost) { secretion_cost_ = secretion_cost; } #ifdef __REGUL inline void set_with_heredity( bool with_heredity ); inline void set_degradation_rate( double degradation_rate ); inline void set_nb_degradation_step( int nb_degradation_step ); inline void set_protein_presence_limit( double protein_presence_limit ); inline void set_hill_shape( double hill_shape ); inline void set_hill_shape_n( double hill_shape_n ); inline void set_hill_shape_theta( double hill_shape_theta ); inline void set_nb_indiv_age( int nb_indiv_age ); inline void set_list_eval_step(std::set list_eval_step); #endif void set_first_regul(bool first_regul) { first_regul_ = first_regul; } // ======================================================================= // Public Methods // ======================================================================= void write_setup_file(gzFile exp_setup_file) const; void save(gzFile backup_file) const; void load(gzFile setup_file, gzFile backup_file, bool verbose); /// Make the individuals reproduce void step_to_next_generation() { sel_->step_to_next_generation(); } #ifdef __REGUL // Regulation void init_binding_matrix( bool random_binding_matrix, double binding_zeros_percentage, std::shared_ptr prng); void read_binding_matrix_from_backup(gzFile binding_matrix_file); void write_binding_matrix_to_backup(gzFile binding_matrix_file) const; void write_binding_matrix_to_file(FILE* binding_matrix_file) const; void print_binding_matrix( void ); double get_binding_matrix( int row, int column ) const; #endif // ======================================================================= // Public Attributes // ======================================================================= #ifdef __REGUL double _binding_matrix[MAX_QUADON][MAX_CODON]; #endif protected : // ======================================================================= // Protected Methods // ======================================================================= virtual void display() {}; // ======================================================================= // Protected Attributes // ======================================================================= ExpManager* exp_m_; int fuzzy_flavor_; // ----------------------------------------------------- Selection context Selection* sel_; // --------------------------------------------------- Transfer parameters bool with_HT_; bool repl_HT_with_close_points_; double HT_ins_rate_; double HT_repl_rate_; double repl_HT_detach_rate_; // --------------------------------------------------- Plasmids parameters bool with_plasmids_; double prob_plasmid_HT_; // Base transfer ability independent of evolvable donor and recipient ability double tune_donor_ability_; // How much the individuals can tune their ability to send plasmids double tune_recipient_ability_; // How much the individuals can tune their ability to receive plasmids double donor_cost_; double recipient_cost_; bool swap_GUs_; // Whether plasmid HT is uni- or bidirectional // -------------------------------------------------- Secretion parameters bool with_secretion_; double secretion_contrib_to_fitness_; double secretion_cost_; #ifdef __REGUL // Binding matrix bool _with_heredity; double _protein_presence_limit; double _degradation_rate; int _nb_degradation_step; double _hill_shape_n; double _hill_shape; double _hill_shape_theta; int _nb_indiv_age; std::set* _list_eval_step; #endif bool first_regul_; }; // ===================================================================== // Getters' definitions // ===================================================================== inline int ExpSetup::get_fuzzy_flavor( void ) const { return fuzzy_flavor_; } #ifdef __REGUL inline bool ExpSetup::get_with_heredity( void ) const { return _with_heredity; } inline double ExpSetup::get_degradation_rate( void ) const { return _degradation_rate; } inline int ExpSetup::get_nb_degradation_step( void ) const { return _nb_degradation_step; } inline double ExpSetup::get_protein_presence_limit( void ) const { return _protein_presence_limit; } inline double ExpSetup::get_hill_shape( void ) const { return _hill_shape; } inline double ExpSetup::get_hill_shape_n( void ) const { return _hill_shape_n; } inline double ExpSetup::get_hill_shape_theta( void ) const { return _hill_shape_theta; } inline int ExpSetup::get_nb_indiv_age( void ) const { return _nb_indiv_age; } #endif // ===================================================================== // Setters' definitions // ===================================================================== // --------------------------------------------------------------- Transfer inline void ExpSetup::set_fuzzy_flavor( int fuzzy_flavor ) { fuzzy_flavor_ = fuzzy_flavor; } #ifdef __REGUL inline void ExpSetup::set_with_heredity( bool with_heredity ) { _with_heredity = with_heredity; } inline void ExpSetup::set_degradation_rate( double degradation_rate ) { _degradation_rate = degradation_rate; } inline void ExpSetup::set_nb_degradation_step( int degradation_step ) { _nb_degradation_step = degradation_step; } inline void ExpSetup::set_protein_presence_limit( double protein_presence_limit ) { _protein_presence_limit = protein_presence_limit; } inline void ExpSetup::set_hill_shape( double hill_shape ) { _hill_shape = hill_shape; } inline void ExpSetup::set_hill_shape_theta( double hill_shape_theta ) { _hill_shape_theta = hill_shape_theta; } inline void ExpSetup::set_hill_shape_n( double hill_shape_n ) { _hill_shape_n = hill_shape_n; } inline void ExpSetup::set_nb_indiv_age( int nb_indiv_age ) { _nb_indiv_age = nb_indiv_age; } inline void ExpSetup::set_list_eval_step( std::set list_eval_step ) { _list_eval_step = new std::set(list_eval_step); } #endif // ===================================================================== // functions' definition // ===================================================================== #ifdef __REGUL inline double ExpSetup::get_binding_matrix( int row, int column ) const { return _binding_matrix[row][column]; } #endif } // namespace aevol #endif // AEVOL_EXP_SETUP_H_ aevol-5.0/src/libaevol/World.cpp0000644000175000017500000003620412724051151013567 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ================================================================= // Includes // ================================================================= #include "World.h" #include "HabitatFactory.h" #if __cplusplus == 201103L #include "make_unique.h" #endif #include #include #ifdef __REGUL #include "raevol/Individual_R.h" #endif using std::cout; using std::endl; using std::list; namespace aevol { //############################################################################## // # // Class World # // # //############################################################################## // ================================================================= // Definition of static attributes // ================================================================= // ================================================================= // Constructors // ================================================================= // ================================================================= // Destructor // ================================================================= World::~World() { for (int16_t x = 0 ; x < width_ ; x++) for (int16_t y = 0 ; y < height_ ; y++) delete grid_[x][y]; // grid_ is 2D accessible but 1D allocated, there were only 2 new // statements and these are the corresponding deletes delete [] grid_1d_; delete [] grid_; } // ================================================================= // Public Methods // ================================================================= void World::InitGrid(int16_t width, int16_t height, Habitat& habitat, bool share_phenotypic_target) { assert(share_phenotypic_target); if (share_phenotypic_target) { #ifndef __REGUL phenotypic_target_handler_ = new PhenotypicTargetHandler(habitat.phenotypic_target_handler()); #else phenotypic_target_handler_ = new PhenotypicTargetHandler_R((dynamic_cast(habitat)).phenotypic_target_handler()); #endif } width_ = width; height_ = height; MallocGrid(); for (int16_t x = 0 ; x < width_ ; x++) for (int16_t y = 0 ; y < height_ ; y++) { if (share_phenotypic_target) grid_[x][y] = new GridCell(x, y, HabitatFactory::create_unique_habitat(habitat,share_phenotypic_target), NULL,std::make_shared(mut_prng_->random(1000000)), std::make_shared(stoch_prng_->random(1000000))); } } void World::MallocGrid() { // Although grid_ is a 2D array, we want all its cells to be contiguous // in memory. However, we also want it to be 2D-accessible i.e. we want to // be able to access a cell with grid_[x][y]. // The following code does just this grid_1d_ = new GridCell * [width_ * height_]; grid_ = new GridCell ** [width_]; for (int16_t x = 0 ; x < width_ ; x++) grid_[x] = &(grid_1d_[x * height_]); } void World::PlaceIndiv(Individual * indiv, int16_t x, int16_t y) { grid_[x][y]->set_individual(indiv); indiv->set_mut_prng(grid_[x][y]->mut_prng()); indiv->set_stoch_prng(grid_[x][y]->stoch_prng()); } void World::FillGridWithClones(Individual & dolly) { int32_t id_new_indiv = 0; for (int16_t x = 0 ; x < width_ ; x++) for (int16_t y = 0 ; y < height_ ; y++) #ifndef __REGUL PlaceIndiv(Individual::CreateClone(&dolly, id_new_indiv++), x, y); #else PlaceIndiv(Individual_R::CreateClone(dynamic_cast(&dolly), id_new_indiv++), x, y); #endif } void World::evaluate_individuals() { for (int16_t x = 0 ; x < width_ ; x++) for (int16_t y = 0 ; y < height_ ; y++) { #ifndef __REGUL Individual* indiv = indiv_at(x, y); #else Individual_R* indiv = dynamic_cast (indiv_at(x, y)); #endif indiv->Evaluate(); indiv->compute_statistical_data(); } } void World::update_secretion_grid() { int16_t cur_x, cur_y; double ** new_secretion = new double*[width_]; for (int16_t x = 0 ; x < width_ ; x++) { new_secretion[x] = new double[height_]; for (int16_t y = 0 ; y < height_ ; y++) { new_secretion[x][y] = grid_[x][y]->compound_amount(); } } for (int16_t x = 0 ; x < width_ ; x++) { for (int16_t y = 0 ; y < height_ ; y++) { // look at the entire neighborhood for (int8_t i = -1 ; i < 2 ; i++) { for (int8_t j = -1 ; j < 2 ; j ++) { cur_x = (x + i + width_) % width_; cur_y = (y + j + height_) % height_; // add the diffusion from the neighboring cells new_secretion[x][y] += grid_[cur_x][cur_y]->compound_amount() * secretion_diffusion_prop_; } } } } // Substract what has diffused from each cell, and calculate the // compound degradation for (int16_t x = 0 ; x < width_ ; x++) { for (int16_t y = 0 ; y < height_ ; y++) { grid_[x][y]->set_compound_amount(new_secretion[x][y] - 9 * grid_[x][y]->compound_amount() * secretion_diffusion_prop_); grid_[x][y]->set_compound_amount(grid_[x][y]->compound_amount() * (1 - secretion_degradation_prop_)); } } for (int16_t x = 0 ; x < width_ ; x++) { delete [] new_secretion[x]; } delete [] new_secretion; } /* * Perform mixing of individuals * * Depending on parameters this can either well-mix or partially-mix * the population */ void World::MixIndivs() { if (is_well_mixed_) WellMixIndivs(); else if (partial_mix_nb_permutations_ > 0) PartiallyMixIndivs(); } /* * Suffle individuals randomly using Fisher-Yates shuffle */ void World::WellMixIndivs() { for (int16_t i = width_ * height_ - 1 ; i > 0 ; i--) { int16_t j = prng_->random(i + 1); // random in [0, 1] // Swap individuals btw cells i and j Individual * tmp = grid_1d_[i]->individual(); grid_1d_[i]->set_individual(grid_1d_[j]->individual()); grid_1d_[j]->set_individual(tmp); tmp->set_mut_prng(grid_1d_[j]->mut_prng()); tmp->set_stoch_prng(grid_1d_[j]->stoch_prng()); } } /* * Perform permutations between individuals randomly * * The number of permutations is given by partial_mix_nb_permutations_ */ void World::PartiallyMixIndivs() { for (int32_t i = 0 ; i < partial_mix_nb_permutations_ ; i++) { int16_t old_x = prng_->random(width_); int16_t old_y = prng_->random(height_); int16_t new_x = prng_->random(width_); int16_t new_y = prng_->random(height_); // Swap the individuals in these grid cells... Individual * tmp_swap = grid_[old_x][old_y]->individual(); grid_[old_x][old_y]->set_individual(grid_[new_x][new_y]->individual()); grid_[new_x][new_y]->set_individual(tmp_swap); grid_[old_x][old_y]->individual()->set_mut_prng(grid_[old_x][old_y]->mut_prng()); grid_[old_x][old_y]->individual()->set_stoch_prng(grid_[old_x][old_y]->stoch_prng()); grid_[new_x][new_y]->individual()->set_mut_prng(grid_[new_x][new_y]->mut_prng()); grid_[new_x][new_y]->individual()->set_stoch_prng(grid_[new_x][new_y]->stoch_prng()); } } void World::update_best() { x_best = y_best = 0; double fit_best = indiv_at(0, 0)->fitness(); for (int16_t x = 0 ; x < width_ ; x++) for (int16_t y = 0 ; y < height_ ; y++) if (indiv_at(x, y)->fitness() > fit_best) { x_best = x; y_best = y; fit_best = indiv_at(x, y)->fitness(); } } void World::ApplyHabitatVariation() { if (phenotypic_target_shared_) phenotypic_target_handler_->ApplyVariation(); else for (int16_t x = 0 ; x < width_ ; x++) for (int16_t y = 0 ; y < height_ ; y++) grid_[x][y]->ApplyHabitatVariation(); } void World::save(gzFile backup_file) const { if (prng_ == nullptr) { printf("%s:%d: error: PRNG not initialized.\n", __FILE__, __LINE__); exit(EXIT_FAILURE); } prng_->save(backup_file); mut_prng_->save(backup_file); int8_t tmp_with_stoch = static_cast(stoch_prng_ == nullptr ? 0 : 1); gzwrite(backup_file, &tmp_with_stoch, sizeof(tmp_with_stoch)); if (tmp_with_stoch) { stoch_prng_->save(backup_file); } if (grid_ == nullptr) { printf("%s:%d: error: grid not initialized.\n", __FILE__, __LINE__); exit(EXIT_FAILURE); } // Manage shared or private phenotypic targets int8_t tmp_phenotypic_target_shared = static_cast(phenotypic_target_shared_ ? 1 : 0); gzwrite(backup_file, &tmp_phenotypic_target_shared, sizeof(tmp_phenotypic_target_shared)); if (phenotypic_target_shared_) { phenotypic_target_handler_->save(backup_file); } gzwrite(backup_file, &width_, sizeof(width_)); gzwrite(backup_file, &height_, sizeof(height_)); for (int16_t x = 0 ; x < width_ ; x++) for (int16_t y = 0 ; y < height_ ; y++) grid_[x][y]->save(backup_file, phenotypic_target_shared_); gzwrite(backup_file, &x_best, sizeof(x_best)); gzwrite(backup_file, &y_best, sizeof(y_best)); gzwrite(backup_file, &is_well_mixed_, sizeof(is_well_mixed_)); gzwrite(backup_file, &partial_mix_nb_permutations_, sizeof(partial_mix_nb_permutations_)); gzwrite(backup_file, &secretion_diffusion_prop_, sizeof(secretion_diffusion_prop_)); gzwrite(backup_file, &secretion_degradation_prop_, sizeof(secretion_degradation_prop_)); } void World::load(gzFile backup_file, ExpManager * exp_man) { // Retrieve PRNGs prng_ = std::make_shared(backup_file); mut_prng_ = std::make_shared(backup_file); int8_t tmp_with_stoch; gzread(backup_file, &tmp_with_stoch, sizeof(tmp_with_stoch)); if (tmp_with_stoch) { stoch_prng_ = std::make_shared(backup_file); } // Manage shared or private phenotypic targets int8_t tmp_phenotypic_target_shared; gzread(backup_file, &tmp_phenotypic_target_shared, sizeof(tmp_phenotypic_target_shared)); phenotypic_target_shared_ = tmp_phenotypic_target_shared; if (phenotypic_target_shared_) { phenotypic_target_handler_ = #ifndef __REGUL new PhenotypicTargetHandler(backup_file); #else new PhenotypicTargetHandler_R(backup_file); #endif } // A priori useless car déjà fait dans le constructeur de reprise sur backup //phenotypic_target_handler_->BuildPhenotypicTarget(); gzread(backup_file, &width_, sizeof(width_)); gzread(backup_file, &height_, sizeof(height_)); MallocGrid(); for (int16_t x = 0 ; x < width_ ; x++) for (int16_t y = 0 ; y < height_ ; y++) grid_[x][y] = new GridCell(backup_file, exp_man, phenotypic_target_handler_); gzread(backup_file, &x_best, sizeof(x_best)); gzread(backup_file, &y_best, sizeof(y_best)); gzread(backup_file, &is_well_mixed_, sizeof(is_well_mixed_)); gzread(backup_file, &partial_mix_nb_permutations_, sizeof(partial_mix_nb_permutations_)); gzread(backup_file, &secretion_diffusion_prop_, sizeof(secretion_diffusion_prop_)); gzread(backup_file, &secretion_degradation_prop_, sizeof(secretion_degradation_prop_)); } // ================================================================= // Protected Methods // ================================================================= void World::backup_stoch_prng() { // Store a copy of stoch_prng_ in stoch_prng_bak_ #if __cplusplus == 201103L stoch_prng_bak_ = make_unique(*stoch_prng_); #else stoch_prng_bak_ = std::make_unique(*stoch_prng_); #endif } // ================================================================= // Non inline accessors // ================================================================= std::shared_ptr World::prng() const { return prng_; } std::shared_ptr World::mut_prng() const { return mut_prng_; } std::shared_ptr World::stoch_prng() const { return stoch_prng_; } list World::indivs() const { list r; for (int16_t x = 0 ; x < width_ ; x++) for (int16_t y = 0 ; y < height_ ; y++) r.push_back(indiv_at(x, y)); return r; } void World::set_mut_prng(std::shared_ptr prng) { mut_prng_ = prng; for (int16_t x = 0 ; x < width_ ; x++) for (int16_t y = 0 ; y < height_ ; y++) { Individual * indiv; if ((indiv = indiv_at(x, y))) indiv->set_mut_prng(mut_prng_); } } void World::set_stoch_prng(std::shared_ptr prng) { stoch_prng_ = prng; for (int16_t x = 0 ; x < width_ ; x++) for (int16_t y = 0 ; y < height_ ; y++) { Individual * indiv; if ((indiv = indiv_at(x, y))) indiv->set_stoch_prng(stoch_prng_); } } void World::set_phen_target_prngs(std::shared_ptr var_prng, std::shared_ptr noise_prng) { assert(phenotypic_target_shared_); phenotypic_target_handler_->set_var_prng(var_prng); phenotypic_target_handler_->set_noise_prng(noise_prng); } Individual* World::indiv_by_id(int32_t id) const { Individual* indiv = grid_1d_[id]->individual(); // When the population isn't mixed at all, the individual with id n is in // grid_1d_[n]. Try this first... if (indiv->id() == id) return indiv; // ... If it isn't, do a basic search int32_t nb_indivs = width_ * height_; for (int32_t i = 0 ; i < nb_indivs ; i++) { if (grid_1d_[i]->individual()->id() == id) return grid_1d_[i]->individual(); } return nullptr; } Individual* World::indiv_by_rank(int32_t rank) const { int32_t nb_indivs = width_ * height_; for (int32_t i = 0 ; i < nb_indivs ; i++) { if (grid_1d_[i]->individual()->rank() == rank) return grid_1d_[i]->individual(); } return nullptr; } } // namespace aevol aevol-5.0/src/libaevol/Dump.h0000644000175000017500000001010112724051151013036 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_DUMP_H_ #define AEVOL_DUMP_H_ // ================================================================= // Libraries // ================================================================= #include #include #include #include namespace aevol { // ================================================================= // Class declarations // ================================================================= class ExpManager; constexpr int32_t AE_DUMP_FILENAME_BUFSIZE_ = 256; class Dump { public: // ================================================================= // Constructors // ================================================================= Dump(ExpManager* exp_m); // ================================================================= // Destructors // ================================================================= virtual ~Dump() {} // ================================================================= // Accessors // ================================================================= // ================================================================= // Public Methods // ================================================================= void write_current_generation_dump(); void write_fitness_total(); void write_secretion_present(); void write_fitness_metabolic(); void write_secreted_amount(); void write_individual_probes(); // ================================================================= // Public Attributes // ================================================================= protected: FILE* current_file; char filename_buffer[AE_DUMP_FILENAME_BUFSIZE_]; // ================================================================= // Forbidden Constructors // ================================================================= Dump(const Dump &model) = delete; // ================================================================= // Protected Methods // ================================================================= // ================================================================= // Protected Attributes // ================================================================= ExpManager* exp_m_; }; // ===================================================================== // Accessors' definitions // ===================================================================== // ===================================================================== // Inline functions' definition // ===================================================================== } // namespace aevol #endif // AEVOL_DUMP_H_ aevol-5.0/src/libaevol/Dna.h0000644000175000017500000001750412724051151012651 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_DNA_H_ #define AEVOL_DNA_H_ // ================================================================= // Includes // ================================================================= #include #include #include #include #include #include #include "ae_enums.h" #include "Mutation.h" #include "PointMutation.h" #include "SmallInsertion.h" #include "SmallDeletion.h" #include "Duplication.h" #include "Deletion.h" #include "Translocation.h" #include "Inversion.h" #include "ae_string.h" #include "JumpingMT.h" namespace aevol { // ================================================================= // Class declarations // ================================================================= class ExpManager; class Individual; class GeneticUnit; class VisAVis; class Rna; class Rna_R; class Dna : public ae_string { public : // ================================================================= // Constructors // ================================================================= Dna() = delete; Dna(const Dna &) = delete; Dna(GeneticUnit* gen_unit, int32_t length, std::shared_ptr prng); Dna(GeneticUnit* gen_unit, const Dna &model); Dna(GeneticUnit* gen_unit, Dna * const parent_dna); Dna(GeneticUnit* gen_unit, char* seq, int32_t length); Dna(GeneticUnit* gen_unit, gzFile backup_file); Dna(GeneticUnit* gen_unit, char* organism_file_name); // ================================================================= // Destructors // ================================================================= virtual ~Dna(); // ================================================================= // Accessors // ================================================================= GeneticUnit* genetic_unit() const { return gen_unit_; } Individual* indiv() const { return indiv_; } // WARNING : creates a new char[...] (up to you to delete it!) char* subsequence(int32_t from, int32_t to, Strand strand) const; // ================================================================= // Public Methods // ================================================================= // Perform all the mutations (local mutations, rearrangements and transfer) int32_t perform_mutations(int32_t parent_id); // Perform all the local mutations (point mutations and indels) int32_t do_small_mutations(); // Perform all the chromosomal rearrangements (duplications, deletions, // translocations and inversions) int32_t do_rearrangements(); int32_t do_rearrangements_with_align(); // Perform all transfer (with insertion and with replacement) int32_t do_transfer(int32_t parent_id); // Perform a single local mutation at a random position PointMutation* do_switch(); SmallInsertion* do_small_insertion(); SmallDeletion* do_small_deletion(); // Perform a single local mutation at a specified position // (useful to replay the evolution) bool do_switch(int32_t pos); bool do_small_insertion(int32_t pos, int16_t nb_insert, char * seq); bool do_small_deletion(int32_t pos, int16_t nb_del); // Perform a single rearrangement at random positions Duplication* do_duplication(); Deletion* do_deletion(); Translocation* do_translocation(); Mutation* do_inter_GU_translocation(); Inversion* do_inversion(); Mutation* do_insertion(const char* seq_to_insert, int32_t seq_length = -1); // Perform a single rearrangement at specified positions bool do_duplication(int32_t pos_1, int32_t pos_2, int32_t pos_3); bool do_deletion(int32_t pos_1, int32_t pos_2); bool do_translocation(int32_t pos_1, int32_t pos_2, int32_t pos_3, int32_t pos_4, bool invert); bool do_inter_GU_translocation(int32_t pos_1, int32_t pos_2, int32_t pos_3, int32_t pos_4, bool invert); bool do_inversion(int32_t pos_1, int32_t pos_2); bool do_insertion(int32_t pos, const char* seq_to_insert, int32_t seq_length); // Perform transfer with the search of alignments Mutation* do_ins_HT(int32_t parent_id); Mutation* do_repl_HT(int32_t parent_id); // Perform a single transfer at specified positions bool do_ins_HT(int32_t pos, const char* seq_to_insert, int32_t seq_length); bool do_repl_HT(int32_t pos1, int32_t pos2, const char* seq_to_insert, int32_t seq_length); GeneticUnit* extract_into_new_GU(int32_t pos_1, int32_t pos_2); GeneticUnit* copy_into_new_GU(int32_t pos_1, int32_t pos_2) const; void insert_GU(GeneticUnit* GU_to_insert, int32_t pos_B, int32_t pos_D, bool invert); VisAVis* search_alignment(Dna* chrom2, int32_t& nb_pairs, AlignmentSense sense); VisAVis* search_alignment_around_positions( Dna* chrom2, int32_t chrom1_pos_1, int32_t chrom1_pos_2, AlignmentSense sense, int8_t& search_sense); // Undergo a specific mutation // useful when we replay the evolution void undergo_this_mutation(const Mutation& mut); void compute_statistical_data(); #ifndef __REGUL static void set_GU(std::vector> rna_list, const GeneticUnit* GU); #else static void set_GU(std::vector> rna_list, const GeneticUnit* GU); #endif protected : // ================================================================= // Protected Methods // ================================================================= void ABCDE_to_ADCBE(int32_t pos_B, int32_t pos_C, int32_t pos_D, int32_t pos_E); void ABCDE_to_ADBpCpE(int32_t pos_B, int32_t pos_C, int32_t pos_D, int32_t pos_E); void ABCDE_to_ACpDpBE(int32_t pos_B, int32_t pos_C, int32_t pos_D, int32_t pos_E); void inter_GU_ABCDE_to_ACDBE(int32_t pos_B, int32_t pos_C, int32_t pos_E); void inter_GU_ABCDE_to_BDCAE(int32_t pos_B, int32_t pos_C, int32_t pos_E); // ================================================================= // Protected Attributes // ================================================================= ExpManager* exp_m_; Individual* indiv_; GeneticUnit* gen_unit_; // Genetic unit which the dna sequence belongs to }; // ===================================================================== // Accessors definitions // ===================================================================== // ===================================================================== // Inline functions' definition // ===================================================================== } // namespace aevol #endif // AEVOL_DNA_H_ aevol-5.0/src/libaevol/JumpPoly.h0000644000175000017500000040127412724051151013727 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_JUMP_POLY_H_ #define AEVOL_JUMP_POLY_H_ namespace aevol { /*! \brief Definition of jumping polynomials for various settings of the Mersenne Twister */ #if SFMT_MEXP == 607 constexpr const char* jump_poly = "2c375358c852082b88bdf47ffe5ac31b6cd4e255a12f271951f250f805d473248be9e75baee81f0474e793983cdc11c198d269b4bd9c34ca9eec3f91cceb172450d9b6001eaa29d97ba1cdb59c50684e"; #elif SFMT_MEXP == 1279 constexpr const char* jump_poly = "d9b26ff41ff79250750aa52e7426726d6ade8b9ee66174636bc772ade2aec8f913f573763a809dbeebac14488a5e04da0adc700e064da0ee470935e771d119eb9f08bfa78a3ac74516f4aa8b7885bf212287c03ab64837e8a56c12a0862adfc9a6d054e372b3ae2e11cd2d3c4a3ea924b6beb11f8f96227c61cf8b528b59565b2c040962d5d24d37cf7a0dee5175ca10e0ac797f8f1a3eb99a319ad15d540996"; #elif SFMT_MEXP == 2281 constexpr const char* jump_poly = "2b1e867bcc6a7adda82c2a26cb38b0ccb7f236848f6c3179e98b5d8b9db21d7df3bfa37941c8fcc0fa42cc4e244503040bad9575e6b0c138d52fe3f83b851495995a561ce64df116fa918b247e3a43817dd77f41115150cf2802c7a511f4e1487798ae3ee0b3cc2e155f82575731dc3bca3a08df85f511179bd7435c9594bd8dc28068d35251820015cd3ef7a23c8d5a1cabb6149a8e36216d4c9838b3ef79d06cb6e2f6e26daef80c2803f11bc03d06f75c2d69f064b72d3abf526961af2510cf688af3f2bfc56e7e4e11286a6302ee21e1109e0f3fbe328d9ad907976fde4aff6e683e3645e275a09a676ce585532bb21bc75bc4eeaf6643df3e886857411eb19bf93be3684689155441a89b32b070dc7af40e4aecaf632fd5cd7925b16af8"; #elif SFMT_MEXP == 4253 constexpr const char* jump_poly = "9da17b7f8b81dd8668afea353420300fc56674207f120d8350c6b565d3a04608ebad52f9826d4f0d30b6547ef0ee6be8bfd85d970ee9d7573c72f44a7a90f2eb86d59528a8146b811407f1b08c61d5e349bda9aac6a04a785ba66736e5160858e123a2d06fdfe59eef6e7093b54da08219a3f179cd2776e4595bce3c72307dc555f3d9485d1f82b2a46dded685d2e200d93584a49eae81b541d2e7eb0a1c3cf8d13ba75119a15e606decbb2067e8a760bd024a3dc2b2c703fae28db65a0fbca2466aa2bac285200cfd1702a9b47b29541ae4375b23734d0ff26254e855ad912e9260713a1d20561457508149557f27d6b5edf5afd4e9d377dac89cadd8d9dd28a3c90eccfd7738a10c3df64346135de4c57a708a7dfd33c28e5a1875b90fc0ee642a7050f974e8b7dc62eceb098a70d1a99158c4ca1d805fb721e4966688a6a0dbf60753baa8ad5e302f8244325b90d5d04bf72e92846141ea44926b141866ee75cf79d2cb944494afb371dc0d74caac434a758823ff05493b219c3c29031520161c84b5ae3c9e0a1451c1e723d7a9c3737e66a289dc18d102c241b28dc0c03ce5ea67253e3540f21477e969716264a6124247bb59b202359b2a371ea4cdc2bffdec81613d9ffb0b8c4ad3bcaeb8c576ede6d67d5629b32cb01d18b4a420de854b97aae9d4e35b3ab04131704eaea7b30a1edf54a11cf9e27df97779b2a86dd5505762c7461c475dec5da0bb2c9d092c792a371ee929788006af05e10ca69c6"; #elif SFMT_MEXP == 11213 constexpr const char* jump_poly = "e1fb174eeaec8c048fdd060653c54c0e59746d6bc66ff4cabbbda5f086d06d3796982a80b6467dde91bcd2922b87732361602b2c5610b8146fda7090b5d82aca1c69d40fa235b4f9b44bfc75bf670d089dae22e63f416d009eda5ec00af694026ff7fa0889f830d1ffd0863785190a8c65ff1baa8f5379451d3964766c7e205aa30c66c33f7734a906f8348e008d5d8f1194625711028a77443c986cb71f19b805c9866afdf2f65aed441faa734749dab56e908d1c8edfcba9b0b65752ad5cdafb4efbb18f3bff49974f26cca3a5ac90f97a714fa0b84124f227b4cde80230911be4493a927dc1125bc055230a25c5affb018214d1a6271f3ee92156e12320014aee4321dd246edddb95c56a11b0adeeac677edf7365698f413c9871070ae258c266ed700ed3b4b83843d13d9b5dd149a31520f484da4ff3a0c6e514ed5158b5fdef19c1cb5c7b00c596c59f7175a90ac9b69141a252221bbbcf56fd60c591e34821f8b8b5453329d0b009d635d329e081906aeb61deaee2250806a12dcc235489337e3ba473df5544c6cfa39b455cdfe840fe555765cd8d93a4d6500ec87d4bb5127af2415b59319a044e0fbc9087db8b541c155f1f2e32f03ea91ec0210de1a829a11ed0ffc00d4e4fc93e9817a709cb3a97ae058c05cd57abdd9bacb0426c57acc52191881040682a92ee2342acc7c76d59490888173dc540a2636b485b231b29c07c9e0dbd1faad61f16833e77d64a286afce616657ff87fc6222c5f1cab7751b86b71444eb4adc38e5dd403002c72cd1c6d2e87f1aba5d2a9a3dabebcd7d01552ba6e960fb19bbf9566a3379dfe87e43defcd496640b838294184cde7ab949402d45c38a5e16a21bc56abad8c4422b882cde3b72a00368505afef747a3397db4b27bacee0fc1e228305bdc25216cb90dde8a0e36913f1bfa7c9a73bdd441c1c70522df14b978eca879f3997b91486e7d1159acaaef8d72fa8467d68017adb5d59012b3f950d60e0bd674766c4d104ff011ea7106a87937dd37b8c46fab7bf3e7120c93f657ce93412b15606506491a6e525cb8d0aa79f4e93e40a8bf06daf835b4efc885ba7e45db506d1d3bc4f7a94b0d0f0780f14d540b67f153a13dfc6ce225ac62ddfd8b09565aafdffd3ad82955715b57b55cf70ae2f75be37cc200b6a23c2e96674d11725ff061b18b4504e2f85894e09bb41d507881740258667670134d6ec1a625a92f5cc77d47a10a6d6ab16de5de03cdf5651133cefcd9742ad0f66b6b9395a3c44bf5b30d10527f8d3d12cca4ff4bf00b677780fae1257f10f2f84be5662fc231ffdb1df65c90ffe5910761f775b491b26fe767fca3c1a5506762f8c47a1f30894c3ec300fa4005b81416962044bf0e233b2687403aa0558c168dcc748f3183a59a295aed59ea945304734ccdc439ddcb15784e522e88fd9c21090869db9e1676e2a94f3314b67a3f8f9b9db3680e93f7fac34f5da727548c629db273a650e330d1e7fdd57896fbc4eb0e0baeae249c13ef22e62568c4ea7e7efa1710c4ee39e7cc2df19d83b46dccf96da7b91002dce4548c296c8dcc2cce50ca6ce170e81ae069e6b3f139afe75e75be15d3a9cf20cdc33066a4b43975ad5e36823f71793a0dee97c9995debd2784aa3ad20a386dc99c943ea9324e85c1a457678e0b8f7708339c2b7e9c5056f01e697e7229131b8238d64c02e43c548c1ee141f8f38ad2c34f9aebdf95cf2e821b5513d29d4d0a892fa83bd969c4feb0794d4d72ef5d9076f664fb3776ef4d6d103cc2870e642e3617a75891bf4ae88046b5fa23f9d74543c09546acece46314c4c39cede5073161ad47682268017e85327c5294a2e2835c5aa782c89741d4b783275a5d023f1679e18ee49415ff1361af6bc89adf4f6a6f52acd8da4a24b5c69623cf88ce71bb4dad9fa293dd6c83a5706e91a06b5da2b45570aee388648ffe385028cec042f3ed3ec042066cd9def7"; #elif SFMT_MEXP == 19937 constexpr const char* jump_poly = "a23d5563c1fff635b7d3687fe879e3d54f7caddb7371f6174fbd8870d7b7db4aedc6a2c671133f72ab011abf5a98910b1024f2e5c1e89722572831d99320b814b252d58f9433ca547804394c69f4ed2b612068320daad25dc1e0bcef4c59deaa0095329c362103eda909c683e0a9b398efc2b69ac74087f0443842ce5c618d4bb58c66b3046dc752a633f040b2be7b32c7e7de01e17f93a10329d9249bb0a9c25bc41f3831c66a255a61904ce209dee70e7448df9aa741d01da9368ff827915b6f5860cdce17ee9c0e462fdb983709229b4e011796e425d5c0c42079bdae36dcda37603310dbad7b9ec04f9716b95a541350d6df4e62fe62dfcdd185fe90a139c3a56f66be753bfabfa80bb3d52b59c9d1ac03ab01449829dca1fc0a01bdd7c1c9ff22fcfcef818158a3eeb5d4b7eb237e14e781046a5257119651c00aaa6957da10c8490826eed8103192d97d2743f6221e748e29bd7589e1a716f0047cd990230f4d72a0505fc22b48657f56461285b019856c01ed37e3c3f33cad5aee8693c07d0982333d5d19661e74d0f0a0e1f27817abe25aaec92f028d5c082a4ee9038596c7272d6775933b13b516535f0892fe3de01ade7430687be70909c612a8837be4f702165d905ddc005e183a3147a179d6a07e6296a7c36175fb6cdcf725314f77f9d6d96e09d2129a1fc013618033a89352e9388aa7c6ce8da20ed2127e9755789060f1a8a718c1c9474ca379a7a1e916145a173680b78691186ae7a8217a6a918ff612e4763dc9464c98cf82980ceea52dd40fdcea3bc63cbf0acf577495f7ee78a01736ac4532877a5a5adb65af2016b925cc7f60ce45a6aa05db46154d46f9d1ba5f867a94c8fb5b59bf802aafe09b31f94342ea5363e4e7b62f3ee05a588a7b748e39ada7a3168139f6f426860a59a0d6237377a385531a25c0c34b20770ca28589357c92cd5a480f1895a19595e9164f0adb1edbdcfcf3056a2c0e7c8ecd1f1862858239074f49f0b5cec86c71da5371682583a7a3543024946be138e29dc17458e4807c7666503d347e1e0c30d5ae0665d0fcf0ef7379db17c7f4e71258b3f1040ed17496b6549c2e8daa2f95f597ebd88e63e4f58bd9fb6308b3e6f644b33855646c559ceb1fbacab511fbb5073e457a8f10adb16ea6909267e267fc4de62489a71dad8e30164a4a932d07471f2c71836313d8d3a8acfa5fb1aff504ce2e5eb84a06a2a1a402e2f76e300d31b8f92595ab92c724ec1b78d6e80564534f835f05ec931a39bdcc45b29ba8aa44508404bec50d7eac6c03e4c0b9c87ef987c0158f9da3e0116e82ef8004a59a255864c11e3b77756e98947056f1a343e3ac250d544e0d3827d98ca4d6bdedc4605699a2635aa9ea0cf665045b44370f2bf42345cd024d8937457f7263ba26a637f9c3b6f51b4d117a8e2251619d2880c006d34a96273adccbd0cfbf7aa9a769f828cb0641e7d22774b9ecd3f72f3e382b899ccd4e11c31810374172f77ccb3b51f972e9ca26d953a1fce6fe51ad169a1f98f798a49a3825a9ca98bb8d82c48c3cc05a317555a0adc7271e35c14afe06f1217d986d3a5f27b6b6829c3b46b918a72d93783b8df2e33de27c62d5d0a8198687f0c7b2c7285be165fefea6eed24bc4b284ce286cf1e617210fbb5bc403ae3981bc11711c1d291d828c54a6e4087d437dc810d28943e902e673ba7653a0d60d6df420496b57ded084d594e3d43678d4374e81c4616f81261f39c053126c17f5bdb6409d29623bb0aecdce335571dde95b23ec145b5c663aa9a1dd749beafafdabfea1ee05d18ef0f9b0390b2909527e4b010d5a8c18133825ffc7c69fa3879b952498066a0a2de1aca65e753d6891cff04050005c29ccf5f5a293b8910fac6f2f660a3061f8922b21bc4cd3df550abca3805feb2b5c7acbda10579dc90c374b31b619472a004851262d9813193bd01cee9503ce444aefab6f07fbe80a0ef08e62d096581582845b2700824ea65b410dd7a9a6a630f6443d4b8d7d0428cb362b913e1ef380b91a4e9f58b7d97a28d2b704a3c7f8bd228c29b514eddb81b433f30242f61a4b3886b3e19ca8ea8ecccb7981a48e35009acfe59026b1014457b25af997bb4f0cf6c02d7288f21f73981f7e3d13a453d31e59b3d8bb276a8b3215c4aeb0d8b175c98737c5ec5ab482d2161783e22b1fa05e49f5b467cf1803c6bd727cd413c907a3f7ca1cf44b66934dbd1aae65bc496bcd9f935d242e3e46346781ee800afbb6c51d2e5caf6143a8bae08b8144a46adbd03fae129096e3046d907084b23d60ee7bca6557bd9601b6cc3a74aa0c8fd5cd7f4e8fd8d2e274b47d308d35909b127e5a0d728bd35e07fb89af8cc1ecf1fcdf30efdce59dd3805e31667da92341bfe23c95a999da84b15a3bd502e692648154093c16191d2ff5a807ba60e71c2cdc3e13d3ffcb221ef064eedf841ac21946bebc8dc7e3d511d8b2a25d3724d4edcf47dd6dcdb87baaa6957610251b3b84e356ff1d6d58c44555ed278866d7fc6d86e3b32e377adf618e522dc84d840225e05c3586fad0706ccef54e86aac4ad5fade89354fb90ebb46a33cc79c31b416686ee9f784eb3f2404035e2b478d094e6fbde9b19c3ca9cf45c782ad318b61ffb1efaed4edbd9e2f9697ed4db2b3d32d81e7239adfba19cf5c3faf405984de7f2d4957d231c96babfc53f47644593df18a1c438b03d25722be9633018087289469040a5f9c4dede3880a96cd08a75a21e13a7a6dfbc7e48318b2666d52b2263422eac92afe8543a0691ce33a8404cbb99b0006f29d5a0bcb95bd75051813958fd0fa4e61e93633b67d272e8cb1de0ed030cedf0223e18990c9c7e7819696cd9aa53bb84d1f0647d28ea798edc08e671ba30249a96cb4234e42ac3dd6e12472061c024fe5a6c178e9aeccc09f7e89195d34fa17822f901c886fc99ec9ce9843f444a43fc640218ae56c94eb68bfbe0053e9c290bc151c1b6f7a38b21067aca34bdcf00778a10bcafe8d4ac811668b8788a48dbe139f29de1e044bc8c83fbbd4eafc8c33d6797175da24f18bfd06032c37ff7a93cfbba1cad6761d672ade73096b556d4d7432436c186f65abebdca45cc27e99e37651b53ec8561018e40a20fdea434687d0a61b2160be096d3a9d97a9ec3d6c7a6794e70b64cc6194b8649126f192ecadc553daa84262617550c1b78e67bf8ff6c1a5d4eec82c9ae414348a61c9c812b80efb977c5451192bdeb27a47fa1ec1f98acaff71f4d399f50ac567b08477fb140d8505c9097d9c4e9f16d702cfebf9bbad9ff22d4796719babbb4cf95c1ae831e5000b68e154f388567c5ca95f56a3e20547db2426619e5a48883dd55af44c8e9ca3cb3a6f26fb0d272b69f0f537271618bb77a385d2f153d834077dca863f8ef6a705ea296fbea1e669c1aa1c45dd9161a806f9aa053784b734e93ec3a2beb7f910ccf67165aadda29e67096be9cacbafb85740932997f147649dd9cacff18562e1b774f4cd5941ad7"; #elif SFMT_MEXP == 44497 constexpr const char* jump_poly = "6caad9646010c6e030ad6486ede1d7e2d0d9122a99553188d1972357e0eeeb500586646c540a925f430cbfef2ec953b259bc21128bc82e8e3fdd29310fc07e48578b710f4002a6bc178b59dbbab4e2d999c2ad41844859541c857e4efb86f1b66ffce0d43aa66a041ec2b48ec669cca2fb86abac00cb2e8323bf3977d0bbb2c7c711b4bed35578d7b8bfb6cd0698ca5112785bd5e94604c825e3a268cf5e83d30cf2f587d5267e7938053291e837ddfa99baa243aa39ea065f893854ff28987163ae1aa0b4c1cfa186c8046add5844d345401f8a56e0b4240484551f0431da0620cbbd33bd9cab2c83304c0df8f0fb53ace27af8ae2063b008f45a4d181ec3c618489ba2e6d6ff9cb200b74743a76d48dc7a93f92ac9987f8b551501958f86985e149f08a63d402d4d2d83cb313e60d88ed6c592dc03ec23f30d2846f29f6baa5d6422b2b0ba1120d939475300d191c67f886ed88a2453e553c4d6165b994fcf08c0d26bb5ce7063bfef50d9cc60fcd5eaf1c21d86acc26595d019bd448a3dc9bfc19216619db9eae34497f06473c5452687620790e093479b4fe780fa6373e72cf84df297c58ee53959c666376c86d863070efbd63f0e7b6fcfab07e2723e3ea9e3de5e1a0c99e58fd0a96066dfd7199ff48b304943655aa7a08222b84d9f5609fcb2f0108cd1aed86aefa9070a46380bfcdfa8a4d522500861446c4817984c165da297e235d41ad75ccbe1e03a8b0932fa588d3ad10244f07cfb8e7c7e3bde230c8d7795975f70ebf0e72a6c1faa6afbb7f19121e9796b48e13a6b0c0a20ccef3f2819e67c9e50bb9b8a11599927b52663eb01be5906d5c5b4a083d35919553f89e68f7ad67038e1d11b230c1ac60526c142deda850aee0fa2dc28e2f4b3fa6d84220b4c4d2521dc571a2bc667b4a1ce6faf013fca0fdf226437dc3f6701d705747a09696ba79f158864b997aeb46a6b76079c5cb48329873cd3e5073d7cab25b5d461fa14f63ea2f4470445977467969bae5ae2fe180a16d663f9fd77501fd944da68b5f6e6ea16d50d77a357e35958ce693cc5998401542e62026087755a2023b2f1822841d117ee6c6bee7d216c6d5e3c34aa2e2d58259e39973d206a9f5a11dbb0248d98a83161c37b578797412a00b218511a3bc6c1b85b74254bafec4242fb3b6118175952b8240d1d42e70dee240b219a0880ba0b230783e8e10f2f3ddd5e14edce7ef68cc4050dfa84c85af24d980e15386e3bd675f75bbe64ec03918c282bcd78ac309d938b35dfa483a47f6584989021d73c587f4a51d61d91d24468049ae0fa2186a1ead3a3eac066b68d3fc94bbc4f43a3cb94a6e692a6c4747d2ef95d7827d81a3abbbd70b7306385a33208c702c050afa8e0aac334c8f048602448be9dcd89f7b5af1ad83b0a102c95a84060b04ba451f875589a7d0a9c13e50cc058c9c57c0386f9a8cd68d9753cc7424d8e1555e0d45de799f551f320e2c523ab5317bf5b5f54b7320e0f6f1bb5be29175013a68e6ef33280a042bf6b37a4143193926c24529901030dbcdcf25eb78d827dd388d362c4d1dd9b19f2c932db9fa23381adad589b89b4f4f75330a0066a8e3770d894a7f91a01901270311009467b6991d036fff42f3a6eab0e6228a641e914c237f989b9f088d6eeb981fd90fa7c682d81fe164742c9f33e7b359d2bd7282cf63fc464591dec41529678c5e75ca71494ce35723bbfccde9ffa6544cfc8c3f616461f64db8cecd8a755d3f9870b5e344eb72216bdeca7f2842f18c9b3f86e803747ed395e3bff3d4c7adf7c2a7152cbb7b63fb8ccb5c610345669a81dd6faebfb6f90aa9967ccf527d16cb34e184df9b1e76c4cecf1b4944144868f1d02095735b75c1439241284b14199e1ba3d70a7fbe30e5da972843e07a5064ccecd768714959f270afe8c7098a54814cdc7c6798f95d5209e692e12491429614426c84d5f33d24175210b87511f346d6d67fb2178009f0797656716653ef0aca961cc6dc35e20315d68fe366a4720ee511a062bca11e1885d5f9db804097cb73ee52602138588bd9251ee304b88dd8dcfc1f0e108ab5bb9305689f335af29c35a713be47acafecfa0db95680df6e0b1ff1217b6fe4054eceadd95ec370c8cdbba5ba6dcbf360567f557783a01a2cc37cd63ff390e313dcaf2887b8f374c78862a316737b44a5c3ef528e0fad177c1cf6ddd1ce34f41d5274fc03e7f55fa108c8724b5c497d58856995454780f013285e71e32338c1482578f878610be1576ddb97ba95e3b9cbe46f049399c128b3346a710d34a3d12f172dd94f7cb01ee060b664c8bebd06638a103c256a3383cf4581d9a71bebd3a1b926686e11ffae27beaff3801fef3d77c750017e8c7176cfc5ea7a984f8309d15e49e551fadbe646947cd9a288b709f6e48b3614d42364a8f0d73330ccc96190204b12f33771822152cca986621e920014870f91fab5d445f947ee47455cdda9c14cc4c728ce01ad2c3725177c5eb49bed09d8a23a9449bbd8abe158c372db81d6bdb3f21e38a0464d099896d3e053b402391ebcbd12da093e5297ff098813f290ffd0056d7a0209244144e04ec568e2eaf8c9970c3217d0fd5d571c11219a4af0d41cc8bbdbc208e28eb71ee628909d3bc962554782271b281289ef851fc2fdab974ccf36f6cc2d2b9a3833ce706047c096b74b41483c190a62e8f2d8a2f09149bf7de80b3349347d3eb9fb446dc50c2bd66d0d4216de4d7499ee9403841d8c541d541816ba731b5ea694c087735062ae86efd6afcab9f00c6fc7a3a4a58ea31ada015743b22f3cf513f36c79405d928492d3d71129ab72c1790bc5bc0c4478dcde93768ce618eac0778c906e2a1d9839ebe6039394f48479f3546e04cd90c053701f89455cdcf15915c679af2e3079d34fc30df422cc07c1e0338f745c9eff8651cdff8cdb9e62890597842212a67c759d7300c79370f29cb49c38a2e44e96a7e8143e2c092441469b6c28dd0e2d06a31b0810bc2bd630548106d7d77bb16bc6ff8ae66c8bff07bac5e9911c10203f278d4e491abfc6cd77c151b84c703f578340f1eca31e9b12c02319f160f883bf4a6fdceedd77d1da6f91996824abb6944c1894b46af9ca3835375ea2b230484cfc9510c80b68054ceb5ae3a2da0c848b5c122dd1dc0ec8bc72199feb82e8130d88c8509d453566c5c0c3c3abeada5f7d399accac6290e3c55430f091c0db390e9dc28c7d53f391dc074cb5cb35aad6f13d4bbe01f4070c8ed235ecb93094685e5d632240e7cbdef7478845cc1b375f011773440e308c55533d3908bf7c2b4a2124c7fcfbc21160b14f7f774a393f6c6d20b5bc11b0e7029ebca0c72f5d219de4baffa3de1e4c49ecfd1a04bef1b0b1f1f4835f3a56f0aa8fdd0cc64d41edde62b5d8d0c5482097a32f47967168dc1c192aeee73954caeef751654a1541e04c534d201672beaab587080c7cb35b2106bd983f5da25266a3370093877f8664f207687e4c5964b9a347b25455d438995057432abc6e34a0c2bca64f1bb440c143db8ec04baf7073097ea7b9b53e794a626f66a26d0073c702fe52df3fdac89d45255d89a7a0d57384723ccd04a741ffb9c294a03afb47e7b3cc097f6c90a4602c7af7ad9439b73f4b797344e425648e20ca0eb2bb6df14bb13498685dd175c3af23686345caf99cc3d7150adc37a4e4a468bc622aebce6032f0bfdeb3114e37802ac95878f75d2a130745092212b494ade5cbc22f8953fbbf1e8317356bd3f893a7391f69ee4b4e9e5400474ed220319844ef0cfbc954f4c674b146c858e97d26882d44dad9417654aaeb0c1c05073575c743df17831cef24e1218a002831c34ff3ea2cec44581532022ba77fb0976c86d6297b16fab26de7f2fe47b18150bdab5384dcc131ea19cbe6d788f9555ea4dcd44a6bf8e857d3edab7ec888d4dc2dbbbb4d14bac32f509600a200c831f4e0a01671221f7a02aaecfdc5523e1569ce021c3f3ba45bfa48a2ff2068bb5ca75029f59cc431a824b038b2cfa00ed28bda882da84c43759f9d05c15c8c959eaf711bab8da7c46a6ee370e001f9a8610f41431d57632bb7cb8f8440b8265e87c1a5a6dff13e8e5f84843d7d6a9d204042251d91e99b532ce3795a4450266e913fa6fac460261204fd9b33419a992208bf9f3f6511752533eff3fd3dec51bfab5fd82db2103942060ee439f40914bf9d4e02b8a2786daa9e02a9ed12995d898074c4e4575b979e28e1daed08b4c914caa90407530b590bba5e19120601a2f3fb70e3f6739e2ef68e8927b5778ee5400ff65e174626063328c86183db7ddeda2d403c6fee16387ee224740613d320c97fb24e9a2b3432e771a361fedab1b61423ef40d64fbfdea7f4e66d8adca2ae6134ac85eaa1799d8a6dfe290825c04741467b606f768269c6877b2df87294849e9da9534fa5023815cdb34c67ed4b1e7c87080b9712d4f1fc42bdc01cf9009573594188bb8715d02e8c89fe5e27677e9b9384f2d1743679c751f443954be0eac01d058dd49a18b19fb735bfecf67d830c5e79fa3191e770f422e26a55be3c866ccf94c614e2d06fd97b09598f750ff78714816b67bc561978f688a7ef7dbf8e1bb67a39a6a2598da50610704aa6f6df46a428fff867f332f5f84bb899f0e934f2d7fe6ed641264763e4480cf0fabdc973af34307e1d583edd01a386fac836e578a7809747930c7bb5ff7e0715ca850f8045c77d1de34308547371da0bf8ff40cd056c38a20561c9a3511051412bc3808aef360ebbc5b36a3a2ab7d60c3a1152fec4b82f5ebe1935bc5fe63592392f01753b0610b8892cb6223456ff020e4225a4f4ff2959ed2189a0bbd41edcbafe8107ab96be7a8c084d3aabe959c101b568c68a0e86e0e51311eb09c6b62837fb46d1bf9ec264e6c1a6d15b3cafc920dcccf4b11295ffc0202d22a1b869c626f1b330b54c64d1b76c91ada174b1fec4c12beeb913903c44a1cb69a92381db3c4c30fdd2140e8c1a1cb2910c4e6f9eb0df346895d5f521def06d1ea8fcfcb7ffb90687a3cf0d10d578567c70f934ae26c9f5adda6613b7b08cd64f308a7bf17c803cbf8301902b9a077d255c3007791b3464b98ad020d4212dd2d402d685224034e097243bfb8dc603c308033812a10edc2db95324d7fe6c586583d33e0c095f0877bf02e1f5ce521600374b1b18926819b0a1dfed2a49bdaf40d619dd30ab15651b07a456419e30310921029899426b367d377de0ce1d60f4e684d8cb8129d14c40d62e505a35dd686ff9dee950b830e7187f9ddd1dba5b7dfaf8360358b7ed1a3c8834751cc6baa18d8e1351840fcad13bb9cb097c14e153a81c042f23b3b1ab91de4d0c484f71b00f03ac2d7d04da4b0cb4ba699a40fe52f90ca1bddcada1aa2e2bc2ac01d557c5f0182ba31a04e3a7b78b3ff63792c384dbe8389af0ed90c2bd3d46026b2f2b74cf883006deec89bbc15a5a61cec0d95b3f4b189b0720ef74143e0a6a86dea0f9bef46607aebbca2deb8c737eae143082b5aed7622d2da4af8ec55ac7d4e27cf5f577dc08f962f2ba5b09ddfc179ee47f249259c33219468fc295e7ce66d7bf588c4e98ce594fb563ac796a2a61c3163c1ef194627fa8a423b5c62d70f155cbdce1cc3a642299d773f791540acef1ce9fefd40601caf8b4cb070fd60d1be926d2808bbe73bb7c1e8de216f17780e2c390a7d371c7a1e0ff7c193bd7ffc5828233e2aba4c38a15184e807c70cbab91ff14f19cacc2c1abc00c57bfec032ebf77189a767d852510c43554dc08e52a2ebc8b5554f05a9655b5e2c86d24ddf82e16e9aa1455635a759c70c7f6ecc7fdeb92fc18a6420a347062e10daa45a52ffa355d20dbec1324109a56eb48e8a0c65a4064f44e64d3013f44b3b77e35b4024058e6c704b9a3b3c5f20108445639f8fb9664ebe38af4459d18fc150648da1bc08581303c6820d57acb368d0e7c5f3358e7fc3da31b75e29b70e4ce0f2fe00bc48494b6a71e855156372cba5f85d26598a5b9b87034b4cbbf9703fea767979592c05780d4f578dfd057c7bc2616316c0eabd9bc4348f0fe2efe0127a52608f1c9fe371499f73503d6acad078f315a068b737ee306699b07701964d15276d1399829731daf970889a09a0d0f95884df708c94721176386f4f61b34d55f891ee95c6fc1943c729aae22739b87d0493c50c4ee06b186ad4915d8849a05336111e8b679f6605184d6023c796aacbc30c9bc1c3c7a4bd1c0addfd5b4283184f7617f826397cd8907d524fb8b7f7b3cdcffa15ea1497dead96a4a574410309ab0468fa6a2ff68af7bbda6a1cdd5a29959ddb454f35604d6ce1eee809935a60b009ea85db057c24e5cae2647c3050db04b2a840cfbafd8d01b4cc79d37ed81d11bba99101b7a184d0951f2f8d67b4ba8ea1b1eaabd336ad9a330ae45c9854c8879d9135bf0eb532877184eaf6c76b37ee679ad395aefc6c0837afab6025eeca505304f8a76985fdd5eb6d088899b21b12a27a9c2f9d4fc202a2c2a5444ea99153fae663ebc344691ddab0cf2f24ab88dfa827006a0e44cfa12f8e656300e6b8881efbe19d9c64784eb7d0ef9ddf45b3846c2a73e97096557c63787e95302c726fcf43c03a3e16b8993e6b43ffc56679f8b701fbe5a06e3760d2e5026f85e6c245d210ca1b9075f6d71f254e706dd576f4fd29101a7db682fa90826cfb58d56bf2fd1c35894c1fa63db637e314e7e00e9cce30b0471601ae787ae60936dd65c9250cbbf05c227829a9196c1d78886aa1fd017a79748e3e16b239417d96a21130cb2f4415feccd310ae276b8bffa85386f4c9be04ff40443a96530892e6644dbbeb7d263e12834aaf9d1da071ccbf0c3f11490960088ed6c10d8571130f7bf9488c3e6c4e8294d96786543aaaa2b7f729b0dace38247b802861a9562f3b6ba38f301bffeda1858c2b0f0152326bb704acf1a3ef217e71665331d7126d841edbee3d2759c1fc7009c6f7e6ed3f677048065788e7a1065d1b8b3152dda8151f1be395a469016bb84e7a13f22d4adb0cfbfb6dfbf3fa36704b56d3b5fd38da1a138ff20666175260abb51bddafdd212891b3fd2111833473a3a53ab9de69ba6e59ff78a1c1149eb7a9ea74dacdea7d6f4b11466dcdac73cda258053bd338a6628be9c51f0e4eaa73c171978d0e9a8a42aa732498bb07190174ed8d53cfe633b9d0db21df231efa314317f8eb1084124d412ca609ff3930ee23ce7302b12e09debf3de83b23db0877495e71216cec52309cf884e11e88695a17b7f60560958d68147d8a4910e08da8019bf26e47213a598a436032c373080abb070d181f9d55c30b7539c45dff71bf0e2ca3c0afdd0c1dbe00a52fbc8bbaafa7c506848d9d2d5160fbe1c592acaf0f9e6cc390bb101079b12a618f4245c3b6d4514f8989ac04cb828555362cf9fc82e69d2157ce52bbd8facb033f34db8ddf7a5bb17cd3a57955068b9ec2c6a2b8e08e6f0acc8bb96f6148223941a34f0be4e7579bd5e7a174eead9f12c098473333397270629b0171492932906c46e691aba5d85f394e897340b0f71f079b45d1cceadd210fcc6c6a4e4882ef71d8190a1b8c28b3c5ca147cc5bce1ef2b84207a61d91e810d037b05a5043cc2f98e974dc6265880205a6dfb47d5ff17b91adfa7ca009e1d44094563fa84281026ea4530ba270bb51ef0de80cd9395bf80bfdaaf202c883e6a0f13e356b6d1201befa7cfa19abe2e58ee490553e4fd8a1d927e1aeb1ff479614aaf9aefa5f0073457ff4f8f98f238aa40367fdffb799dcdb59b3e55d2b976ff3daf46661ef00f641718ca6af830ef3d18d58427f2"; #elif SFMT_MEXP == 86243 constexpr const char* jump_poly = "933da3fcceeb5ce9c3b6f2eea0dda398900240ba716aef34723cf6d7417c4318858493833a3cbb3d094d1b5b977c7a87105827de0ac72d586ef73bd385022eb28e52f3ac527785bede4fda45a0f320de350efecae3a0553e56f4aab32e02124bf83b07f989d2b37fbc4b45c994ccd03f909a83e08c7458a8bc79dc5eda62b7667ea1acf094b636e81119b9a9ec0ddadb9c3433de8d0516d456b529e9fa08382f030c411dfa02a7adaf9a16ce5193f0a17b673d4c5f32b296b21a3af5bdc6da5f4043d34599b04c55ac6f0d4f4dc28ea46101bfa35219d2b79a33cfeb9612bfbcd761925e2363d39144c2efd144a1f05d613fa698b496a1106d6220971386c0055b27627885fc02e14b5da1574015dc10a430c04c99eada982b27134ab35d208335ae903f29a9a28e6f6b7c89038c665bad420f9a9d9fa4de757dcf0059e55f70d189f259064f842a059bf4cf50a54dacbc3c46e2e3e948c3ba79378b39dabc6955359c0c8b5a08009d89567f38d3eaa66c323d1a67cb310e306101ec9ac2f6140823976dd3ab8efd9d85130bb993523878d908bf53c41066b138e801a61ac3e4692ba3a79a1f6eaefada0a95651c65059b7465414f285847d6e6ce10096c0a16f048549adcbf03305e94c11321290d84aa2fa70b91e8fb888e9a8a6c1c8c096c3cf34b41ba304deef152beb1f52090c73ce23910960fc486c7cf3f84ae361ca4a37c53a9255777356c9535f152744e27d20547a6c084b6ce398fd05e1db7b66c16d83b4702b2f181dfe39b4d0e84c6806e537ecd3e01a5c21bd22fe64cdf56e3b6e55bfe7e13c2d71e59c7d66755ed9e60b6fda28043e0ab87e5c04acf84d1f81b53d91599fdb0d65c1ffdb2f9f6271e83b637a6f35572028ed18a01eae10e8f6d54c49bd8e2f21157f5cc63aa90045896351e083ac226cb0b7b3cacc83e2279c3b7077fb7acac673d7b3b617ba386253191a556e29a7fb0be11becb27730c99f440208189764717ba4431af1567fd8a1e8eafde6de886b747a7a44d0bb6d15efbb80017913cf20e32f213e16d1bae08c3b2a28208f3654643f39e78628887d6cb4805a90e6a4852ff2d54c46e9ace0d6a8cb96fb6a90262c04fd755468569f54c0df4604dca1ffcc9f1d9f4732a2b7a7c68eb6ef73fc9712fac511332835627fcbaa32bb2071eb7332f0c2588874a8a610a8354c3b126c1c0f0d1f5d241d0c2f4067fe8dd305731300bfdbdde349b1d7e0c10c922c8caa8ea52fbfef1c87be00ebc5ea0876135c2243f0c07371ad40c27df30974d4d7ff84f55898e1e4bbc6c8858b5e48a45b64326b870e27db9971cdc34ec00ec76ac8cd55fe7bb760d34f0390a89ef54cb9e882f4eec29a2fcacc56e09680ca3cd44c4e8828bc8026e5e795304fb63b5cfbcbe7f73398cb796f685b4855554bea8a097c99771766193c1d943974c8c3d371bf6d4490707961e067195540c4c78283a58c7ece961f16e8286c11fb3bc0c9717382bbe7ffee55a89b11e181c46e67f71f340c0f002ae161355bcd1c2b8187e2c7474b47ae60919840c1119cad99478e81a6735486be692d7a5b9ce25d5f53b53d311a5074bbccd1d0ba93fa065765daf3e0406824821ee345faddefc9b0aa95b7640ae20c38e840880b2d4cb18cb290406ba6d97885ddad609ca0a752fdd08563118b3107e2483c6ebd0fee5ff850dc9548373124b8818bd59be7dedd231919a3654e5fe4b7188c812fbbb6edd7cb0dd4e3f567bb8bbba201ea19fe6cbd4bf66ed76b24cdd7c68e896d48f6fcadb01802b4826df1d05bf548c7ae237a0b594a65a8af45caf9d18ec4c7a67fe87d93cda663783da274a852d7fd82403b3f1dbfb786ee20b20ff29537b408ca288c5daf4f002edceb058af10df710e46472616934a2eb67efe70873b504a4244c3ab52eba5d7780a67cdd84f42482be2ed4b7cbee70df6a84bb22b65b11457badffd7608dc92d9694c1136560b0657699878e69b2b787de0bd61894131910aca33a3eb0d26a93bec963f5b482ff04af0190702e028609dccbc1926c4c05052c06cd136d3e5f371a47c37d7281738bb0be5e3fdd48cd77262471ad2d7fae6b3d0262ae3b037670ceef42b4da06374890ff53e95aa944a64006959e46f7227e764df2bff29d5f88e1bb3cf0e2da8ae1df99285c10e6a45ef1f1108c664865d7d6a0a455a8a01f53a5f4aabf38ae259809091d285b4f6c17b19ec31b25cf59769f559022921d5ba972fe4da330ab8f0cb73fe63af38a74590409d4cbdcb64f3fc2a41ee769c5532e808d88c6ad0687d7969d480efec6d7b79692d9db41afabdeca664723c41bda1c51dcc6b36b77fcbd4134132c192112b12ef6757e730bb11127a6dfdf1d875d5546da19e9e2310a49aaec765b6df77a9afb36214fe552dce4d2c52f3b1539c3b21c27aa1e47c9872ec2f575536da458127409ad126f4c2927cb45bc7d328f74739e786a0a09e54582e59ad1fc8c02a87fe4426bf91e1ac8114a991b4c38a6586ccd93d4a9b5bcf21c0ffc27c0d8050694e398aad11400afd7e87eaf04c2494c6009e71fd12ce315bbddc69023daf5823440139de4db0314c460e8311248221c8a0650056dec507ce2f4a04a96e8ff9d6b493d91d1a70b6bdf5d53dd2b4cae372b2c6361ccbb41e3aff2e385d9e93b9d5b68101c2cf1f9d6efe3fcaa6d5eb1fa0c734ea4ee7308649f53ee6e45609f9ac5c3e2716d5473ec5996312316bad007e254bb71087d760ea8e594830e01da3f9ab07f3da4a96021ef234c6f6b995c9bb20639a709d069b6a89b0dcefac4751610ddf05fa795b689c7d7323da19f25e9bc205610d3fbdbbb6804f45daec7af60b73b946af3d902e067305e001e92efd42597ebe45dd0ec9988a555a0b0a06114319f3cf792d46b341b0ba73a42b345ed9b9a5735c6ec10ed425256c11e52c49c5d1a09846361b406541122e6b6967071ea798bca3184c2b2ff9d4e99c9a6beb9bf797665d70e2d9b01e1066db3ef89836267861ddfe61ece8520a911dbf460cbbb08e10b2b1b617bb824403222a01090290a04063d9acce34209a5c3b5a5ff1ac7a01a56a42b23e0d03be99b34016706ed4458c294a72422f4d380a1a516d6679192fd14f284e505a4aa3b48931e2469bcf337f7a60612e8b46db66f951a02a71bb4ba8c554edf1e685bf1351f4a314f941ba45ed049beb650132a1141ec6052814813de5bbec8ac87d711605b30a536910de5ff0fbc3153c893da525774608484338b7b43aae4e744fdf25d1101a59e4a1d43924e54527c041542307f7179c44c1b8429af42a5d494df4b38521763706a9e6bd0aa867902e25d792b9dcc442710f7b70c5d793e6c2660878c8c15a12da82992f836bd742456cfcda30e7ccc84d2447959f0b6210bbcc428a6b33f5254d11e3fac4ee53939e072a33748d42beb24bd13f19ef0034f5013c3c8961b733791848ab0bbb5b88fa06a12c55b0e8f5be8a10bfd37b7e65223e658006001b4da32ed7dca264b657188a8c694fe6fcb6e6064e821e6808859aef0bb35678ccc29127ed7d74fa850f98d5f07920b7c8143fc838ba7dbbd8c4832268678911456b6c72eac0c5ab99fa263d92dfca65a2503cdfa948e3e48223f70597040b73e8bf14534e880fd0e5d8c6e278838870a58a04eb0962f6783587d5d9741f4bd26ef8aab723a2077a059669242adb84d1f80536dc33687132e0fccbb1edb8d314de1e793f4e851aa609eaf59ac05d99b126fb6a782f67eb6a8b854c98651d03a4ece157c782e02b6ff118c4157b44ac7b1e1b76a50bdc067bebe779505a8fc86691becd07a2a34f3d526d89c221e1d52be0df947599d292b289a4d869aca01268fe80a2db201b0b49c36ec99735b8893257c64400edd3707dcfd4c01b7d7f4fbb8d8ee08b3620eeee032e42af32bda8d4ec026da77101671c897bdd58bf709e823bb02a2dad0d744dc93e9669e97a06c3ce73df80432149d0337e1792846d273934b1fad277ac9233bcfef425d53e9e757d793af2babcfdc05700eea266ea61c7f13260c124fa66e7db7bd337c459a2649cd94af8dade401a95dcd7417aed5dfe2cd83e9eaa29467f560d8d9b63b082c412689cb57e91cad2aceb0fbbb9b8ac2506b396791032ad00e33ba5e89e9b55467d5bbdb51ce59dfe061c239e7369141aea59fa9694ab74b8e5d025d6854941ab3a19e998c1b7f468a58cad9b3bdb6d29b2aaed4e58aad4942a707b4bfed362ed6e4b88a0c068c1516644df74e300b9c79b8bf03b07ff25e44cbdaa6c3bb430bee090cce4eaff0ae54b2695464d2cdba60408b084385e31389d652b3dc5f3a480ccea21bd34474528401f42936b52e4b6ed7a0de284018a4c9272e3126f333d0a7eebf7127962dc776fd952c6e4a260868cb953958e86d9bce70a85729583581528f50efd537fb48badb8461f2d1a2092eb939ce46be0be1dd6f8ced266f11703b0fdddd00568afa2183fd8d8449bc4a75c1bcd74b5dc27aa6fc87236382cb750e397893f1f1398382dfc165ab82cb00126764ba00f96950e5e39f43596fab826fbcd10acefee70e47f554679098f9ba1de6eaf777016b27e66c90589fc692bf406b4ed6860fbeffcb7939e1df7ecb3156aa6ec711f8f4d83b20e38d5e563306373296907184b02f0d436d28bd5cb045a67020a79553f4c953d07aa1618bd579725692ea6fc7adc31915f9be89f82ff6ea1b96ad30318753279c9681f44b2f086ba12382bb42b4b7ca552c426eceea0726f26bcfb71164e984f084563cedace82907cb47e61ad9deae8ad70078236d009a9b08079a28e452f9ac25e992aab9b718a8335d8f81a1679c54771f2a7b7de253b3f02a80d73eb9d49cd5a5f2cfa852bea7fd111c21f356f06e56a503c9b2111fc33ba355489baff1ad1eb131f627c4a696aea2db3edb18f00702871d83d062a24d1be0f652269086621734c4a7da9d34341ad05cd8c3d57d243ac9c085e2b7514027304a1b74be458d156c8508b7976e26f6af868a3f540e6513413804f008dbccb39937caf87b1084d791677f65bf077e602a43e419c46d0f06bf6ccc137408541dc6d477b451fe76bfa3e5a83e8161b2054c2771a26298b3679a730381e267a592fbdf76a982c4c2f214aed369fbf5d0f0e31c550122e09e4227e8857576e09edab1a3483f28109bbb9a0408edec12c077d49d93350216877ec8e853aafa3207bb0a798fe2489253029d402c46468a91d93d3d09e767fc2ec3740c690a8e649b9c9a958477a5ea6daba15bb56b83bcdf40727991fc95e2e5834822665ae5cfd2dbaf95bb3b05fa6ed873c3a8dc6e065ef589ce06515b946391f659337d7625c6870b48d7490dc404f3dfaeef407a928a2bf967df03a428febd55278ead920ffba4a1dfe38629b2f73fff881b56b261e2ba4086e29ad793242a780a05b78d980762790a5fa59866c166595f6008acdcd1e41a0e987419ee81da9eb17d7545da1db9529a74be9db9f40818b775447284d9f551fba60ba7ce9ed1a0a1c3172269d65c65659c53f035074cfac3200d381467c588e806cbba1b867fe9e7ce5df6aaee6343d4f30216957592c544202c4426ffbf6fcb8cc783da4331cd9a58562479f85c186c8c7a34075807276d887b87dd783cfc4f49b261c139686f737ec515af4438b6170ef175b0eb0b88621217cf3deda7df548fd8c0f1d84321ddc967005160ee4065f6d29c817c543676fee3a1be70317bf3937f7c852cd5baa3173599813144eb5fe54c17461d235a1e509dd0080a16035ad8d34104d15651f18dc82e8270739fbff49ff562c14dc9a11ff75f32d6393ff8c04b13ac4241454db70f0f20580fd8f68c52c083561e56d9e6c125247bcdda019ac4afc4eef89148980fe127d4a1429676824647e78e3946e125cde20ea36665c00b5629a94d8eb9c9827349004cd1c1c5ed0ec07b3c527766ffb29650b50cd8c7b73de5bb3b57a5926222f8c5647280a6baf45107f23c47733fa58919d70a00a7c1f72394804f2d32ebde3ed17012b1e49d390c378625e7986dfb5e6defb115529744eae56a47e7ae24f6f9cc974ed21ca474b00826aa8fbe30cc81cd52cc8a67a2a5c157b404de5cd6211e367824d862ec3f4dbbc22feabaa94e1757caae1939033148c46f250df319f458399f8d5b9fa8989a7e2fcd9ddc16d65fbb8410943da761943c916fcc5f1dbbf851a2e03c7abbfc23fbd22b33ac6b1cce65dd35ea91925ba0056a8cece361ea6d73a51956bea72f8152883b95ee39680f10062fb95616fd9ff4f947bb317f5bdf8578b06265bc9b707d8d72cce5de98f8b2cb7d1a1ec949ac1a70425630ea06582f1142657dcf37c520d8dde768785893fb2f3857b0106428a2bdcc4ec33338dfeee946b3069662d9b9d71a7449f2cdca116f632d329a91e62e972cb15796d78fa87b562128901fa2ddf6e863b0f926a4b1c1290212655992bd79bb34ff5f42ba87f0d9c615c5e2574506b92f624296fa0b45c2c1753a64690f1328827165d34fb9425b5be80022f2ce31836c78bd2a07478680b07a9d6ee13c1e22c4e89a8227939a45d37c88cc35f6f1f387af8db0989b4e2438ca0f26ab93a884f0264fa4eba3366cf273ce7abdf560f5b0f43713408a18f30dbdf3f01945df3f6497f406f412ef280c76f2c4a0ee1b6d2a1645e0125cb867a932036fe1c898252fba36b31c80dc3bfcfe9f9106ad98ddac3a4bdd288c5aa5eedee6ac079e8aa9f1ae3bb936fc69d8fa4ae3bacdb4eb2da1c71ddb82fa8c254c1e8ed60cf9b2dfae7d2be8126bbe3d7b8331e96eef0566e0cceef9f8ef0a880b2b22a9dda3b16c33b2b5df4e7737302c8da0a85c4cd7f8e7bbc586f0c569369f417bd45a89e0287ab2be14c99f9189eaad9e48682df12db049b4326880b239c3ef6239f5baf0a74eae4d0126f3481bc7d2583d2725abbe8dbe42478769d30e9f39367547867560f274970ba1afd909214718ddec69ae0c158f9db32ecba02a537262fd5b4c232577c417e12acb947239fae4d667ee806fd0bb675fc2d9f5ca44f31784cb10d1f3d8fc8823fbc9cc634370522361299f87b58c17d6f23172dc90b724250a1bae745d2fef5a1753f7911e7990ecf04f8d858d2155e2c4a9e72078384ec1e84066c214563b54fdec9ac8819f4378e2b38075e8c95bbb7a50476de7b4fef2b394540a09e0f06a9e04a9c5292f04143277ddc86fdc0b1cd818d0f0ccba14f1129033ba3e70c75321c81f259260f1df17fc7d27c6d110a2880ae7ea57121d0acd75bc08f19137f34b9d8d3775682d572f76fee7e0bfc67d73ff5c4457f394ab5d96f58e171556e9a4a52ea71c289ee369f20579dfcb119695b62e1e89f771da735b8f95a6ba6d1a2ea62b23652c6390497653f8dff1c23c59eb59fa5e72a3c9a3f62fca7be23ae95e7b78eb6d24d2d04f0ea03922ffd25f649cdf3b1909b8abdb840ef2ee0835b2c70674ed2ef5420417aa4e0abec491ca3be07488c186c4f3b1b6712f82ef2b35c3dd4ef36a8a563a8aace2e0590a1c9a5ae0d0518dc8012183b65d7997de640733f568e094143ac3bdff3355d151c706733fa3dba3bfe61f31e551678c45fc489b271b6b4c3e4fbaf50fb2dd9e8e94974c3603e02562729fba815ef8814dcbf7195b2ace4e058daeb8257389b906d1319b2fc69990b1b36fc61aefe1837631db43279e8f986cd5f2ec2ad58f7672cdae1b47a7c524a187540ec6ba2f9edc9940743f8121e92c05e3f380560fe2778cc4ad4317d0f80dc6128a45d3115c42d4ae62fa849abb6da572de61b4f9ba99bd3567d70ec002813c0e107925cd0fd738eb1ed0bab3f149348bc7b1d12542f2ac788223f8450be7573a76d57b114e885b569259ccf57884fc9a9b8c94fb4de7e63f51fb3a1cd78e41ce1329103e59372db3f0a9fe8c10bffb25477c68f859fb355f66ee7762e6ed983e616bfb6d7f15720df679db8ab3f1a2eca06fae10ecdc0e3ac7dbfabfec738d459e91c101bc96d6388ae2a9c2bf7ce65dfd74340e5e7002a3fd42d77cf554fa23bd9e79f50904e596cab0060c7bae6aa79e0ad92729e6c1c5200ed426d61c6734a21e5b78c07db6f23ebc02a66a371d3a8513746b582386ea8a488ce048ad8cc3635803663d2369f70e825e2b0a0d911e96c86a3dbb31af8113058a092837597018c465d2152d802541bce48e4ca28b91dfe771c7ba310d16ad800fb88133086c1c71e2690f9c936020ce56aff382f54b3d247afb591238ed97bee690b29bf4ca60754ebd46ad3fe0b66dfc1cc5a592114ab5a634adcd3dfc01116ef924365364826c352305ea273653d458915354e7910bd6a8ecdb4439eaf38545ea3ae75bdcf2f91a08026e3f1bcb16c2d7f7ddf584279b8b1e09f6d93dc8f78d8e148784af397c4c77ca040b3e0950d75bc32646332590787f3885d9613c96ad50f85b0210ba1a9e84c57adb1e4fbfd08e97c8c6721a71a05e07971614133bc3e881503b762264a261197e680cad91a039db80bb28004dbc8aa75054a08c4bb187193d1ae396d8a4603cf08ad40b4a8df679c4ec140ec94d73e01bdce011cc2351566bcfba5f3273e994515e4ae1c0f6927e8c0539cae98e3086e85aad23f4a336b492fd9a70738f784026fa2a36c623f06a53e41c178505e652b944d9ad7a3141f3e6cd236402d20f33a9666bbe9582853ef64435879cc9a2d13ff506abfdc3b318a3a0451f6bf5dd5ec129199aa9fd06ab2ae89055e4fb0a791c0b406117ff3736cc18b8b4a82eea7a24c24097fd74da991a1107ebadaaed6849f74bfe85eb32b514a14e7a8ddd3e9dc05b37f6945a9eed0f9242e4cd1b1d7ff4949362e205c74ac3333dff828f62e5b20313de2d6ff1d4b423604aeaf00d646fed13079eec0dd103231de9d3f6ff946d44a025ec5fc3a212fd667b8f432bfe8b0efbf20f84b6c192eb330e9899022cc9a907707c9c6ced0937353eafe220f43d969f7d48690204f25b523bad8ddaaa7d510a5a88f9846c6d8f023448c109f547bb63e468c1852b956c7d4c703dd2caba431ad809c13568eb13ff0f1205abd5c6bcaac92a4d658e04bbd8b8770215789fb4f3a3d86196812b3a03f51e668db6b9f7607d6b2951a7213d4668608c808c7fb95abb91b6c0a0ed029ced0d894f2b0bd8e4e90bfc0ed3a860ffdf6e478e4fba3f8fd5ad3c9a5db7c2c9e0e9656f15a0396c846f906e91ddbee43e86e56662ab6f9338b20cf1c37c0abfd43ac65a8223608cc878f6bd4df62299496e942f5979734358afb5b110981533e442654cc13907e35f9d5db6fdb1920da474e305216592db4a61ffa06e6da9da449958e1cfe124cd4bc0f6ec7f6846be6dc9a34b71ab8c74f7c362cbc29b404361cdb9c99ebbeb3dc24925f803c2a91e7a9236e631e3fa3cd404e0de38ac8e82554810934034540ab40451581f6977c3a61710695cd0cd5e3d2e9a749e334f178ef29610579f10c2aae0be16503e39839f77c1b46053ed19001adaf9d481c10fcc1d370abfd36db524147cc74ddae1649c6bbf5d87a21b7e97d1419b7b826f655202f5e24585f1527d498ee556800f9db08a03f2f645f6756516acf4658e37439588bf32068413f20df406de04c5c92cd6d77a5cf7a19f98f96591e12ca70f32d12bdc1b8603a2aa09fe2718179a397a137a6873d282a35949c382100a6fe254a43f29ba27537d49adfd557194c6c7e34eefd3841dea26e4728b1682f9ecc840f088dd8d31d1e6b0b80bf0860ed508e447a750203776ed9c18d05fa36ff58e6a44838baaf3cfd07d0f41eb6335df480300a9262939f8808985d129f977b50a1131d8c2b65002031c64190c3a29efe991fc5ef2ea71b3a0b69ae22c3971cde5e94d713b98fd4ac6d3ad923cdbf622ae6ed3a260b57e3bcbffbb81de5b7ca4d3ab6d7d04f2deb777dca4ecf44da831be69f1bc45f5715bac6700f83f909da8c196ecbc7b4c35fd0cc593b2ac6501e1f2e74f0fa4a321a7cf5636a696ceb0ed4948259b3939970fd422533b24bf6361afcabdcdc6ca2186da9a53df423c467fd40a39d40310afc121a0a4fae35f0b8f36546e5baea387488fae0c4c1d7eca0ccf4328edb6b95ead45315181d0d80d6bffc4887cfc0204e973f018ad4495335e34feca26519e79df934ad04e64bc04fd826871e232ea11e66067aa95d2db5b8c31c790fe904e226f4d9a375abd2ef5e6e666b586a6333000b4f9eb32abb2a4f761a0f3373de4790224cda53160ef93cd4d47082d9fbe70f15b20fa24633ef9379a6a36222f253e26fa9ffa4bf90f2a4cc4e08f096f46017a198615cd3641c1ba727e3dc0965c8c1a86385e7243dfdc27874224305225fa19ec9f986d35318a4068e7ff02ef9fc4963de89ea531b4f22c88fcefaa7add0ad195631e38a52350d73a41994978a4a5734b53abd5ad4e76872c86d144669e19c58f4df7104995d94059f59f85fa5014e95935755e84290a7402cea6cc9a25a6911a63adab9b7c45945ae3b476be7dc87038f3ef0e28fbb0bf889211863c4ae6bdb19ee2ab1a351d57edb3b5cca9e541570f3bcb4ac4dee6fba80562b32f20b2088e86927517c287db5490a50a68a1adc63d54ef8ccdf24709a2ee8bd044f0614b2e2838f117501538c6c5f5209bfaab7b5711c5f1c924ae856092ebed9767f4afcc7415bc3c1291e2499f13c7d5d3bfe7c07355d53002e7f0b573bc3c307732726236fa0115eaf618329ae079f1e385dcb131c7acaa5a2e2aecb84bdcf81b3f82ec996d10c3ac2b883f72b63ddf2383eb6f070d42dab0b43f5394bdb49633d88b2864fde3d8786eb2a97971ce231ec817e18e352735de450af6cc1243dc4be534d3bf498d86fa587419693dd22f021fe3b1fd0ed13a6462bfb055a38157431e4cc6e35c61a0c2c7eb26a7b630d2b12cb2097465f97c25fe31023f8abb78cbd75255d0f0c3ea0878525c66074aa18223c68699068da082e60971ce6f5fb4b04da32c0ef1f963a3aa96e42efb51c39c335a851670661225fc04397ea5a96f8dc2ce872f0b32eb5bd1c302be551178f8a10fff5325ebe770c4c2ce20673e15d088f2fbfb044a20d91ed4bf7a152aa43a38d9b0256de82e1985875c841382e444d0deb3f34d112d7e0c9c6ce9e228aff9fe71f7ea186720602a48de3a5e1d33a36a4b26d43f85ea6f931c7984e34dd5e27540c2df07ca1ddc095013bcc7950069e9c60f0962bb9b6eef02231218532d0c2e527029e50ff4e700e49f1b936361b74ee878fbdb905826f69f1afb3163d53fae2e23d71fab45a8ef75c97dda24107a67c47a57e967dbc71d94286b2973457c7fab999cb7d50d23993e3193c73098d2babe747224e2de2fb13a0b2dc75b773efe1aac8c4e824f9c95f1d75cde039bf46a6a38881f511ded9b534519434f1d8f7d729b097863d2a92feffd0e13845055d3aa87b80011bdff1641e805bd4af74ea43a91e5cbcf1c10fe75ce9c6b7713df546e2c4f708e21c55beedd730299c37d1be6e2f20971968b246afcacbd33038429f915977bd2c546bba548e671c5c73ba592530e5fa5cc6d609a560bae025d3dda4614596421316de48f38c0ea438a48694410928eead29cb5a204180c559cb39fc1b8526b3ea1aff74e4c9fdc40cbda08fb20dd1e9d2d3d8a5266a91a9f43b8edfc8b3b7628c286b6075dfe1c1369c38b0a15f2a46295fbb5533d46e0e6cd1b4a241642ef23bc24d098f92f00a19dd924bf73751645d87984a88475b3d3b0342448392be45fda03d82ba97b0343392001e652b603c49612fb2ac23ef3c5ea46981872f945f40568c82c5cc942877dbe617392489e3731c0c6b67eca044e3d2dfb6332b80becaeb60fe4385bb61d4102530a173cd9f3b839e6f50ae0e94a122a3d67bed565d084909dadda7a8bd5121c245adcc187b751bd4c17083924f22db8615c92e15cdd27f0221265bcfa0c579090e3e4a822f6bbbb61894984e9736fd570928ef4f1f3f7975f341ab4cfbf7146c54290a853d2f12ddb6a9a38dab7274d1a91fbade28dde7f4db920a39af3a6f452d633a0a211e2c1d8a1ba20174b088335ac68b2dd57647cedc00c65ded099048cbca3c8b50379a3b7762f31072faf524d003aa9fda8d641ff0ab3a9c37c0d995de5f642ea61979ee8f72b3a9d5ac19a01146146c439c74e8c9422f9cc4983cf61efa2c551f9cc2d0a80ab67504b6f877266ef7dc6c9900732c90ccef3528def09cd7b61f00cced268a5f78d7007c6faeed4d95e9e5b31b8fdc89dae354d3d44492fef126bdd6fffe610514a1da767870c5b55ee9a83aff49af3339d3d57755f5719fd41e3386dde7db6b69be97d22cedf56592f0da36324f761415f3dc0e489f15a28891003dff13adc1bcff1c665cb6d9a0c8da5dde59962919789f46179cdd27c21e6ec81be487cee9dc34e61ce56fe6bb8e71263ccb1fd30344650f094f7cad9f41200cde860b9174e8a1a77b2f6613647af8ee6b2e81e8ce32234503f1e8fe2726142aeba9fe5f171639061496849834bff74e80de5c7c7ef683ef9e0cab8bc9c8ee4685e97ce1fb2a6010b77a0cfc6219be970c1a61e2380e5e50da1d31b21a062b9368bd5201c0b7b11f51bd402c0c9731f79d6dd495b3854decf028142683b0f97c021d5a64097ffd16ca5f7b840e3771b848ad49ea1eaa38e33c01c1fa75f4787b8d7ec3d8b9ac8671264a6fe05cdf85ddd56264947dc09f8d12b6c556a9a10f4b33ea0b577eeea7ee19f8e5cf177cda3fbba6e7346867cab38cf4ea60cc340cd841fc3873ad4a27c4f1d0734a05fd4d1d323e5000c953a519d3aea87045bd7a61a31e0d0e652569c35e831d2685f536baad0fa0ec8d5de8e7b411836028398c472eb089ed3c1f17c4cb3d47caf5bfecf89fef33d9954fb16c0d6333be1a0e951d22797e8062f46957e3fb4b0709563158139924c2eb423a985a312906a46541ee95cac5db8c30a4c482c00b6a9676467b9472af5774954144b284f58c1bfb918ba70a292e8cf8c78c6da3b79d72a094b4c2051a44d8dc413f8fdbbd183e2e5ca26810fca0deca73e782857cfe86781fd2371622a487819a33fc351b28abdd054867d449a0ba2bf0f53d5f008fa6f5160e14e816dcc5357fde557778bd37aaa032c9300e03fe2f4e60d99e7db90006f7103ff130f1f6042e0b57964b94536b8d0ff5e7bc4271b84b3286ae69d0e4d9ed706ef4896aa7385cb2bd3fa16f9b093fae1397d7469644f9c8378f843319dece76db49d951b287fa6869c4e3e7f77eb1a6abb6942e8b8cc34900f7942a0bd0e00e3c855b476068d6e9f0ecb884effa8b7dc462e51549da143c2c65a2ba73a735e3629472d6057f44275142a8358f86550988cbc7d730ef11ab019e383f90440c5fa6ab5bd1a55cb43d6cc60c9d998c821d20238b91fe7b091ec2a8fb347e0a0a675fa110562c23b597f144c71ec169c3ec079351c560a49c71642fd336868588ccd8e634dcad6a6de983f64c6727428f2072ce69f9b17d9bcf25909b224efefb64b8dc8590695cacde49c19d58b4699144c5cd411d32d628803bbedf344f3139703eec1289e87b0db7e7c15bf8602eb65fb895a511cdc5ec8e99c436c598918af02f2943a01620d539a0a368944ceb230081036d1e3b682e08a3017682d98bfb668e5a99eaf1f3007c02fa6381682f807f0734b00611143a99f96f254c14abf951c28bfeab6953f3224506c9b45cfd5faf35d826b2d116e2f639af2a1b0862e8a72d1ab776668de7f9a29c39af37757869b59589a399ec6e29ac87f66de14a1a221b719012ec194e11580a6771465bc21130caf9019ee20c4e68ab2795c254057d1fca0e98cb5bcfa86347ca41deb6ecc55618f0def1628edc94bf49f91652911e8414fb362f0c2bde960f35ad9f2e9e63b2acb325be36b91cebe258373003eac9dd35114e04c6c3f389500dc9f28f8d3591f64bd0b96819246d29efa4ba4739651510e5758f3c0880316f27b7c23cc7f6e87dd93fd1e308e48e7769d075ab8e13a476adfdb1c6939f7ab3913bcb86495903ef3cd7115808f45005ae5b868b369ad89af197aa20c7385f4a7a445102eb778fc1e83d62020fd0b7e242586ce0d6daeb317e1eabb656556d23a0687a345a44de80748ed1817f20cccc8643957fb87328ae99f553b8a0459c5750952ecaade9a7e13346f5e2ffaba7052ef834e06883986540436d35bbc0a29baa1b9cf1ac79c54520f303f827d421c04dc3831df241a0042871debcd5e8bf76fdae260a41422633c51e225f2e5c245e2322c93b7ee1cd28a21c2fb8fb95c9a12c10b1b0908942d94c85a5e247c9abe38d2c022adad3c97ed1d66ecc193411af9cd15bf6fea9fca92578b0b96dd877620eaaadbdd5cc9d66a80d41c5909e7908193efada90ab04e9dd61446f91b50f533197b313f8d0961d8679b11886672f7e9f81ba5bf4050add8df0db93ab49ab520287a12a532c550727cd1acc522d214c07d8d756f0f4f5b95cc9a37d59ea518b8fd898d88f6cb4a6ad243f72f5b1c44a161f2a680e93c60fc1db562a9b8022b8fa411d653775fc5380d5a77d3d3ce6688ff32b407d0a59b8014f2ffce22e708bf2dcce12027e7723d1ed9a30deee2b68f9be0858b13a22b72bd5b8067ec035839759b1cc7808e70c3cc2de44631197096dea67fce042e7e78693ade8b1579968d8c6da333d987acfc5ddf7be3673894619b07eb36ea80f1f6ed70a18dfa4a1df447c5def09522955447eb0a428fe33ca9392a7fa2741959b7facfdbfacb3e211913e2bab9a4190c51a3753a1566469d7570595458c23089f23f102ba55210d3750af0104b25e4a2a96c9318fd851e840c16998a22ff58dc715cd2e288d2457d2bc07c7853c630184a7438653b2cdc81e66c3e89de5da160d9985c2c89956edc1cae96d3b7a208db492b0da13738f4e56bc6fbb875e4dad09109d3599f033e8d8c64444205f3923e2248e377d99c8aefe1a525e732fd0eb64264f08a09ba765666672a930d8f7a9d926aecb68420ee1e5b2c6bee9b10b2196d3fca8cb2de81188613bdf2f84ab4686accaeaaaca8ebeef84a2eb78ce6fd6170614012bdb2f20f07320c153e2fa84b4f80819e8f70731d7e1d9e0b13c787057b3e794bbccb88b072546b144cfe58eadfbf0f508a7d42e5059ab3676b5a459f151ae9b6e36f92517e053fc2a56396fb4f04ac480f49d15"; #elif SFMT_MEXP == 132049 constexpr const char* jump_poly = "ee86f54b0be59c6204771bea03d614ca275a40a9a3ef32f8a14fea7d0a74faef106b8c6406a8dc468b78b5494b3620ac0b895c23685904c1cefb5c80336caa2ef9d5b595733f2a6f4ba6f1acc44cce80ba67f0da127f98de09e07314c32551a9854d09a8d9a64b9f3feaec4551d7192c49c2f02ecc26f5f2fd1da46a77aa0c3f50576c5cb604105abb3af3acfaa7ba2dbe5df35af84dffe4ae0cebaa2fa8ff5c85ffa5dadb5881d02acaf4c7412a8c1b29503150c96fa2dac1dd44d771fd6751bb3b53082a9723e2a80de276229143bdee8e97ff04330b01b18c045eea05eb2dcde96d4aba501139e5a04f2aa598fffaa37fb86c864ce637932cb85db78086b8eab55901ebb15ccf44f75b98d429f0aaa6dc23330760b2e1fd62e1bf421a8dfbf82b33aef40a6204cd82ea74530ee84a91d18cc4b0db9e1667cf51636f0d4ead28ba60e4c6cf6fb80fe755fda562b88ff69af9b7e6186f2d80ee85ebb261d1b0575e060307678b58b4e20b5a75161b648b93c84e905849322db4add38d92528b2a8c8c0fc862efa9af1416220bf45daf16e6aae8bb483bcfe221fd9dc968f310f3112ea04e2f7a74f95fe76f8243702869e5fd4cae544c00f794c598178db80e974b56d3f319b1d04eb75ec01e7f5302444bca90f04b37430c2ee63637d784e4bfb784e908048bf14b3742738eb689a38a591fc6e998d7703f211d2b732428bea670d244e06e8ee1f852ab9a3f9e5412f12abbd4823c39189984c076df8545c352a7a908355f3ba941f0174a0997d979dbeee10eabf910dfe9bf7875f0548675a0037f3aa2fbf3478e74a438793cfee88519ddc261a9d64b5da7d8ee025ff24fba87a88484af04a5b1517ef7b448685694e5d2ac6532caa93049594d5e3e8412e8a664283c87c551d337825a0ede17725d1328069b99053aabfc7c49e5531127d276344b87b3e3bd98b920ba38716c084c0a7b0fc8e0787b9a743f5719c3eb136d49dac6318af2ca545c5c5a7a93a2ad32a5a048d97c1fc7e6013a61fd2731243cfbb3b6bd8f793cc5d75b021bd5c7bbfbe63441cf794feae5eb26146c86db3d7064e085b8a73596813eb48514b461db5252d7ab2085defb5abcaea42c80155dd03771eed81511e6909f57a2193f4f89143c7b9edf19ea7c30860cb923ba2024e75e16aca442feb2b9a52cd7f23ebc67d84be52392db82e13d531714be8e7979714aa4ff7f028ef51684ac065ba31dd66e021b26a6d30641a7453aa7532e9f55b778714462bedd201dcd37fb253c3ac193f90fdaa9acf7cdec8e951990df65817a6e23cab25a01005643f3cdf8cb0a455f8525bdd2f562a1826e3d8e9e9b92be572c65ea9b11f41a7c4ab56ee914302753bdbcd1f32c37c7976576d67114421d2ba3af7b4d231a58cfe1ff13b3f4e8250a9bfa0eebc56a376ca11d4b4d2a982fef54e10d752f7f725597de30718c33bfae2fe7c90b248495dd42b209ddf072a74938d2a324a1e359c36e16ecc8e79bf3bb4b2d975a82cca1a1f87bd2f54db0d09e5b1b6d66eb1ffaea2e7395fe6d053e6a5617a81c64326b72cd51ef1e40b79781e9bf3ee50ed40e58cbfef3edd7f3e98146d546baeabdf2962d0deea963a2deff9b0b5b5e9f2cff6c12b352ea129d0a556f19741b31bd7dbe7448d4484c19b03ca2bc09e42943f09f964c57e6fd78c7985a89d5eee5824c8118f111f5dc1f5458376d0a53b63f499462bdb500961e3e81d5dc7a5faf8f5fc3aa1fdb7b88067c8c0728412058fcfbed549918e97e6dbad3217cfc44ebd9521f6a81d0c5b43e4d2153b8d9c440067753c347c545037d3558c36e2985c0d9446c61e9caee16b657f47fdc6bcbd9d6798dd9b143824e2cd0bac86b529413fe79c916bb0a6ea32bfad151cd8da32a5ec76d362de1a909a1789bb86ed83d2645cfc6daa8c0d99e05da4f3df715a934a4f5d765e0d7d4423eb5e75c4a05624963144ff430ec2ccf5f952461fac9889ce055e649cbf56e9ca8b7df17b01866952d417e2ccee00e6a6d8734adb6572ddbbb808ba114fe9d79167e7091a395fe66254d408b53651e9d8d6643fb4407cbfe1807ce6b53188f027c119d5c63711cf86a6cc30ed0a595b11bca8e5e18562e653e18ea154ae7400c7103a0999f7dde95b7c99572f28867c3b3f29704683d17cd836d3dc9343877d22c07c53e5a70d8a698c64de80f765b5197418370afb276737f23173ae8dcca3923d3f3e5a0650891aa05b9fcd2ff268cc354afd2572a5680e98bed046ecb3f5a0cd8f80371c863fe4473c82ea44170b73a2d3883d02a161b7d49257b8e2e748d9d52c93778cbb9c65625770b68ffa232ab6abf144f05e04b00e05e1c67ef44858bb05bb4a670c337ff0845f0be8950257a3def235319b54f29e67b1f8d039836d94473c50dc1df7ef85d73057da6f21abd683a91fc73f725a6cb32a525687a0cdf95c2291ef70c366a8d0d3e23183c6518c75fd5fd40d680162d91709576b4c62c5aac877f1376cd6c9d5bb5230e38b5c68893869a5044bc4aa7c6e6d6ac3618d6e22a3c33d94419f8a5d412bd5c0b545b823b7f4484a669a7504e392369456b13172903f73479dee36ad23d8ff3cd1662502c29ee84c9b6887754b40919859f417563c7b870b20645ad505540f0e910350ba21442ee179dd3c0bc61a2666595f6a3dbe38295c9668ed5f6d041e91584499fb4749b626a74253938ee30935fb9d318fafcba84780264479bc2806ce95ec66bb3f002dbf2933e1352fb67ff5380c130cd3cb1e8f442c91fb623dedd544b928fb8be3fc825466da024f456d48867a63032d3a1f1a959aa8eb603b2a1ea5916001ba7b7af6df3795445ddc0efd4a764ef466ced0643330435fb79b18bb7409af5eaa3ac7e3613af81143ca0f3bd53ed09811752d9f8370aec3c98d5392d89d1597b5eda76f7ec0da2732cc390ba80f5b761a030c8908d40a6c68bf2d01def6cae902959a129e799ef9c512097ac681b06a724f57ec51610ab10a83a511bbddad206fc6bc163c8637c8cec1361dc7d3e140431f382aa2beb259f64829e178bb00d58809db17812c5c36fc9ff634a4ab2ac1471c5c7792764e8b7d191cb0d1e8cec3dcd60db8061e28b10d6318df00116ef9d2a61f142cbf338ed649020f89435243b7cffd4756654b886dad9376fb3b4df1c00fc49456a8f75684feb6f2852c16394e6af40504e69442d51ec3e8518a29944aa456aa92da2f429abeaccd259a1d1bcc85f4c70b2f5783275b762722421954a627b9bf29521e24b253edc734885147bfe048f38e5b2efe0339fb06883354518933aab287a20da0732d2efb6c5b3fa9bffb447cb1b11fbceadd12a22019e5438c60060905a74beb45882d7fe763084c3831eb438fd0190e5bb7e6acb6853ac4825c3494cee179981fc2bd73b74e251dec9968368819202daf125612e85c33602feb2bfd5312db2248e0fddee85195b47ba6c473e71e662dcd0f4aa3c3ec54c983b0319d523fae3de82eede4224c6214e2a87debb2df0d51a0529bd87ffe796a25e3497333b71a8b5103fe755d2e3661eaad941847dab95eada5bdc442018c5461074da53542f03cdfc5f82ebd7d1715620e06c17a102c4dab4f87473930fc109e07d427b97d7ee479f15b55bf0172ae2a1ef459edaa4cfb2caa3cd54d4aba3df6ad6cf487921685968e87b6fa65b435a1ef61c29b7862332137776b6f5236184e1bfdc2a1bcbd03bb3e5a0e0c271c1123475329547f052bc4a2febdd6abc0ffdfa04a5bbc5eb5cba03e1ef72be29783092d987273289298da994a421e0e296c2f79d594443218edbba1d44adaa9ae4b8820a5bca8855a26d282a363e06d29e7793722566d5fba340f74352d3ad16bcdc28f66e4b9ad3ac5a53f752ff21e68955da846c222cd1aad25ebd280cc67ac89764d45e7793bbbeb898f540263fc39c722a3cecd4c152b1d9c591db5150d8d16f4feaac937fca89daa4474a81c560f9562e98b3ae28821d7d5d73704180a852c61a53d793e25168476605a96f2f6375714ef9f67485a1916305c602c261ba0d2209f779a03dbd3b5b4e472ea2c61ad0b40f10795665d3aa43bd9e66b4aa8ab091d7d5c3f2384dc618a5f168536ee5ebf214538eb377749868aaaba2e14cf59b3912942c6b8b35271dbd9405899526d2ba1fc07514792b922b7a221a1622b4f5f9af6ddead28dd39570dba661af96f773d86db9c7135b85c9a425902cd2c8a5a96cf9b336d9a7777849c187529baacde6d8de45af50f88ddeea6695b1ba63d9a14d51909e989fee93ae068e7425beb3238aa00661f289df4581ae05876591cb8726de5f270186402c14390e5afad1cdb64adaedc2164cad0dfdee3ba1dec0adf07b8e02e4c3f3d78446396181325cf98aac3f19ee6452cb28fa3707d6d35be95e4705ba16da00ed744774af1434f97a7062b2633a23fa673e6bdd0dab4928f6722fe90874b0eb878b59fa0cb18a44287284da488d6608ea1737a67b8c3d9eb4972e498a76c4aac97a84bfef8f61ce64ffccbbd1a123bd787680ca53957c08b6db94d1d6b49a96fc3b6aa57f3838d9c77a44678d17ac5e6f10eb60cd9f4c83e0deb0546507303d00378f1917f34dc3853c1433509b5b5245ac8cd83d60b9564e24f83cb1b1b03cd06f02ed2a8704d7bf8d7e02d081e8b6155d9845603279cbbf1e2be29977cb7177bf87dcec21b0a84f78565af7e8f4bdbd6973fd846db5de4e91ad40bade291c3be832026ca74d2f2d75eb2f86b1159a681c5491124ae9e95895a08af529880a0b2a81f3ce9813b17ef18b7880cb906dfc1d78e6bc458d6a35ed7a3e0e308365c873251b7486fe85010d74169877663e35c3928d71715017802750505caa937979a7f867ee016326644621c14d72a90ad31476af3e768ffda11a10915187bbd9f0e2d728a2722bd702569079432690e3aa8e5150cc7b1f2d903d916bbfa774887f16808119bb11b803f3a560da89c0552bfa7111cfc9dd801f5456459f5cb81b50238a0ce3f7333b3c979b271188f899f2d4c17cf10e2308cd795c82189e9e66c98578be6b5e9ea39a1ed241c4b402acf1352c4473565e8849b8d7bc5e1f6f655768b37d0e89c163c1b814aba156de27a4320d1b222bab6755bcc72e4d22288486e8892f8d6d0de6919fb69c9ce7ae001df5095821954faf795e045970cf2a6ddd9ad11112c1c0962dd7b8af86a0627f7c4ee5bf112c8edce9d7e2489cddb0b16f768982cb151731858b753ad5c6567a23a7b8cddf16eb0437227de5504fc79f6f79aade265c15a7bafb530fab294a0ed58786cf951608a572676695f797a1558ebe55dd4cf2059f0b4951e63969be28b3caec57174ded4b956ebfdc9643cc86bc341a1094ddf07adf813206abb384c93b5daba5fdd235da04e4210ea6fce8d724ed556f340a51c75044a8d86361b2ce73a1ac1d61f1a8a90d65d2846f0421f1a5a455a78d281249a4f9f1b248baa61ff7bd4d25a941cabd603fbc20216032234b950761b6f925fdebaad4a5d60ce7e2c2ec596cca544b537f61563d24fa916f9e1d6072ec90d9e31c226de1ec4265b10e5d5247ad67e4741167cb16eb270d7d7063e8f311d19c5a152df85d7912974f4a39a4bc8a255eda603e01a4b24faf14fff8aae529fd6ac14d8eb56119050b756f72180e7280fc8219fa4767c85406548b45079cbb9536b047f15a4444fb8b85cb261fba4dfb6efd096b7d2e09221c5cc8a952c90c4d23ced69d754489338df23e51ba4f68564175f2f68fed41fbd8ee823a42c10f8f9f3b85c904abcfc82fc56aa4937bbba2fd32195d70acec4eead69decca1ab4cd498993d76e456373d13bc7077c86f8648cf562bbd25e9eb6923dc22bedbe153f5adf794f325b47d4b5dc4dc78a8f9ac2e3158161d892f424c161c057decdeefe949ff33b5abe083baf7d5b072e1e564357c643d360f35ac51eb0e42fe2a398405b17997a635cc0041b7fb87e1f5d8a0d46c51a0448a20ebfa952a89169cee80d682c74de87e145576d344dfb769d06324634ab6ce4a8b4cf2f23a632cca931ffac9675477ebbbc6eb5ecee65e2713eda01b25d0e47569e7072049c1a987b4427bd6c58e5474e1b5df2889fdcbdc7a93b935b9d0a922705eb4f4568395f36318b37538d75beab617e7e1d6a2f5412c65d5c20e718c8f8e16a21b354526c422779a05e5a52820a24c78bd521f769b7bef12861551930096a04282a4733c12c3c4709f28f2a8c637876a6f0eb1a11bcae25e0bb93dab41c469ed05231457c4af23d60061acf849f0adbe09475da47a42c2b1e316bebccf153a05e7fc1db1b7a094022865e18771943fd5fa2a4a5942455ef99daf41ef7d197d6a0b40fd1fcfaa6ac1ac50a1f80c081b6a23bae4a89b1c92cac6282308ed525d2848e493267db21f2fd338a89d4a5e1d1d351a9f709523b5400bd4d229ef56c47e8276167d3e568df38f2bda90eaac775ebb95fd31586e51e3c49acd952aca6285cf2cc47058ebda0e6ce0eea297b01f7613268b3c12855a3af596e57df9899ce32f997f34a3d2ba12f17a77a9fbea925e9ee66d201b4b513e88373d97c4d04aab9f9352c5aa59736704d53982219de351fd4bc0d1f31f61369f9396a0ce2eda75d86f3f41e5edd21e45f923b149ad3aff149fdab7a359c9b275d3a77235a1f59c91fb1146956b21437f8f561a1b1564051a4d0b6751edb175bbf23cc6f6c6ee3ad87f93fde0d1f4b663efdcb6b44d18901af9005a334076035447413d8e70d36931415f211b5a6c3d479fa4e8559f1c939a2ee800205662bf8d0e460891d7879e04f350d96580731371a2cf50fa8615dbe683bea832fddbdeb8194cd04a594e260b71d791de14b68c037e1f2a0c871fd55dfdd1de928915a788d660440d9253a58d0c027d769ef62a78c199c27a4158a68fce66c687f35c1bbf3c10460f3efa0652b80e31dc903973e3c0d8beebd4da6f41088b3c198d382f50e1ec5835c7d6bd690df92384dc6fddad94247b794b0185fbfed234c89cfa973debfe1471f981b77f9b949f5c6dfe47458f7d3cf68ba8e31c98156bf65e0ca514a18ee4c98f8c40d2f582cbbe3709d956c1d24464626b94f9d1a0bde84eb71aa06d17fcdef184c56d7205ae6dd7a42e76a975710d24b55f9eefcb261288a08aaaa8697a35aaaf059bd90f798e449fdc1f80663870b56ee9efc8a33f09af76257243e1ea3df38e630f85920ef66d61c0662fa376dcd759617ddc017ca4eb2f9c8d41d5af3d7bec57fa6994c672568cf1f2051f3c96a1ae06cd58a782509d485656b3f31b657610e87ad97d5d61964428f27aeb68eb6575dc8f5523bb9df3bc36f2d51816cdfc3d1a38ae0c9c7e4397d32249f5467c83c410c16bc73192b72fcd219fe130212f80ec5b030cb950d43c17b9ae24f2404d24106e3ef1e3d0e580e1969556027ba18dc85f80b3143f75648cd5d04b2783588e5c03a8a246838000925229200fb25ea7ac564dffa58477b682958dc6c57baddfa89042abfdc2a69ce181c6603b3e43d9ecaaf68ad6755be9d67d9826bacd79dfd2f50508701f3aacc07c7b2c046baa7f8b0898c1af45dd7807fd64112dafc93879bc7c0dba05288ef4eef2ae461bbf644ca5b246c8da767ca6890b790fe19023c56bd37545ce62f3b69a15c6419f4eebe13f1aee1d0c3449311058cc117d98303bf0e8fbdffe0337f2881efbdea0f4e7a99f4a7c40f959f40909b5d8530777c05dccb8faf4848c8fc20ac4e7fa511f68c6cff19163c511edf7b5be368b29bfa9dc275af9e4678cb9dbd07970450b2cd0b3a034deb28ccde50cec911063a2c4b0bcf7640147ae0004271ce8ba032bb9ac451ed05e65ccc8decff916a14bc1226f53487d458d9f47b0ff9e94d062811d53591c2b526f0458fde81ae71aff071062d26b6bec7cfe60472b9f07d5ff58546c99d9144941bc6e381061439c4ba9fd9c067947de02c21df9c3157c03b105088ec2de1c4f5bc64adc2a938fff3e1e98f65297bff1d6bc56223b8c5faeffe220d7f020054ce9384c1674d967f1a2f728dc9caf1add8b5999c736c7ad006ef539f7f3b83fa487c451a5a1c84444c1629b01bdcb7c29b92992430f3ba6ea990904ffb0fbc171fd38b5bf98d7c7e15cbc1cbfd2e430eeb1a75765ef2f38463ee29ddd9cac6664194726465897db5cc14dc215713f28214dadbadee44de4f46bf940705f2eef3943fd6682d2da8e0027c0db245a7dd9c316d3b7fd931d2fe1d942fc4bbf5bcb4f4e76ad89c656580ec39d3df72cccfd570844dcab1200cbc6828cbf02e19b5e48329783432ac0479c470d092b1ac281afc7545cf975d2a40711617f4f0ec7623c608b79385a5c388d24bdaac77830c5f9ef16ac06677e7cf1ca624469bbf6b8ee4cfdfc7eb56f489c7f8ee1b1b1c4dea696d573483ff0edc3394884250c9a513dc6679475dbf9e5fbad3461e1b10bdda9a428b665f3c6f54c0c42fc0432415c336ba0f87aeda9c5bb589c3910c7f4df57ad4b4458db4061e6d51bf813a08884ded0a0985d6a060d0b81bfe52864272d54ea894ce945862d668edef1c6ebe1a42dcd975e0c5e9cf9c6372e95ded102038e413a9cf7afcf25910ac0d8b780bf2531bad8c45d27ffb564a95dbef046b5d590d5ed59f8dd05f266ec8105f05f9de8d859e70959d7907ac483c0c6e0df5d6e8d62e3a594ee360808146da53ecd4d0a6634b169a72c4780030937a7f61eba3504f16f8ed8267f19cd140db123d6503e68f0ae55b3e11c0a165a0c38ddabfc13c264f4771249bb780122b9db860fa14c8c12813f35f52330a9faa892632c32f050b3a2ca4dbf9ae6acce7d1b9b92ec8107ef190a95b1cb2ed11454371614595da4179ed181b6c6f3a1eb35d6a86bfa611997838c6d307f15b70229234070640071d4a71021bb83568d1d41cf01bf77c8e0d69d5d68da890c229f269505fdf5c74fbce0c2151a58236a72d8a95dfbeb664233f8935bc995666d7a0d48c5fb65ab950c545ffb7359f13ebc368bec28cc10dbc0a0d99d7191f7d6d2e03e99ca035dc7e515aee94b6ab5d11b3e62c0d21fc4697a6ef420afa1ff445555671b803e175e5ee1e6e7aa561aa83d007909d223f8a460546b5888d83c0f208a2a8bf3d62dd99ed18cc8b818291c8878f93f2c072d017f4043150fd5000e01c24fb89789119229007ab4cfefd24a844bcc9c94883e1562b7708901a8994d9c51ac9461502c940ea1bab4c245e11fb91bab43fe16120e6c0852443732a1f62979fef761325136f06cca214989aff71c45a96e48c546edf494e20f970a44e1dfde6058ca020fce51e4b82c1fc626ef88000b7ae0f2ad96077d0b7c9812f70cc3ac301bb0e444f8cad26f92a7f8eed4ba0d0c317c30f6d6f860cd8f82e12791b13e268a1cb6aa9d1b1b61437d69fd408db8072616ae7c37bbd22feb8babc3c88c4e72eaf1e90a67b3477424eec8ae523ef9403ac26b059acffd3f83488b42006a806b59ee5ead746004ddad0cc22bd8964b0e87ca650be8fcf177a39dfabe049957fba59c03b1cb1258167ad2da55762393c2007b6d464872a1491ef513ae44e0db2c912b91a7d95180b408ad4d63b8e1d816cea6c75d7c2805801932fa6e39a0600ecd231c295ad3db11d3c2ffda19028f3c49282690401be630169f084ccf9cc3f846a992aba60ebac333ab4f14ba341390a48f8f2e837ca5b7552a1a5745f771e7a704d8dabf8ba46f5f406ca8d1b3fe328306d44bad2c5462a661537c4f0609a908e80f0c7acf5ad10631f8d80d3e50b8c2d728da21cb6512adc1f6794ad1a1d4f0ea631ec1f050e4499fc89b988314b5a007d1d746f0c118797759b7e667ff1641a84a48d90473b102391d0bea18337713a9e4d139c9ed0eaed7d3659ec2ad9d0a81e5aacb09e72c4cbe62755b4d5bcc1677018a145effb45e998cc5d7db1e8ef41fd3f9d8b7300c9cd58180ccdafe9734cf6d3d2e5a090b7783a767f15ce1451b63da9f3f85420224deafcbe2f0f53530522ae5dff8d9744fd907995a71905bcb89b3a2f7d986b098bd0732c038ea22d0100a9664aa081f7ee6a81f750799fa8586ca1ff0144c32a7c3056181b2995eef5050a2dcaab66d9a50f4230a4db84314d229b2c0f7346c5c3b54e17f3b7cbe203a2273fa036df0d92db67f48db24c813f15da09d669b904d6b3f169404403bfb8113e05f7af8e5dd8cb67615a20603f9daf01d04abfcc4ca7eab8bb3e6bff5a076e187bb171a9d806166141a56aaa439b0d16e4d58d204ed7958c23325cbdddf2be86af1206e104d76045b0b0670d1efd09a9577272e5eaca6f2f365837dfe038bae8a9c6035dd04822a0d337c1f7c9ccf7bbd338c4e4db55354fa1c8a3a865e0df49e6a98af248b6794e4e16df54f613dbc470a47ea94a0303216c634a7631c20be137205e56a6b19f51daa399d62a6b0a1eea93e358cac662a22195c240f375fd12edd1e0d7ebd7eb78acc8c940750b681f3568abe74c28776be4c5d3ee3dcf348ef3d13623e6cddd426a7e982e155447aa04852375f09c2b00591045a3f01a0efad519051e00964d2012dfb0918c79615e7a1d31f893d7f9b9ec230f958e6c1f74aec38c3675fbb92685951b92b6d0630551bc6c6e84adf14cade58ee0363a01389fecf287290d241fa276a76c9cf67c07413a56be1bde2c463386b03a66c57a6f7dad826fcd7dcb83d37859199b313bb130eb7a15d2b1029ca722785643319870beb1803a6e4d84227ea8a7b8dc4bc80004e5f7d9551ca68e625b1fb6878e0dbf66bf11b4a9c60b5a5b7e13cddde39ead6b57a58653051aea8e830fa9a4629f9d244bd0ce7ce91b90dc58ef7d6aea0749eebbee40999a18f84a3db1243c4ff3d6dbbb6784320ad5870bfbb747fc165e349a0f1dbc131c3a69ebac4e43fba3cf031ab82ad543965483b7caf7f93032b1b1541a8bfb5aba808ce1a84ee575d6a5d9b51282c8ba27e3d0e8ef5540130e7bc2745361bdfda073eb4f347b76b366c97a08874239ba77431682dc416dd47397726f8f3284aac531e7f06db6dd8e4e8c923a574be019ee8e4f1278aef7fb5ae8a6de905fc6a5f8bea39784d0422c25f6ad18173dffebefd434de9fdb86728b0fb757ecf9f39c4cc127a7a80f66148147ad1cfb95c8a98b39f6b97573cd64901c59606a453c53135503d17d2c7183f40e52b15886172637f525fb1dda462982e4eaac77f3343d2fc2ceb8fdd187278403b827500f41b47791de65ca1ddd67b233513ccc789eb2cbad0841a5d7b42aff5e913edf2f96032e8ffe450bedcd64c9c27ad1d0b4056d2ca88e0906d9baad26ff7e4b4c75b0baeb3c694d311395517da4aaffd418ec311fc01349c1cb107000d47cbd434bb7508156e24c8420a83db7764fcab09da3d1b9e0fed7e29f7d373a52dd89f05aaaec4f95bf55945eafa70eaab48805dab3a57c238e446a1c9693b8ae27c7c6dda66646a914b5d1c416238543b3eb5bb96663e6f3f518e41f33b8c2959a9df5fee1b4e12552522047a34fd2e43f44191e58003ff05ad764af14d3495effd6865a479bad6e253d3bbb1d62eb44c10f2e7162ad06099d21445421679cb7c6c8908cf2bdd823caba05b592cce7e1d2f90cadee7a592b5da4d70e62b84638e8af1ca3a8de05552d9efe46a30ea39e3bc4d2bec5837472b9b176d136462639ca246f087d9a2f860ce0a10ad71d9664e5a291e324f0578978af2737cff0c9086a672cabc472b658f7835d7ef1741233f238844f213f0be38b958a15679da8363584b7ade511d0897fca0001a4a3279ec4d7121a529823f4e2d9e80a2c754e46e68883c8dad1a60b6eaaae68ad62af7e9f89275735e9d2c343a8d1994af5a64a120567233b963300d063476698fac4ecac89c26a7829ebc4b991ae8fdd85c7185c2b0a153af3c4783e514faca45f2475f7bbf3dff4fa60b8b45f1dfb8fee6d4a3a7c71b2d10c0f5c11867368789f9e5a754974a2ac5c57739f56ee1e995c38813e515c4fba6a4dbc00fc176ff2f5a30e7a4f377adcbd91b130f8293c7dcd0b6a97594e649b000264e101a3b30523e2cd3c3ecbb2c695321b80857d57a4864ceefaf5235f62dbd93361505ffedca7e453ee7a69939e8b334c6b0101a538f727ec12ee3e576c6be79a1777defc9b37c2c042e2e5528a38738a4984792e5f83a7ee87ba9b89f2082c4a451c79835e400fe6e29ff57229b6edb83675d17f075d39cdec590cc80c1e1955e09e7ef74ff46cee13f996b768bcfda547e25c479f527463d117de9c30329d0b4c01eb009ecf9917383e0b397e725c45b0519d5d8abe6800615ee572f761699435dfe2031ef1de3b17fc18d127224d89fa44da23cc5d6b9ccd4baea7eef573ec508fde25987fd11327775d601478484925b96f06246e8ab94cb466694fdc4561ee5ef5eb948c41f9c1a7b34e4e91b143190e6f0453db8df5734d6dcdd4622e05070f94e143f2f8d366660e7f59313e3415f9c01e640d2d65f4921b32ee950e712c631272badd2b73656888be53f9b0f5c659d73f5c971dcbd5b356862cc664ad75f04afadc3d4bb74edb431cfb55ee9b2f211eec9309cc2317ddd591cc2d2c442426b22d2f2bdd53a5caac10d5b4f89dec4b9950182dfa5f841e72b156ec042501a83fbe030843240f5d5c95cf740e82a6b89fcedec3b5abb5cfa8eafc89f9fda14f67818b4a228068d6fd517c83273d8f9e05bc65cefae5e3f3f57826ced5c1f6f7b7ece7666a9723a90a772716a209b451170ac9e9a1b78ef806b821dcd9f747746615d4cb1b20465c81c9cbc45abd6a2e90aeabd8b8dbd6fb84f3b3b7c614476c0a6b7a19df1d140888fd0aa7391ae186ffb17855b1a99737effe57e8b1f0b56887f64b0f5a1a06e6f4a340da9545f2325705b275c15a0702a50f87758f19b2087f4bfa5882696fbf82fecf489c2c4f21f961d3c14f67c7237be003e90bd9f540bafff970c26f817433ff6f2cf84a443cf0c0e8186eae81a71b0dd240151e217062c5e3e59b2d4bcf6c969d105fe74deaae0d1b95904a4ad9ffdf90050f2b1fbb763302f4324d95ec58bed922bd8a643e64a50e44eb2b1548b08beaf3ac1cfde256e7f66f58de68b6de87d62073e5063216c01a17ee3d576976167659b9b2693469b931e57eb00085800ebd9c6e5839b22d287af066977a6d2ac0ba8a1e50e2fdb70bbe23ec40034bbbdbe204fa2f671a0c8ef2d0949e0bd3b0c683e15d1fed50f193b5f2e0f786a9215f0e19283c24fe4cbf703e210186497f8653fba9c586e10e115ff5b77248f69e4ff523d5bec948e8a3a3a41750b0e5602e0848f009e7f65032b94d56150e0dd43309c0d6fe62a08c9641c1b1d33b706ff44027933fd789b4071630d30b317777bc3c3a6bdf8c59d4703f092f181b23de1979451233ec43c24e813962ba924c75594a5a8ced79c82224962cd1598c5db607daf8964437728cc8d8c45a03411aeaa7117451dc0d1514c2e157b9454cecf8e1ae3d0057abcc6fec1de0faf93f33bd152eebb02c846917792208bb4c6fbddb78e1537de2226c8aeeeabf6519300e9c02701d71f83b429fc032ea456384696c35d8d6f6fc4482a12259cf9c21bee0b15f8380a8b2086814c95474ff0039947167f78572918de67a8e46f05f653401f0b153de614c2ffb74b22c3de08c3cb499ffac3c1cfd38ac15d5c3a8821895fb36ce82f90ba06f0a499883ad9f15c0e0572ba92e8c41df7c47fabeaae94bd3243654deb9da5ee4a06132f00905fee10fc1c627c5474ee327689530c3b55547cf1d832e955b1f4654c8545dcaff53945d036d6f47cce73d2f3cdb7ea8bab5f10c16518af1192214c4e32b5d80340d38db128fd768a2bcf2240e1bff9f8cfe431404f6cd1b589cf012d93cee0a0df64a3695a483e6fa704ab3a896b48cf9a32d87a84faac1e9881584adca70905b99ce83ac6a38df79763bcddd6796ad1bd3bcc8c91afb4bf828c559355cfc93e77fe595ed7e65e80f11d597fc4dda1883aeab7a681400687f9d32a5ad47cfbb3df08b2c1e248f6f59f74446ce73915a0fdc7fc8567d0592cb4cd4e6f94ec027d62525deff193d17b735aa4d65a2ec58567c9ee0b895693eeafea951f22fada65a3e06661011d15a64c4430960b94e980587f5bb0f0f912404faf8b01299f33cf5482d2b5574240ff6ae6a600a38f8c3175147858e3611442040cb9c3216858954e426d1c8e1bc39508a708d0b23b1b64228aa1b98af0ec1a30d4b8613b9b3c9b24575d5d56b6addac9fc65da955e67f35c1c438531cbeed83a7ff8b5bad80391a3da460f732721ffefbfaa4ff7c3b66a38f4c1acbbe9ed2005ad2218ac92785a569eaebb0951c15f80f9e296df6d9406d643fb62e3562fa44bf08b08782c3023997af800f0813a18b535ed5d5c60b5592f8093be0ca97f4bafa45947506e5fc7d2cbbd56872a95f5b099b9629a33cf1ebd2c5d758280aca4883546afaca2c18c61d65e71b65b949b2e29b89deca1a3df91055890d912ca2c12304102a5aa11cba302aa6a24d213d103128a32b12f0ad182b288774a43dd3c5bae4a5aa3cfb8e1c90850a9b75726aef3f7d9390013d3420ac401985e2e497fe554ba5ff89bb51699df4047db064bdee104c3e8abe1adf2831d439468ae2e7130bdbf58e38cf2300d8230b170fe121fc7aaa23af12b709dbaafa7ecd9d4828733c2ee7cd799491d8417bd12fb54484efd5d29a8767626326208bbb4f3930ecb8a5a8dd2cb8e83093a56d9101da913da49f08e36b7d566f5f17897be05286990197b1509d7ee48d05be4dbcd419582e91d14b92a23447fd16608eaa0016b7b829052e25450753930b804f31b4c63678df3a546e94d9a0a0b0abf4942af991bd8a0a8128750f66ffc26ce5442486558aaff724d3f097a065d5bf2a732dbd7a2591787626c1762be890f6ba92ab47ed858d1a8bc7e7f31b44c9ebc3fb47abed5955863ee5a1a140189a841b6387ed88faa532a208344be47da9c85930cb45ae2066c982a1f9443457b066a7342ad68f81c7cda413acde860b03acb96e039fd4b70dddaca565ea87621c82d666e9b4e5953fec6290f1ab7b1952e87658a8a1f740dc88c70af55087ade3fed8c12e69de5963c1bc00b58909787376a388eb739e90c9483ce1b552e18229408120eeb695f2a9b11af04617fe23f8fa9926b5c5a427063bc35d3db418eec3ce692b805a63b3f6cfcceb05aa82c61b467a5a5dae290ec77422ced591ddddbea072c1f3a4506105ce355be8abf2ffed9ae232bf33916110b13e5db94a2823a35f7c874afba2338c0e834f2ea3539a4adaf7a9c1455c1a4c2c4225257f8b474684f21b5d31a9fcd7502d5ecf2a99da2a761bf722675f431cb38467fdb145ff51aef47c7131d8be6141123102beb7baf87863df8bc76393e07be2a53cf178f3747dc308485f15cda286bb48e17cd3b954b703ea35296e66a2dcd506de27cda34e91efa38bba048021f6ce1034fcaaf927db5d3c4d2357e33a21d0cd71dfc2bc13d81a3cc9804ecbcbbed611f305d458092c0165a515df2e69b107e3f8dca7bfa04136b2c002eac6fb72c6140c993bd63db8b02f890abec9a47d146caa2b88b6ba6f80193cbf5efa42471b8b19f20b4c02848a106ecae4b191071baf533207ae2e8bacd0f445c291de04a596646fe491ba6119e6773366e9a10d9098e250aecff093897056c29de1a67bdf9e9668a89fdbaf426aaf15fc9eae09f21e87e1da2b7b4f26c190e1979354ecac6a488baaf389441293ab4a85d57d26abc3e80cc74993992d2cf2d28408eff39d1e65d064349d94f08ed22e15dbdba9d4ad1a3f823e8dc12c603a45faaa0171fe1700f2bdbcea1615381e8950a057001e15110d520616c43633c63e3349f24c340d6c34db658ca58c2d1f5e651b4498d2e50277c06a5b2c895c8f9bf4c92dafb6da867f5e6504cb1e0ece3c639305b1d7c37291f68f3fdc54a42babb4248c5195535ec79a9703756dbd2875bc578ad16528b08ecdc62814ffd3eb0e400458f8d5266820533ce40e29abf268361d094751157fa31691597d517c7dccb5325c5c49231414fd22135c294c3e867977b4343820b9c96c191f9441f7438bc3799668fc101dd341571332b800a9e43e5a00e0679d7dffa3072fecc993ad99e27b92efcaa66ae89e44987f43a98644ce96ccd55b93e4a65f30703e970170bb06c44799660bddfcbe87b361baacfd0b6994f88b96ad7edff5d3fc72381a4b20217b30864daf5942546425e5412dfddaea18babb57438cefddaf5d7da6e5745220b2378556dcf1a3b22d6ddd6e48240dd47b7fa314bf725efab11085af643138f8272ced5f2990c67ca25bf8a37f68435b732a9dbbb598836a74d79c8d3df6fb4017503b3b3199d41403fbb43e86492298cb363ade80ff0e4a6bfb157c47df4e7e2b2973e01323e12be65d86d9767f7cb43079d81bbfee07e6608ec3eb126e82fc836af23fb1fcb4e3bd0c817d1b6b9c2eae8317e0b560330d2104999b03b774878fa753eaf24ae6dfc6f698d0961c4a105b1b049485607406a4a3417f16be1cfac40bfff756ad3d733fe467d9e6da9db6904167a971d8e9354e38d22e494a8e9dd1143e51288ced98df21b1ccc4568db1d930ed45e5673ff5026daa55393972c0bcc52d735851eb022f1e18005d7a341c0794aab34a9bc11af908e159b281bdc3694da4d21902ccac6cbbba95fe487065bac17dd5a3b641eb974c6c147de9cbae16540ff8fdc70c6f9dc6a5efeac24fc63fd91e4d8be8858a26e8f8b430a08364550f87544b410e5d964715a910d7c797d0454552cf3d26b1938dff862f9c49ff659f8c3729953873d95e36c811aae3aa63a921074cd06388ea4e3822677fb6773fb009e4cbff54ab770b0ede8f3c886a26361da2f88aa300b4e3d7a784486fd68cf07e6b8ac9f4703ca8ea880a80809c6d9fb6e490f8841a8b525ef968f38b7c0e54daa01165d6d6aec174c4aa0e59ddbeeb5f5825d71bbac03b5f6cbd66d65bd991aa5002508429082589aa2de9e10739a1faf732127789d50ece7591cd7db5b33ff88cf02d46797cec3bcc2da774da553c837d384b8a692e3175cf92b6161584bdf50348d3c5fde502a04ecaf0e54ecb0db060134e75a36fed5159a3d9a706c4a526e3bfdb6a2d1fd883727a79160fcb8905629e50cd81a006326dee3d1c908119cb3755d616bb05d449be5b90d8f12faa67b0fc347b4d7d124ab3d5f2f7faf63465ed6ca3f177265d7664a9ea1552e7f3cdf88711adb049b4a0c80ed7b4355e50165bb3a85a08c6302ae69fa4990954286f7e805cdade8f709d4c9c78b7ed67d432fcc4ac55e1d7a85235538afe95265785b8b83127163f22989d566b8ee78a0d535a2c46a6ec60cc40fa9ecfb5fd89077e6f75382e141fc7925ee290c303666d5dbc817b7147f289f7e7edec093cd408990a1bbebba35f804a888f0dc0a54dc86a35b21b2439b1cf7c011633bc8b30adb1b1ffbf3faf505519fe8169dad8013129d40d5e2b310f647a86cbf7d64b4417c155c62ea96010a7e31ed72eb5ac83a8300f8f83b7316078c797b86256ae89c8f633bb756609a495f9caba94fb9c8d886fc78cbd3efe8539bc8f346d373ccc0c81b481272e3bf89c4ec1ee963582d64955b1428d36c061b0398986db41b82a0eaf3ba4c044c36f3c8f6524e4ad0d44bb7a28d187d3ce16607e0646e8352c54ce41548e6ddff2a1e406f2b6bcc0b5c91eb3131b201f05614d95dfe4dbbd98b81d251b11ddd938e700c2541fb8705713778596ca0910a90a6c88b750454a46f5f03a015dbe129bb3338310cfe34ad3830c34733a52f00d9eb1a328e95e2f7694beb0cc1d7f054d022b6f2e655275b2fc17da2ec534fbf6ce2116e882b89e9e21cbcd989b4d0caa187ca5877c21724e81c0207730983ad173c6a1f37db20bbd699f8ce7341384e08cc157f5e52f4071c432ed133a718cd0a3a874d574eccb5d96c501cc519c775a1d5170be2387c8babc050e480e600cbbf1a6eb7f0efdf9225a8dc4b5c678097878bac79f1575d05216b006af8267623d6d93618cada554fe8ca5efec1478931e344b088ad6a4b76529f5314e3beb9ac7ff4817009a28a151d6c7349bf18e63dac31f1f058975135ad0308693a19468c9b9db3937fe67daee08519e03352dfc44e4e9cdce912603e8e1b4ec371fc47c8fc2642c88398ba3f2785faffdfa17d9a220694af7f95e115717be84b6a578fa4b90267647c8fa68f45b5db696ea6395c88358a614dff9723ff5e5e22ae9f0631348ecebfff06953c9ed53a5d8121e0f569370d1aab71df8cd0c9a842f349a6e5e9e6b8db4dc568e223adadbe3727c6d3586c57f877ce7b227ddab2fc5478e1851cbdcb15504881f0164cd84c3987f93fc3f53773d4e9c6658ffa197b581ca3dcdd0768b98d57c39ff6bada4951e55c0924dbf8e282be25a0de226cbbbb3324d0362ebc49e67bd6650b3aa101dbc85ba670acebacf284a65a20aab91c74d9c12250ff482785a15afb61437610e505d72c3f586f72c157362b996268919d8672e4c1e0b4daa33f3f0281c684d286c0040be00bac8e8b5dd8499802a22d92e396ea9623b650e280bf96291c588cfd82cdbef264fe0da24d8c3f8d06d9fc1d8f4134f4e79e69b0bccad6cf640a950d982aab0627d5c30164b4ccad0753f3ce405fa2ba02c6bed060be68aaef1400de0c2f87ad61ac72d31e4bd4612c51c1d8f993a3e2c5915a3c2e8cebeb438b61fe137266d009ffa68292b031c8727dd95beb542659b6b843a4b63bf5f1484413b8f7260e6c6825129e5538aa9c5e1fd821aad3dcfe9fbe37ec3822346e6f7529e7d9c12fafbffc586eab4705b76d07637d272686e66fdda218427c5eb15fff29788e8fe2017ce8c8fee49a5927dc5e3f361ac4d5aa4d8717d8b0cb75b1e21d98324c7ed0735ef56002d9babcc032a8735eb584747302bc8f95cc65fe6c9af498f975668cc13b8ff917d8d5d385e200aac945b7a6efd06421ab3c69f3834d315870e5942b88069b7c968c57ea87871fd13b99f32dcd326cf3328f04f73896c8c6c219b8c40c8f973519db02831d1296a5d54844e31aa223f8a99e994e0f03ce340afade338b7aee7b72d85b2c7331e43e3541b226db66e26ed7a0b9c031ff1a1204a4814f0adcd6ebbddc00866ab398998a172eb1e194fefc703f72a3a4a27b540b2207ff84946293d9b05545893d3dd33f36c95a27dc62c172d2377fa18cf34410301abfd7f5368428ecc398cd8af8990dc08ec108236948ba4c6187df0caa36efbedbeaffa1f318322cd39fcec28f017eed906811908c88101e95780b75b30848f0df45a4b67fe7247d4d1f1192a49d48882c792d1677fe94f7e9c98d8c81d22106152aed6fc60c4ad686102c777847fd2704ce093e98dd8aa2471ce9ba594156a4b24daf5d833d1762ab5254daf37547219b3e3531ed67ba3893c3935393c3ed08d05eec1366cb8ee1208b05f040bf02249a8b08f9e000d40fa626a95487027c33bf4eea81cfed68bafc3958395861ec6987c0c8227a2d3f033852adedec74c8fb1c3b6492af60d36a402af0ba4b7811aa570824cae36ff86f19509e94b166ef3ad31309fd9a4b7c9635ee5f0d9ef473d87616f5908945a9a8595c6032c8123630f6e641ab5323790e608b2e1e33df74a914e54f0c37502da863f1a2c2e011f79a5a7ecce1d1c4a097a79a3b462d0a55e36f3d92abc9568a18e18efce37a79b56522e541b40f2076ff7e4f0586716b0602a7e75901962a96de9e76ddc5798659f479c5b61c90c39293e9541c97b656a1123ba0566d7787bef5df69ae2064652fccbe35c5c26af7d1036dd12218a468d0489ed565f3ccf02e14562a89f4fb15347468efd3e0c3cbbe9db3358aea663c09a6f51410d5c9b3aa382a3f376a53d8a18612033947e0d8620d262f67a001afb7e6c147db3ccf1554a5b9617bc0e285e6be71aabddd0b6fbbc0c10b00b294606e7969d0f40eaf1fb72b2c7c0b524575f9cef3f04860a75755eb364cfb278d4b36e09bda11292a6ed40df5abc99de12949e07993a73be5c850490e492df561859bd843710134f38105dd4cbed86da6c4d4524c5f4254b14ef2a9fa506ffe260b3d9c9d1e6b1a0a6fbb186c5f3cd92514916f0a0919c7794385de6253f6e29ef53e9a81bc435e0307de41bb722db5c19b159241d8ff17d5eaebc01bcee013d2851535a31d5b1d4c0dcaf478f067c97dd2eec48e6edd2f456d19e2a94378253389e63bd8f50b802b98cb5a3c0715d542baa727c60b4ededdfd3e7df149227eb1f90216fd88c8311a42715df7225c951d80a791acb89cfb17c75a21855797317134aa2b7f5da08ea4e350cc3214078c53c608494353535c8d7ffbe922113f02421ed807ad6d287e5f0548b79fc33ce460406761205f1b69d60ba830aa4f2f6053467b61f34658bafbc117f8b0acc9abd26058a5755d74868596a58237399c22a6c87fffeadf4842fe6e39428323c57c580a299e888d3be20431b676a192778f25ebfe667b0c3c6c4b569d7588c111be741a3eb2599f40ed94b0dc312ecfad3435f2f436bbc392c03631cb03ddb4ed00ba8e64ed1788281c646197f0e829f62bd301154bc365f2ef40bc9cea22eb2575bd1dcfabfe21de40504500b87fa9431169f585592b7a11ed426de3df113951f8c701a49a17c08ab303a41dda26062d9fa08717558a860e28e21b1ad4e0607c3658172eeed88132e0df088b064466ca3d1287259aabfb61e5537035f5087aa85140a3b06835223800112cf2d708208bd9604c55029b6bc0a396d62e8666a0f1335e1061c1fe9866b3fc702384500dc141f466ef50340ff6d3722b0b66e7280d7f90100c8718802420b6ef5ec12e68dbf889afcf42dfce62fb85bb9ce0d82c548c559c4137c48193918ce95d218a16e4f3016cc00d2756eb34541b384496075b00401b3a509d1bc17726a83c3508a8d8a37b60ce0ccd0272c0da96467ec5e90f4dc111564cb1d3f12ba52f160132f73320063ebc079ad2b40b10fd679e3a61d25b81404130f43b5962f5174ee223700173d1a6ad9d56b4fbfe2bca762c6675e49a9dfeebd9dd887c30e47c3d1bf2b1eee86b6d9120dcc43a54a5d9625748eb158bcff421b4aef885bbd8b724bd55a93dd0a4e6924c92a67c0e25bf9b9a231ad262383fca5d71ad325cd124e012760273295d7a805114c869b8a6c1eb8ecaf213db0bb97e448fb956acb1b5685f2eb5ee277045cd5100adf767f4a01b1bdc8a4a77b17da66ba759d375769cea810ff0514c933c79a2e47ebc48d78b4f029447a76bc8f79d927b62115b570e3b5babba1da95bc73f384f371cfc94b5356c6ca28eb94646d040e531140d368306c0c6d2fd5d25085b876b2b6631ee6bcad14f66083e4fef4a68fcfc64c2cf2847c6c8d56b092fadfb82f2f9962cc1bc0232f274def9d943c7b9fca022a8257c530d85151adbb1a90da85448039bc119ad60f43b6cfd5a743367f65d64a7568f1277d1cdc3d721c72ff6d37250337311430a5c1121b3e69a8b0aaf8aaecfffe72ecb108ae91a80a37e92bac356dd8f6047c8d333da43617b593836ec40d94306acb434d2d3a6e161c1e29c48d80fd58642de198b158380aa018a467ed5fddea2c577c9ac49bc7d1e4fbb7d0c9f7fd2bc27c5ab350929cd51b52c47e606a87fb28464bd2865a41a47cc6a58d4dcec7e6871f00b4e29d7b9bda0d2069d685f9e97cf701cdcb3e0bfa474edb361ea88e669debb84c010b9829fafe1d1954ed993da15fa7033b2c13e19195cdca18d0e54caf17bdb854d134efd167c1d0c0eae0927f08a156c62d1a492873e9ec1f22dfe0f1b19a41d0fc22debe926b6c2b9e5ae0f800be5dd05685e84038d713de5588358ded65489f7b6dbb561ad2cc8ae68107ef3fa0d7a70b7f18ed416940a2f60bef5bcfbccecd924f090b19208623aaed2116094da1d95975a77049150dc78a138ab0f4104413fd82f9722277e3c8de9b97bc34bfef153fa2a8a9c7fa57a03014ff60102a4114d2a4716956d7417aec0ca9729f8a20508cd5f1ffe2c1cd1ed462a4cbc31f8c129cd3fb92d68e1e32373c8670ec56599a73ba4fdc583418f5a434f23709aee2d9ecd145463725708f0cd8bdc53336a7940c59f9f7033da9470d02ba2ac5984a43661732452fab1edaaa42d6647d269c90b75785a23442b874884f25ddcac529a265597d1e7eed8a8762fe1bf549e4fe38111140992b64657c8f642edab2fbee822b78ef8d442f17bc4adae2011885da26bbea550dfafba8719e1daede85983f6f105965480065fb824fe0e34bfcf480ac7970764ee1bd159e0afc65d4c80e67192c369459528fce4712b15d19216bf4a9446f8f26cc138a5196b275ba092a675c1f89b9b97f733db509e0fb9ce6765981780d4be1a52fbef8ae1ad1531aa25cff09e33ec335b9eebaef5ff558e067cea290b5492e125466c0868aa93d7ab6ac4ef0ef9d488bd3d49430797c707b3637f4d8c913b9adc1d5e454b64f7f407d618ccd5ee3176f0c4a5cbc0008ff99229860da34550c7fbfb1812f929747ab84e3f70044d8a8f30220e09eef03e2b6865e21eb9c1907129d71d9ecbeb9485395f1f7e7e2789e5558d418862d93c628128e3a77552e463ee6b63d6901102dedbbe9c927d3a92af0e2e0914b7dd8c855b7ca5a54e02028e893fad932bd2d52a448207c4f8de84e475d132f3b432cc7b863310c81488d6b48b0cabfdd1986867f540d92327ce9a1c1b4f0f90fcf83ac859701037fc0ca32757a09002d43aad5b12eca35033c443b83c4ac331b235ca2851fb4e615612fc46ad063d94e8b599826f3c1d49f3ef6678bcc5242e6bd6baa4c4536f512417716ff272e58f692b129da6c2ba9d3f8f63595479b3935d171112e22c693de2398311d5ee6b877f2b7778388bdb1c9fd3554127938f754a5a68a6a1ffb80ee5aec086bb2923169900ebd1c560772feaddf05ecec07dc60e3267d3672fc719d69ff44ab146b0a5bf1a811cc3921c354b491dcdb0d64daa3477755de9805a36e975af3dbae8b228c961b7bf6553c156951b284df210c47fa0dc5e957d6895aa9c71cb34a913abaafb3b1584223358908477ac9f80321d4ee1f5b6ac3fee2cc2373d69ff80b609303ece865bd7161122fdbae9ae0600dae0791800bad77c4406dcdaf10ed3d366d076f4757ab3b705b31e5cfff1c022267e9c0ee61756d463215be31376aef32c358e385b3ff8d66de6bd038be521"; #elif SFMT_MEXP == 216091 constexpr const char* jump_poly = "fabdf682938a008933e7f552cdb0c935af57be5a1b9ad2331f52d39f03f0faf355a359cf9953bb56f515d37ec77c1a681737893e649c9552c7d4b275924c17a7395674d620a389468d1735220fc98d9d562a3a04c82b9155ce8b367353578f378cef6e8da22df79d90d2e6caca511b9fd96d3e6bf03e3b2fdb9d7639999fc77a14373f339f30c3c54d575eb043a38fd1fa1a1b1175ed5f31d40e374b2f1ed6ed98dc24a8a8c0d47a208ab0ac2ec865b4f8ba268081d727ff07965bba7a47fe9500ccf12f4d042613bba5a65fbdaa51b05bd28b0a2839d51e887aadb91ca89c0b627539faeb75f774c2eb2a78a626fb3de25d8f844ffaf4cd14121662b4cda1a1b44a42fcea60d1e9171314660ff9ea7e082fbc8133269c4ef2aef26c787b75d985b498db4aa8c345d39a80596d63b38e0f3673ee6ed2041edbe3e4331677c1c46a84ba5c13a191cd85317ac5f78d4868c11b279517956577212576de76db164e56ec32eee23a04f044cddc80e24037f6a81068b47024ea5585f3815c09501aa9dd041ad74f1806a23eb53cc04ce3306d8883ebe43674a99d3aa2d1ef21bc49916324f303fc4aeaf1f6f0189419b9d971fb1d04902d5a60207edccf7bc68417c2a265d6bc8713358bb8a4d175f60fa2dcd73efcb66bb7a3b52c4b701eeccbb4db6a9c3ce14cd7e5ae6dace5a081c5a3086db41ec923f3df74d01fdb6bb40bf1c383ca92b57dc5f141a5226e404adbab19291897170990588b197d4b0187906700af63bdbe5688e251c430af9f235bd60ad61f2994f5c46b3d6ca5d54e1c04719479acee00a60f1f476185c3e7a1da8c3b61f1da1180ae37115702ff26d9bc3aee553d7fa79d95ed7961db0492a6883163224637f9f0fd80af9cf3ab20ef9f3bd6556fdd08d092cc718f9e885d199d72efda9f504cebf51b9994b23a54fce33ae5bd9bc4a5e9d514f3e37c26ac96ab6c3168971d8b3bfbda3828a18dee71bffa12e4b185bf26f9f418390120e031fe6cc15d33864addffb8e3e8b3e81640adf28b16ca80d8a9ebe3b124ef905cf982bd815f0558bd993406cb89f861ee8098b9076a0d22af92a13f27296b8081fad2b59a1d0aca9eb91e3f788d21ee12bd89848517c6c48cab931df23f4d026302de8d57c0500e1608b711a1af669638c547889860c2d4bef1b08ab6250350d4d97c3c686359f9a2bd84df44872ce78a2e548357c4c5dfebb2cc5279e1035beed56da498ab91c20dbf80e5b19d588b7b087b89b809e8bf629f5b267475aa2d706c9ceca0863bed436c5b484443938b93ace6e69b81b0ee0e18c75658dd91f2f6f55f255c246177889586354d8483fc165fe11ed5bbf950d93b0896d38771ccb28c1136abf4cacb9fab835f586847e094275e45a41590d582d2b2ed87f35f98aa11bd289bbfe089ab15a14dc5fe89d62e9cadb467ab2eec9577ecb508e1f337325d2516b6af20864d723a0e6b1587fbc176f6da7b6e2db9de93dfc7ea56a4ab50c56762372cdb0d3ed827772efb15580b3d04e9480278fd2eb0ba47b654c7ef754b91685d1d60eb54e017ca4313bf2d1776743e3653af13de05344e2a8ea17a3ac456a40f6d3de1c2f797b78abe33a9eab38cb16839fdbc4c8da67e1a115440d39c7084e907f1f8cf32c52e8b7fbff9f7803101f600a60475e36dc9580fa5e184c2ad37bef0eb708b76c656d5c9ded28256d28f75bc61e23d1be27881a24ff31d0530f59340e8e884ac601fbc4de116c077c95e08d47542a3845c0d84f8feaa871631da1fafb2c9de4c9b2b7255fddbd4d157b73cf72e5dc61b6ff706cf95f4df8ae5fb739bdf4d59ebbdf0648c95221cc6f19e7179ad4b50cd74df0af7acbbc551e7ff2e3e541579eafe19fab342c6170f387a14fab262bb88d4d8b2a07d84aa980e6165e67fedc40bd71f532383fdd68f1963ebefb780568f7823b8d66c308f2f195e7e4f5b53ca6390a5f93ef825417493d38d14e91556a30cf2c26df955a76c4e257cbb1269a09d0e990529a419033193f0a24f9230adbcc7bff29aad4c906411be52bf2b5778db3bd23a04681154c373887dcf0efa88dce6af497980160174852cc11e3301c7203c570519adfd7daa555940bf0b1632c481aa86a42e723e6e245bc9de954629ed14cfd184fa46b3098d7999724529b5c85107b6bc353b10a901c1f96cc9a6661f4fc77ce7b35eb0f4fd3c7c087a1f4abd743815c1abcf746f9d2c8ed8e823b1af999aea1d0bb4c56424381437b6cbfb5163b4ea1f1ca67f882336c60335ae5bddcd03576f4c51de5ef81e51db48ad81de769ba1fb9cfe1d7a0e10257740f3de24fb8ca54c2c3ef8bd4356d51f69f363424f41e57fdecfcc532a5296f99293d085e7bd304eece3875a5fecd765c3f13c4f23eb2d041cbd0b26a56e893da31b6611343eef96ee952fc5689b30d1fe1853fec6a8a4941ad2c181098c3f2f02554dcdfd08c6afaf29560094fc1ac7a919946e30c0801e1926026de685c4d8f94c86fcbc201ab00c2e5fa35e7682aaa3670a051264414c7a596afaca4ee452e7de51e25becc0318940ce10a0c04be96d9301441321b11e19ee55f60c65c084cb6ebfff02260454653289e6592eb55d898863d01405f945d056e0ce01ea58e115f28ffed5c64d280819a521b1803bb1e08119f8d00f68ea7bc679e0b241d4b8cf34e7bea1356d640bff91416cd5ddd1c28d28d233ca22ea98fb6ee0868276f7b9b94cdf96166a84cca7f39ded1fad4db74de9a459670771f9f76c5e964a83a478e340cf0e5eb800648565308549de5a64501d1737939e75e20bff4e382c9866c9d733ab2e8074af5f9891da5daf80699deaae708e75d9391e36bab1e6aecb3ee52ffa467dcd705a6825bb13b3ead1dede39c0e91151c0ed040dfadfdbad86e68fb9b5d66ac9a7890aa58f0d9c2407a4043823fdd8576cfbbc431fb5e09fa912b11845a72b7ad98ec681cfac8393c0663293727dc37cd5eff408136302542849898f817a333f55649bc4075d701fd2acebf865201dac779aec72f2cce2f4bc47982a5fe9e0f75e52f1d2c7305fed02b6a3645bad12d8b7eb847eb6444e70131a7a395e1170fdb2e8e91d4b74ef8a69d0fc072ddfce8be80ecd27d4e429c48fa1dd653021da2a606ce47b6e5ea8a9d76cf22beb0a6b23c67e73d885616e800112e892d43af187b74d6f90b03e0972c444f3753d2cd838c0bc810a1805a24b4424e71ec6452f4b8dd8e8bff613414b6c5384216da4539a059a266f892a2c42f5ce247f6ba78343c3ddb4408985e45cceae7d82f27ed3ba7d29bb232598a656e9a2bae27b7d5a78d791335c7f73f0af5b19b796e11e1a969215e96a485bfc0360d82b93b82c7eccb92e939ac02c5ad5842f4fee8abb4c8ccb1f11832a9decb1fd26d49da3c6a0f12e4e2ee55c248551337fad7ff6f0cea7d0dea4425cbf998ca980a7eba838b48cfce9d43ad42ffdb91d68787dbda008e6221c6ecc91e0bd455650bea0ef0d20ad5b4e0f97aedc638a9e930e0081c67a3db974cc323113a4f3df3431431f4fb49ee2d7e81fcbd68a7a1ab3afd021cfe4ff935affe990409404e7d3a0e54f677399c1d96f58115c0e6b722becf99aedd9c779576940cffb3f7361f1cc8ee960953f2a72ff04fb386ea4326f5098432cbc6539372ca3ce4bfda4efbd620c1dae77d5c647bf6f00923af58ed8301b887fd3c8c747ccdb2897e386a2593a8233fde2d4178eef0ec3a77766ff6ee733b75906462f162776190cee130a2110a9f4a71fe076ac583841a0c799abb2c91ba8ec88168e6ec151d6f80cea404a2a4ca722df26287b053aecd690d8b9a105b726757de52cc189123c7d816a4e3551fce1065b1ff6c84308892032a5678b3b06260d2822580849ea63fc684722ffec0dede10af1567125404ec88a9cf7106ccdb0c1b224a1294d198d11c1a96610f8ac76ea5431ff8ad27e8ac61aff3488bf95fb748ebc626457e6dc41e3d431a6388066881c532fa81f2546d0f0af3ac36f40c9e7551e383d487860f6c9a467222991f2759bddf8e7d068995d19f40c67986a33d4d52556d03682e2c49187b3bb9e38d4778e23ab29b630a4752a1560764574c9fb9c600ec67306e374a7c9bfa09c862dee86172a66297e273630471ceea591028897e51f3232d0db61f0464b2241e92ebfa060b1271774cc2ce1001ae1c517ed46ffe06218ea9bc2074bc2eb6df9d431ed38461b9816977d5726087c04271739e997fb593fb71a614413043b7f7b3e9c1ad0d50c205475c0f7fec2f5da6696b599a71b21f3561768d6ce2fedaa3d99d6f271606ab661eb608920c96098d2bfdc07cb76723f08d03e832263f5dd75bea8dc7d00ab3d31d3908451eb79a991b37b6e5793de2823081379d48464168f54a88de3e8cf296d7b8d9c94014b7845b7b3c33eb32f8029bf76040d71496601c7dfbc9501c4c3583ec41721b72a198b960a4e2353a27b8261e7ba9a52ea1697a4c401eaabc1f2d182f2758cf72331d2adbe73bf99b7b3180891247bf0dfaefffc7a7cf9fef96faef5e810acdaecaa24b4dac761618b7d6b228cbd370665329921bd69b7c9ce079879ac43fc920a737088802edc58ee46903e3d17d9154b1c363cca29d7f37bb6da4de8decec1bbde0cc7a7dc768b050e03801861802152595853f4e4d005af3f3fb265152b4956fe604ccbcf753ade637efcc55d557aca89f50ce25614f4845bf2058005c53239d48e17eb1a65930d2b4a84d4335dcd78fca3758fd58fbb38ff188a5059e4dfdbdc1c829dd7b636a42309deb30b26270d696ad123ffdf8073dfe322e78eade26062e5354d3f41ffa810de0ce992261257586db36951f6a9ca1749346478843867daa81919a7e201a9a6d09b2fb86188389c3bf3eeea4b9ffb0efa7e4eaea2053624f17a74afa939f17b32d2273854e6016df47606dc293ec4c5bc798d6c971e97793e4c85f05809f24e3cb6f8cbd8bcd253efa1dbedca88d4c39b83d14e47a063f0f19430af0b250bcf2117ce3a09504487e2764e88cc5327f266d90a47c61a845677060d22b1b2f6a231f5ac6c83055c8eb0f87acafbd5cfe3112ee9be5a1623f3762725ba98a1a2caee15acd22ad0f4a4a5a297410ffddc7287aefcf58e7b6a757a42a3023bb896bcad64c406e23ff42e7aa40d9a7e33be3e73b26160779fd47b5a32a754679d6b4fe008fd3c708d45e036f6b45a2960ed339c4287bfe8856603d89a52a0351f551098ba55709107910a5b30fe0a61c50983a9cb7f293040b75ce3f5a1c71802988ec8c1094cec1960891dab8a543319575f5a42199e9163eb36f06978a3d86ce20ce1bd7d15e655378abaa71e1ac04729ae00eb4ff43dd72ca08867f68d81c307f450ae5a204e045a8ec561dd1ae24adeecd1d3dc60fe32ce6cc7aa1873b75e3304c93120083279f65b3d8d738f8a585eefffb8409348164a65753fb9ae1d4d924f5456f9c851605d5bcd70c2b52519194caf898ca2a5f85e7cc4c2f33b152118d6c654dc2dd6cbf28b92f08ba038f235fbe1a8cc2df943684290246fd42946e89aeea68c8c531245f151720d1ff30afa154f62bb12fc4490f82a8b67d663cf05c9f4d670d27e31ea2e1817ea77364a15b32db719de7cc94d6825cc01e7b6d41a6efb26e1942aa6536595efad1386186d83af5ef6bd7208d23b0ea0baead9422077a24d03e712dc74c1b270ff3b0fd8e481219ec5d6ebae51840bf4ac82e4729448eda34fc2c3c7e25c02e985565f91b4b9d0bb10ade294ba2c778f688a11d8320092df9310c273a6a948806a22a74afdc5ef9580ac07ef56a1b8cd2e304f5d9b91b263dd6cfc5714a7e878fc6e873a065440d9e306a85134e888b83349000c83659fdf53072a627b691f95b09338847fb328c928a9a398cd6e5bca146068c1e015d5f252bc529df089e826e6fbdac93e22a8b186bad993d5b373a8e6edae2d70bebc4663f0a63d5174f3c5d3d953a6ceedb5592f3f08f46e8f09a1a463f81abc62ae891c63b83a212d815d0e043b49d9c8f664321fce8c5fa303fb255a26292e7f015b1c47d5999c44d1120ccdf4e3facfe4865b2a9a3b2955b157e73929a5ebfc506e3f96405eb2a036eb099fdb0aca6443dda555a9efe9d076556cb883f4ec10b52dd259c0485c5ceef2121b7848d602fa286df7515767cf161e4e828c10a49e896ee29bc0c525724ddc7d919bf0c5807aa4413f23d9a8ddd1dd3b08d4737c10814ffd21efe79b03c7b56f9eef244b3e533c99421e4075de4de2509791668e44cc6d5086b1f4ee8a7ef604ec36f2adb3add4254f4d3d01852e5be14f562b9c4190e9314b6659a366bf96b79c33d657d5be5b7ee571f40fbd6edca1c9ff675ef8799bb7fce4106898fcf90cf6a50e88eb81059740e591282d0f964cc8e93cd09f0f953dbab249d18aed1e9f225050a5be4c5ec7aad21d33d637412aebaf4bc033ad79a531da6782e596141f6701a85bb35355cb6fd872a44c5d1c323ea9cfa85f72188f6b52b12b9d920e47513215bfc22dba1e41bf349bd914b5601cc251b6bb697a3a8ce4c65e33bf46458891bd88bad4daeff79b843f0198b3862c0a3c550a713f3a5b483adf4493636a1db53ed1b9650f358cf34603053f8916f0b6892343eccc7b3394f1d056a5f7703aa0860cf0b0e164b0e53649ac1b164ad80b5526c1fc48e10cfa13f5fab699660763d929f692faec2381e658a4534f9d7f122968a2ef837052c83d18595fdc7d6707c9ece962653c8732d3c02b68cbcfb2f99f73d67b79755070a198676ea415e19712f72ad995a8dd028d12a3390babe475d597ba8702981111fb745423d23b0cf13264bfbc956d447b32d3ca9392244333db218d3243cf0c6b3e8f7d45648412a0551e40b3b496e37610f04366d6911f67a779cd7d00ea87669777e9610373ea4e9647852465419b9aa39b0302826f4298142b49f25424488d80241c1e7bf3d0fc6816a66284e37059d2d6d28d2ebebe58db5c236d35566298965f2c2495345b2368929af26f98a46e2892cee3a07058bcadd930526cc7ef62fab0539863d482913cd7dec57f2e8a121c9cee0443b73bb0b967ac486632f0281618c9c780ae8d45f8716c0791c97ef4bdcd2b1e5bd4f8a3713eac4c1cf6ba816863686d49b9c13c17f04b08346348c705e5e97ee8f9e339ede35df7698581d74db54fab0f7c160c1c0c2bc77245cfa740376263b120e96a1b1c4c09c47631c891c9d6994aecd12ac10e932f4a73e7e10ae135abdbdb4b3c9f20b79f906e459bacfbf63a4e54d141fe527ff3a5c978db7adf0554ce64c7532b5e12c0fa9fe20b5f685af51aa851480bf92396943700cdc3d18a14d581648fd8c5c54be57a8e16e80b3095cb8d5b3a9f0987491a00d67e4747af89be3ec8cefdd3b5f41d95be4215c1c65d5d0a03ca4b12049acba0419315fe1c6f4e3bc3a4af13bdb385efdf7ae9ba011a275caf374c44b840ae081fc59ff56729f51c32e8b71e9e87ce8cf690a70cad9d43834a9a01831a34bce70dccdf10814633c9f9d930c2a51db6db8ce75396372db15120c7587e18b9e2854b50f23feb70ca5e315c99a6ada6521cdceb08ddefde1f2464606e3a12d8aac3412d12651cdea6d312f34d7195f2a1795ddfba91fb73e07045edb65a24195e1f646a6cfcb6a13ff045a704df8aacc648fdc18544aab30ecb7146ac772ecaa4cb455651229c8c1e0aa37940734fa5f30d753b0c3f0565ab29eb3871ce92bfab1a2a48dd2f76739ff69285f2c6e217e9f34b33af53112efccfb7ceb4aaa37d37afba3882689163fa4e641621f8cc9b43c3529b4fb2ae818bb6f09ab4dc93f2ac97efe202c67921c6373711e72fb312ad5b4602586605cf26eef2a3f96f99b2dd2960074f63d1fedc45910a0c4755de1f59835c1ac2d3f47537197b6b33b860eab6abe3550ffaee93e2774a4b0ab9620e1772a9cd6bb4d3ca110f21ccef02d1e9ca6cca4a279a926269463553cdeca4f44c0e43e596ea69cdf72d0af668053119d8af50c17fc9acedf0fe7d534a597577547450da8da24929165e75061f43da890930d8b293a6f180717382482541db0edd495a594cb4272045123defac91f2a22030a9c7069623fbd7338858bd2928d57c1b48d8318bd32ea006c02042d57ae565db5ab2d66fcdf2c01a091d1dffb99863d0c712324ff7a6bd69ba295a51801cdc9c31328b9e306fb3e60397716c3d3fd7dcd1e74fc6f8089dfccb6edcd78cec8515f55876fb198df23a482ea5251e5f591707e9b24a4b5df75f8ba46d60866abdb0f6c1bc652baaedafae6b9b0d5948a09cea56b6296fb53ca26bde445c9aabd15d3c3759a361e181cb8dd6c93d9cb72a469a7b83e5a5d533954d99382d42fce341758264be8656ac230b608e336bfdfa555acb0b726d59e369a1d8e772b74c972bf0b01060ffc95450a53dc3f8fa994f461888b4aa3617dbbebb3df670a50c779c0579fee2483fe6e60e4da20afef97aa37912d9a432e97d17420263656d4b5cb93995b91f251b22c09be4b27032a20a02b4b7e48c4185c79a76c6ec93605716ec90a8400e334ccb3c6543b8e6463b2601ab98a0f3bb9715719f866846effbb9719cd3f241aeaa9e552665a6e21c12e8a481c8c0d5f2c26101810d765ca14726def8db5378de85924448f526d1b3edfab93e73e9519739c02986acb077b699a070eee1d144d3eae4adf32c1d5d8fabc51dc9baaf30d25d9f655fe17a6d3f9bae3325a88c9c779d36b778ca6a36166881a96854b909226aca2abb295fdf2887623e35bf3d8544398e30a5611fbaa202c17f291e53aaf3e091f32fbfa9c3629de996721cf9fae98704a3053268b7acad6f1fa488adccb099cf02417b7e936e2154d568501cb9bd1612483f58b138f95411cd5f1664855dc15de64f64e57e5852792cf8bec85ed330fc867a0acd9767538f4733c6fb9df8dfcd21e8e6ab11c7bf306233f3f04e665577e356ec25011ad6d0130b30b3f886f2c6239d0ed2a433a218c6511dd92091d3342043ac04460d3de31ecd59d91c4be64ee3a4dbd5347ce8aa20cc91b5f810ccffbb126805815bcb3d68dd642779bdebcafe090eee29adb6c5b4d335b780c6b50243e37947ce6ade865012df045d4fc84f194e9170561efb977f6c33d1a86d351d90feebc42e13abf9a508077b64aced702f5d6932d3f28c08f93e1a75d07024b1d311155f9a354f13bd9e84d3bbf92ad038a82b89c29789687a7531030a121ae3164379337e9feeff9dab1f899bc4554bdb10638c3a27bc74622dac3779fae0afd5de356e1538f839d6d83ea7773034a351416424ddf1808b3884aadb4b68f8a28ade261322be5b378241af2364ab2a16a1d0d172f0b24ca3c087f862ed0ae67465c94cf8832345f3ace382f052a136e46fdb6dc129a90333783d375ff50e019c0c0dc160110496ebb8f77b01d84e0fa2061707520e572be1c552aa8e17e54ba7dc35e14c9f1c53d56cd4d9657c2d1c32fbf013846c4bd958a15e1b97bd70deaefa77211e744436597bd83141412be69e67c10b50acf931c7ce5154cb6a67e7b4f23ea1494f36e9cd5e7a4048b6cef9a1dcf2028b3734dccadd2d227a9e62d0cdd8c2c39945bbc10216589fb668acbe65d02a2aa14849567ceb1a7182fdbcf5724189e4c18e7ce00051a814353f7e76d8bb161ccc2f49744447723655a25f2f554706953ad854c08ec7aeba8d41f002218abfb35e7cfb97e28836fdd486e8a927f98ea1083974cdb216d47a6b3baf46b665511cd9a678bf35584f9bdb8ee4e0b7e65230a6c0d00e79e4b3fa3d3f583691cdf8228a09717e8dc3b16ce1e5fce46601a6e85bcd82a7692787b0ed969b8badc3cc45d11bea8c7d7e6c4ee139ff449a11b3c599b9a4b3b65503efa30514910dee43318e54ec5b96a13e95251e22c8b0fd5b4d0c0fc5871296c12adb1e29197930b71cd6823aa9ed462cc21681a4b13d9472ebe534681a05c926bcf8a0e052296274071e4c7b9f76e83c8dd500120c8f6146cecf7cdfc17fe14a5644d0fdd0507b873483c37aaf1302d0e0134ff0b7a7645354883904a37e3fc4bfd304890b97307bd0bf82afb4f4837b8dba6d05e9ff5208b1cf80694a759cbec84cec3a5ae370095b0cbb7527f5c98f2c7585fde8f1fc9cb157b1b362fccc55bbb19f9fb607ee5e03d3a17b45b6e05707853794e31a52a0f2dc95be788975129305b3636d719c4f0f243145ea392e25c31003e3a26b1cbd9176db3f40b878fffd662edf30c76a0eae8d7b47f222356da660857727ac47400d5249f3e4596adf967475c4ec9f1888e5f0dbead29eacd829a157f4e30191c42f899ea7984c3fd512a09788129670f2cbb63ea3569de2ddd0a4be83e77805218f9c53134c9485da6cd2768d5bc87debc1aad8386e2327f39c271226f14857e05d2ba5bae2d79e3ca940781af771f27208c260392c04a9eb1327c46190fb90351d7659d83e5892d2ff607b9d0a56f06c31a6a56204e2378cc23f2cf61021b0afe71547e5793e6f0b4cdc7b82792abc63a5a9a7af8737c7dc50746760a423f4d816161be79206f47e5de874c1fc8be845d79c9d21adc7df1d6c743eae5c0da2cc323d1fd3fa6ce9cb56d85da7ef2b9c8dabd47bc80fa5c619fcb94672de661b86f5db18cb4b371a8f25b42ada0c9b6499893541e369ed03cf14da183bed4e08023c205df3ef15843b8850669d0aaf91dabf2598b309ef3ff5131ed5b0e6a1a6e2bcd860cf346682ca4f94d6ed721d590d3c9594eb619e46751eb2421c85aa74c0952e13426b766ee7165fd69051ad0fb8f5f32a33ed2b6f3d8b3a902fbeaa5ead4d02b38f7ac8bbfc3741faa289e588852458b507dd2a33f208620f1b4508c7c6a8e8ca69492c7441711bd02b6737fbcbc92e2144f4a574a5ebe6ad40ef94f5272dd24f53a26310023b996ed8d8ce1a67d11e7f12c2541c3941099afeab6fbe8376193de01a12930ca962e75a5a01638b9936aad0ad0b7e308b903c66df101acc015af4565269ae410a7ad959bba7f61fdb73985126563548068f75dc7cd4c8c3bedd842d2ff3fe2baa7835bbdde2fe6cf687fc06b4074a5bfb35de65c324dd79b786bb74931e22568174bfbaf9d73592ccde5804caf22dc1d810078ed4a16eea303458a375013616390c822309f92c590126fa6c3dced2c259194fc71981bc2ce3f4fb67a2aabba6f4bc3bf1ec8b7a4f9276370df921d0c7828a0d094c3287708f9347cfe476449cbd6897f5d44906dda7dd48058c4b2d476f9c8c2b3548eb90553bba81ababe3f62ccf4cc527eabfa0d52278a6db5e97bd80c1449f8bd3c42ab09c7e9863a8ca6a11428b87ba74e70de4557e76daaa96be490afd245d2425cac55ce26d39bcb1e5b181b2acf72b0506ff94ba744151b2bb928961ba9f6641e76eda4dce2f0b252dcd514d4ffd72a077e7f26e8fdae9c89487c5cd1ca24c5d330005714f486d92e23fbadd456edc870c860dc24b88058ca8b4f149aa3a99f600318a2c36512b484e6648f193b8e262c19bc7b08ea7d752025c85770abcfe8abef952152b62bc04ea762b7fe20f511806dc1a1b3f592dab71942a2e8a00488234754966d7880ae6900b204931627a1326f19553c48a6f6dff4158125bf83bb68802ec2f150dbbf2f074797758d64735cf39b4ec624bfd25c2016e799f42bc5d0bba6841c1074b91c4fd64cca6dc70078a6650788ebcf151b6a23a612f9fa87712746fc5a7ad7264895481cddf9b4587efa5f05c520ba8d9e3330942beb50a1de213768fd19b33391ea4f75de634a6916422b2c7439f33f4730fb3be5b3edd655df5450187c4e0a1fffa741e8b5b5806064c86a7bd09c714b2b5b8e72668319e4c3f80ae67f7043459cb1f56fefff5ac4b5611b1bd11c093c906ff39ce8f6a229ccc8cebd24f39f106bc15b9284281078f36c75e232c21a8f9bb2395b0e7096882ada1bf5f0758a183ba70f88236051e31dfca73f009568bfd7c5139c9bead62991527f10bf4586f3ba8a7fff343953ed8fbe2bec608cf3ac64bad8fe14add860304ba26a56f7c4075f57f251ec5bd99e1bac0c5c1a6302af965a23d0b91eee8788004cc37ff83d7d185c2f45cdb6e1edaf7e4497fcbf0abc1ba5a8d9768f6b0fa406196a8352a8f1a2ce9755f59ff92422754a40ef2f87691895264f6cc935af9bc171be16a01b298f67de34c247fa88ea5a55171b413cb765d08e394f4f07d66f72f72f3874fbd8acc69f4f31d31ae2b10704fac3d50b7a420864afdc5a6daebf243374810c728678410cd299eac3165b6ae3f23b587f09130ae232f5381dac6fec0dc23fb261c7ed2bdc6f2a30a9d8420d47d12e863e3ca76ba6a2e5a70ee77b9fe6e1c6e2eda0d35f17635bc4aa152acf5cf7a8fb23ad78b833022dadf1231e8a8fd848fe6dcd5e1398a617cbb06600448289962df4b45b978f2fc8c2a60d1fee7101c76a7c5f833c93d882ee6161338313a0ea127ef65e63d7921fef54cbc057e9066e7d4ff925173420cd3b52455dd2c5f7063f6431223d89ed99d6f96f6453bb0daaad79d9cece6effb3dbd6eb05c02db29cd40c1a1cb37c9e80ad071ce075f6e6323b2d766f13e4f7d51fd90a5c6e8822010af45e5190c75368a57cc3814226c8d33a7507103f6de900ec25e47646f000212c142b990ebc6fe73924eb6fbf5aed2587d8c10c6b063d1ff658ed07fa2c0ef766f1d45ce6261213df2aa8cf4159284c7099bd21c86f1f69792065a611113f1f9327037cba17634077ad35426166ef5c62d8534a5ff8f3ef9831702d624fb580323d484cc2faff265ec7b8ed439b892c7974fce9862d91a3d0f74595611567a66327a97fcdfd4d2b088598b05b18a72dba082ffe72b3870f1cd020ad2aa4c63525d1be0509c2def589103e2771f325a613d925079bc68a95508de9245c654c2994b09879bd49b2d6a28f62d6349b1c75c5a2fb35e5aa8f10633396c4ed3d9dcaa8e74a5714cc736ffaa728080a1f513a73eafbf0be8bc17f7c2f058ff680966f0cb877f4e131671cfbc67c351eb7c297b18a87a0b494447bfcefac608af0f575b5c77e91478ff9ceb65e3982cf6815b9c2892f9dce4190d93e4299116b1ac96ca0ca40d44bb2e7fd70279688d1dd81837c9edc3d449d11d9317a485ef9f7ceb7b794af6fdd267c7174d82805a6c2377fcaea74456d662758f5b1957274aa50b902295350d0d0404f880556ae1e5a6adce040281138bca72d09139a721232728126e409b37cdcfd0065e2eb6b70bb17eed1fceb09101c34e669177c9a09be6f59a1e72402f973ea53eb6ebc474c058a2ee282a7f93bb43543ed5a64ab5d436f49a0fb01aff6741852a6dfcc9d88fa354a97de5b9c98869b4761e66ec7fc94b8af619b5f751d87c52dce3633e0176345ccc5b92e31cbf8a00a24d7a0ef72a316b3c8d1b110908e48486bb491a3ccaea579673c1a664c05b254145ca8e216bb58d49cad5a87ef1f6b94280dfdf7c51953d91571bd9c3f9e4b763c9a6b4ab0455371fc35351dfb21c7ac4109601560b404b6a963156d389d9d28cbbabac5b0bcb994ee1727ffe834d6cfc4460c7d6be72237e8c6855a5b87a4caeeffb2efb1fbe056e61a5c34940a19118bcb48698ce4e8677352a7b70f1d2c177e2036854c63b770509ec4e4540d8f4d198b3565a1491638c9813f4ecfd376264e2156c74af1da891afc1b55a9c7cdcec64da3f79dcbc40b1bfad5cf52b096a33cbef6f2539ec7903428b5495349f1c9fd603d37c59e370288eee35f5b7ec48539e6d247c0a92181174ec40a9c0830be5fbafb37be103b6b7fe742606515f3311120e2d1897189a50d2ac17f04c59de1f67152327603d98b4afb6d977152984fe817a180c842a7e6cf9b08f836f01f12077440797933a58ff2451fdd8a8e78921aa205ed2d242fbce9f7b69d184e5d4a9e083dfcc976253540fbe6257512dca2824a3bf4ed427b3d93c08432609afdec5bad047ea86bcb8c30200560ac8645c095822d9dbfcdfddc76fa47cedd245304c02e959324a16b94ff69c0aba9e5520149d2ff5fb3bd01b04f227c7d406de796a719284c398fc30337351114a3c89de40cae25c20cfb8080287c09ae10fd90355b999373bda92db2b4a3fdfa81252d476a7d588d0508fee5dd8e3e6f918271733d53fb2bd9ceeb796bc7355d9edccbcfbc013cb0442c33966875ad3abb1778dad30614d264e21e159a3ff5e817a3dd665e7117b511eaaeacbd81cd9fbe0d7ee5d7dd22a7d3ce38c575ed78828f4e443541c7ff84e4430f43c9379d8220512ddb5fac76fbd2c31cd868a90b4fefda5bfba4018c37334e6f03fb96292fce9753cbe803dff080629e0276cf593d1d78e8b9143556d99dc1cf72e091d7d338420f27cfc1f39dcc41b0d016612b756b938d1633ee17c2c4f86930ebcd98b66dc311200df79760b813a6a930723ec9d0f57c6359bd2dfb357a8efcc40bdac1aba323152a8b280499fca1a64f7c2f956e9f698dddeb2605749bd8787feca5fbe60ac2088b8e2223a84dd10a22df0e644491fb6a0f7ff23767bafc433209fa7ff5137b0a1c012763093ed3ef765f2aac449ad59b0975b2d5b9ae8791987ba2cdffda6baf180143e72efbf6099dfd4fcb89068d09f2b3dcb9e55620376d299f19ec70f4be40ee64a5a38154fb441eed3d2f667da12a53b661d9026c6155952927071d2dbde8af36c79755a071a208243a703235846d505c7202f124b3885fc8797229af83f04264ab315cbe2797c0b881dc942ea2a941a6b00f53fe11fa9cdde0f39f008073bc18960ab43af8c9128f39503cd973d06e6c00fd1975bf24c18258c3746b7f43c0b714f042655b435bb03b2d40d34dcac33484413436653d7d749ab8119433311ea532b0d90821ec96a4fe57f99bc19e138a911236541cda3635284b35f87ffb9bfa66e0b835e58eda1732bbc76911313e53e594d918141f7f1292b30af11565af5783b4f9eee8c8d6cd97184a6aac6d5f6fb227fc474ede1017447a6cf17f21fdb71e68feb582d39a99807f9a531327a70a5faa0a1b8eeb691d03fff19ed90ad641bcc4fcabcc6a466d76655ad0e886942a4c8690b3311a4861aa256b863639dde35690592639e0e0b8661d13ff41915f28dcf10e8c1c4300fdb62b0ea1e5dcba8594459d40776f23502887de8a28946fa9162f85dfaef97b13aae4c097a30151b16ea184a741f830808cf87430b9fe917d0ba7f26deb6ca89a6bb02361139479e261add784f0a961151d165abe703845d5b90dd2b5e6e6a022396e192ee6e09dd4eb1ec8a5240d1fbc0443cc1d60d461916d1e133c5cc84341eca15cf67aa592b41a9bd2d888695dafd0c89750260eaff221225b2bb38cba855aa915bd0d6aa69ed6a24117b0a31c8aa7a6117d74ced93682f24567fec71fed58c935a1af34c0737eb4553033f2ce461f1d50315fb708766ea62478c17013ec07332234b9787bd2aaaa3349faca339f4f3e102ba3a4c1c59001f240edbf43638bfc128303e256fbeafd45750ef991e22e7ec3fe49f8b6f20fea27590f9ac01232ad275fe1baada8db74e13696b26bba475091d5adcfabe14d56a2c89aa0619a549b75fb815fbfc3eff692953aae81ffe6dfd985f69df9efaa489a41ac3d0cb2d7a5d0c226605cc0436e89ea69cf47fc29e9498215058be21502321efb7c21e333f8b46295eee5f28e898af9a853d9a383dd6d79bcb34e12104d423abcb6fc35a59169507f1829892c69d6c20918f733e508565cca5506f290cca34952e3c919a45d9e2da2f8f4745bb20ad0703734f916b48e545758af6feb9a8dea4278207fefc50f8227f007987313e5ffeb0bd12fff6347d5d69d78cf3d2ec129acf8cf0b84a69d1ad9a8b63e136e4cc4481015b4a94478b036de89aa9c6e0dced9570ee3a51c989c1566eb4c1ef1b8f9d7b111d4ff6e47238333c328cf18616b761ea420c03dde47b539b3550c61dbba44611e575108e2ce29bac31b69d4b847ddd7f14b1a9ca85ce5e805022101789f189fef87e10ee66d3616955ba763b82268849343dce7e1611d2506a6f2d336a5b14b5a96d9e4df21779e7073de1ab256fc7e656b227c8c638463976af5796027d6230c4d2d6892c73e16666fba8fe1a7ca04c18be0e5f91a2f3bff728e8fe8d47687924f9cb01f9ddb79a83f6305f38fc5c4ed9498996f3c2ac8a30267d73c898e5a3afb466986081aec62f212b07ca54664a355c47f4af7fa8ad31053f152cc92259e8b47963beff73caf3e9e7f40f7fc4bcbd04a75c00c94e3004576cde1c0394b712178e37602fa48db8b10ee8dfea5d1c3ee84cdbe9b3fff6f019059a079ed7a1e008ebcd42b2565503ec836e6225b1fe52492b760462616002f0599e146604054cd8131175d7f8f51635961082379f5377640cd2a225845dd5d14038cdd6cdbc0ee9c38b98c7bce473766b9f5842ef62bf598e0e6c9496790809735456e868961c39f631b69793e1c51b2f3db9005a044290425fa84ea526b187b0f89663cbabe441d5521bf9ad0bb481ba57e70cb1996016da204af7bd33fb72218fc40fbc12a29636fe1fb6e249a4e8da0ddb2c6e5dd51f99d9c4b84734c18bcbad90070d06749f21232d84a3c069112a5ce832dbe63e31511c7f4a84c557871c4d03505022bc03f01698156f5e1fe2089fec881ce9329a7dc87e5e86be5404ef652b09d248bdd31b49142102449becb07ba80d46fbef04f63b85eea54313e70322541f11819584c57059015dd5b130220fc254f89065f032c11fbfd90571571f47b682b473b6591cf1a68a403e40205eb20121236605a76e3610876849af9c7f3f728da8ddb85605e020b146ce4f710ba23e19d52f03af46f685b64cc7724d83041bef877204ad285ffc20c13b6ae4b2e06623efee4001f739eb986b2884da80cd8fc6b2388073f7d6452cb74a79d1644bfecc012e2376527114b7849d13359ad92abb4e3fe12f7bc5dc8c55517ebc700ee9a41b216821e83b6d8249cd36d7518546b6e0cf829c562cf0b395b3226e014d2bf56836fa7f4f81a19c4fe5281cacb1c7afe55790f2b4c1c581223c6a27272cd1f199f3be3f33f42ebe605c5eb03e72d8f7bab02290d40bca51b1fe73fa1efda72f947f5fc5c8bb3eeab963343a9ce323f77624724a4f17b57bd979c1b94e849725a6a13006c5957a558dcb27c3e640f4a9df15cf9cde29e5fce3cc1cac04c3cd07af9999f2922cbafa77d9f5786ddfc62c0caadcfaaf8f9b57d7fc6bcb1e2c2ce2cede5e0f8b8158f802b386bcf7f522b27b6f723f8f52fa5f197a85d82e6c42035e5d70801bb9ee7413a849e8d3b77f4f3d6266177a8a0d5660055cfcbb2fce4a20c5690897720b6d3cc7a7023687322350673ee887ff4b390ffe525489bbe0ea2c38b17dac758b77a8d80426eb0016054ce9f10737e64d6fe2ca838d7fec0b2b4d736f36551213df4c536fecc837d55829a1fdb4435796464b47b881ca2c045ca95e1d7655fe60a4740713aaf39c5b4dd2dc1a7d401d7ecc1fd3831721e6bc5b0aacd9feea1fa3c9698c637b8fa6c919a58ed34c4a471f036e6f3e67be5ad4960c2e302fedfb4c631afd4cbbf777515e3d3a865637f1855d63f9eec8434e3bc2706e80cb2fc74829006c5624d5b6b398382dde1fe1e3d0eaadbacf88c396dee45614764e712a4d7c7403dde7ad15f677c86bd3738e5be2d2b04bc253d4a2909f53a06e3e80234b0518adb2e3cc2b186d112c136c3f328bf9c0ae5896509631eaf9d9de27bf1ff09ac4546a74bab64ef5dfbc2da6a3b1cc699c798cee587a5b97b019658d2b2bc99c50abba62c53b105b7a3335bbd4530e37c824bceb909a5625f634eea5a9aa3d540f7f93fbef01183c522cca64ab9d1201be97793369e03e5f5014dd198b460174721328872779dbdd87a64e024144ea8bb3725d4012c2e50b1133a5ff014675807d399bbc9b5a1e5378cd4464a315b72ed0d022af6bbeba3f329824e9f2cd43c3015c3b4861d215be571f59536a4ea537844061e290e8bfc27be169a829eab6af2854e082d515423849a97f7ca38911371e7514c1458e51eabe2e65b837d2bd251778a087f3c7b5b1d8860be691dfe1c0944161a3ad55d94b9405479a1b2aa3f8856bfa4eaef3401833a413da7e85bbc64ef4272401b0da61b8d8dc5b4e414a2a54d0cb6b023f3969b5eb91977d4646c1c0203645600ced87508cf09b1876ee6094aae3750d8da06deca8e24ea4003cdc5655e17d05bea6b0865df8b754bd5221511c3ab2a626ee63df598919ac141d7be5c731b93a736f011c4165228a7bddfa9fbf329d9075574915613a48a5d9d5ba2b354c8bbcc6f89baa9d654a6b545a5616b7143589d9e0ee6860a10209ec6a698cf89aee83465b004009f96ad2134533c44354122b7f5e39e9526f1dc5086d831a9543cb4865e81be752736c0bf0be1e3d32198ec6f1c7933c435124e677bda8004b0b886642c483320dd08d86421315de81f91400ff57e225c1885ef68fc8cbe6cd77ff983e7aae9df5c61cced2962437679bab2dcc0c83f70115d4c22d1321e368be6a04727f2894dd9d9b77796fea87d5e9fc71a4ebf3ce5323e67683977ef2441d6276fae45076dd2fd70c3e5285e9995efbff644626ed9fc2c53246f2d3d93378cfe427db8f8535d96a36758b024d7a2de7596c2908e7d4e9226883095fd7c460e336058a6f7830df0ceba886733253dcaa81eb7b718ff2739cc4816972cb11fa9afef17c715340efed2e285a290e41f92b5a12ebba184a8f3dc6f39557d02a8fcc1fabb0153116a64e8b1896413064187264d47aa0eee037d33b51598eba9c1e9489bd15f062f61f14f0f4d33644a8e3fcab222465fa76451c3ae96be6c5b9a7f3e55818f786d24fa15c80988888202db005a7a0be8639bae308499a3c930c0015b61e87ba8422e3cce8b754cdee01fe2002f7b0cbd03df3a7d3d78e47b9cf9fcd2984335df9cc8122b2a4da204906d263ff28f74a01547b1b6f1ec3e064a62cf527f4e869140205e744dc2b4bf3038685d38ce76e026de98e501a81feb58ac8b7e9ee7e22e86ae0abd4cd31fa7c003b68bee7722bb19fc1167618dc1872e821d2f6d4eeffd0513d6b564699511ac93194693d408c77f8a7e9d76d5125b5e87e49b24cf2e3e5691db8dcf5f3a7e538f5cbab0a0a65f51bf08190e8041d8e6ba4ee00868c5739e66e9fc08fef8066c1491800018c5d34ad7afeef06ceaf4e997977bddff05c055e071d91c150e8d9a3a8b06398b2983365eb6d993b6dd6ab370eb8c03c22efef3e32841db9a3d6a081eb6c28bef4c50a6aa6299e25394014a5f1223d8f6153a4cb6a19de476bfc9ea105bc6f14aeafa1f1ea59d429418d8c261767df729c6a056118860add05c3a1d156ae54c151ec97961a27293193b530d0ba8cd5b40538b6f324c213d54e086e9fe7bd70eccbfc570f940b016159b54290225b1510224e2ac6ef070bd7a786ae576433b97aad0adbd4bac0fc773da4256cdef79aefe2cc90198af61fc7f1438147a24b54b2da8f0c1b9685e89ede0d5620608859a5e84fdfbd525a83d0793064e49659b06f494009fa3579d9c242d90f1d712bc5aef028fdec46f48dd79d80d7fa7d02a87692ebc08544ef0259a07659456eaeabc9117233a0988d29e6d028506c3335f61b3dfb90af8911888a13a0e5655e54a75535fabd682d191e6a9719a78c590415201e95c75e280aede734e36b36ef3469002ea8cb85e7cfa356c7d15c19a1b3faa3184e55ff0c2180536a8c89dd230bb851d2686f801aa200f77832d10d345bf3dfd4a02400af0e36c97a754e8012e674b80bf5ac4d5db6c8484c94717a260b45267f52eda8af7a1ca096ae9b34cf5cc4666084440958b3b84560a873cf3d25f92c6b2adad20d02947bae4c1f3d697aa9f6494262d68550f4ad6c60b9e1ba178bc5c596f027d45d6548a25bc84439b8073d9e1bc849c63b5c1e074eea665543695169d9ec808b4a75bde086cfc6e697a431f846e5e818aee5593bb446cb79af34a2024225a867aa4a743b886538b40ca37d36bcaee4ffa9e67557f1015cd5e46d0e15fdb51897260e1969efcbed8cef7652c7447f2114772fc62190a6fc0744f49fe2bcfa8636f8ac57d93564d555dca6d28f016af9cd0e4c4efe800a10f214308e041d7c4271853414a337ed9a8d816af7e23323f6a646f5942084faf1817ed66c57225a41607587988d0c8701f2d62b98dae16d17ee649ca6e5fe6e49c38b50f91b3243249c5694c7cc57a37e072d330d8e434007309fb55c234aef8a3477dbfeae2c24956a1c398be41ecdce35856becea7cc8f4dde92842a38501c553890d7a5b3c4dfa5cb125158d9cbff79534f01b5667bac1324b92c3705938150e23e39f6d6f3007ea1687c6b63ccb4ba44bef318040fe0a82cb433cb5e93e4ba37f26654cce5fbbeaf85e8939a0ccf705d8ebd6299c8ae18ce6d0c212dbffc89ba4fc9abe68149e3ece6ccf5cdf9209c2122aa32585fdb5697844c41c6f83a204ee1637a55b7f19c6558e99f79c55d45c915f68c980744bfa7e9caf9adaced049b80ead99b37e1eaf058491875c23a4468daafd597a282ac200dba5cb68162bb03be91192c8eadb600e787a207692cde2d2c1d4640d2d812bd52953a34aa5d84317155c81d340910bc5ecc2f24b530fe4fcccf3e9f1f4f3acc7986c234e366a0e7d02221ccf5c658e1c8fd5c2c2960bbcf428db00a2122ac224ee271ba6257da46a2dd877d5171105a1f199b42fcd918c80a71e58b324a13151b9c1a51225e0aaaf5d28440cea2d7ecd46a68da657639a4be4892be6617ef6f3026bcc307ab8b84fd219fa70c17254701f65dd1fff2446e2ca288bdd0afc4fac3973695e2c7cf17d49a78d88024e073bfbc5c3369ef84e1fc541b8a681204e6ea2b047fe58635174569fbe2a9347eb4616a49f50555a489b6293bb5420636a23c9152a8dd8f93163456f273e0bdf4e1cd7dd4eac6fc9f03b01f0f0ef49417f7a9a4777c59282b29a8981fde4bd0c8a66c8f7b1935634574b3107b26401414684e67a4ca434bd802e65ce415cc11afdc0cb6c96095c4a9fa9608c3483ef20fc3a3e564bff915abc2da4461965b1ab19806b024c9e64bd2ec4b9f4e844abbefdf4fe2ea06aa6bd2bb92a4131c0adbca3d024b3f0b9a7773d8196577995a6e1cceaa85cc823fdbc6cbb1fbcedab741a075b098c4469e223ce0df9dd9799c613f3abf09d6a6341700b4a7d04f63edce54ec30925bf37cf7871a6eca1de638e3560576869cd1c7153328959d25abd5ac7ce742e6e67e46b2b44284191091a93017811390f6795c5e30e1745201bd3e31b12e78c01bdd5c05dd6c58b8b4fbe86cdeea0d200907b8007e1330b2eed1df9b427b3f2203356d90b069f3fdb6633db2ed0273f0b7791511ba44f676bbe4920fa205dc59f5d8cb819461408f625f1a5c306cdd884e2bbbaadc9fe43d3561cb5d9f6452548f5f8615d874befa1b0a21b435fb7efa3b18f3c03b77cc2ace38e74af45587401ec6eb98d777651a77870ea62d3f03f7092137d3e96a3571d53379512b3d7078222488a19deef1eb57215870cbb5fb650c90a70275fc91363fa9e2cf32ca172d8e94fa404a074039f38504d67f9b1693aaf9e0d1af3731d7355d4686aefd45f86998825ddfd060a812fa6d2df7299f4e5c85f1c64c16e4490ac772e81fe1a165c2d1c64a9839b25bb4ac33893d3a2f110bba813d80d9cd9a9a833f397c125e3287b09f87a6f9976bc4917c1eb55036fd1da271246fad5fff8954fad9697caa5916b0bd8f7650d66475cdc20467d6cc3232565a902d5fba090bd6e3d43019cbf0b4facbb8e8a316aede16e2c281501e68a1431915c710aa040eb4e7898cf194b5b7c23039aa3a6419e0bf0d0715a6b9d25068cafb1cfdb4494704b9358ee8f568a0b1600352322ddfbeb55a45cc20f572d0519621aa7ac6aa37003545ceef7f43389aee666be78f80e9815d231e522f64c72ac1a24484aa10721f516bb3cdbbc84183a74ae9be85a8226409d5df1d5d08cc75f4d2b856cfc21f8cfdb7089725f76ec8760253b02cee98e538f73f0cb82e61a8e9861c0878b7ff5e6619be796a96b6058929d5c63912a6ca4de37ad7c1c6a69acd9e093f695aef524af9a727cb1bf49bb968f9b26800669056acc42e6e75174f9380bffb29cf080579a6acee5c318c6780fea7bcf7d1df0c169ccce2b493a6bd8ac659764edb77eae75c09b9aaed9a07ec3bd0bde95a8060b176317d56f07343421ae7d6859e67e0ef6dc352f93055371f2d4e6c27cafa77c94d7cae4ae27a438ffd3d9f6c33adf2a8ed7decfbe2d99b682342191618eca83822f54829c826374ae2472dc33be76c1cb9deb86f6bfa1c3ed90f56a35c1208fa0ab2e46df34420d8ade5fb098ff2309653ac121c1787c0c260c0e1df0af7e273df763b6211bb121a166ac2142d428d5e9baf7213ea0947c99a204ed3207c19f5a26fb6d50326192db05e77ecfa6475d707fd3cfac78c01f184559a917c813a0da83b5f37c45213a77572fdd267ba2b472bc1882fe7196487ceb4a7909174aa48fc2ed14ad94e35e767eed78007d0d215e6a86d317ccb91cdfe02d051c5465343b5f65809b1c2d5c62669cc1bb2b6967f163f02494fa0f64f1a0bbb3be945c3f333fb303e33cba9aa061e3dcc01771da2ee20ca241a913c8c744c0a698404fba467c9ad407980fde345f6349bbf7694d2cbb1d3ba73db5ea0912248ea489e14f8fbb98979fb449f5f2b482fe681d45d4d6ffe82c55eb45b80396fd3e31857318464d89a5125f685bd6d3aaf300f54bbe523411a5995eca67c5136465796a1224173b26a7c2d10208c39212db01de7cc753c6a4c9e190a5d325668320cba6299db3b65969107a2d9282474ef2f50ab6e422bc385a7c37e6b5aa5231ee06fc73ec9e1940eb0e34c0d592bde44224063b82d91672d1e1100274ae0d99e0d1a850a4d817ed08e4c26699a426ea194925de9878187509921675a75f6f78432560cf49b28b07c60e6848cc0db82b543704a97fab6e49f4feb0a0fcebf0bcb7a42b9d3ac0985c354d652340abe0462c3e85588c1f53affe1ec36fcf8d233ea5a1ff2bd124d44b8b994637774bc410d1e2d32a529af4b88ff630c6e118f5731ae452697b0a3f63e286665ea373abc3f0063192ec7c0fe94f617ad7d1edf278d7886545d6c9546b87607c9d0a74b08242a87e734033387acf9fbaffe050d83000383327f8b6144c6e2017751b3ce23cb15f25a88fe68abd0998b00461ee95821751240e731a2d7c48d5be6a64e17ca7fee5e4e7f11776a1bd029d4cbd133c964675ee1e894832152dcf30ecd5f8a20299b631c250cbc004af850d9994ad2f66d726802591e22f342e2b87af44c8d5974e59453580f4014c1517f02557aca600133623c6eb941d8baa07b5b219aae5cf8b52b23b5fafaa4547aac132e909f73c17cc99382ccbd4345a430c56b95d13be801f6ac65f2f149d031854970a03633cb7e41206befe5d31e57f9f838a6a60ee3cf72d914fbef7d1915d8c3e2ad4645cd5292427b7d23eea190f73c54db8f1b983e744d67650ac5eaf2f0a63d5aaa46bb4e6d45378b89c01728fca8bfb2d467cc978d5b28302664a64671849210010cbfe97e87e9aae5a96b11b7669019ea86b419d9de845e8cd4388a4b7bcb6e2d5d5c64262703c6a51a9f46069fcad39095827612769643260b7e7e1eee371babc76cb95f8f153621cb995856e4a76f5bb999303337fb36b98a5cb803cfcbf628e5d4290913a7380761dbd149c9323aea72e480a1a966ee2a3d0732fe1108603f552bbd2d14dd3107d291485d38847b36e144c9d4538a25a4cde2581e9ab119a229bdffc08fde6fb35ac4f7483a706592ab014a82a7668b0f1bfaca6e5bc708446746715f8303b91aa0e418503ab76ed986df84184abfa52608b7374b441d56bce904473ea31e20943c38bd47ce36d9a3a88650a833590c609d2443b0775ef7735afe9633e8e2984f320b8caace25889cc3bb3d02f5aa131fae52707be60bf91ab949fed7386caca158997bc33aaa779e6f9c96d10a77f199b15a8935f7986972e58c6ff33b930d9f55d4a1fb9b26c79b5701d69887f031b0d6e1f0588d94bb5ae90744e57749eccd34a61687603c39422318962109889e59d7c92fc8fe50b988ccd6d13a7a2cc8df9e70a2f55131b73e70750771cdf8b29e9795985f8c8a8dbf756faac2577c197d3e60c612dfdd8fe1df36fc3725d902db5ef1d2366265caf16ffcaae47f4e4154ba235d15748316cf7c3545623afa4a7ef1427b66a1764d39e588c4b6287d23d1de5ab9bc61286ac84a4e1af13a4b93f65d3369d14b2549ffe8e0c2f60cb7119f8750f22a9ae171e306eb455a7737178be468829f7265b592eec4c926d7764eede27864c814bc8e392019f085c2d73b95a586047bb813df61159dfcb44aef0d88fcaa70c9b38802d236465bc8a6717b7d3365931ccf628b58e92aa7907aff2e1403b6052ee3c8deec39158cf953a2f16b5600a50a0f51a8a99eb34cd49882085cb4338e8a9c89ea4ff3ff0dd7c8dbe06c59be383ae427cd3715cd7108fb5c6aa97aab6d608065fc2d8d4c45c3b5355c71a44e9c4c6dc47995f6c4251ee2bf49b394d4ddc80d99db1a182bede1cf67e607991c40936fbc565704c39e405068ea4ab017db439cd5b69b30b9d68ab96ddef459356455f96edf976079c03c49bda0241730f285716f734cefb8bfb9df83808f93848c35ac97785e46056cd6f4e1ecbd45beb4d7bf35bbd8571a51a037749c612d68c09a136f3cb4c68f4c75d026543a94610eea85dbfabc0a7c9b24428ac476eddda7c6ec858811c5b01aca96f95b0ebeca442f47426630f1c5b122480c4c663fcf14553d55c9999ddb6aa285a223a9eda60362252f2ae0c12c19ed5b760c20a58001d1cb87887d15b6ecf68a9169c683f0c737fd207868438647e1623e21cd3d20a53ce6b8895b8d0e6e098bfe13b0c09c1182dcc00454b1eeaf90ca7a815b80d1aa9c4b71231bc6fecce6e585b57bb80e6d1bab40681cc79b56a41c3c7844c893b2007be23780aeca8085572f43563ca0f75a3d52ed5e1c4e1a5149f01ee764b15ea5f2e1859a0ed56311e2584308cfbfb063b267b6188d4e8dfba26a77a5c31e0eb0c7b86de58b933129b9887945cf27ae01180fc9ad6d29a27ed6f0831f2fe1942c25ba27470595c81589ce180cd04f5720eec94a16b716177bf9ffc5ad514b21d7cdb81cd2a557195b84fde9e1f1afaeef818fb0438d20eff834b71cc42acf6c797d708ba28206bd82c942a639cdcbf50d0dc016fa4a958544f38b33679d8ec37d5df025094bac8722dd85b89c50d9316d04d990b8d81bd199eb62b498d1b65f8c13eeffbea64a6343f67719bae2fba925ff1b97e35463ce7c889cba3217ec3c5462ca7f637913d3398f629cb34e55fdaa60b346a73ac800222ac26101135b8c7a8572fc8893692271ee139e0925ed449cc2e87cd9006bc1bdffd54097e0aaa8b96a12cab7a5d5e997dd2f29b66ad97bfafc23dd9efb1777d6a538df6e748517509c7d05b9b62d319a0396451bb05f1df7bdef9a6012dfb0a151450a8ddb1ea30ba32012ceaa8b1b603145b56ef04a904aa2c8f8fc2789b2a4f5e4fae16c0eba84f22c49998f08ce5169ca4fe574bd52cda3e0fe4c41fa4984a8217bc9587628c78b383841a4304c9718be5f6cb60ed28c064222415a27634949b86b1900e8c293503e404c10adb44fc43a725c2c6f660005bb3e9c1c7e4b470b7167ad8017b36d4fe5290c24860f9c6c5b7638323db700a531f6b2c429e8a909fcbe387e83599204852f009c54e8a71f0b87c211a987e7811e21ee1cbc22aaded142fd52f9009ccb9346b94d90276b3c5a1fc431df69d05d7d54701f5c5476b463703d1ad838fdb6beacd393643766c92c1529f8c2e124d9adbd82c7ffd1be33d8939c6f7b71b0db2fe4e1cfb0ea513d09fa7d9822cc228d61a6d252b0f860de0d848a087d25282dcf85c428498c00f5a009e09751c3b7892cb78c2f9be88d5d8f8761c2b23d014c6e8dba4ed08f82a231f7ca86af983e2e4634cdd3a6dba969bc5c1fc34ddbf8a6f5843ad02c158a413c79a5145797502c07041bbc6538dd0c88de5f8b32b422445c83a21232a2fc9f8e39bbddd1b2b675dfee02af4a707c7daf335c6c1ae8ba20ce759e99d1bc3fd0c05e55e078a7b2c3cd3cbf2f73bf8126016774903761aa18da7d9fd1e8f4e68c35f8a2ae0f38e706ded13f1c39600577cefa831443d4349e6960483666af9833637a924ee83ecdda48247778a4966168d02cf03f624e3ce36b30c6864694b13732515f01b4c3c43808e14419a66bda0dcc7bdb655bf10ecabd0318cb29e27f9a4388edde1b15a24b1f521c795d41ca5b8f6cb5c5135eadd972ba001555e5ef5ebc179368cf0edcac0f38e8b7ee989a0c1446dc7f9dd6818520ad2040557aad1088fc03a4e5e59063cbd9bfc438f96651b57432f691dfc8b31698303b3d2ea1ad31aca16bce8001c7e1477052d322ac1b015774afe143919ea130d24ccec5e9d2a6b8af69b8fd5566e4c3987fa847834a457f10c747086ffbf403a56903c7838fbd262574b07e22488241bf2576e7461807a66b8a56a04f865b7b3a50ff52c96b77597f8d12c74a8b1eefc443f733625f3d85bfb781034ddb0a69e2557d7fde18f5e87030400136027053379a6513cceea7a8d1a222cee701a2bc9191203a6cab07d62e96f77677ac72629558ba02dd72770005455c8bdbb3c013384a6cf4f49e5347e411f550c06e0c251bb7c87bec3d2bd1df3cd24adb822d416b99e8b2d4f40db9036944552c1b56f739544fcf352cf257eebf847444219317d482539896df953a3cc00d3da2b001e867205a63e86456648123831f2ee205277137acb43db028f281a111efdb2575e51b9dd71692ff2da2dfde2128622d6cf923b2b5f884cf4611ee7da76e5ae4c716d5ef7705ee77a8ad824015074c665983543f6406579983afa0a74bf9cb436887dd59b6ea5b86acfb41543e010cbad99041a1f22e03db764e8d43b1c46748fa49a0ab958b1dcbb1ae27a448edf68f3711e22af9986b4aecb735e8ae7ff4f0bd21d04cdad9f8aaff478481c1608c95bd35265268eb291d6f684548073b2d938315a16316de73b22f1527850147a344e3123514b8c308addb4eff229dca6fd5c9f0e0ca15d1a328907e61afa7541c74187b04910a6ee290863fc8f2b0b0389b0a42582ff48374c04b7dd8b1245850c2719029530a13564e06af09ee1910d5f48570357c7f591e8be15c6ce8b7b66cdf74a89d7d3b0ea25a465df96fba4959c8af6a32dbecfc88f3a86020029c1977de2657385b2f20465abaf5228de550bb699dcdcdd4bc01b84765280efe5e56f0821b418c0f7480b732ab8a25a48b91513c40abac860ed88b2a2ea30aac097bd669b5ed4eb97630126f8cf9beb08abb89d113dd224ea005ef7bf3c448ca5fd9ebf6d4727c54b838cf69d3dd9b3f7dfe5fbfe2d7b6875b9bef3546a009d7b4b5e160a8b93ff9c8744a367856d57da1cd4886a501e476a9a4cfa9374e872eb46eb314de94d1d7f332deb62b7a541aff44150ce66e54f8ad079a64002f757d02838471bb30d54700ed1b8ba9c5af5dcaf7b1e9dcb74e506de035bcc28637d05951ae11b4d48b970746306fa161bab4b462241fca51188cfe39bd6fcca182d91fcd436a2068e1c66aaaaadcb906a9b4b4aba271f92c784e50bc2dc07a6bdf82628a6bf771aaa76379ec798f122fc9e155cd955c5f7ba4a3455c0c26a22cdc6395d65ff39b425cd647fe71ad5779c5853e1ea43096c1235c9df7949c6bf34b21fb2bf8cb05d43227237fabadaae915a5089ec0e792a846322d49314fb54aae7a0d1781afcd45cef063f8c7982bd9654fe4d424cbf1a855e91a0c1a967345ee0e45d583c2b6e6c84690328365a97ba889867f430e6f1ab26d52fa9ffe9fd04f4b8fbcf9d68011b57e92981aa79be9b11e130244e503e545638a81992946da31d8d200f81f2f19cc3401924b4433014574b6e5ceb1ce7a1989f91fb6fbcb9cce9248c0f93377d675d0268dea281cff66a13ee14ac3478f8d58db584111eae0a07a6d71ae8334d6575822962461adcca49aefcfb59c23028f44ed93c80a8bb069968873c55a041ef688cb7be2cc3f3e96cd1b1a118c927f67d9e57e360665dca1d01a88589fe19ad2195b6443a71e125acaa17708e9aeb8f8b123612eda34f2a69c07bedc460e5a2d0ac501ee11413934872ad759da4f1a788fa642e5449fcf54d1ae521de01c5fea3bfc33ad5742763abc8e051ff69d03c89337fa7568e3cd4d483787d126354215097c9497cf8f135b623ca7a027f42fe65bcc9e87f74ef8e32d69f9f983285af70ff91d92f14d012eaec8f9f0f78621445fd0c8b290977a83672af7e32045a7a68f652d85e1350ca486954f964839e495b67dbcc3e5e9b0cf1cd171949fba8fbc20325f2b2320231252e163f95a29dc28e5e9e73732cf6776332d726d1e8845f15cfc3f5ca7915ae4a79098fe44b086c1c98fbf473688573b1396481e170ced64f1ab910b7c3bb1557c0537e392f416c8b4ac8b8cf653274643d2e16da6f15ef95ebea82026cd92ddba2fa476a79cb9067072fa3c96b10588460e2c165879d40b8d57de5373ac6b809ca89fdc736eadd15f996104799ac60eee416137415081156038e02cd1dfb5d820fd550e6a14a584d680f824e83e512761bcc9ae1fe226ea1248c033c1bed418dfc4b2d73ae1dff67ab1182d55b2e03ba92bac7203873940705c3c54d14221486d4dbe5fb4c32570cefd3ad93383f58b77cab2d820bef4327826dbfcdf0cf0badb0ab37f7ec38cfc283eebf56eb2bb5fcf046df8a4da9d8f4929331b1bc4ebe193aba824386428b42a516c44224ca84e62567989cdb02f07516802658d6b215548e04e8bf36b41e60e8c67514f7d6f6ad6b33d750936fbcef8337cae0e09bdd0ffdfe3b65a756c354d1278067d8bd2e2b928b9b407d45b68902a9ec35811a3154e518d1ab44488ee3ed2422fb7a2c8bb0bbcc03189603df9fbe77ab4f3d46cb0a0b194e85428fa5f33bb2154528e8ce736a29c729450590a715d43734429c22d81c9a7e98fe1fdfa3f3309626ce2005e3778b1d02cb9f549f781ef3dfef17fae72fd29a139ac737618e2ee4b2d9f596e567e74646f6ca8b2350e8f87e9a018ea472a63ea02785972f824e3d9f22ed8291b0276f7779003d01a6501b68ba238c15437fb3c271099f48d3e7ab22d8815ff01b65bb800677a84abfbb382f99f2cc98b1b2a4a95376bea1a7e3adff4a817bbd2fe33d7440a115d2f5bb6c08f397345a9408835840834b187cd5d7a810d06ba24867ea74778018e11ef22e68d79a254ad096b723920372f91adef123d80d85f9d20cef4b761e8f31cb1bca0d2b2ab1a3e925b84510c8fc23aea3780593c174be0bce350e7756d9110540d643274ddd852d3af90ddaad208f7885907ee5d37a9746caef519837828ca69c4571ed30548796f1b8432e0c13515df9ca3927f9dfc97e1a9a819ca5e9d16a6ea9e11d542af3568a47e767279c81db737e75552ac3c28161adb116217e5e8595af842ed23dc70cb46b8aa4c169097eaed2383dfe148c1e6d37d38384fceec2d05cbcc1f012492ccb0ed091a629c3f87561b26ccf33b1b85da357f8589685c791c37d6042dcd9f6d5ccde3143f779252fee5715aea5d500a8913e320b3690787279893ae69c9d50bf7a25eb97d7244593942b281c7046c3372b050f2bede7f43d55c4e80eaa1cadbfa1f2c70f874664957d7c01d4139e7341d4f0938067eed7325b3d2eee9fc839f626f7d0218de243c9d3b3142186888dc8d5b362b7dbfda66b350ca9fde12ac2f4429397f6b3ded4ac4b71a4a6d09a4a620c2c58a7bea0e6ee88707edac23ee4e4ba86a08ab678d7467f0dee1e8f6dbcb9857f0776a85802abf001085e03f65a144a4242783d212ac478515aa0de9cd2660aeb40111cc381b55cede1edfe396e8c6d8df0fb90d99e26fba7c34b509703d6d82f6c3b966ae233869c294cdaf19fe1166d838d1af95436f744d271fb9dcd4f2a84b264ffc875d39face0ea8da8af8f2dcb905db1d08eefdaa172312c11204e0a2398f99b305edcfc5263d370b8c2a57b55835016b68e643ca7e69c1249fa8be027ce5bdf9740f2f4eff8801b182c790d23016d04d7ec9623dd054b8b6406a31b5b746dbf7dce96e3f58f472a73793b7d26dae67dae3640dfdd9112bc81106b166fd4a6f1af815aace46bc4d894bffb7e50c218db008e2af33e543ee26330e326d57ea34b68b812be84213b24e8e6697ccbbce17663238fe200edb62b3f26da5c6e4a0d340f1409f179bf2e4ce574b449d8501a29999cb1e51e81cf4f80e0830ebaf936997756e9b7441209b4e9c5ccd762ef9a6db9fd406a9e9301ebf67b141f00961fc7791ee5e6841eea48c134ad37ce5e5f86b9700dc5a0b09949ff030efe6037462ad0c072345d16f1aed8f953c15398fe96c2bba8ef889f918d45fd33a02ad49fb7df4bf5a55b51170b85cf3f23104da01c516eae4a70daeb5f4a8400ccb251a8e3c0f18f74266b43419744748a811b7cbde3fd5cd59aaba60df5f9509ce7c25354668b65efa51d9c2cbbfcfd069d7494eeb2492d711dfe1044eb4440e4b1e5268473d18321b398a3cd1839c8f741131d894a19b8e1565450756d60bb296a84820192290fae8ec5573c4149482d83fb91db39192201cc15755de51e8552bcbbf3a4921a10636bddad9b0f7b26f770f9ad5916680d98604eb921f4533adc839090f8dd5b895cf75afaabfcbf951d1172dcfc809b2ecf0efc49a70ec7a55f41a39ab239af5849172b3c7b9ec1f67b1abe62065cb9550b5ebb94ef8f93fe3aa777fec06c778ec6c68eb9fb41106bd5e52f40d18c857d1d3382e811915dafc9667e4a809760383c81af16dbbd07a61b90fd3cab4c56b73dba3d6bbeaab274ac079b4184c146a6bcc8eb1b0a75750b35828d737438c1b287d4291ac82314604a8e850fc385f932d8bef44b31ea0fbac32db2e02a3800f38783d1d9b20b90d1d2a7d00691d6e8a3f85a3d5050d804c195a49466964b086b0f81d0cbae8380d0af971ff44d76ccabf420f667ed1741197a72be780e5b88b5e5807fc3bd39e49ce33e3c15860095a7cbf39603421304e2abcb4f4fc8b8d3fd55c7a9607fbaab6b5173c6109ee050a0bdc804565a54a02fc1c9be615d72c0b8f7cf2bcbf0d255db34f921c76ac713310eba60c131a9e3b6ddb277f870c6b88a07251e52d4caa840d823a9d9d8d6af683d0ecae830eff8dc2c4c4927a0d624ef76fbfe8730e31ff757b78e677e9f5ac73e7be8be17c22e3ea1cdd7e0a8b60be33a50fd18b94e4c7e757753b3191fa42da3500258502addbb0a6a40692b3808a26e15f9c001126d9a7737e5c8b9c3190d9160f523c4be5eabb6b9e4263b3a69742611c0a5d46dc341343caa00a32fef86297b79ff3387c311855e0095532bdd738ba4391fa83e18005acf7eccab61f941860c481e935d23ac83eb3c861a429f7056a3f68c744bb4e7d2beffe7c25b2175d228855b101b4c6dfc04765b9296636d2c5092c0ae3eec283e3ac0307b08494a0a7daf143e3a786a5bf0e874f022de82ace45e12c958187626c94227c50b6db44ea875ccb630a3155d254d1252965cd447eeca3c6124d89407dc4b1496eceee990adbeb2d0199153c425dbab429819b21620f96d2ee3fd80a6e280484a5d969c8b7ba1a71502411860e8763b5016c90c4e1a076fc077d7bb8b41c24135f8f9da5d65d1715bcd2a7d4581160dba1ac607a2cf79abe1f0c576a60e042e5bf63bff1c0e6dc5bdf99561e4e3b7e75333f0c8bae35c6aa7bcecc92ef854cf67af9f8a0d45e2c3a67140930924b809084d50b698dd83349d1338ae4d60e28ac2fb870a9372bb91e279b3fb434827a81b93c70576950284e29fa6a84ac4b34156a512881aa2bc25926343f08d2d17bb23c38a3dec43b85345f73f65bc7e2d8f6e9a48df4698160f76f475b6d28aa40bfbebb03bc29392a8801c3d5d6eb4a789aac9434cdb6a1be72263338eef2dae1d46f3f0f02d3e057fdda8accbdaf2449288e44ddc90b15e585535f2441386afc4475b0960a7cd9801e9f25885e12f52e3d5576ec735e2845b189432f7730eaf4f9995c39bb647914395f6bd6196470ece04acd3f2163d175173d6eacb8149355582cdae3724e1777bb054856c4efead0c3e509b17d79f73be24a67b550a7bfa0e203b95cd929b4f413dc9e9d4139d0ec67c34cc79fde593648d344e960149601dc7f3fea1e1449f8df273fb92c1fbafb7b881092952375027cb6441b76532fdb550ca4d5fb27fe0650f6a2e32ebfbb38b6f93905fb395af951a22c0fc4ee1fc6ea2fd16c0cfc7eec540a9991fbd10b494eec7b36ac27146e00061959f5a47ea8dd183ed283f5508051f445c7bd9d42db47e07682051e42e0457ee48776c80c08b77fb1ae521ddf0b825777888a606e1b1556b79478fcbd702f5e022141413cc68f36842acf90aff6eba08a281422affab923674e9fee5a4beaf49d4183f9bbc2e4c422bb602151e9fbdfed150fa6e70335104e55221e796a6d7d982425df724cdbeaf1f58d06eabdaf067bbcac2daa32792dbdb2135c66771da098c17d5a9aba9bf49a1d22d89902919ecabe5dbad93bf7536da56521162d03654ec95337fb3f039c0f84133f048f7a7fbcc5caa91b3c4c7d1468fa99d1875cfd300b20f9c7b8f6492c27c4a98cf20464de14a327f72f454338c185283d42b4000469a56ac28786d4433782dfa5fc8a11f6cb08a634f78201f008c8855b0dd552bcb1e464d4597d849aafaae70a921ac8ace010d74bb5d5cd338965131b62ed47e1a4d762dd3ab9450da48714c1ae13c86108729f0b253f5df2aaaa1218fa6e244ada669673cf6f5ad9aa2dda99d97699f0375f5a729f24a08cadaa3129d627160ac2c8592683419272432f9abd1802a364a2ddd8f760a672962330b4b11924eeae47da388dc9d48a6959399fd8d28e1a373b883ec16eb7757163b1c951b46c50ecb3a62419aa0c0a5208ca822b4fc716b9dfb81417c92fd180e29f87cd3a7795c21b8cc47c23c30fff63856827597abe7170c666ab2e0a0e42a213ce58840570d2e1c16e9020e0bc499c56128a6f4bde568b51b758ab45ce4328d09591721fa8bc41b4e242df44582771aca6ead2b1bc06db8d5fba3132efa72750e676802dd29498cf180684a9d2c915f0267af824580530ea3ff0320fa1e9b5e7d456721bed800434dc4dcffe87d04917750ef6706ae7c14e8502e10f3c147f0796fabede5c01b5abb7a45f9ccdd9b365333f9bcd19e232bbca63571a9a4f8d5e4bd5d068e4f7bada44a6cd5388b2ff1176753d048939478df3c8731aaca062c7bc21e94f5cd2b78d6e6851c4607ff8960e1cdc1904adb28bc75e91184dcbbf09ea855cfc3d84b57ac5551fe869c2cb19be39071c3047b907f1125715f34061f970847938c08ba64676e191cb19f8cb91dfffabb6f791318c2aff7fd4f3b3f4f7c44be02c5811280500f926578fd098d5fe2c2f635c5824943ead2ac2c120cd4d9c19d1ef74bed1c6e77f26db27b79a5366556dd1dbb21115863294ab59312d4f52f790f4d03f72d768cd3ddebbca2e10343de4671395fbdc5351f2c51a864ccbc24a20ed7c40a75b5847c1eb638dfc8d00ebc701f7358f94b55be253c31951012c843046a7ea857a762aeb007447020d43bdecf6e8c88d20880afa0bcc8f0f9402db607c33991415def9a2e1f19e8fc86601a9109c2b21b1684fff29149e74b4fca5e855f97fcfdb9bc7d413b55000146d425bc02dbef24caacdcb5005ada87be46b5e44cb33f7699004442231ce0a6abc7156b5404aa0a78679ebaf7dce0b34c025be80e063af5efa7d4036d58cea548a0a25fec89f790e7138c129b11a82907320c185b98e6e8df8e0419363f68a5298b3e169687c3b8d718fd8c8245c58a497c227f222cac1cd6367d6a87490787498cf7668be42bdfb3b69e7e48561637e9ed4d4cfd0b988110d1d0a221cb9f4b8f5fc9a9873bc6f01d12cf119c060aa570cd3fd957066786b5f156c2801d3d5e8848f9bfcb51c112095403dd156d3bcbc7017b98afebce6eb9b35371b00bdb7c9a56ac4abae2e9430e5eaa7d0a01aaf638e33cc26425c2c7612611a12e20b0c908c2759777d60412c06b58accec0f91016d52c6f82e42d8687283f20e29e786075c83913ab335a146c4d666e8960ed1e515bb9cf98984aa8314634c49e4f8f84f2eb7109a6bb9335061bb04bb8b88f3a7d6aef6fb566695fbfbf1ef407a7c8d159b4105348d7435ff92446aaccd7b0d6ab60b26d0bc018b485d13e18f06510fe17403557b2adaa66e820c598c5d2f5069bcdcc9a96bcb03342b4e4a3213378467c81b0a8d87a7c2f339fbf582637e244577233b7905006b572615cc592452ecd45873f50f7dfe3b450db99a63baafa09889e1a196b36b104b6255023f26157a7552fc4302229284e5040229f14a7a57b024f737e8078987923024173ac79bb0774495e4a7e1c0e78b9e786c3b3037cd5711bc6851b30c7b5a91120e809a79038cbbf51ac8dd6e3cf645ff1259bf0121300908e5ee3535d7254e90af0ea38cfce4331825b5938846390da380fd85508583e730f0812c02bfeb5a7ccd9f62d2a09b569a748f9d967547dda5f83dee16448f65c9df4c03ee1bec0929764293e0093d9cb94ebc167c89161fed9035bfa6d6171ccbbf59b400e7c68ba6ab807888ff54e5850ea4323d465f0b6a0d3f32287b6d646b79c3615b7ea67a215f880f6abaffdd5cbc22c93fb350bcd5a67f8e3faf670cb16795a6d49c8605dee919a03e83aa859299222b6b004b04edd4b98f9e10f68280fbee989c0050e6af28997445610c43861b62825ed493d40194396c3fecb4cdbe32b3cfb895c81c70cae067c54a5b40925bbcf28ada12a1c3da4bc261683395896e77d234eec1946d81a58e8464e7abfc466f00faec847c6bba107262b84ca21b22afad8b9abbcf2f678ed8972f7e5ca713f46cdbf734afcff2523663e605215abbc7f7f2744dcb3ce4edcc35e87113dc0b06773328a19d6a1e5c74cc76d10a68cf574c5083003ab310346fe89eb324c420a56daf19c395af09bcb7eeeef0a954798e22737c3d0437b7e364c9c41005121730174ad9b5db11aa3e5feb8cf35420b07665ba2948381215b5267b5a73dfe6e946699d1d9ab9d891b310d88948bf4dec9a688337accb1e6d3a96c6e216b870c51a6c970abd9c057600df09d1723bb4ac5a8c1d46ed30df9f18265a6033c3ffd2443893fa103b38f1e59e27a2f26a97434c2878de14ed8a03a5238ce0fc6d4b6ba98a4a678a314797f3ba067c8a182d61433fb97444c5e4c2df034490d9d36e7360921a409996bcc827a3c11a9a2926903ecfa3ffca6fc11f17d5039e2baf0755a46e2c76786d0160230c8e6f89aa00211956f92bb0fdccf604e2db742a2fdd114b11ede807d3c558b714e3840bdbb4d1e0a6f4c9a2ff2a72f37abfcb2563122eb3ee3bfc2c0d85bc192ca3cd4a6a15e7045e5975de985b2479cf41f5ff38c462453bcf985c3ec1d3fe847264e661644ee1fa43b2fecbc356f9f115559970097524589051a406b3bb9f9aba862fc1d67ed85fe24ceb18285fe1f617152e730adac8947c74efff43b3c9a3d68d1304a1a5ba9b079565d2ccd969c2f8332119ec1f57cc1c49cdea2f632b4c480f3888957f1aeee3d667aa360b53b73dde2fcaada5be24021651a64bf9a690ed70a91b73f999235303ccd830387663658735787fb85e72cd6ea3576d48e1accbbea4759ec57ab20b9e98bb3ec900204a2d8aaf4fe254d7855916f00397cc6e7f748575f4fc0c891e006cc309fc15a0976a105ff71d9a2af3df9a5de0204ac658e4e0bb6e963a5b50468656b609906db55441e82fd41e0b8874a1296015c83bcec6ab749b918b74fb12baaf10f136629869307079974437e3b9c87b50bcf9b16c4dc261657a5d41226ca4e82b30ee98eb07055c4022285fbecfc78362a5cfc6bfefd5353a28715081d9ab4f337b080dbeb2fbc415ee0bdfc91ab48a1c7137d8ff927cb2a894ea44f06bd732df3b10179b4791dbd17c744ef0a88d16f8e5398c69fd69b3eafe67dd23fad5da8f633df6c0fa42a14e2fce33c5f2ca4e5e0904780b7c48ff03d950af6d602103efa4189d1d861bcf2d92cdf60a6ef504ebc517dc8081dd9a32f135a8eaac1432646fde24642184e42bc1f11814443b0307d530b1031ea66f76a183092248b594c3580804a0fc0043e32ca71045f27ffba05a7fc533341cb30e5e74aa00440553486cfb314815301375bc6d8ef95dbc2b2eb4bbe49b58596b5da265d3dbdf6b891ec4aeaf8c411acc3aa5f50a535c5dd5a7987aa7f03fe7d0040804a9a0f4e6c7829b98ca4a17de4378c8a90ee1445ff7033541fb404574914a21e7237d57c60c4b5d3d78cda8dbc634e5236b6e390afe2d3d2be920f1ec717d0fc1f5fc3108a7add66cfe6a2390f4dd654c4160e8493e629834e24e1f71e837bd980ca07a99ce1fec4999a71a587e0f24d328db01d2a337d1a77447121098018c0f4308e79c2ddd7fc0e45ada5d5fb3d1a7e66d726758d66aa8cdb1d0d8a7b9b743574187650a042056bfe93ccdb5b6d4cfdf777a1e2e50fa8e589f54d549ef5ef80068c55f9d224d03c824d32e742cbb5c4acf086840e74cd17fe7fc508279d3302efa786da7fd2e71a02f2bd0203d9ad517b186c056d0fc1c8b914dbe83f06cd6754300a7592669de06f9ede70efd034e31f318565561a4270bac129b16a453d39ca68801f744a32a83b9cca447aec4476740bfb5d2fda9cb5bf8b2be0f75d9d7e231c807d9f028039a26b474f8d28ad1dfbca9069d620e32d9822fa3a6f3fb985cf65eeaafed28c06414771eda69c77692711e86eb3520270fb3606885880b680d946f3312e79f644a1e43f0c4ba6b962a2b74a3b29608684f5514322392b20d17077764d5136d977964d8c6be016c0b2f01c7c0bbbff785a427f78b06ef570846dccbffb244f8648478de8afa71380f4e0f94c775cdbc7eda76dbe51aa6c51c34c2d49270d0b8fa3d43f57f6144ac9baf5232e4f26617d2ebfd9642cef57ace5b0a6aa83754d58057f5286024638d94956a8a1c4c1bdaf642330b284ec195dc8cd943eda16a3ad64d85d12acf725e0fedd8937794bc680674052d8a970bda4138334ed257460aab17d1a6f6ea81037bbffc86c3ad2192c8901c3bf1afc2efa55efdeb36bdcfe7b6029bb506f7f9a7ce4e94d4664aecf686a9b751406f33429250d50babde20c61cfe0d90f4bdc84790cec6d1421814f4eb91df27454b430450589bda54bea8e93e09c5f63401646ab9ecb61c33d660837db08ba664a728d56cb35a162566977a69f7ddb9b80717896feaedad98eed85b1e823887531ce5134bed58edb06f2e7f58619aa7d4504cdc99c5c8d7278fc63938241dfdf92f7fbefecfed4614f9859932437646ed5fdc7eae65d3716de3872dfe6a11acdeefadeb36800a49bb8754449d4fd89cece4910107e791e3815e8e564a28b61b86d4b953b5c78ea2036ffce137350aeff9aff66f86c1f52af6b3488291a6a439c56cd9d7051f9adeeb38d4c4777d1fa78d71d1fc8ed0e313a7c165df26d5fef59ff3dda17b265bdfaf40fcf7b063b738d5b7995405fd7272f243e0ec11c56b4419c8cd75aec4e786fb8047ddee8847b5acf43b35035e849cd09983b3519cd70fc1162a3070c6181874edd221dbece3868677dcef1feedab2ec4e0efc3073752f1653143d7b7e69d467bbb97dfc64f79115a5bf08ff0f8927f4392f248170b7affbb26e0461c54b55b5676c4822dd90d465c2b13d3b7392ae3b1a6ddf57324469c939e4278c5ac599fb46df89ef4b7c29b8754b4f3e25e406b2c9e3fc1581251a4665e0483cf6928d672896db3835bfec49edb738f1824d8b7557a"; #endif } // namespace aevol #endif // AEVOL_JUMP_POLY_H_ aevol-5.0/src/libaevol/AeTime.h0000644000175000017500000001127512724051151013312 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_TIME_H_ #define AEVOL_TIME_H_ // ================================================================= // Includes // ================================================================= #include #include #include #include namespace aevol { // ================================================================= // Class declarations // ================================================================= /** * The time_ value represents the step that is currently being computed * * e.g. when creating generation 1 from generation 0, time_ == 1 */ class AeTime { public : // ================================================================= // Constructors // ================================================================= AeTime() = delete; //< Default ctor AeTime(const AeTime &) = delete; //< Copy ctor AeTime(AeTime &&) = delete; //< Move ctor // ================================================================= // Destructors // ================================================================= virtual ~AeTime() = delete; // ================================================================= // Accessors: getters // ================================================================= static inline int64_t time() {return time_;} // ================================================================= // Accessors: setters // ================================================================= static inline void set_time(int64_t t) { time_ = t;} // ================================================================= // Operators // ================================================================= // ================================================================= // Public Methods // ================================================================= static inline void plusplus() { time_++;} // ================================================================= // Public Attributes // ================================================================= protected : // ================================================================= // Protected Methods // ================================================================= // ================================================================= // Protected Attributes // ================================================================= static int64_t time_; }; // ===================================================================== // Getters' definitions // ===================================================================== // ===================================================================== // Setters' definitions // ===================================================================== // ===================================================================== // Operators' definitions // ===================================================================== // ===================================================================== // Inline functions' definition // ===================================================================== int64_t time(); } // namespace aevol #endif // AEVOL_TIME_H_ aevol-5.0/src/libaevol/PhenotypicTarget.cpp0000644000175000017500000001366512732772533016014 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ============================================================================ // Includes // ============================================================================ #include "PhenotypicTarget.h" #include "FuzzyFactory.h" #include namespace aevol { //############################################################################## // # // Class PhenotypicTarget # // # //############################################################################## // ============================================================================ // Definition of static attributes // ============================================================================ // ============================================================================ // Constructors // ============================================================================ PhenotypicTarget::PhenotypicTarget() { fuzzy_ = FuzzyFactory::fuzzyFactory->create_fuzzy(); nb_segments_ = 1; segments_ = new PhenotypicSegment * [1]; segments_[0] = new PhenotypicSegment(X_MIN, X_MAX, METABOLISM); area_by_feature_ = new double [NB_FEATURES]; } PhenotypicTarget::PhenotypicTarget(const PhenotypicTarget& rhs) { fuzzy_ = FuzzyFactory::fuzzyFactory->create_fuzzy(*(rhs.fuzzy())); nb_segments_ = rhs.nb_segments_; segments_ = new PhenotypicSegment * [nb_segments_]; for (int8_t i = 0 ; i < nb_segments_ ; i++) segments_[i] = new PhenotypicSegment(*(rhs.segments_[i])); area_by_feature_ = new double [NB_FEATURES]; memcpy(area_by_feature_, rhs.area_by_feature_, NB_FEATURES * sizeof(*area_by_feature_)); } // ============================================================================ // Destructor // ============================================================================ PhenotypicTarget::~PhenotypicTarget() { if (segments_ != NULL) { for (int8_t i = 0 ; i < nb_segments_ ; i++) delete segments_[i]; delete [] segments_; } delete [] area_by_feature_; delete fuzzy_; } // ============================================================================ // Methods // ============================================================================ void PhenotypicTarget::set_segmentation(int8_t nb_segments, double *boundaries, PhenotypicFeature *features, bool separate_segments) { // Delete the data to be replaced for (int8_t i = 0 ; i < nb_segments_ ; i++) delete segments_[i]; delete[] segments_; // Now replace with the new data nb_segments_ = nb_segments; segments_ = new PhenotypicSegment * [nb_segments_]; for (int8_t i = 0 ; i < nb_segments_; i++) segments_[i] = new PhenotypicSegment(boundaries[i], boundaries[i+1], features[i]); // TODO : Manage separate_segments } void PhenotypicTarget::ComputeArea() { for (int8_t i = 0 ; i < NB_FEATURES ; i++) area_by_feature_[i] = 0.0; // TODO : We should take into account that we compute the areas in a specific order (from the leftmost segment, rightwards) // => We shouldn't parse the whole list of points on the left of the segment we are considering (we have // already been through them!) for (int8_t i = 0 ; i < nb_segments_ ; i++) { area_by_feature_[segments_[i]->feature] += fuzzy_->get_geometric_area(segments_[i]->start, segments_[i]->stop); } } void PhenotypicTarget::SaveSegmentation(gzFile backup_file) const { // -------------------------------------------------------------------------- // Write x-axis segmentation gzwrite(backup_file, &nb_segments_, sizeof(nb_segments_)); for (int8_t i = 0 ; i < nb_segments_; i++) // TODO suppress warning segments_[i]->save(backup_file); } void PhenotypicTarget::LoadSegmentation(gzFile backup_file) { // Delete obsolete segmentation data for (int8_t i = 0 ; i < nb_segments_ ; i++) delete segments_[i]; delete [] segments_; // Replace by data from the backup gzread(backup_file, &nb_segments_, sizeof(nb_segments_)); segments_ = new PhenotypicSegment * [nb_segments_]; for (int8_t i = 0 ; i < nb_segments_; i++) segments_[i] = new PhenotypicSegment(backup_file); } // ============================================================================ // Non inline accessors // ============================================================================ } // namespace aevol aevol-5.0/src/libaevol/Deletion.cpp0000644000175000017500000000711412724051151014241 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ============================================================================ // Includes // ============================================================================ #include "Deletion.h" namespace aevol { // ============================================================================ // Definition of static attributes // ============================================================================ // ============================================================================ // Constructors // ============================================================================ Deletion::Deletion(int32_t pos1, int32_t pos2, int32_t length, int16_t align_score) : pos1_(pos1), pos2_(pos2), length_(length), align_score_(align_score) { } // ============================================================================ // Destructor // ============================================================================ // ============================================================================ // Methods // ============================================================================ void Deletion::save(gzFile backup_file) const { int8_t tmp_mut_type = DEL; gzwrite(backup_file, &tmp_mut_type, sizeof(tmp_mut_type)); gzwrite(backup_file, &pos1_, sizeof(pos1_)); gzwrite(backup_file, &pos2_, sizeof(pos2_)); gzwrite(backup_file, &length_, sizeof(length_)); gzwrite(backup_file, &align_score_, sizeof(align_score_)); } void Deletion::load(gzFile backup_file) { gzread(backup_file, &pos1_, sizeof(pos1_)); gzread(backup_file, &pos2_, sizeof(pos2_)); gzread(backup_file, &length_, sizeof(length_)); gzread(backup_file, &align_score_, sizeof(align_score_)); } void Deletion::generic_description_string(char* str) const { // TODO Use snprintf to avoid buffer overflow sprintf(str, "%" PRId8 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId8 " %" PRId16 " %" PRId16 " %" PRId32 " %" PRId32, mut_type(), pos1(), pos2(), -1, -1, -1, align_score(), -1, length_, -1); } // ============================================================================ // Non inline accessors // ============================================================================ } // namespace aevol aevol-5.0/src/libaevol/Rna.h0000644000175000017500000001536612724051151012673 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_RNA_H_ #define AEVOL_RNA_H_ // ================================================================= // Libraries // ================================================================= #include // ================================================================= // Project Files // ================================================================= #include #include #include #include #include "Dna.h" #include "Utils.h" #include "Protein.h" namespace aevol { // ================================================================= // Class declarations // ================================================================= class Individual; class GeneticUnit; class Rna { public : // ================================================================= // Constructors // ================================================================= Rna() = delete; Rna(const GeneticUnit&) = delete; Rna(GeneticUnit* gen_unit, const Rna &model); Rna(GeneticUnit* gen_unit, Strand strand, int32_t index, int8_t diff); //Rna(Rna* parent); // ================================================================= // Destructors // ================================================================= virtual ~Rna(); // ================================================================= // Accessors // ================================================================= // void check(GeneticUnit* gen_unit) { assert(gen_unit == gen_unit_); }; //~ void* indiv() const { return (void*)indiv_; }; // inline const GeneticUnit * genetic_unit() const; inline void set_genetic_unit(const GeneticUnit* gen_unit); inline Strand strand() const; inline void set_strand(Strand strand); inline int32_t promoter_pos() const; inline void set_promoter_pos(int32_t pos); inline double basal_level() const; inline int32_t transcript_length() const; // The promoter is NOT transcribed. inline void set_transcript_length(int32_t length); inline bool is_coding() const; inline const std::list& transcribed_proteins() const; inline void clear_transcribed_proteins() { transcribed_proteins_.clear(); }; // ================================================================= // Public Methods // ================================================================= int32_t first_transcribed_pos() const; // The promoter is NOT transcribed. int32_t last_transcribed_pos() const; // The terminator is transcribed. inline void add_transcribed_protein(Protein * prot); inline void shift_position(int32_t delta_pos, int32_t genome_length); // ================================================================= // Public Attributes // ================================================================= protected : // ================================================================= // Forbidden Constructors // ================================================================= // ================================================================= // Protected Methods // ================================================================= // ================================================================= // Protected Attributes // ================================================================= const GeneticUnit* gen_unit_; Strand strand_; int32_t pos_; // Index of the promoter on the genome. // The promoter itself is NOT transcribed // The terminator is transcribed. int32_t transcript_length_; double basal_level_; // Access list to the proteins transcribed by this rna std::list transcribed_proteins_; }; // ===================================================================== // Accessors' definitions // ===================================================================== inline const GeneticUnit*Rna::genetic_unit() const { return gen_unit_; } inline void Rna::set_genetic_unit(const GeneticUnit* gen_unit) { gen_unit_ = gen_unit; } inline Strand Rna::strand() const { return strand_; } inline void Rna::set_strand(Strand strand) { strand_ = strand; } void Rna::set_promoter_pos(int32_t pos) { pos_ = pos; } inline int32_t Rna::promoter_pos() const { return pos_; } inline double Rna::basal_level() const { return basal_level_; } inline int32_t Rna::transcript_length() const { return transcript_length_; } inline void Rna::set_transcript_length(int32_t transcript_length) { transcript_length_ = transcript_length; } inline const std::list&Rna::transcribed_proteins() const { return transcribed_proteins_; } inline bool Rna::is_coding() const { return (not transcribed_proteins_.empty()); } // ===================================================================== // Inline functions' definition // ===================================================================== void Rna::add_transcribed_protein(Protein * prot) { transcribed_proteins_.push_back(prot); } void Rna::shift_position(int32_t delta_pos, int32_t genome_length) { pos_ = Utils::mod(pos_ + delta_pos, genome_length); } } // namespace aevol #endif // AEVOL_RNA_H_ aevol-5.0/src/libaevol/StatRecord.h0000644000175000017500000001746412724051151014226 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_STAT_RECORD_H_ #define AEVOL_STAT_RECORD_H_ // ================================================================= // Libraries // ================================================================= #include #include #include #include #include #include "ReplicationReport.h" #include "ExpSetup.h" // ================================================================= // Project Files // ================================================================= namespace aevol { // ================================================================= // Class declarations // ================================================================= class ExpManager; class Stats; class Individual; class ae_population; class ReplicationReport; enum indiv_or_pop { INDIV = 0, POP = 1, STDEVS = 2, SKEWNESS = 3, NB_INDIV_OR_POP = 4 }; enum chrom_or_gen_unit { ALL_GU = 0, CHROM = 1, PLASMIDS = 2, NB_CHROM_OR_GU = 3 }; enum best_or_glob { BEST = 0, GLOB = 1, SDEV = 2, SKEW = 3, NB_BEST_OR_GLOB = 4 }; enum stats_type { FITNESS_STATS = 0, MUTATION_STATS = 1, GENES_STATS = 2, BP_STATS = 3, REAR_STATS = 4, NB_STATS_TYPES = 5 }; class StatRecord { friend class Stats; public : // ================================================================= // Constructors // ================================================================= StatRecord() = delete; StatRecord(const StatRecord &model); StatRecord(ExpSetup* exp_s, Individual * indiv, ReplicationReport* replic_report, chrom_or_gen_unit chrom_or_gu = CHROM, bool compute_non_coding = true); StatRecord(ExpSetup* exp_s, std::list> annotated_indivs, chrom_or_gen_unit chrom_or_gu = CHROM); StatRecord(ExpSetup* exp_s, std::list> annotated_indivs, const StatRecord * means, chrom_or_gen_unit chrom_or_gu = CHROM); StatRecord(ExpSetup* exp_s, std::list> annotated_indivs, const StatRecord * means, const StatRecord* stdevs, chrom_or_gen_unit chrom_or_gu = CHROM); // ================================================================= // Destructors // ================================================================= virtual ~StatRecord(); // ================================================================= // Accessors // ================================================================= // ================================================================= // Public Methods // ================================================================= void initialize_data(); void write_to_file(FILE* stat_file, stats_type stat_type_to_print) const; void divide(double divisor); void divide_record(StatRecord const * means, double power); void add(StatRecord * to_add, int32_t index); void substract_power(StatRecord const * means, StatRecord const * to_substract, double power); // ================================================================= // Public Attributes // ================================================================= protected : // ================================================================= // Protected Methods // ================================================================= // ================================================================= // Protected Attributes // ================================================================= // NB : All the attributes are doubles because they will be used to // compute averages over the population. indiv_or_pop record_type_; int32_t pop_size_ = 0.0; double fitness_ = 0.0; double metabolic_error_ = 0.0; double parent_metabolic_error_ = 0.0; double metabolic_fitness_ = 0.0; double secretion_error_ = 0.0; double parent_secretion_error_ = 0.0; double secretion_fitness_ = 0.0; double compound_amount_ = 0.0; int32_t amount_of_dna_ = 0.0; int32_t nb_coding_rnas_ = 0.0; int32_t nb_non_coding_rnas_ = 0.0; // NOT including promoter but including terminator double av_size_coding_rnas_ = 0.0; double av_size_non_coding_rnas_ = 0.0; int32_t nb_functional_genes_ = 0.0; int32_t nb_non_functional_genes_ = 0.0; // NOT including START and STOP codons double av_size_functional_gene_ = 0.0; double av_size_non_functional_gene_ = 0.0; int32_t nb_mut_ = 0.0; int32_t nb_rear_ = 0.0; int32_t nb_switch_ = 0.0; int32_t nb_indels_ = 0.0; int32_t nb_dupl_ = 0.0; int32_t nb_del_ = 0.0; int32_t nb_trans_ = 0.0; int32_t nb_inv_ = 0.0; double dupl_rate_ = 0.0; double del_rate_ = 0.0; double trans_rate_ = 0.0; double inv_rate_ = 0.0; double mean_align_score_ = 0.0; int32_t nb_bases_in_0_CDS_ = 0.0; int32_t nb_bases_in_0_functional_CDS_ = 0.0; int32_t nb_bases_in_0_non_functional_CDS_ = 0.0; int32_t nb_bases_in_0_RNA_ = 0.0; int32_t nb_bases_in_0_coding_RNA_ = 0.0; int32_t nb_bases_in_0_non_coding_RNA_ = 0.0; int32_t nb_bases_non_essential_ = 0.0; int32_t nb_bases_non_essential_including_nf_genes_ = 0.0; #ifdef __REGUL int32_t nb_influences_ = 0.0; int32_t nb_enhancing_influences_ = 0.0; int32_t nb_operating_influences_ = 0.0; double av_value_influences_ = 0.0; double av_value_enhancing_influences_ = 0.0; double av_value_operating_influences_ = 0.0; double nb_TF_; double nb_pure_TF_; #endif }; // ===================================================================== // Accessors' definitions // ===================================================================== // ===================================================================== // Inline functions' definition // ===================================================================== } // namespace aevol #endif // AEVOL_STAT_RECORD_H_ aevol-5.0/src/libaevol/Tree.h0000644000175000017500000001270412724051151013043 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_TREE_H_ #define AEVOL_TREE_H_ // ================================================================= // Includes // ================================================================= #include #include #include #include #include "ReplicationReport.h" #include "Observer.h" #include "ObservableEvent.h" #include "ae_enums.h" namespace aevol { // ================================================================= // Class declarations // ================================================================= class ExpManager; class Tree : public Observer { public : // ================================================================= // Constructors // ================================================================= Tree() = delete; Tree(const Tree &model) = delete; // To be used when we want to run a simulation. Tree(ExpManager* exp_m, int64_t tree_step); // To be used when we want to INSPECT a tree, // not when we want to run a simulation. Tree(ExpManager* exp_m, char* tree_file_name); // ================================================================= // Destructors // ================================================================= virtual ~Tree() noexcept; // ================================================================= // Accessors: getters // ================================================================= inline int64_t tree_step() const { return tree_step_; }; // Precondition for the following methods: // the tree was emptied every TREE_STEP generations ==> it contains // only the last generations since the last emptying ==> do not ask // something about an older generation ReplicationReport** reports(int64_t t) const; ReplicationReport* report_by_index(int64_t t, int32_t index) const; ReplicationReport* report_by_rank(int64_t t, int32_t rank) const; // ================================================================= // Accessors: setters // ================================================================= // ================================================================= // Public Methods // ================================================================= void signal_end_of_generation(); void write_to_tree_file(gzFile tree_file); void update(Observable& o, ObservableEvent e, void* arg) override; // ================================================================= // Public Attributes // ================================================================= static const int32_t NO_PARENT; protected : // ================================================================= // Protected Methods // ================================================================= // ================================================================= // Protected Attributes // ================================================================= ExpManager* exp_m_; int64_t tree_step_; ReplicationReport*** replics_; // Two-dimensional table of ReplicationReport* // dimension 1 (lines) : generation // dimension 2 (columns) : individual // // !!!!! WARNING !!!!! // The report at line l, column c is for the // replication that created the indiv with index c of generation l+1 // light tree representation int32_t** parent_; }; // ===================================================================== // Getters' definitions // ===================================================================== // ===================================================================== // Setters' definitions // ===================================================================== // ===================================================================== // Inline functions' definition // ===================================================================== } // namespace aevol #endif // AEVOL_TREE_H_ aevol-5.0/src/libaevol/Rearrangement.h0000644000175000017500000000674312724051151014744 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_REARRANGEMENT_H_ #define AEVOL_REARRANGEMENT_H_ // ============================================================================ // Includes // ============================================================================ #include "Mutation.h" namespace aevol { /** * Abstract base class for local mutations */ class Rearrangement : public Mutation { public : // ========================================================================== // Constructors // ========================================================================== virtual Mutation* Clone() const override = 0; // ========================================================================== // Destructor // ========================================================================== // ========================================================================== // Operators // ========================================================================== // ========================================================================== // Public Methods // ========================================================================== virtual void save(gzFile backup_file) const override = 0; // ========================================================================== // Getters // ========================================================================== virtual MutationType mut_type() const override = 0; bool is_rear() const override final { return true; }; // ========================================================================== // Setters // ========================================================================== protected : // ========================================================================== // Protected Methods // ========================================================================== // ========================================================================== // Attributes // ========================================================================== }; } // namespace aevol #endif //AEVOL_REARRANGEMENT_H_ aevol-5.0/src/libaevol/Dump.cpp0000644000175000017500000001664412724051151013413 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ================================================================= // Libraries // ================================================================= #include #include #include #include // ================================================================= // Project Files // ================================================================= #include "Dump.h" #include "ExpManager.h" #include "Individual.h" #include "GeneticUnit.h" #ifdef __REGUL #include "raevol/Protein_R.h" #endif namespace aevol { //############################################################################## // # // Class Dump # // # //############################################################################## // ================================================================= // Definition of static attributes // ================================================================= // ================================================================= // Constructors // ================================================================= Dump::Dump(ExpManager * exp_m) { exp_m_ = exp_m; int status; status = mkdir("stats/dump/", 0755); if ((status == -1) && (errno != EEXIST)) { err(EXIT_FAILURE, "stats/dump/"); } } // ================================================================= // Destructors // ================================================================= // ================================================================= // Public Methods // ================================================================= const char* DUMP_FORMAT = "\t%d\t%d\t%f\n"; void Dump::write_current_generation_dump() { // printf("Begin dump\n"); write_fitness_total(); write_secretion_present(); write_fitness_metabolic(); write_secreted_amount(); write_individual_probes(); // printf("End dump\n"); } void Dump::write_fitness_total() { sprintf(filename_buffer, "stats/dump/fitness_total_" TIMESTEP_FORMAT ".out", AeTime::time()); current_file = fopen(filename_buffer, "w+"); double** map = exp_m_->world()->total_fitness_grid(); fprintf(current_file, "#\tX\tY\tfitness_total(X, Y)\n"); for(int16_t x = 0 ; x < exp_m_->grid_width() ; x++) { for(int16_t y = 0 ; y < exp_m_->grid_height() ; y++) { fprintf(current_file, DUMP_FORMAT, x, y, map [x][y]); } fprintf(current_file, "\n"); } fflush(current_file); fclose(current_file); // Has been allocated in World::total_fitness_grid() for (int16_t x = 0 ; x < exp_m_->grid_width() ; x++) { delete [] map[x]; } delete [] map; } void Dump::write_secreted_amount() { sprintf(filename_buffer, "stats/dump/secreted_amount_" TIMESTEP_FORMAT ".out", AeTime::time()) ; current_file = fopen(filename_buffer, "w+"); double** map = exp_m_->world()->secreted_amount_grid(); fprintf(current_file, "#\tX\tY\tsecreted_amount(X, Y)\n"); for(int16_t x = 0 ; x < exp_m_->grid_width() ; x++) { for(int16_t y = 0 ; y < exp_m_->grid_height() ; y++) { fprintf(current_file, DUMP_FORMAT, x, y, map [x][y]); } fprintf(current_file, "\n"); } fflush(current_file); fclose(current_file); for (int16_t x = 0; x < exp_m_->grid_width() ; x++) { delete [] map[x]; } delete [] map; } void Dump::write_fitness_metabolic() { sprintf(filename_buffer, "stats/dump/fitness_metabolic_" TIMESTEP_FORMAT ".out", AeTime::time()); current_file = fopen(filename_buffer, "w+"); double** map = exp_m_->world()->metabolic_fitness_grid(); fprintf(current_file, "#\tX\tY\tfitness_metabolic(X, Y)\n"); for(int16_t x = 0 ; x < exp_m_->grid_width() ; x++) { for(int16_t y = 0 ; y < exp_m_->grid_height() ; y++) { fprintf(current_file, DUMP_FORMAT, x, y, map [x][y]); } fprintf(current_file, "\n"); } fflush(current_file); fclose(current_file); for (int16_t x = 0; x < exp_m_->grid_width() ; x++) { delete [] map[x]; } delete [] map; } void Dump::write_secretion_present() { sprintf(filename_buffer, "stats/dump/secretion_present_" TIMESTEP_FORMAT ".out", AeTime::time()); current_file = fopen(filename_buffer, "w+"); double** map = exp_m_->world()->secretion_present_grid(); fprintf(current_file, "#\tX\tY\tsecretion_present(X, Y)\n"); for(int16_t x = 0 ; x < exp_m_->grid_width() ; x++) { for(int16_t y = 0 ; y < exp_m_->grid_height() ; y++) fprintf(current_file, DUMP_FORMAT, x, y, map [x][y]); fprintf(current_file, "\n"); } fflush(current_file); fclose(current_file); for (int16_t x = 0; x < exp_m_->grid_width() ; x++) { delete [] map[x]; } delete [] map; } /*! \brief Write the probes (5 int and 5 double) of each individual at a given generation */ void Dump::write_individual_probes() { sprintf(filename_buffer, "stats/dump/individual_probes_" TIMESTEP_FORMAT ".out", AeTime::time()); current_file = fopen(filename_buffer, "w"); fprintf(current_file, "Id\tInt_Probe_1\tInt_Probe_2\tInt_Probe_3\tInt_Probe_4\tInt_Probe_5\tDouble_Probe_1\tDouble_Probe_2\tDouble_Probe_3\tDouble_Probe_4\tDouble_Probe_5\n"); for(int16_t x = 0 ; x < exp_m_->grid_width() ; x++) { for(int16_t y = 0 ; y < exp_m_->grid_height() ; y++) { fprintf(current_file, "%" PRId32, exp_m_->world()->indiv_at(x,y)->id()); int32_t* int_probes = exp_m_->world()->indiv_at(x,y)->int_probes(); double* double_probes = exp_m_->world()->indiv_at(x,y)->double_probes(); for(int16_t i=0; i<5; i++) fprintf(current_file, "\t%" PRId32, int_probes[i]); for(int16_t i=0; i<5; i++) fprintf(current_file, "\t%f", double_probes[i]); fprintf(current_file, "\n"); } } fflush(current_file); fclose(current_file); } // ================================================================= // Protected Methods // ================================================================= } // namespace aevol aevol-5.0/src/libaevol/PhenotypicSegment.h0000644000175000017500000001403012724051151015603 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_PHENOTYPIC_SEGMENT_H_ #define AEVOL_PHENOTYPIC_SEGMENT_H_ // ================================================================= // Includes // ================================================================= #include #include #include "macros.h" #include "ae_enums.h" namespace aevol { // ================================================================= // Class declarations // ================================================================= class PhenotypicSegment { public : // ================================================================= // Constructors // ================================================================= PhenotypicSegment() = delete; inline PhenotypicSegment(double start, double stop, PhenotypicFeature feature); inline PhenotypicSegment(const PhenotypicSegment & source); inline PhenotypicSegment(gzFile backup_file); // ================================================================= // Destructors // ================================================================= inline virtual ~PhenotypicSegment(); // ================================================================= // Accessors // ================================================================= // ================================================================= // Public Methods // ================================================================= inline void save(gzFile backup_file) const; inline void load(gzFile backup_file); // ================================================================= // Public Attributes // ================================================================= double start; double stop; PhenotypicFeature feature; protected : // ================================================================= // Protected Methods // ================================================================= // ================================================================= // Protected Attributes // ================================================================= }; //############################################################################## // # // Class PhenotypicSegment # // # //############################################################################## // ================================================================= // Constructors // ================================================================= //~ inline PhenotypicSegment::PhenotypicSegment() //~ { //~ start = X_MIN; //~ stop = X_MAX; //~ feature = NEUTRAL; //~ } inline PhenotypicSegment::PhenotypicSegment(double start, double stop, PhenotypicFeature feature) { this->start = start; this->stop = stop; this->feature = feature; } inline PhenotypicSegment::PhenotypicSegment(const PhenotypicSegment & source) { this->start = source.start; this->stop = source.stop; this->feature = source.feature; } inline PhenotypicSegment::PhenotypicSegment(gzFile backup_file) { load(backup_file); } // ================================================================= // Destructors // ================================================================= inline PhenotypicSegment::~PhenotypicSegment() { } // ===================================================================== // Accessors definitions // ===================================================================== // ================================================================= // Public Methods // ================================================================= inline void PhenotypicSegment::save(gzFile backup_file) const { gzwrite(backup_file, &start, sizeof(start)); gzwrite(backup_file, &stop, sizeof(stop)); int8_t tmp_feature = feature; gzwrite(backup_file, &tmp_feature, sizeof(tmp_feature)); } inline void PhenotypicSegment::load(gzFile backup_file) { gzread(backup_file, &start, sizeof(start)); gzread(backup_file, &stop, sizeof(stop)); int8_t tmp_feature; gzread(backup_file, &tmp_feature, sizeof(tmp_feature)); feature = (PhenotypicFeature) tmp_feature; } // ================================================================= // Protected Methods // ================================================================= } // namespace aevol #endif // AEVOL_PHENOTYPIC_SEGMENT_H_ aevol-5.0/src/libaevol/Metrics.h0000644000175000017500000001713712724051151013557 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_INDIV_STATS_H_ #define AEVOL_INDIV_STATS_H_ // ============================================================================ // Includes // ============================================================================ #include #include #include #include #include "Individual.h" #include "GeneticUnit.h" namespace aevol { // ============================================================================ // Class declarations // ============================================================================ class Individual; class Metrics { friend Individual; public : // ========================================================================== // Constructors // ========================================================================== Metrics() = default; //< Default ctor Metrics(const Metrics&) = default; //< Copy ctor Metrics(Metrics&&) = default; //< Move ctor // ========================================================================== // Destructor // ========================================================================== virtual ~Metrics() = default; //< Destructor // ========================================================================== // Getters // ========================================================================== int32_t total_genome_size() const { return total_genome_size_; }; int16_t nb_coding_RNAs() const { return nb_coding_RNAs_; }; int16_t nb_non_coding_RNAs() const { return nb_non_coding_RNAs_; }; int32_t overall_size_coding_RNAs() const { return overall_size_coding_RNAs_; }; int32_t overall_size_non_coding_RNAs() const { return overall_size_non_coding_RNAs_; }; int16_t nb_genes_activ() const { return nb_genes_activ_; }; int16_t nb_genes_inhib() const { return nb_genes_inhib_; }; int16_t nb_functional_genes() const { return nb_functional_genes_; }; int16_t nb_non_functional_genes() const { return nb_non_functional_genes_; }; int32_t overall_size_functional_genes() const { return overall_size_functional_genes_; }; int32_t overall_size_non_functional_genes() const { return overall_size_non_functional_genes_; }; // ========================================================================== // Setters // ========================================================================== // ========================================================================== // Operators // ========================================================================== // ========================================================================== // Public Methods // ========================================================================== inline void Reset(); inline void Accumulate(const GeneticUnit& gen_unit); protected : // ========================================================================== // Protected Methods // ========================================================================== // ========================================================================== // Attributes // ========================================================================== /// Sum of sizes of the genetic units int32_t total_genome_size_ = 0; /// Number of coding RNAs (at least one gene on RNA) int16_t nb_coding_RNAs_ = 0; /// Number of non-coding-RNAs int16_t nb_non_coding_RNAs_ = 0; /// Cumulated size of all coding RNAs int32_t overall_size_coding_RNAs_ = 0; /// Cumulated size of all non-coding RNAs int32_t overall_size_non_coding_RNAs_ = 0; /// Number of genes realizing a function int16_t nb_genes_activ_ = 0; /// Number of genes inhibitting a function int16_t nb_genes_inhib_ = 0; /// Number of functional genes int16_t nb_functional_genes_ = 0; /// Number of non-functional genes int16_t nb_non_functional_genes_ = 0; /// Cumulated size of all functional genes int32_t overall_size_functional_genes_ = 0; /// Cumulated size of all non-functional genes int32_t overall_size_non_functional_genes_ = 0; }; // ============================================================================ // Getters' definitions // ============================================================================ // ============================================================================ // Setters' definitions // ============================================================================ // ============================================================================ // Operators' definitions // ============================================================================ // ============================================================================ // Inline functions' definition // ============================================================================ void Metrics::Reset() { total_genome_size_ = 0; nb_coding_RNAs_ = 0; nb_non_coding_RNAs_ = 0; overall_size_coding_RNAs_ = 0; overall_size_non_coding_RNAs_ = 0; nb_genes_activ_ = 0; nb_genes_inhib_ = 0; nb_functional_genes_ = 0; nb_non_functional_genes_ = 0; overall_size_functional_genes_ = 0; overall_size_non_functional_genes_ = 0; } void Metrics::Accumulate(const GeneticUnit& gen_unit) { total_genome_size_ += gen_unit.dna()->length(); nb_coding_RNAs_ += gen_unit.nb_coding_RNAs(); nb_non_coding_RNAs_ += gen_unit.nb_non_coding_RNAs(); overall_size_coding_RNAs_ += gen_unit.overall_size_coding_RNAs(); overall_size_non_coding_RNAs_ += gen_unit.overall_size_non_coding_RNAs(); nb_genes_activ_ += gen_unit.nb_genes_activ(); nb_genes_inhib_ += gen_unit.nb_genes_inhib(); nb_functional_genes_ += gen_unit.nb_functional_genes(); nb_non_functional_genes_ += gen_unit.nb_non_functional_genes(); overall_size_functional_genes_ += gen_unit.overall_size_functional_genes(); overall_size_non_functional_genes_ += gen_unit.overall_size_non_functional_genes(); }; } // namespace aevol #endif // AEVOL_INDIV_STATS_H_ aevol-5.0/src/libaevol/HabitatFactory.h0000644000175000017500000000120012724051151015035 00000000000000// // Created by arrouan on 19/11/15. // #ifndef AEVOL_REGUL_HABITATFACTORY_H #define AEVOL_REGUL_HABITATFACTORY_H #include "Habitat.h" #include "raevol/Habitat_R.h" #if __cplusplus == 201103L #include "make_unique.h" #endif namespace aevol { class HabitatFactory { public: static std::unique_ptr create_unique_habitat(Habitat& habitat, bool share_phenotypic_target); static std::unique_ptr create_unique_habitat(gzFile backup_file, PhenotypicTargetHandler* phenotypic_target_handler); }; } #endif //AEVOL_REGUL_HABITATFACTORY_H aevol-5.0/src/libaevol/Mutation.cpp0000644000175000017500000001773612724051151014311 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ================================================================= // Includes // ================================================================= #include #include "Mutation.h" #include "PointMutation.h" #include "SmallInsertion.h" #include "SmallDeletion.h" #include "Duplication.h" #include "Deletion.h" #include "Translocation.h" #include "Inversion.h" #include "InsertionHT.h" #include "ReplacementHT.h" namespace aevol { //############################################################################# // // Class Mutation // //############################################################################# // ================================================================= // Definition of static attributes // ================================================================= // ================================================================= // Constructors // ================================================================= Mutation* Mutation::Load(gzFile backup_file) { // Retrieve mutation type int8_t tmp_mut_type; gzread(backup_file, &tmp_mut_type, sizeof(tmp_mut_type)); MutationType mut_type = (MutationType) tmp_mut_type; // Call the appropriate constructor accordingly Mutation* mut; switch (mut_type) { case SWITCH : mut = new PointMutation(); break; case S_INS : mut = new SmallInsertion(); break; case S_DEL : mut = new SmallDeletion(); break; case DUPL : mut = new Duplication(); break; case DEL : mut = new Deletion(); break; case TRANS : mut = new Translocation(); break; case INV : mut = new Inversion(); break; case INS_HT : mut = new InsertionHT(); break; case REPL_HT : mut = new ReplacementHT(); break; default : Utils::ExitWithDevMsg("invalid mutation type ", __FILE__, __LINE__); exit(-1); // Superfluous but suppresses a warning } // Load from backup file mut->load(backup_file); return mut; } //Mutation::Mutation(gzFile backup_file) //{ // pos_ = NULL; // length_ = NULL; // seq_ = NULL; // align_score_ = NULL; // // int8_t tmp_mut_type; // gzread(backup_file, &tmp_mut_type, sizeof(tmp_mut_type)); // mut_type_ = (MutationType) tmp_mut_type; // //~ printf("mut type %d\n", mut_type_); // // switch (mut_type_) // { // case SWITCH : // { // pos_ = new int32_t; // gzread(backup_file, pos_, sizeof(*pos_)); // break; // } // case S_INS : // { // pos_ = new int32_t; // gzread(backup_file, pos_, sizeof(*pos_)); // length_ = new int32_t; // gzread(backup_file, length_, sizeof(*length_)); // // seq_ = new char[length_[0] + 1]; // gzread(backup_file, seq_, length_[0] * sizeof(seq_[0])); // seq_[length_[0]] = '\0'; // break; // } // case S_DEL : // { // pos_ = new int32_t; // gzread(backup_file, pos_, sizeof(*pos_)); // length_ = new int32_t; // gzread(backup_file, length_, sizeof(*length_)); // break; // } // case DUPL : // { // pos_ = new int32_t[3]; // gzread(backup_file, pos_, 3 * sizeof(pos_[0])); // length_ = new int32_t; // gzread(backup_file, length_, sizeof(*length_)); // align_score_ = new int16_t; // gzread(backup_file, align_score_, sizeof(*align_score_)); // // break; // } // case DEL : // { // pos_ = new int32_t[2]; // gzread(backup_file, pos_, 2 * sizeof(pos_[0])); // length_ = new int32_t; // gzread(backup_file, length_, sizeof(*length_)); // align_score_ = new int16_t; // gzread(backup_file, align_score_, sizeof(*align_score_)); // // break; // } // case TRANS : // { // pos_ = new int32_t[4]; // gzread(backup_file, pos_, 4 * sizeof(pos_[0])); // int8_t tmp_invert; // gzread(backup_file, &tmp_invert, sizeof(tmp_invert)); // invert_ = (tmp_invert != 0); // length_ = new int32_t; // gzread(backup_file, length_, sizeof(*length_)); // align_score_ = new int16_t[2]; // gzread(backup_file, align_score_, 2 * sizeof(align_score_[0])); // // break; // } // case INV : // { // pos_ = new int32_t[2]; // gzread(backup_file, pos_, 2 * sizeof(pos_[0])); // length_ = new int32_t; // gzread(backup_file, length_, sizeof(*length_)); // align_score_ = new int16_t; // gzread(backup_file, align_score_, sizeof(*align_score_)); // // break; // } // case INSERT: // { // pos_ = new int32_t; // gzread(backup_file, pos_, sizeof(*pos_)); // length_ = new int32_t; // gzread(backup_file, length_, sizeof(*length_)); // seq_ = new char[length_[0] + 1]; // gzread(backup_file, seq_, length_[0] * sizeof(seq_[0])); // seq_[length_[0]] = '\0'; // } // case INS_HT: // { // pos_ = new int32_t[4]; // gzread(backup_file, pos_, 4 * sizeof(pos_[0])); // length_ = new int32_t; // gzread(backup_file, length_, sizeof(*length_)); // seq_ = new char[length_[0] + 1]; // gzread(backup_file, seq_, length_[0] * sizeof(seq_[0])); // seq_[length_[0]] = '\0'; // align_score_ = new int16_t[2]; // gzread(backup_file, align_score_, 2 * sizeof(align_score_[0])); // gzread(backup_file, &donor_id_, sizeof(donor_id_)); // gzread(backup_file, &sense_, sizeof(sense_)); // break; // } // case REPL_HT: // { // pos_ = new int32_t[4]; // gzread(backup_file, pos_, 4 * sizeof(pos_[0])); // length_ = new int32_t[2]; // gzread(backup_file, length_, 2 *sizeof(length_[0])); // seq_ = new char[length_[1] + 1]; // gzread(backup_file, seq_, length_[1] * sizeof(seq_[0])); // seq_[length_[1]] = '\0'; // align_score_ = new int16_t[2]; // gzread(backup_file, align_score_, 2 * sizeof(align_score_[0])); // gzread(backup_file, &donor_id_, sizeof(donor_id_)); // gzread(backup_file, &sense_, sizeof(sense_)); // break; // } // default : // { // fprintf(stderr, "ERROR, invalid mutation type \"%d\" in file %s:%d.\n", mut_type_, __FILE__, __LINE__); // exit(EXIT_FAILURE); // break; // } // } // // //} // ================================================================= // Destructor // ================================================================= // ================================================================= // Public Methods // ================================================================= // ================================================================= // Protected Methods // ================================================================= } // namespace aevol aevol-5.0/src/libaevol/HybridFuzzy.h0000644000175000017500000000573612724051151014444 00000000000000// // Created by arrouan on 31/07/15. // #ifndef AEVOL_HYBRIDFUZZY_H #define AEVOL_HYBRIDFUZZY_H #define PHENO_SIZE 300 #include #include "macros.h" #include "Point.h" #include "AbstractFuzzy.h" namespace aevol { class HybridFuzzy : public AbstractFuzzy { public: // ========================================================================== // Constructors // ========================================================================== HybridFuzzy(); HybridFuzzy(const HybridFuzzy& f); HybridFuzzy(const gzFile backup); // ========================================================================== // Destructor // ========================================================================== virtual ~HybridFuzzy(); // ========================================================================== // Public Methods // ========================================================================== void save(gzFile backup) const; void load(gzFile backup); void reset(); void simplify(); void add_triangle(double mean, double width, double height); void add(const AbstractFuzzy& f); void sub(const AbstractFuzzy& f); void add_point(double x, double y); void clip(clipping_direction direction, double bound); // ========================================================================== // Getters // ========================================================================== double* points() const { return _points; }; double get_geometric_area() const; double get_geometric_area(double start_segment, double end_segment) const; double get_y(double x) const; // get_x should be moved out of fuzzy class as it really applies to pair of points bool is_identical_to(const AbstractFuzzy& fs, double tolerance) const; int get_pheno_size() const { return _pheno_size; }; void print() const; inline void clear() {reset();}; // ========================================================================== // Setters // ========================================================================== // ========================================================================== // Operators // ========================================================================== protected: // ========================================================================== // Protected Methods // ========================================================================== // ========================================================================== // Attributes // ========================================================================== double* _points = NULL; int _pheno_size = PHENO_SIZE; }; double trapezoid_area(const Point& p1, const Point& p2); } // namespace aevol #endif //AEVOL_HYBRIDFUZZY_H aevol-5.0/src/libaevol/OutputManager.h0000644000175000017500000001650612724051151014743 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_OUPUT_MANAGER_H_ #define AEVOL_OUPUT_MANAGER_H_ // ================================================================= // Libraries // ================================================================= #include // ================================================================= // Project Files // ================================================================= #include #include #include #include #include "ae_enums.h" #include "Stats.h" #include "Tree.h" #include "Dump.h" #include "Logging.h" namespace aevol { // ================================================================= // Class declarations // ================================================================= class ExpManager; class OutputManager { public : // ================================================================= // Constructors // ================================================================= OutputManager() = delete; OutputManager(const OutputManager&) = delete; OutputManager(ExpManager* exp_m); // ================================================================= // Destructors // ================================================================= virtual ~OutputManager(); // ================================================================= // Accessors: getters // ================================================================= // Backup inline int64_t backup_step() const; inline int64_t big_backup_step() const; // Tree inline bool record_tree() const; inline int64_t tree_step() const; inline Tree* tree() const; // Logs inline FILE* log(LogType log_type) const; inline bool is_logged(LogType log_type) const; // Stats inline bool compute_phen_contrib_by_GU() const; // ================================================================= // Accessors: setters // ================================================================= inline void set_backup_step(int64_t backup_step); inline void set_big_backup_step(int64_t big_backup_step); inline void init_tree(ExpManager* exp_m, int64_t tree_step_); inline void set_dump_step(int64_t dump_step); inline void set_compute_phen_contrib_by_GU(bool compute_phen_contrib_by_GU); inline void set_logs (int8_t logs); // ================================================================= // Operators // ================================================================= // ================================================================= // Public Methods // ================================================================= void InitStats(); void WriteSetupFile(gzFile setup_file) const; void WriteLastGenerFile(const std::string& input_dir = ".") const; void PropagateStats(const std::string& outdir, int64_t propagated_timestep) const; void load(gzFile file, bool verbose, bool to_be_run); void write_current_generation_outputs() const; inline void flush(); static int64_t last_gener(); protected : // ================================================================= // Protected Methods // ================================================================= void write_tree() const; // ================================================================= // Protected Attributes // ================================================================= ExpManager* exp_m_; // Backups int64_t backup_step_; int64_t big_backup_step_; // Stats Stats* stats_; bool compute_phen_contrib_by_GU_; // Tree bool record_tree_; Tree* tree_; // Dumps bool make_dumps_; int64_t dump_step_; Dump* dump_; // Logs Logging* logs_; }; // ===================================================================== // Getters' definitions // ===================================================================== // Backup inline int64_t OutputManager::backup_step() const { return backup_step_; } inline int64_t OutputManager::big_backup_step() const { return big_backup_step_; } // Tree inline bool OutputManager::record_tree() const { return record_tree_; } inline int64_t OutputManager::tree_step() const { return tree_->tree_step(); } inline Tree *OutputManager::tree() const { return tree_; } // Logs inline FILE* OutputManager::log(LogType log_type) const { return logs_->log(log_type); } inline bool OutputManager::is_logged(LogType log_type) const { return logs_->is_logged(log_type); } // Stats inline bool OutputManager::compute_phen_contrib_by_GU() const { return compute_phen_contrib_by_GU_; } // ===================================================================== // Setters' definitions // ===================================================================== void OutputManager::set_backup_step(int64_t backup_step) { backup_step_ = backup_step; } void OutputManager::set_big_backup_step(int64_t big_backup_step) { big_backup_step_ = big_backup_step; } void OutputManager::init_tree(ExpManager* exp_m, int64_t tree_step_) { record_tree_ = true; tree_ = new Tree(exp_m, tree_step_); } void OutputManager::set_dump_step(int64_t dump_step) { make_dumps_ = true; dump_step_ = dump_step; } void OutputManager::set_compute_phen_contrib_by_GU( bool compute_phen_contrib_by_GU) { compute_phen_contrib_by_GU_ = compute_phen_contrib_by_GU; } void OutputManager::set_logs(int8_t logs) { logs_->set_logs(logs); } // ===================================================================== // Operators' definitions // ===================================================================== // ===================================================================== // Inline functions' definition // ===================================================================== inline void OutputManager::flush() { stats_->flush(); } } // namespace aevol #endif // AEVOL_OUPUT_MANAGER_H_ aevol-5.0/src/libaevol/Alignment.h0000644000175000017500000001127412724051151014063 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_ALIGNMENT_H_ #define AEVOL_ALIGNMENT_H_ // ================================================================= // Includes // ================================================================= #include #include #include #include #include "VisAVis.h" namespace aevol { // ================================================================= // Class declarations // ================================================================= class Dna; class Alignment { public : // ================================================================= // Constructors // ================================================================= Alignment() = delete; Alignment(const Alignment&) = delete; // ================================================================= // Destructors // ================================================================= // ================================================================= // Accessors // ================================================================= // ================================================================= // Public Methods // ================================================================= static VisAVis* search_alignment_direct(const Dna * chrom1, const int32_t seed1, const Dna* chrom2, const int32_t seed2, int16_t needed_score); static VisAVis* search_alignment_indirect(const Dna* chrom1, const int32_t seed1, const Dna* chrom2, const int32_t seed2, int16_t needed_score); // ================================================================= // Public Attributes // ================================================================= static bool with_alignments; static AlignmentFunctionShape align_fun_shape; static double align_sigm_lambda; static int16_t align_sigm_mean; static int16_t align_lin_min; static int16_t align_lin_max; // Maximum shift of one seq on the other static int16_t align_max_shift; // Work zone half length static int16_t align_w_zone_h_len; // Corresponding residues match bonus static int16_t align_match_bonus; // Corresponding residues mismatch cost static int16_t align_mismatch_cost; protected : // ================================================================= // Protected Methods // ================================================================= // ================================================================= // Protected Attributes // ================================================================= }; // ===================================================================== // Accessors' definitions // ===================================================================== // ===================================================================== // Inline functions' definition // ===================================================================== } // namespace aevol #endif // AEVOL_ALIGNMENT_H_ aevol-5.0/src/libaevol/ExpSetup.cpp0000644000175000017500000002604512724051151014257 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ================================================================= // Libraries // ================================================================= #include #include #include #include // ================================================================= // Project Files // ================================================================= #include "ExpSetup.h" #include "JumpingMT.h" #include "GzHelpers.h" namespace aevol { //############################################################################## // # // Class ExpSetup # // # //############################################################################## // =========================================================================== // Definition of static attributes // =========================================================================== // =========================================================================== // Constructors // =========================================================================== ExpSetup::ExpSetup( ExpManager * exp_m ) { exp_m_ = exp_m; // -------------------------------------------------------------- Selection sel_ = new Selection( exp_m ); // --------------------------------------------------------------- Transfer with_HT_ = false; repl_HT_with_close_points_ = false; HT_ins_rate_ = 0.0; HT_repl_rate_ = 0.0; repl_HT_detach_rate_ = 0.0; // --------------------------------------------------------------- Plasmids with_plasmids_ = false; prob_plasmid_HT_ = 0.0; tune_donor_ability_ = 0.0; tune_recipient_ability_ = 0.0; donor_cost_ = 0.0; recipient_cost_ = 0.0; swap_GUs_ = false; // -------------------------------------------------------------- Secretion with_secretion_ = false; secretion_contrib_to_fitness_ = 0.0; secretion_cost_ = 0.0; fuzzy_flavor_ = 0; #ifdef __REGUL _protein_presence_limit = 1e-2; _degradation_rate = 1; _nb_degradation_step = 10; _with_heredity = false; _nb_indiv_age = 20; _hill_shape_n = 4; _hill_shape_theta = 0.5; _hill_shape = std::pow( _hill_shape_theta, _hill_shape_n ); _list_eval_step = new std::set(); #endif } // =========================================================================== // Destructor // =========================================================================== /*! */ void ExpSetup::write_setup_file(gzFile exp_setup_file) const { gzwrite(exp_setup_file, fuzzy_flavor_); // --------------------------------------------------------------- Transfer gzwrite(exp_setup_file, static_cast(with_HT_), static_cast(repl_HT_with_close_points_)); if (with_HT_) gzwrite(exp_setup_file, HT_ins_rate_, HT_repl_rate_); if(repl_HT_with_close_points_) gzwrite(exp_setup_file, repl_HT_detach_rate_); // --------------------------------------------------------------- Plasmids int8_t tmp_with_plasmids = with_plasmids(); gzwrite(exp_setup_file, tmp_with_plasmids); if (tmp_with_plasmids) gzwrite(exp_setup_file, prob_plasmid_HT_, tune_donor_ability_, tune_recipient_ability_, donor_cost_, recipient_cost_, static_cast(swap_GUs_)); // -------------------------------------------------------------- Secretion gzwrite(exp_setup_file, static_cast(with_secretion_), secretion_contrib_to_fitness_, secretion_cost_); sel()->write_setup_file(exp_setup_file); #ifdef __REGUL gzwrite( exp_setup_file, _hill_shape, _hill_shape_n, _hill_shape_theta, _degradation_rate, _nb_degradation_step, _nb_indiv_age, _with_heredity, _protein_presence_limit); char* binding_matrix_file_name = new char[100]; sprintf( binding_matrix_file_name, "binding_matrix.rae" ); gzFile binding_matrix_file = gzopen( binding_matrix_file_name, "w" ); if ( binding_matrix_file == Z_NULL ) { printf( "ERROR : Could not write binding matrix file %s\n", binding_matrix_file_name ); exit( EXIT_FAILURE ); } write_binding_matrix_to_backup( binding_matrix_file ); gzclose( binding_matrix_file ); delete[] binding_matrix_file_name; unsigned int eval_step_size = _list_eval_step->size(); gzwrite(exp_setup_file, eval_step_size); for(auto eval_step : *_list_eval_step) { gzwrite(exp_setup_file, eval_step); } #endif gzwrite(exp_setup_file, first_regul_); } void ExpSetup::load(gzFile setup_file, gzFile backup_file, bool verbose) { gzread(setup_file,fuzzy_flavor_); // -------------------------------------------- Retrieve transfer parameters int8_t tmp_with_HT; int8_t tmp_repl_HT_with_close_points; gzread(setup_file, tmp_with_HT, tmp_repl_HT_with_close_points); with_HT_ = static_cast(tmp_with_HT); repl_HT_with_close_points_ = static_cast(tmp_repl_HT_with_close_points); if (with_HT_) { gzread(setup_file, HT_ins_rate_, HT_repl_rate_); } if(repl_HT_with_close_points_) gzread(setup_file, repl_HT_detach_rate_); // -------------------------------------------- Retrieve plasmid parameters int8_t tmp_with_plasmids; gzread(setup_file, tmp_with_plasmids); with_plasmids_ = static_cast(tmp_with_plasmids); if (with_plasmids_) { int8_t tmp_swap_GUs; gzread(setup_file, prob_plasmid_HT_, tune_donor_ability_, tune_recipient_ability_, donor_cost_, recipient_cost_, tmp_swap_GUs); swap_GUs_ = static_cast(tmp_swap_GUs); } // ------------------------------------------ Retrieve secretion parameters int8_t tmp_with_secretion; gzread(setup_file, tmp_with_secretion, secretion_contrib_to_fitness_, secretion_cost_); with_secretion_ = static_cast(tmp_with_secretion); // ---------------------------------------------- Retrieve selection context sel()->load(setup_file, backup_file, verbose); #ifdef __REGUL gzread( setup_file, _hill_shape, _hill_shape_n, _hill_shape_theta, _degradation_rate, _nb_degradation_step, _nb_indiv_age, _with_heredity, _protein_presence_limit); char* binding_matrix_file_name = new char[100]; // _binding_matrix = new double[MAX_QUADON][MAX_CODON]; sprintf( binding_matrix_file_name, "binding_matrix.rae" ); gzFile binding_matrix_file = gzopen( binding_matrix_file_name, "r" ); if ( binding_matrix_file == Z_NULL ) { printf( "ERROR : Could not read binding matrix file %s\n", binding_matrix_file_name ); exit( EXIT_FAILURE ); } read_binding_matrix_from_backup( binding_matrix_file ); gzclose( binding_matrix_file ); delete[] binding_matrix_file_name; unsigned int eval_step_size; gzread(setup_file, eval_step_size); int eval_val; for(unsigned int i = 0; i < eval_step_size; i++) { gzread(setup_file, eval_val); _list_eval_step->insert(eval_val); } #endif gzread(setup_file, first_regul_); } #ifdef __REGUL void ExpSetup::init_binding_matrix( bool random_binding_matrix, double binding_zeros_percentage, std::shared_ptr prng) { if(random_binding_matrix==1) { for( int8_t i = 0; i < MAX_QUADON; i++ ) // i for the quadons { for( int8_t j = 0; j < MAX_CODON; j++ ) // j for the codons { if( prng->random() > binding_zeros_percentage) { _binding_matrix[i][j] = prng->random(); } else { _binding_matrix[i][j] = 0; } // printf("m[%d][%d] = %f\n",MAX_QUADON,MAX_CODON, _binding_matrix[i][j]); } } } else // random_binding_matrix == 0 { char* binding_matrix_file_name = new char[100]; // _binding_matrix = new double[MAX_QUADON][MAX_CODON]; sprintf( binding_matrix_file_name, "binding_matrix.rae" ); gzFile binding_matrix_file = gzopen( binding_matrix_file_name, "r" ); if ( binding_matrix_file == Z_NULL ) { printf( "ERROR : Could not read binding matrix file %s\n", binding_matrix_file_name ); exit( EXIT_FAILURE ); } read_binding_matrix_from_backup( binding_matrix_file ); gzclose( binding_matrix_file ); delete[] binding_matrix_file_name; } } void ExpSetup::read_binding_matrix_from_backup(gzFile binding_matrix_file) { for (int i=0; i < MAX_QUADON; i++) { for (int j=0; j < MAX_CODON; j++) { gzread( binding_matrix_file, (_binding_matrix[i][j])); } } } void ExpSetup::write_binding_matrix_to_backup(gzFile binding_matrix_file) const { double value; for (int i=0; i < MAX_QUADON; i++) { for (int j=0; j < MAX_CODON; j++) { value = _binding_matrix[i][j]; gzwrite( binding_matrix_file, (_binding_matrix[i][j])); } } } void ExpSetup::write_binding_matrix_to_file( FILE* file ) const { for( int16_t row = 0 ; row < MAX_QUADON ; row++ ) { for( int16_t column = 0 ; column < MAX_CODON ; column++ ) { fprintf( file, "\t%e", _binding_matrix[row][column] ); } fprintf( file, "\n"); } } void ExpSetup::print_binding_matrix() { for( int16_t row = 0 ; row < MAX_QUADON ; row++ ) { for( int16_t column = 0 ; column < MAX_CODON ; column++ ) { printf("M[%d][%d] = %e\n", row, column, _binding_matrix[row][column] ); } } } #endif // =========================================================================== // Protected Methods // =========================================================================== } // namespace aevol aevol-5.0/src/libaevol/ReplacementHT.cpp0000644000175000017500000000707612724051151015200 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ============================================================================ // Includes // ============================================================================ #include "ReplacementHT.h" namespace aevol { // ============================================================================ // Definition of static attributes // ============================================================================ // ============================================================================ // Constructors // ============================================================================ ReplacementHT::ReplacementHT(const VisAVis& align1, const VisAVis& align2, int32_t length, int32_t replaced_seq_length, char* seq, int32_t donor_id) : align1_(align1), align2_(align2), length_(length), replaced_seq_length_(replaced_seq_length), donor_id_(donor_id) { seq_ = new char[length_ + 1]; memcpy(seq_, seq, length_ + 1); } // ============================================================================ // Destructor // ============================================================================ ReplacementHT::~ReplacementHT() noexcept { delete seq_; } // ============================================================================ // Methods // ============================================================================ void ReplacementHT::save(gzFile backup_file) const { Utils::ExitWithDevMsg("Not implemented yet", __FILE__, __LINE__); } void ReplacementHT::load(gzFile backup_file) { Utils::ExitWithDevMsg("Not implemented yet", __FILE__, __LINE__); } void ReplacementHT::generic_description_string(char* str) const { sprintf(str, "%" PRId8 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId8 " %" PRId16 " %" PRId16 " %" PRId32 " %" PRId32 " ", mut_type(), donor_pos1(), donor_pos2(), receiver_pos1(), receiver_pos2(), sense(), align1_.score(), align2_.score(), length_, replaced_seq_length_); } // ============================================================================ // Non inline accessors // ============================================================================ } // namespace aevol aevol-5.0/src/libaevol/Selection.h0000644000175000017500000001630212724051151014067 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_SELECTION_H_ #define AEVOL_SELECTION_H_ // ================================================================= // Libraries // ================================================================= #include #include #include #include #include // ================================================================= // Project Files // ================================================================= #include "World.h" #include "Observable.h" namespace aevol { // ================================================================= // Class declarations // ================================================================= class ExpManager; class Selection : public Observable { public : // ================================================================= // Constructors // ================================================================= Selection() = delete; Selection(const Selection&) = delete; Selection(ExpManager* exp_m); // ================================================================= // Destructors // ================================================================= virtual ~Selection(); // ================================================================= // Accessors: getters // ================================================================= inline SelectionScheme selection_scheme() const; inline double selection_pressure() const; inline double* prob_reprod() const; // inline std::unique_ptr prng() const; // ================================================================= // Accessors: setters // ================================================================= // ----------------------------------------- Pseudo-random number generator inline void set_prng(std::unique_ptr&& prng); // -------------------------------------------------------------- Selection inline void set_selection_scheme(SelectionScheme sel_scheme); inline void set_selection_pressure(double sel_pressure); // ================================================================= // Operators // ================================================================= // ================================================================= // Public Methods // ================================================================= void step_to_next_generation(); void PerformPlasmidTransfers(); void write_setup_file(gzFile setup_file) const; void save(gzFile& backup_file) const; void load(gzFile& exp_setup_file, gzFile& backup_file, bool verbose); Individual* do_replication(Individual* parent, int32_t index = -1); Individual* do_replication(Individual* parent, int32_t index, int16_t x, int16_t y); // ================================================================= // Public Attributes // ================================================================= protected : // ================================================================= // Protected Methods // ================================================================= void compute_prob_reprod(); void compute_local_prob_reprod(); Individual* do_local_competition(int16_t x, int16_t y); // ======================================================================= // Protected Attributes // ======================================================================= ExpManager* exp_m_; // ----------------------------------------- Pseudo-random number generator std::unique_ptr prng_; // -------------------------------------------------------------- Selection SelectionScheme selection_scheme_; double selection_pressure_; // --------------------------- Probability of reproduction of each organism double* prob_reprod_; }; // ===================================================================== // Getters' definitions // ===================================================================== // inline std::unique_ptr Selection::prng() const // { // return prng_; // } inline SelectionScheme Selection::selection_scheme() const { return selection_scheme_; } inline double Selection::selection_pressure() const { return selection_pressure_; } inline double*Selection::prob_reprod() const { if (prob_reprod_ == NULL) { printf("ERROR, prob_reprod_ has not been computed %s:%d\n", __FILE__, __LINE__); exit(EXIT_FAILURE); } return prob_reprod_; } // ===================================================================== // Setters' definitions // ===================================================================== // ----------------------------------------- Pseudo-random number generator inline void Selection::set_prng(std::unique_ptr&& prng) { prng_ = std::move(prng); } // -------------------------------------------------------------- Selection inline void Selection::set_selection_scheme(SelectionScheme sel_scheme) { selection_scheme_ = sel_scheme; } inline void Selection::set_selection_pressure(double sel_pressure) { selection_pressure_ = sel_pressure; } // ===================================================================== // Operators' definitions // ===================================================================== // ===================================================================== // Inline functions' definition // ===================================================================== } // namespace aevol #endif // AEVOL_SELECTION_H_ aevol-5.0/src/libaevol/GeneticUnit.h0000644000175000017500000003645212724051151014370 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_GENETIC_UNIT_H_ #define AEVOL_GENETIC_UNIT_H_ #include #include #include #include #include "Dna.h" #include "Rna.h" #include "Protein.h" #include "AbstractFuzzy.h" #include "FuzzyFactory.h" #include "JumpingMT.h" #include "Utils.h" #include "PhenotypicTarget.h" #ifdef __REGUL #include "raevol/Protein_R.h" #endif using std::vector; using std::list; namespace aevol { #ifndef __REGUL // TODO vld: check types using Promoters1Strand = std::list; #else using Promoters1Strand = std::list; #endif using Promoters2Strands = std::vector; class ExpManager; class GeneticUnit { public : // ================================================================= // Constructors // ================================================================= GeneticUnit(Individual* indiv, int32_t length, std::shared_ptr prng); GeneticUnit(Individual* indiv, char* seq, int32_t length, const Promoters2Strands& prom_list = {{}, {}}); GeneticUnit(Individual* indiv, const GeneticUnit& model); GeneticUnit(Individual* indiv, const GeneticUnit* parent); GeneticUnit(Individual* indiv, gzFile backup_file); GeneticUnit(Individual* indiv, char* organism_file_name); GeneticUnit() = delete; GeneticUnit(const GeneticUnit&) = delete; // ================================================================= // Destructors // ================================================================= virtual ~GeneticUnit(); // ================================================================= // Accessors // ================================================================= ExpManager* exp_m() const; Individual* indiv() const; Dna* dna() const; AbstractFuzzy* activ_contribution() const; AbstractFuzzy* inhib_contribution() const; AbstractFuzzy* phenotypic_contribution() const; const Promoters2Strands& rna_list() const; // TODO return as reference #ifndef __REGUL std::list& protein_list(Strand strand); #else std::list& protein_list(Strand strand); #endif void clear_protein_list(Strand strand); void clear_transcribed_proteins(); // Direct DNA access const char* sequence() const; int32_t seq_length() const; // Statistical data int32_t nb_coding_RNAs() const; int32_t nb_non_coding_RNAs() const; double overall_size_coding_RNAs() const; double av_size_coding_RNAs() const; double overall_size_non_coding_RNAs() const; double av_size_non_coding_RNAs() const; int32_t nb_genes_activ() const; int32_t nb_genes_inhib() const; int32_t nb_functional_genes() const; int32_t nb_non_functional_genes() const; double overall_size_functional_genes() const; double av_size_functional_genes() const; double overall_size_non_functional_genes() const; double av_size_non_functional_genes() const; int32_t nb_bases_in_0_CDS() const; int32_t nb_bases_in_0_functional_CDS() const; int32_t nb_bases_in_0_non_functional_CDS() const; int32_t nb_bases_in_0_RNA() const; int32_t nb_bases_in_0_coding_RNA() const; int32_t nb_bases_in_0_non_coding_RNA() const; int32_t nb_bases_non_essential() const; int32_t nb_bases_non_essential_including_nf_genes() const; int32_t nb_bases_in_neutral_regions() const; int32_t nb_neutral_regions() const; int32_t* beginning_neutral_regions() const; int32_t* end_neutral_regions() const; double modularity() const; double dist_to_target_by_feature(PhenotypicFeature feature) const; double fitness() const; double fitness_by_feature(PhenotypicFeature feature) const; int32_t min_gu_length() const; int32_t max_gu_length() const; void set_min_gu_length(int32_t min_gu_length); void set_max_gu_length(int32_t max_gu_length); void set_exp_m(ExpManager* exp_m); // ================================================================= // Public Methods // ================================================================= void locate_promoters(); void do_transcription(); void do_translation(); void compute_phenotypic_contribution(); void take_ownership_of_all_rnas() { Dna::set_GU(rna_list(), this); }; // DM: these two are identical to functions from Individual void compute_distance_to_target(const PhenotypicTarget& target); void compute_fitness(const PhenotypicTarget& target); void reset_expression(); // useful for post-treatment programs void print_rnas() const; void print_coding_rnas(); static void print_rnas(const Promoters2Strands& rnas); static void print_rnas(const Promoters1Strand& rnas, Strand strand); void print_proteins() const; bool is_promoter(Strand strand, int32_t pos, int8_t& dist) const; bool is_terminator(Strand strand, int32_t pos) const; bool is_shine_dalgarno(Strand strand, int32_t pos) const; bool is_start(Strand strand, int32_t pos) const; bool is_stop(Strand strand, int32_t pos) const; int8_t codon(Strand strand, int32_t pos) const; void compute_non_coding(); // these functions are called once, they should likely not be public methods void duplicate_promoters_included_in(int32_t pos_1, int32_t pos_2, Promoters2Strands& duplicated_promoters); void promoters_included_in(int32_t pos_1, int32_t pos_2, Promoters2Strands& promoters_list); void promoters(Strand strand_id, Position start, int32_t pos1, int32_t pos2, Promoters1Strand& promoters); void invert_promoters_included_in(int32_t pos_1, int32_t pos_2); static void invert_promoters(Promoters2Strands& promoter_lists, int32_t seq_length); static void invert_promoters(Promoters2Strands& promoter_lists, int32_t pos_1, int32_t pos_2); // See WARNING void extract_promoters_included_in(int32_t pos_1, int32_t pos_2, Promoters2Strands& extracted_promoters); void extract_promoters_starting_between( int32_t pos_1, int32_t pos_2, Promoters2Strands& extracted_promoters); void extract_leading_promoters_starting_between( int32_t pos_1, int32_t pos_2, Promoters1Strand& extracted_promoters); void extract_lagging_promoters_starting_between( int32_t pos_1, int32_t pos_2, Promoters1Strand& extracted_promoters); // end comment static void shift_promoters(Promoters2Strands& promoters_to_shift, int32_t delta_pos, int32_t seq_length); void insert_promoters(Promoters2Strands& promoters_to_insert); void insert_promoters_at(Promoters2Strands& promoters_to_insert, int32_t pos); void remove_promoters_around(int32_t pos); void remove_promoters_around(int32_t pos_1, int32_t pos_2); void remove_all_promoters(); void look_for_new_promoters_around(int32_t pos); void look_for_new_promoters_around(int32_t pos_1, int32_t pos_2); void move_all_promoters_after(int32_t pos, int32_t delta_pos); void move_all_leading_promoters_after(int32_t pos, int32_t delta_pos); void move_all_lagging_promoters_after(int32_t pos, int32_t delta_pos); void copy_promoters_included_in( int32_t pos_1, int32_t pos_2, Promoters2Strands& new_promoter_lists); void copy_promoters_starting_between( int32_t pos_1, int32_t pos_2, Promoters2Strands& new_promoter_lists); void copy_leading_promoters_starting_between( int32_t pos_1, int32_t pos_2, Promoters1Strand& new_promoter_list); void copy_lagging_promoters_starting_between( int32_t pos_1, int32_t pos_2, Promoters1Strand& new_promoter_list); void save(gzFile backup_file) const; int32_t nb_terminators(); //~ // set the genetic unit of all promoters to the appropriate //~ void reasign_promoter_genetic_unit (); void assert_promoters(); void assert_promoters_order(); bool* is_belonging_to_coding_RNA(); void remove_non_coding_bases(); void double_non_coding_bases(); // WARNING: The method below works properly only in the case of a single // genetic unit (no plasmid). // Translocations between different genetic units is not managed. void compute_nb_of_affected_genes(const Mutation* mut, int& nb_genes_at_breakpoints, int& nb_genes_in_segment, int& nb_genes_in_replaced_segment); // ================================================================= // Public Attributes // ================================================================= protected : // ================================================================= // Protected Methods // ================================================================= void init_statistical_data(); void remove_leading_promoters_starting_between(int32_t pos_1, int32_t pos_2); void remove_lagging_promoters_starting_between(int32_t pos_1, int32_t pos_2); void remove_leading_promoters_starting_before(int32_t pos); void remove_lagging_promoters_starting_before(int32_t pos); void remove_leading_promoters_starting_after(int32_t pos); void remove_lagging_promoters_starting_after(int32_t pos); void look_for_new_leading_promoters_starting_between(int32_t pos_1, int32_t pos_2); void look_for_new_lagging_promoters_starting_between(int32_t pos_1, int32_t pos_2); void look_for_new_leading_promoters_starting_after(int32_t pos); void look_for_new_lagging_promoters_starting_after(int32_t pos); void look_for_new_leading_promoters_starting_before(int32_t pos); void look_for_new_lagging_promoters_starting_before(int32_t pos); // ================================================================= // Protected Attributes // ================================================================= ExpManager* exp_m_; Individual* indiv_; Dna* dna_; AbstractFuzzy* activ_contribution_; AbstractFuzzy* inhib_contribution_; // NB : phenotypic_contribution_ is only an indicative value, // not used for the whole phenotype computation AbstractFuzzy* phenotypic_contribution_; // rna_list_ always has 2 elements: make it an std::array Promoters2Strands rna_list_ = {{}, {}}; // protein_list_ always has 2 elements: make it an std::array #ifndef __REGUL std::array, 2> protein_list_; // = {{},{}}; #else std::array, 2> protein_list_; // = {{},{}}; #endif // DM: For plasmid work, we sometimes *need* all the data // (e.g. fitness, secretion) calculated for each GU double* dist_to_target_per_segment_; double* dist_to_target_by_feature_; double* fitness_by_feature_; double fitness_; // Statistical data (intrinsic for this genetic unit) /** * Number of coding RNAs (at least one gene on RNA) */ int32_t nb_coding_RNAs_; /** * Number of non-coding-RNAs */ int32_t nb_non_coding_RNAs_; /** * Average size of coding RNAs */ double overall_size_coding_RNAs_; /** * Average size of non-coding RNAs */ double overall_size_non_coding_RNAs_; /** * Number of genes realizing a function */ int32_t nb_genes_activ_; /** * Number of genes inhibitting a function */ int32_t nb_genes_inhib_; /** * Number of functional genes */ int32_t nb_fun_genes_; /** * Number of non-functional genes */ int32_t nb_non_fun_genes_; /** * Average size of functional genes */ double overall_size_fun_genes_; /** * Average size of non-functional genes */ double overall_size_non_fun_genes_; /** * Number of bases that are not included in any gene */ int32_t nb_bases_in_0_CDS_; /** * Number of bases that are not included in any non-degenerated gene */ int32_t nb_bases_in_0_functional_CDS_; /** * Number of bases that are not included in any degenerated gene */ int32_t nb_bases_in_0_non_functional_CDS_; /** * Number of bases that are not included in any RNA */ int32_t nb_bases_in_0_RNA_; /** * Number of bases that are not included in any coding RNA * (RNAs containing at least one CDS) */ int32_t nb_bases_in_0_coding_RNA_; /** * Number of bases that are not included in any non coding RNA */ int32_t nb_bases_in_0_non_coding_RNA_; /** * Number of bases that are not included in any non-degenerated gene or * involved in its expression */ int32_t nb_bases_non_essential_; /** * Number of bases that are not included in any gene or involved in its * expression */ int32_t nb_bases_non_essential_including_nf_genes_; /** * Number of bases that are not included in a neutral region */ int32_t nb_bases_in_neutral_regions_; /** * A base is considered neutral when neither itself NOR its corresponding * base on the other strand belongs to a coding [promoter->terminator] region */ /** * Number of neutral regions */ int32_t nb_neutral_regions_; /** * Beginning of neutral regions */ int32_t* beginning_neutral_regions_; /** * Corresponding ends of neutral regions */ int32_t* end_neutral_regions_; /** * Ratio between the pairwise distance between genes whose corresponding * phenotypic triangles overlap and the average intergenic distance * (ignoring non-functional genes) */ double modularity_; int32_t min_gu_length_; int32_t max_gu_length_; // We keep trace of what we have already computed to avoid double // computation (mainly in post-treaments) bool transcribed_; bool translated_; bool phenotypic_contributions_computed_; bool non_coding_computed_; bool distance_to_target_computed_; bool fitness_computed_; }; } // namespace aevol #endif // AEVOL_GENETIC_UNIT_H_ aevol-5.0/src/libaevol/Makefile.in0000644000175000017500000010742112735464144014055 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/libaevol ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \ $(top_srcdir)/m4/ax_boost_filesystem.m4 \ $(top_srcdir)/m4/ax_boost_system.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx_14.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru AM_V_AR = $(am__v_AR_@AM_V@) am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) am__v_AR_0 = @echo " AR " $@; am__v_AR_1 = libaevol_a_AR = $(AR) $(ARFLAGS) libaevol_a_LIBADD = am__libaevol_a_SOURCES_DIST = Alignment.cpp Codon.cpp Dna.cpp Dump.cpp \ ExpManager.cpp ExpSetup.cpp GeneticUnit.cpp GridCell.cpp \ Individual.cpp IndividualFactory.cpp Logging.cpp Mutation.cpp \ PointMutation.cpp SmallInsertion.cpp SmallDeletion.cpp \ Duplication.cpp Deletion.cpp Translocation.cpp Inversion.cpp \ InsertionHT.cpp ReplacementHT.cpp Observable.cpp \ OutputManager.cpp MutationParams.cpp PhenotypicTarget.cpp \ PhenotypicTargetHandler.cpp Point.cpp Protein.cpp \ JumpingMT.cpp ReplicationReport.cpp DnaReplicationReport.cpp \ Rna.cpp Stats.cpp StatRecord.cpp ae_string.cpp Tree.cpp \ Utils.cpp VisAVis.cpp Selection.cpp AbstractFuzzy.cpp \ HybridFuzzy.cpp FuzzyFactory.cpp Fuzzy.cpp Habitat.cpp \ ParamLoader.cpp ParameterLine.cpp AeTime.cpp World.cpp \ HabitatFactory.cpp AbstractFuzzy.h aevol.h Alignment.h Codon.h \ Dna.h Dump.h ae_enums.h PhenotypicSegment.h ExpManager.h \ ExpSetup.h Fuzzy.h FuzzyFactory.h Gaussian.h GeneticUnit.h \ GridCell.h GzHelpers.h HybridFuzzy.h Individual.h \ IndividualFactory.h Logging.h macros.h Mutation.h \ LocalMutation.h PointMutation.h SmallInsertion.h \ SmallDeletion.h Rearrangement.h Duplication.h Deletion.h \ Translocation.h Inversion.h HorizontalTransfer.h InsertionHT.h \ ReplacementHT.h Observable.h ObservableEvent.h Observer.h \ OutputManager.h MutationParams.h Phenotype.h \ PhenotypicTarget.h PhenotypicTargetHandler.h Point.h Protein.h \ JumpingMT.h JumpPoly.h ReplicationReport.h \ DnaReplicationReport.h Rna.h Stats.h StatRecord.h \ NonCodingMetrics.h Metrics.h ae_string.h Tree.h Utils.h \ VisAVis.h Selection.h Habitat.h ParamLoader.h ParameterLine.h \ World.h AeTime.h make_unique.h ae_logger.h HabitatFactory.h \ Individual_X11.cpp ExpManager_X11.cpp X11Window.cpp \ Individual_X11.h ExpManager_X11.h X11Window.h \ raevol/Individual_R.cpp raevol/Protein_R.cpp raevol/Rna_R.cpp \ raevol/PhenotypicTargetHandler_R.cpp raevol/Habitat_R.cpp \ raevol/PhenotypicTarget_R.cpp raevol/Individual_R.h \ raevol/Protein_R.h raevol/Rna_R.h \ raevol/PhenotypicTargetHandler_R.h raevol/Habitat_R.h \ raevol/PhenotypicTarget_R.h raevol/Individual_R_X11.cpp \ raevol/Individual_R_X11.h am__objects_1 = Alignment.$(OBJEXT) Codon.$(OBJEXT) Dna.$(OBJEXT) \ Dump.$(OBJEXT) ExpManager.$(OBJEXT) ExpSetup.$(OBJEXT) \ GeneticUnit.$(OBJEXT) GridCell.$(OBJEXT) Individual.$(OBJEXT) \ IndividualFactory.$(OBJEXT) Logging.$(OBJEXT) \ Mutation.$(OBJEXT) PointMutation.$(OBJEXT) \ SmallInsertion.$(OBJEXT) SmallDeletion.$(OBJEXT) \ Duplication.$(OBJEXT) Deletion.$(OBJEXT) \ Translocation.$(OBJEXT) Inversion.$(OBJEXT) \ InsertionHT.$(OBJEXT) ReplacementHT.$(OBJEXT) \ Observable.$(OBJEXT) OutputManager.$(OBJEXT) \ MutationParams.$(OBJEXT) PhenotypicTarget.$(OBJEXT) \ PhenotypicTargetHandler.$(OBJEXT) Point.$(OBJEXT) \ Protein.$(OBJEXT) JumpingMT.$(OBJEXT) \ ReplicationReport.$(OBJEXT) DnaReplicationReport.$(OBJEXT) \ Rna.$(OBJEXT) Stats.$(OBJEXT) StatRecord.$(OBJEXT) \ ae_string.$(OBJEXT) Tree.$(OBJEXT) Utils.$(OBJEXT) \ VisAVis.$(OBJEXT) Selection.$(OBJEXT) AbstractFuzzy.$(OBJEXT) \ HybridFuzzy.$(OBJEXT) FuzzyFactory.$(OBJEXT) Fuzzy.$(OBJEXT) \ Habitat.$(OBJEXT) ParamLoader.$(OBJEXT) \ ParameterLine.$(OBJEXT) AeTime.$(OBJEXT) World.$(OBJEXT) \ HabitatFactory.$(OBJEXT) am__objects_2 = am__objects_3 = Individual_X11.$(OBJEXT) ExpManager_X11.$(OBJEXT) \ X11Window.$(OBJEXT) am__dirstamp = $(am__leading_dot)dirstamp am__objects_4 = raevol/Individual_R.$(OBJEXT) \ raevol/Protein_R.$(OBJEXT) raevol/Rna_R.$(OBJEXT) \ raevol/PhenotypicTargetHandler_R.$(OBJEXT) \ raevol/Habitat_R.$(OBJEXT) raevol/PhenotypicTarget_R.$(OBJEXT) am__objects_5 = raevol/Individual_R_X11.$(OBJEXT) @WITH_RAEVOL_FALSE@@WITH_X_FALSE@am_libaevol_a_OBJECTS = \ @WITH_RAEVOL_FALSE@@WITH_X_FALSE@ $(am__objects_1) \ @WITH_RAEVOL_FALSE@@WITH_X_FALSE@ $(am__objects_2) @WITH_RAEVOL_FALSE@@WITH_X_TRUE@am_libaevol_a_OBJECTS = \ @WITH_RAEVOL_FALSE@@WITH_X_TRUE@ $(am__objects_1) \ @WITH_RAEVOL_FALSE@@WITH_X_TRUE@ $(am__objects_3) \ @WITH_RAEVOL_FALSE@@WITH_X_TRUE@ $(am__objects_2) \ @WITH_RAEVOL_FALSE@@WITH_X_TRUE@ $(am__objects_2) @WITH_RAEVOL_TRUE@@WITH_X_FALSE@am_libaevol_a_OBJECTS = \ @WITH_RAEVOL_TRUE@@WITH_X_FALSE@ $(am__objects_1) \ @WITH_RAEVOL_TRUE@@WITH_X_FALSE@ $(am__objects_4) \ @WITH_RAEVOL_TRUE@@WITH_X_FALSE@ $(am__objects_2) \ @WITH_RAEVOL_TRUE@@WITH_X_FALSE@ $(am__objects_2) @WITH_RAEVOL_TRUE@@WITH_X_TRUE@am_libaevol_a_OBJECTS = \ @WITH_RAEVOL_TRUE@@WITH_X_TRUE@ $(am__objects_1) \ @WITH_RAEVOL_TRUE@@WITH_X_TRUE@ $(am__objects_3) \ @WITH_RAEVOL_TRUE@@WITH_X_TRUE@ $(am__objects_4) \ @WITH_RAEVOL_TRUE@@WITH_X_TRUE@ $(am__objects_5) \ @WITH_RAEVOL_TRUE@@WITH_X_TRUE@ $(am__objects_2) \ @WITH_RAEVOL_TRUE@@WITH_X_TRUE@ $(am__objects_2) \ @WITH_RAEVOL_TRUE@@WITH_X_TRUE@ $(am__objects_2) \ @WITH_RAEVOL_TRUE@@WITH_X_TRUE@ $(am__objects_2) libaevol_a_OBJECTS = $(am_libaevol_a_OBJECTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) am__v_CXX_0 = @echo " CXX " $@; am__v_CXX_1 = CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) am__v_CXXLD_0 = @echo " CXXLD " $@; am__v_CXXLD_1 = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libaevol_a_SOURCES) DIST_SOURCES = $(am__libaevol_a_SOURCES_DIST) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AEVOLCPPFLAGS = @AEVOLCPPFLAGS@ AEVOLCXXFLAGS = @AEVOLCXXFLAGS@ AEVOLLDFLAGS = @AEVOLLDFLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@ BOOST_LDFLAGS = @BOOST_LDFLAGS@ BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ HAVE_CXX11 = @HAVE_CXX11@ HAVE_CXX14 = @HAVE_CXX14@ HAVE_DOXYGEN = @HAVE_DOXYGEN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ XMKMF = @XMKMF@ X_CFLAGS = @X_CFLAGS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_LIBS = @X_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ ############################################ # Variables # ############################################ ############################################ # C99 exact-width integer specific support # ############################################ # __STDC_FORMAT_MACROS allows us to use exact-width integer format specifiers e.g. PRId32 (for printf etc) # __STDC_CONSTANT_MACROS allows us to define exact-width integer macros with e.g. INT32_C( ) # __STDC_LIMIT_MACROS allows us to use exact-width integer limit macros with e.g. INT32_MAX AM_CPPFLAGS = $(AEVOLCPPFLAGS) -D__STDC_FORMAT_MACROS \ -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS AM_CXXFLAGS = $(AEVOLCXXFLAGS) AM_LDFLAGS = $(AEVOLLDFLAGS) SUBDIRS = SFMT-src-1.4 . ######################## # Set library to build # ######################## noinst_LIBRARIES = libaevol.a common_headers = \ AbstractFuzzy.h \ aevol.h \ Alignment.h \ Codon.h \ Dna.h \ Dump.h \ ae_enums.h \ PhenotypicSegment.h \ ExpManager.h \ ExpSetup.h \ Fuzzy.h \ FuzzyFactory.h \ Gaussian.h \ GeneticUnit.h \ GridCell.h \ GzHelpers.h \ HybridFuzzy.h \ Individual.h \ IndividualFactory.h \ Logging.h \ macros.h \ Mutation.h \ LocalMutation.h \ PointMutation.h \ SmallInsertion.h \ SmallDeletion.h \ Rearrangement.h \ Duplication.h \ Deletion.h \ Translocation.h \ Inversion.h \ HorizontalTransfer.h \ InsertionHT.h \ ReplacementHT.h \ Observable.h \ ObservableEvent.h \ Observer.h \ OutputManager.h \ MutationParams.h \ Phenotype.h \ PhenotypicTarget.h \ PhenotypicTargetHandler.h \ Point.h \ Protein.h \ JumpingMT.h \ JumpPoly.h \ ReplicationReport.h \ DnaReplicationReport.h \ Rna.h \ Stats.h \ StatRecord.h \ NonCodingMetrics.h \ Metrics.h \ ae_string.h \ Tree.h \ Utils.h \ VisAVis.h \ Selection.h \ Habitat.h \ ParamLoader.h \ ParameterLine.h \ World.h \ AeTime.h \ World.h \ make_unique.h \ ae_logger.h \ HabitatFactory.h common_sources = \ Alignment.cpp \ Codon.cpp \ Dna.cpp \ Dump.cpp \ ExpManager.cpp \ ExpSetup.cpp \ GeneticUnit.cpp \ GridCell.cpp \ Individual.cpp \ IndividualFactory.cpp \ Logging.cpp \ Mutation.cpp \ PointMutation.cpp \ SmallInsertion.cpp \ SmallDeletion.cpp \ Duplication.cpp \ Deletion.cpp \ Translocation.cpp \ Inversion.cpp \ InsertionHT.cpp \ ReplacementHT.cpp \ Observable.cpp \ OutputManager.cpp \ MutationParams.cpp \ PhenotypicTarget.cpp \ PhenotypicTargetHandler.cpp \ Point.cpp \ Protein.cpp \ JumpingMT.cpp \ ReplicationReport.cpp \ DnaReplicationReport.cpp \ Rna.cpp \ Stats.cpp \ StatRecord.cpp \ ae_string.cpp \ Tree.cpp \ Utils.cpp \ VisAVis.cpp \ Selection.cpp \ AbstractFuzzy.cpp \ HybridFuzzy.cpp \ FuzzyFactory.cpp \ Fuzzy.cpp \ Habitat.cpp \ ParamLoader.cpp \ ParameterLine.cpp \ AeTime.cpp \ World.cpp \ HabitatFactory.cpp raevol_headers = \ raevol/Individual_R.h \ raevol/Protein_R.h \ raevol/Rna_R.h \ raevol/PhenotypicTargetHandler_R.h \ raevol/Habitat_R.h \ raevol/PhenotypicTarget_R.h raevol_sources = \ raevol/Individual_R.cpp \ raevol/Protein_R.cpp \ raevol/Rna_R.cpp \ raevol/PhenotypicTargetHandler_R.cpp \ raevol/Habitat_R.cpp \ raevol/PhenotypicTarget_R.cpp raevol_X11_headers = \ raevol/Individual_R_X11.h raevol_X11_sources = \ raevol/Individual_R_X11.cpp X11_headers = \ Individual_X11.h \ ExpManager_X11.h \ X11Window.h X11_sources = \ Individual_X11.cpp \ ExpManager_X11.cpp \ X11Window.cpp #libaevol_a_HEADERS = $(common_headers) @WITH_RAEVOL_FALSE@@WITH_X_FALSE@libaevol_a_SOURCES = \ @WITH_RAEVOL_FALSE@@WITH_X_FALSE@ $(common_sources) \ @WITH_RAEVOL_FALSE@@WITH_X_FALSE@ $(common_headers) #libaevol_a_HEADERS = $(common_headers) $(X11_headers) @WITH_RAEVOL_FALSE@@WITH_X_TRUE@libaevol_a_SOURCES = \ @WITH_RAEVOL_FALSE@@WITH_X_TRUE@ $(common_sources) \ @WITH_RAEVOL_FALSE@@WITH_X_TRUE@ $(X11_sources) \ @WITH_RAEVOL_FALSE@@WITH_X_TRUE@ $(common_headers) \ @WITH_RAEVOL_FALSE@@WITH_X_TRUE@ $(X11_headers) #libaevol_a_HEADERS = $(common_headers) $(raevol_headers) @WITH_RAEVOL_TRUE@@WITH_X_FALSE@libaevol_a_SOURCES = \ @WITH_RAEVOL_TRUE@@WITH_X_FALSE@ $(common_sources) \ @WITH_RAEVOL_TRUE@@WITH_X_FALSE@ $(raevol_sources) \ @WITH_RAEVOL_TRUE@@WITH_X_FALSE@ $(common_headers) \ @WITH_RAEVOL_TRUE@@WITH_X_FALSE@ $(raevol_headers) # The target_CPPFLAGS for each target may look useless, it is here to force automake to create # prefixed object files so that we don't use an object file built for another set of macrodefinitions # e.g. We don't want to use an object file created with NO_X when building the X11 lib #libaevol_a_HEADERS += $(common_headers) $(X11_headers) $(raevol_headers) $(raevol_X11_headers) @WITH_RAEVOL_TRUE@@WITH_X_TRUE@libaevol_a_SOURCES = $(common_sources) \ @WITH_RAEVOL_TRUE@@WITH_X_TRUE@ $(X11_sources) \ @WITH_RAEVOL_TRUE@@WITH_X_TRUE@ $(raevol_sources) \ @WITH_RAEVOL_TRUE@@WITH_X_TRUE@ $(raevol_X11_sources) \ @WITH_RAEVOL_TRUE@@WITH_X_TRUE@ $(common_headers) \ @WITH_RAEVOL_TRUE@@WITH_X_TRUE@ $(X11_headers) \ @WITH_RAEVOL_TRUE@@WITH_X_TRUE@ $(raevol_headers) \ @WITH_RAEVOL_TRUE@@WITH_X_TRUE@ $(raevol_X11_headers) all: all-recursive .SUFFIXES: .SUFFIXES: .cpp .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/libaevol/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/libaevol/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) raevol/$(am__dirstamp): @$(MKDIR_P) raevol @: > raevol/$(am__dirstamp) raevol/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) raevol/$(DEPDIR) @: > raevol/$(DEPDIR)/$(am__dirstamp) raevol/Individual_R.$(OBJEXT): raevol/$(am__dirstamp) \ raevol/$(DEPDIR)/$(am__dirstamp) raevol/Protein_R.$(OBJEXT): raevol/$(am__dirstamp) \ raevol/$(DEPDIR)/$(am__dirstamp) raevol/Rna_R.$(OBJEXT): raevol/$(am__dirstamp) \ raevol/$(DEPDIR)/$(am__dirstamp) raevol/PhenotypicTargetHandler_R.$(OBJEXT): raevol/$(am__dirstamp) \ raevol/$(DEPDIR)/$(am__dirstamp) raevol/Habitat_R.$(OBJEXT): raevol/$(am__dirstamp) \ raevol/$(DEPDIR)/$(am__dirstamp) raevol/PhenotypicTarget_R.$(OBJEXT): raevol/$(am__dirstamp) \ raevol/$(DEPDIR)/$(am__dirstamp) raevol/Individual_R_X11.$(OBJEXT): raevol/$(am__dirstamp) \ raevol/$(DEPDIR)/$(am__dirstamp) libaevol.a: $(libaevol_a_OBJECTS) $(libaevol_a_DEPENDENCIES) $(EXTRA_libaevol_a_DEPENDENCIES) $(AM_V_at)-rm -f libaevol.a $(AM_V_AR)$(libaevol_a_AR) libaevol.a $(libaevol_a_OBJECTS) $(libaevol_a_LIBADD) $(AM_V_at)$(RANLIB) libaevol.a mostlyclean-compile: -rm -f *.$(OBJEXT) -rm -f raevol/*.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AbstractFuzzy.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AeTime.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Alignment.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Codon.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Deletion.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Dna.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DnaReplicationReport.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Dump.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Duplication.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ExpManager.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ExpManager_X11.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ExpSetup.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Fuzzy.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FuzzyFactory.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GeneticUnit.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GridCell.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Habitat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HabitatFactory.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HybridFuzzy.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Individual.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IndividualFactory.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Individual_X11.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/InsertionHT.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Inversion.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/JumpingMT.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Logging.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Mutation.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MutationParams.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Observable.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OutputManager.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ParamLoader.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ParameterLine.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PhenotypicTarget.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PhenotypicTargetHandler.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Point.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PointMutation.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Protein.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ReplacementHT.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ReplicationReport.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Rna.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Selection.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SmallDeletion.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SmallInsertion.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/StatRecord.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Stats.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Translocation.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Tree.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Utils.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VisAVis.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/World.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/X11Window.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ae_string.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@raevol/$(DEPDIR)/Habitat_R.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@raevol/$(DEPDIR)/Individual_R.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@raevol/$(DEPDIR)/Individual_R_X11.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@raevol/$(DEPDIR)/PhenotypicTargetHandler_R.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@raevol/$(DEPDIR)/PhenotypicTarget_R.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@raevol/$(DEPDIR)/Protein_R.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@raevol/$(DEPDIR)/Rna_R.Po@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(LIBRARIES) installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -rm -f raevol/$(DEPDIR)/$(am__dirstamp) -rm -f raevol/$(am__dirstamp) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am distclean: distclean-recursive -rm -rf ./$(DEPDIR) raevol/$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -rf ./$(DEPDIR) raevol/$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-noinstLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: aevol-5.0/src/libaevol/ae_string.cpp0000644000175000017500000001741512724051151014456 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ================================================================= // Libraries // ================================================================= #include #include // ================================================================= // Project Files // ================================================================= #include "ae_string.h" #include "ExpSetup.h" namespace aevol { //############################################################################## // # // Class ae_string # // # //############################################################################## // ================================================================= // Definition of static attributes // ================================================================= // ================================================================= // Constructors // ================================================================= ae_string::ae_string() { nb_blocks_ = 1; length_ = 0; data_ = new char[nb_blocks_ * BLOCK_SIZE * sizeof(char)]; data_[length_] = '\0'; } ae_string::ae_string(const ae_string &model) { nb_blocks_ = model.nb_blocks_; length_ = model.length_; data_ = new char[nb_blocks_ * BLOCK_SIZE * sizeof(char)]; memcpy(data_, model.data_, (length_ +1) * sizeof(char)); } /*! Creates a new random string with the given length. */ ae_string::ae_string(int32_t length, std::shared_ptr prng) { nb_blocks_ = nb_blocks(length); length_ = length; data_ = new char[nb_blocks_ * BLOCK_SIZE]; // Generate a random genome for (int32_t i = 0 ; i < length_; i++) { data_[i] = '0' + prng->random(NB_BASE); } data_[length_] = '\0'; } /** * Creates a new ae_string with sequence (having length ) */ ae_string::ae_string(const char* seq, int32_t length) { length_ = length; nb_blocks_ = nb_blocks(length); data_ = new char[nb_blocks_ * BLOCK_SIZE]; memcpy(data_, seq, (length+1) * sizeof(char)); } /** * Creates a new ae_string with sequence (having length ). * WARNING : is used directly which means the caller must not delete it. */ ae_string::ae_string(char* seq, int32_t length, bool use_seq) { assert(use_seq); length_ = length; nb_blocks_ = nb_blocks(length); data_ = seq; } ae_string::ae_string(gzFile backup_file) { gzread(backup_file, &nb_blocks_, sizeof(nb_blocks_)); data_ = new char[nb_blocks_ * BLOCK_SIZE]; gzread(backup_file, &length_, sizeof(length_)); gzread(backup_file, data_, static_cast((length_ + 1) * sizeof(*data_))); } ae_string::ae_string(char* organism_file_name) { FILE* org_file = fopen(organism_file_name, "r"); int32_t length; if (org_file == NULL) { printf("Error opening organism file\n"); } else { fseek(org_file , 0 , SEEK_END); length = ftell(org_file); rewind(org_file); nb_blocks_ = nb_blocks(length); length_ = length; data_ = new char[nb_blocks_ * BLOCK_SIZE]; for (int32_t i = 0 ; i < length_ -1 ; i++) { data_[i] = static_cast(fgetc(org_file)); } data_[length_] = '\0'; } fclose(org_file); } // ================================================================= // Destructors // ================================================================= ae_string::~ae_string() { delete [] data_; } // ================================================================= // Public Methods // ================================================================= /** * Remove the sequence between positions 'pos_1' and 'pos_2' * * Character at pos_1 is removed * Character at pos_2 is not removed unless pos_1 == pos_2, in which case the * string will become empty */ void ae_string::remove(int32_t pos_1, int32_t pos_2) { assert(pos_1 >= 0 && pos_2 >= pos_1 && pos_2 <= length_); // Compute size of new genome int32_t new_length = length_ - (pos_2 - pos_1); int32_t new_nb_blocks = nb_blocks(new_length); char* new_genome = new char[new_nb_blocks * BLOCK_SIZE * sizeof(char)]; // Copy the remaining of the genome in tmp (preceeding and following parts) memcpy(new_genome, data_, pos_1 * sizeof(char)); memcpy(&new_genome[pos_1], &data_[pos_2], (new_length - pos_1) * sizeof(char)); new_genome[new_length] = '\0'; // Replace previous genome with the new one delete [] data_; data_ = new_genome; // Update length data length_ = new_length; nb_blocks_ = new_nb_blocks; } void ae_string::insert(int32_t pos, const char* seq, int32_t seq_length) { // Insert sequence 'seq' at position 'pos' assert(pos >= 0 && pos < length_); // If the sequence's length was not provided, compute it if (seq_length == -1) { seq_length = strlen(seq); } // Compute size of new genome int32_t new_length = length_ + seq_length; int32_t new_nb_blocks = nb_blocks(new_length); char* new_genome = new char[new_nb_blocks * BLOCK_SIZE * sizeof(char)]; // Build new genome from previous genome and sequence to insert memcpy(new_genome, data_, pos * sizeof(char)); memcpy(&new_genome[pos], seq, seq_length * sizeof(char)); memcpy(&new_genome[pos+seq_length], &data_[pos], (length_ - pos) * sizeof(char)); new_genome[new_length] = '\0'; // Replace the previous genome with the new one delete [] data_; data_ = new_genome; // Update length-related data length_ = new_length; nb_blocks_ = new_nb_blocks; } void ae_string::replace(int32_t pos, char* seq, int32_t seq_length) { // Invert the sequence between positions 'first' and 'last' // Check pos value assert(pos >= 0 && pos < length_); // If the sequence's length was not provided, compute it if (seq_length == -1) { seq_length = strlen(seq); } // Check that the sequence is contiguous assert(pos + seq_length <= length_); // Perform the replacement memcpy(&data_[pos], seq, seq_length * sizeof(char)); } void ae_string::save(gzFile backup_file) { gzwrite(backup_file, &nb_blocks_, sizeof(nb_blocks_)); gzwrite(backup_file, &length_, sizeof(length_)); gzwrite(backup_file, &data_[0], static_cast((length_ + 1) * sizeof(data_[0]))); } // ================================================================= // Protected Methods // ================================================================= } // namespace aevol aevol-5.0/src/libaevol/ParamLoader.h0000644000175000017500000002555212724051151014340 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_PARAM_LOADER_H_ #define AEVOL_PARAM_LOADER_H_ // ================================================================= // Includes // ================================================================= #include #include #include #include #include #include #include #include #include #include "ParameterLine.h" #include "MutationParams.h" #include "JumpingMT.h" #include "macros.h" #include "ae_enums.h" #include "Gaussian.h" #include "Point.h" #include "Habitat.h" #ifdef __REGUL #include "raevol/Protein_R.h" #endif namespace aevol { // ================================================================= // Class declarations // ================================================================= class ExpManager; class Individual; class ParamLoader { public : // ========================================================================= // Constructors & Destructor // ========================================================================= ParamLoader() = delete; //< Default ctor ParamLoader(const ParamLoader&) = delete; //< Copy ctor ParamLoader(ParamLoader&&) = delete; //< Move ctor ParamLoader(const char* file_name); virtual ~ParamLoader(); //< Destructor // ========================================================================== // Operators // ========================================================================== /// Copy assignment ParamLoader& operator=(const ParamLoader& other) = delete; /// Move assignment ParamLoader& operator=(ParamLoader&& other) = delete; // ========================================================================= // Public Methods // ========================================================================= void load(ExpManager * exp_m, bool verbose = false, char* chromosome = nullptr, int32_t lchromosome = 0, char* plasmid = nullptr, int32_t lplasmid = 0); void print_to_file(FILE* file); // ========================================================================= // Getters // ========================================================================= // ========================================================================= // Setters // ========================================================================= ParameterLine * get_line( int32_t* ); protected : // ========================================================================= // Protected Methods // ========================================================================= void CheckConsistency(); void read_file(); ParameterLine* line(int32_t*); static void format_line(ParameterLine *, char*, bool*); void interpret_line(ParameterLine * line, int32_t cur_line); // ========================================================================= // Attributes // ========================================================================= std::shared_ptr prng_; char* param_file_name_; FILE* param_file_; // ----------------------------------------- PseudoRandom Number Generators // Seed for the selection random generator int32_t seed_; // Seed for the mutations random generator int32_t mut_seed_; // Seed for the stochasticity random generator int32_t stoch_seed_; // Seed for the phenotypic target variation random generator int32_t env_var_seed_; // Seed for the phenotypic target noise random generator int32_t env_noise_seed_; // ------------------------------------------------------------ Constraints int32_t min_genome_length_; int32_t max_genome_length_; double w_max_; // ----------------------------------------------------- Initial conditions int32_t chromosome_initial_length_; int8_t init_method_; int32_t init_pop_size_; char* strain_name_; // -------------------------------------------------------- Phenotypic target std::list std_env_gaussians; int16_t env_sampling_; // ------------------------------------ Phenotypic target x-axis segmentation /// Number of x-axis segments int16_t env_axis_nb_segments_; /// x-axis segment boundaries (sorted -- including MIN_X and MAX_X) double* env_axis_segment_boundaries_; /// x-axis segment features PhenotypicFeature * env_axis_features_; /// Whether to automatically separate segments bool env_axis_separate_segments_; // ---------------------------------------------- Phenotypic target variation PhenotypicTargetVariationMethod env_var_method_; double env_var_sigma_; int32_t env_var_tau_; // -------------------------------------------------- Phenotypic target noise PhenotypicTargetNoiseMethod env_noise_method_; // Method... TODO double env_noise_alpha_; // Alpha value (variance coefficient) double env_noise_sigma_; // Variance of the noise double env_noise_prob_; // Probability of variation. int32_t env_noise_sampling_log_; // Log2 of the number of points in the noise fuzzy_set // --------------------------------------------------------- Mutation rates double point_mutation_rate_; double small_insertion_rate_; double small_deletion_rate_; int16_t max_indel_size_; // -------------------------------------------- Rearrangements and Transfer bool with_4pts_trans_; bool with_alignments_; bool with_HT_; bool repl_HT_with_close_points_; double HT_ins_rate_; double HT_repl_rate_; double repl_HT_detach_rate_; // ------------------------------ Rearrangement rates (without alignements) double duplication_rate_; double deletion_rate_; double translocation_rate_; double inversion_rate_; // --------------------------------- Rearrangement rates (with alignements) double neighbourhood_rate_; double duplication_proportion_; double deletion_proportion_; double translocation_proportion_; double inversion_proportion_; // ------------------------------------------------------------ Alignements AlignmentFunctionShape align_fun_shape_; double align_sigm_lambda_; int16_t align_sigm_mean_; int16_t align_lin_min_; int16_t align_lin_max_; int16_t align_max_shift_; // Maximum shift of one seq on the other int16_t align_w_zone_h_len_; // Work zone half length int16_t align_match_bonus_; // Corresponding residues match bonus int16_t align_mismatch_cost_; // Corresponding residues mismatch cost // ----------------------------------------------- Phenotypic Stochasticity bool with_stochasticity_; // -------------------------------------------------------------- Selection SelectionScheme selection_scheme_; double selection_pressure_; // ------------------------------------------------------ Spatial structure int16_t grid_width_ = 32; int16_t grid_height_ = 32; bool well_mixed = false; int32_t partial_mix_nb_permutations = 0; // -------------------------------------------------------------- Secretion bool with_secretion_; // Proportion of the fitness contributed by secretion double secretion_contrib_to_fitness_; // (0,1) // Proportion that diffuses into each cell, every generation // (0 for no diffusion) double secretion_diffusion_prop_; // Proportion of secreted substance that degrades every generation double secretion_degradation_prop_; // Cost of secreting the compound, as a proportion of the amount secreted double secretion_cost_; // Starting configuration of secretion grid // 0, all are 0; 1, point source of secreted compund double secretion_init_; // --------------------------------------------------------------- Plasmids bool allow_plasmids_; int32_t plasmid_initial_length_; int32_t plasmid_initial_gene_; int32_t plasmid_minimal_length_; int32_t plasmid_maximal_length_; int32_t chromosome_minimal_length_; int32_t chromosome_maximal_length_; double prob_plasmid_HT_; double tune_donor_ability_; double tune_recipient_ability_; double donor_cost_; double recipient_cost_; bool compute_phen_contrib_by_GU_; bool swap_GUs_; // ------------------------------------------------------- Translation cost double translation_cost_; // ---------------------------------------------------------------- Outputs // Stats int8_t stats_; // Whether to delete the existing statistics file // (otherwise kept with the suffix ".old") bool delete_old_stats_; // Backups int32_t backup_step_; int32_t big_backup_step_; // Tree bool record_tree_; int32_t tree_step_; // Dumps // TODO : explain bool make_dumps_; int32_t dump_step_; // Logs int8_t logs_; // Fuzzy set flavor int _fuzzy_flavor; // Other bool more_stats_; // TODO : explain #ifdef __REGUL // Regulation factors double _hill_shape_n; double _hill_shape_theta; double _hill_shape; // Degradation equation double _degradation_rate; int _nb_degradation_step; // Individual life int _nb_indiv_age; // List of evaluation step std::set _list_eval_step; // Binding matrix double _binding_zeros_percentage; bool _random_binding_matrix; // Heredity bool _with_heredity; double _protein_presence_limit; //Specific variatio method double _env_switch_probability; std::vector> _env_gaussians_list; std::vector> _env_signals_list; std::vector _signals_models; #endif bool first_regul_; }; } // namespace aevol #endif // AEVOL_PARAM_LOADER_H_ aevol-5.0/src/libaevol/Utils.h0000644000175000017500000000574412724051151013252 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_UTILS_H_ #define AEVOL_UTILS_H_ // ================================================================= // Includes // ================================================================= #include #include #include #include #include namespace aevol { class JumpingMT; class Utils { public : Utils() = delete; Utils(const Utils&) = delete; Utils(Utils&&) = delete; ~Utils() = delete; static inline int32_t mod(int32_t a, int32_t b); static inline int64_t mod(int64_t a, int64_t b); static inline int32_t min(int32_t a, int32_t b); static inline int32_t max(int32_t a, int32_t b); static inline void exchange(int32_t& a, int32_t& b); static void ApplyAutoregressiveStochasticProcess(double& value, double sigma, int16_t tau, JumpingMT& prng); static int16_t hamming(const char* str1, const char* str2); static void ExitWithUsrMsg(const std::string& msg); static void ExitWithDevMsg(const std::string& msg, const std::string& file, int line); static void PrintAevolVersion(); }; inline int32_t Utils::mod(int32_t a, int32_t b) { assert(b > 0); while (a < 0) a += b; while (a >= b) a -= b; return a; } inline int64_t Utils::mod(int64_t a, int64_t b) { assert(b > 0); while (a < 0) a += b; while (a >= b) a -= b; return a; } inline int32_t Utils::min(int32_t a, int32_t b) { return ((a < b)? a : b); } inline int32_t Utils::max(int32_t a, int32_t b) { return ((a > b)? a : b); } inline void Utils::exchange(int32_t& a, int32_t& b) { int32_t tmp = a; a = b; b = tmp; } } // namespace aevol #endif // AEVOL_UTILS_H_ aevol-5.0/src/libaevol/LocalMutation.h0000644000175000017500000000676012724051151014724 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_LOCALMUTATION_H_ #define AEVOL_LOCALMUTATION_H_ // ============================================================================ // Includes // ============================================================================ #include "Mutation.h" namespace aevol { /** * Abstract base class for local mutations */ class LocalMutation : public Mutation { public : // ========================================================================== // Constructors // ========================================================================== virtual Mutation* Clone() const override = 0; // ========================================================================== // Destructor // ========================================================================== // ========================================================================== // Operators // ========================================================================== // ========================================================================== // Public Methods // ========================================================================== virtual void save(gzFile backup_file) const override = 0; // ========================================================================== // Getters // ========================================================================== virtual MutationType mut_type() const override = 0; virtual bool is_local_mut() const override final { return true; }; // ========================================================================== // Setters // ========================================================================== protected : // ========================================================================== // Protected Methods // ========================================================================== // ========================================================================== // Attributes // ========================================================================== }; } // namespace aevol #endif //AEVOL_LOCALMUTATION_H_ aevol-5.0/src/libaevol/HorizontalTransfer.h0000644000175000017500000000663612724051151016011 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_HT_H_ #define AEVOL_HT_H_ // ============================================================================ // Includes // ============================================================================ #include "Mutation.h" namespace aevol { /** * */ class HorizontalTransfer : public Mutation { public : // ========================================================================== // Constructors // ========================================================================== virtual Mutation* Clone() const override = 0; // ========================================================================== // Destructor // ========================================================================== // ========================================================================== // Operators // ========================================================================== // ========================================================================== // Public Methods // ========================================================================== virtual void save(gzFile backup_file) const override = 0; // ========================================================================== // Getters // ========================================================================== virtual MutationType mut_type() const override = 0; bool is_ht() const override final { return true; }; // ========================================================================== // Setters // ========================================================================== protected : // ========================================================================== // Protected Methods // ========================================================================== // ========================================================================== // Attributes // ========================================================================== }; } // namespace aevol #endif //AEVOL_HT_H_ aevol-5.0/src/libaevol/ExpManager_X11.h0000644000175000017500000001555412725316671014646 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_EXP_SETUP_X11_H_ #define AEVOL_EXP_SETUP_X11_H_ // ================================================================= // Libraries // ================================================================= #include #include #include #include #include // ================================================================= // Project Files // ================================================================= #include "ExpManager.h" #include "X11Window.h" namespace aevol { // ================================================================= // Class declarations // ================================================================= class ExpSetup; class X11Window; enum key_map { KEY_ESCAPE = 0, KEY_F1 = 1, KEY_F2 = 2, KEY_F3 = 3, KEY_F4 = 4, KEY_F5 = 5, KEY_F6 = 6, KEY_F7 = 7, KEY_F8 = 8, KEY_F9 = 9, KEY_F10 = 10, KEY_F11 = 11, KEY_F12 = 12, KEY_A = 13, KEY_Q = 14, KEY_W = 15, KEY_Z = 16, KEY_S = 17, KEY_X = 18, KEY_E = 19, KEY_D = 20, KEY_C = 21, KEY_R = 22, KEY_F = 23, KEY_V = 24, KEY_T = 25, KEY_G = 26, KEY_B = 27, KEY_Y = 28, KEY_H = 29, KEY_N = 30, KEY_U = 31, KEY_J = 32, KEY_I = 33, KEY_K = 34, KEY_O = 35, KEY_L = 36, KEY_P = 37, KEY_M = 38, KEY_1 = 41, KEY_2 = 42, KEY_3 = 43, KEY_4 = 44, KEY_5 = 45, KEY_6 = 46, KEY_7 = 47, KEY_8 = 48, KEY_9 = 49 }; class ExpManager_X11 : public ExpManager { friend class ExpSetup; public : // ================================================================= // Constructors // ================================================================= ExpManager_X11(void); // ================================================================= // Destructors // ================================================================= virtual ~ExpManager_X11(void) noexcept; // ================================================================= // Accessors // ================================================================= inline bool display_on(); inline Display* get_display(); inline int8_t screen(); inline Atom* atoms(); bool show_window(int8_t win) { return static_cast((show_window_ >> win) & 1); } bool new_show_window(int8_t win) { return static_cast((new_show_window_ >> win) & 1); } inline X11Window * window(int8_t win); // ================================================================= // Public Methods // ================================================================= KeyCode* key_codes() { return key_codes_; }; virtual void display(void); void toggle_display_on_off(void); void handle_events(void); void display(X11Window * win, const AbstractFuzzy& fuzzy, color_map color, bool fill = false, bool bold = false); void display_3D(X11Window * win, const AbstractFuzzy& fuzz, color_map color, int x0 , int y0, bool fill /*= false*/ ); void display_grid(X11Window * win, double** cell_grid); // ================================================================= // Public Attributes // ================================================================= protected : // ================================================================= // Forbidden Constructors // ================================================================= //~ ExpManager_X11(void) //~ { //~ printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ ); //~ exit( EXIT_FAILURE ); //~ }; ExpManager_X11( const ExpManager_X11 &model ) { printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ ); exit( EXIT_FAILURE ); }; // ================================================================= // Protected Methods // ================================================================= void initialize(bool with_grid = false, bool with_plasmids = false); void compute_colormap(); void set_codes(); int8_t identify_window(Window winID); void draw_window(int8_t win_number); void refresh_window(int8_t win_number); // ================================================================= // Protected Attributes // ================================================================= bool display_on_; bool handle_display_on_off_; uint32_t show_window_; // (bitmap) windows that have to be displayed (user switches value pressing F1, F2, ...) uint32_t new_show_window_; // (bitmap) windows that have to be displayed but were not displayed at the last refresh Display* display_; int8_t screen_; Atom* atoms_; KeyCode* key_codes_; X11Window** win_; // Table containing the windows char** win_name_; // window names unsigned int** win_size_; // window sizes int** win_pos_; // window positions std::vector col_map_; }; // ===================================================================== // Accessors' definitions // ===================================================================== // ===================================================================== // Inline functions' definition // ===================================================================== } // namespace aevol #endif // AEVOL_EXP_SETUP_X11_H_ aevol-5.0/src/libaevol/InsertionHT.h0000644000175000017500000001126112724051151014347 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_INSERTION_HT_H_ #define AEVOL_INSERTION_HT_H_ // ============================================================================ // Includes // ============================================================================ #include "HorizontalTransfer.h" #include "VisAVis.h" namespace aevol { /** * */ class InsertionHT : public HorizontalTransfer { public : // ========================================================================== // Constructors // ========================================================================== InsertionHT() = default; //< Default ctor InsertionHT(const InsertionHT&) = default; //< Copy ctor InsertionHT(InsertionHT&&) = delete; //< Move ctor InsertionHT(VisAVis& donor_donor_align, VisAVis& exo_recv_align, int32_t length, char* seq, int32_t donor_id); virtual Mutation* Clone() const override { return new InsertionHT(*this); }; // ========================================================================== // Destructor // ========================================================================== virtual ~InsertionHT() noexcept; //< Destructor // ========================================================================== // Operators // ========================================================================== /// Copy assignment InsertionHT& operator=(const InsertionHT& other) = default; /// Move assignment InsertionHT& operator=(InsertionHT&& other) = delete; // ========================================================================== // Public Methods // ========================================================================== virtual void save(gzFile backup_file) const override; virtual void load(gzFile backup_file) override; void generic_description_string(char* str) const override; // ========================================================================== // Getters // ========================================================================== virtual MutationType mut_type() const override { return INS_HT; }; int32_t donor_pos1() const { return donor_donor_align_.i_1(); } int32_t donor_pos2() const { return donor_donor_align_.i_2(); } int32_t exogenote_pos() const { return exo_recv_align_.i_1(); } int32_t receiver_pos() const { return exo_recv_align_.i_2(); } AlignmentSense sense() const { return exo_recv_align_.sense(); } int32_t length() const { return length_; } char* seq() const { return seq_; } int32_t donor_id() const { return donor_id_; } // ========================================================================== // Setters // ========================================================================== protected : // ========================================================================== // Protected Methods // ========================================================================== // ========================================================================== // Attributes // ========================================================================== VisAVis donor_donor_align_, exo_recv_align_; int32_t length_; char* seq_ = nullptr; int32_t donor_id_ = -1; }; } // namespace aevol #endif //AEVOL_INSERTION_HT_H_ aevol-5.0/src/libaevol/VisAVis.h0000644000175000017500000002224412724051151013470 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_VIS_A_VIS_H_ #define AEVOL_VIS_A_VIS_H_ // ================================================================= // Libraries // ================================================================= #include // ================================================================= // Project Files // ================================================================= #include #include #include #include #include "Dna.h" #include "Utils.h" namespace aevol { // ================================================================= // Class declarations // ================================================================= class VisAVis { friend class Alignment; public : // ================================================================= // Constructors // ================================================================= VisAVis() = default; VisAVis(const Dna * chrom_1, const Dna * chrom_2, int32_t i_1, int32_t i_2, AlignmentSense sense = DIRECT); VisAVis(const VisAVis & orig); // ================================================================= // Destructors // ================================================================= virtual ~VisAVis(); // ================================================================= // Accessors // ================================================================= inline const Dna* chrom_1() const; inline const Dna* chrom_2() const; inline int32_t i_1() const; inline int32_t i_2() const; inline int16_t score() const; inline AlignmentSense sense() const; // ================================================================= // Operators // ================================================================= inline bool operator < (VisAVis &cmp); inline bool operator <= (VisAVis &cmp); inline bool operator > (VisAVis &cmp); inline bool operator >= (VisAVis &cmp); // ================================================================= // Public Methods // ================================================================= inline bool match(); inline void step_fwd(); inline void step_back(); inline void add(int common_inc); inline void add(int inc_1, int inc_2); inline void sub(int common_inc); inline void sub(int inc_1, int inc_2); inline void swap(); inline void copy(VisAVis * source); inline void check_indices(); // ================================================================= // Public Attributes // ================================================================= protected : // ================================================================= // Protected Methods // ================================================================= // ================================================================= // Protected Attributes // ================================================================= const Dna* chrom_1_ = nullptr; const Dna* chrom_2_ = nullptr; int32_t i_1_ = -1; //< Index on chrom_1 int32_t i_2_ = -1; //< Index on chrom_2 int16_t score_ = -1; // Sense (DIRECT or INDIRECT) of the vis_a_vis (alignement) AlignmentSense sense_ = DIRECT; // Say we have the following sequences : // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 // |a|b|c|d|e|f|g|h|i|j| |a|b|c|d|e|f|g|h|i|j| // // The DIRECT vis_a_vis between i_1_ = 3 and i_2_ = 7 is 'd' with 'h' (caracters at indices 3 and 7 resp.). // The corresponding alignment would be "defgh" with "hijkl" // // WARNING! The INDIRECT vis_a_vis between the same i_1_ = 3 and i_2 = 7 is 'd' with 'g' (and not 'h'!). // This is because we are reading backwards (towards the left). Directly left to index 7 is 'g' which corresponds to index 6. // The corresponding alignment would hence be "defgh" with "!g!f!e!d!c" ("!x" means "complementary of x") }; // ===================================================================== // Accessors' definitions // ===================================================================== inline const Dna *VisAVis::chrom_1() const { return chrom_1_; } inline const Dna *VisAVis::chrom_2() const { return chrom_2_; } inline int32_t VisAVis::i_1() const { return i_1_; } inline int32_t VisAVis::i_2() const { return i_2_; } inline int16_t VisAVis::score() const { return score_; } inline AlignmentSense VisAVis::sense() const { return sense_; } // ===================================================================== // Operators' definitions // ===================================================================== inline bool VisAVis::operator < (VisAVis &cmp) { return (i_1_ < cmp.i_1_); } inline bool VisAVis::operator <= (VisAVis &cmp) { return (i_1_ <= cmp.i_1_); } inline bool VisAVis::operator > (VisAVis &cmp) { return (i_1_ > cmp.i_1_); } inline bool VisAVis::operator >= (VisAVis &cmp) { return (i_1_ >= cmp.i_1_); } // ===================================================================== // Inline functions' definition // ===================================================================== inline bool VisAVis::match() { if (sense_ == DIRECT) { return (chrom_1_->data()[Utils::mod(i_1_, chrom_1_->length())] == chrom_2_->data()[Utils::mod(i_2_, chrom_2_->length())]); } else // (sense_ == INDIRECT) { // Note that we are reading the sequence backwards, The nucleotide corresponding to a breakpoint at point // is hence stored at index // a b c d e f g h i j // |_|_|_|_|_|_|_|_|_|_| // | | | | | | | | | | | // 9 8 7 6 5 4 3 2 1 0 // // The breakpoint F-5 puts into a vis_a_vis the nucleotide at index F on seq1 and that at index 4 (not 5!!!) on seq2 return (chrom_1_->data()[Utils::mod(i_1_, chrom_1_->length())] != chrom_2_->data()[Utils::mod(i_2_-1, chrom_2_->length())]); } } inline void VisAVis::step_fwd() { if (sense_ == DIRECT) { i_1_++; i_2_++; } else // (sense_ == INDIRECT) { i_1_++; i_2_--; } } inline void VisAVis::step_back() { if (sense_ == DIRECT) { i_1_--; i_2_--; } else // (sense_ == INDIRECT) { i_1_--; i_2_++; } } inline void VisAVis::add(int common_inc) { if (sense_ == DIRECT) { i_1_ += common_inc; i_2_ += common_inc; } else // (sense_ == INDIRECT) { i_1_ += common_inc; i_2_ -= common_inc; } } inline void VisAVis::add(int inc_1, int inc_2) { if (sense_ == DIRECT) { i_1_ += inc_1; i_2_ += inc_2; } else // (sense_ == INDIRECT) { i_1_ += inc_1; i_2_ -= inc_2; } } inline void VisAVis::sub(int common_inc) { if (sense_ == DIRECT) { i_1_ -= common_inc; i_2_ -= common_inc; } else // (sense_ == INDIRECT) { i_1_ -= common_inc; i_2_ += common_inc; } } inline void VisAVis::sub(int inc_1, int inc_2) { if (sense_ == DIRECT) { i_1_ -= inc_1; i_2_ -= inc_2; } else // (sense_ == INDIRECT) { i_1_ -= inc_1; i_2_ += inc_2; } } inline void VisAVis::swap() { const Dna * tmp_chrom = chrom_1_; int32_t tmp_i = i_1_; chrom_1_ = chrom_2_; i_1_ = i_2_; chrom_2_ = tmp_chrom; i_2_ = tmp_i; } inline void VisAVis::copy(VisAVis * source) { i_1_ = source->i_1_; i_2_ = source->i_2_; chrom_1_ = source->chrom_1_; chrom_2_ = source->chrom_2_; sense_ = source->sense_; score_ = source->score_; } inline void VisAVis::check_indices() { i_1_ = Utils::mod(i_1_, chrom_1_->length()); i_2_ = Utils::mod(i_2_, chrom_2_->length()); } } // namespace aevol #endif // AEVOL_VIS_A_VIS_H_ aevol-5.0/src/libaevol/PhenotypicTargetHandler.cpp0000644000175000017500000003473312724051151017274 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ============================================================================ // Includes // ============================================================================ #if __cplusplus == 201103L #include "make_unique.h" #endif #include "PhenotypicTargetHandler.h" #include "ExpSetup.h" #include "HybridFuzzy.h" #include "Utils.h" #include using std::cout; using std::endl; namespace aevol { //############################################################################## // # // Class PhenotypicTargetHandler # // # //############################################################################## // ============================================================================ // Definition of static attributes // ============================================================================ // ============================================================================ // Constructors // ============================================================================ PhenotypicTargetHandler::PhenotypicTargetHandler() { // The phenotypic target #if __cplusplus == 201103L phenotypic_target_ = make_unique(); #else phenotypic_target_ = std::make_unique(); #endif // Sampling sampling_ = 0; // Variation var_prng_ = NULL; var_method_ = NO_VAR; var_sigma_ = 0.0; var_tau_ = 0; // Noise cur_noise_ = NULL; noise_method_ = NO_NOISE; noise_prng_ = NULL; noise_prob_ = 0.0; noise_alpha_ = 0.0; noise_sigma_ = 0.0; noise_sampling_log_ = 8; } PhenotypicTargetHandler::PhenotypicTargetHandler( const PhenotypicTargetHandler& rhs) { // ------------------------------------------------ Current Phenotypic Target #if __cplusplus == 201103L phenotypic_target_ = make_unique(*(rhs.phenotypic_target_)); #else phenotypic_target_ = std::make_unique(*(rhs.phenotypic_target_)); #endif // ---------------------------------------------------------------- Gaussians initial_gaussians_ = rhs.initial_gaussians_; current_gaussians_ = rhs.current_gaussians_; // ----------------------------------------------------------------- Sampling sampling_ = rhs.sampling_; // ---------------------------------------------------------------- Variation var_method_ = rhs.var_method_; var_prng_ = rhs.var_prng_; var_sigma_ = rhs.var_sigma_; var_tau_ = rhs.var_tau_; // -------------------------------------------------------------------- Noise cur_noise_ = rhs.cur_noise_; noise_prng_ = rhs.noise_prng_; noise_method_ = rhs.noise_method_; noise_alpha_ = rhs.noise_alpha_; noise_sigma_ = rhs.noise_sigma_; noise_prob_ = rhs.noise_prob_; noise_sampling_log_ = rhs.noise_sampling_log_; } PhenotypicTargetHandler::PhenotypicTargetHandler(gzFile backup_file) { load(backup_file); } // ============================================================================ // Destructor // ============================================================================ PhenotypicTargetHandler::~PhenotypicTargetHandler() { delete cur_noise_; } // ============================================================================ // Methods // ============================================================================ void PhenotypicTargetHandler::BuildPhenotypicTarget() { // NB : Extreme points (at abscissa X_MIN and X_MAX) will be generated, we need to erase the list first phenotypic_target_->fuzzy()->reset(); // Generate sample points from gaussians if (not current_gaussians_.empty()) { for (int16_t i = 0; i <= sampling_; i++) { Point new_point = Point( X_MIN + (double) i * (X_MAX - X_MIN) / (double) sampling_, 0.0); for (const Gaussian& g: current_gaussians_) new_point.y += g.compute_y(new_point.x); phenotypic_target_->fuzzy()->add_point(new_point.x, new_point.y); } if (FuzzyFactory::fuzzyFactory->get_fuzzy_flavor() == 1) { HybridFuzzy* fuz = (HybridFuzzy*) phenotypic_target_->fuzzy(); for (int i = 1; i < fuz->get_pheno_size(); i++) { if (fuz->points()[i] == 0.0) { int minL = i - 1; int maxL = i + 1; int dist = 1; while (fuz->points()[maxL] == 0.0) { maxL++; dist++; } double inc = 0.0; if (fuz->points()[maxL] > fuz->points()[minL]) { inc = (fuz->points()[maxL] - fuz->points()[minL]) / dist; } else { inc = (fuz->points()[minL] - fuz->points()[maxL]) / dist; minL = maxL; } for (int j = i; j < maxL; j++) { fuz->points()[j] = fuz->points()[minL] + inc; inc += inc; } } } } } // Add lower and upper bounds phenotypic_target_->fuzzy()->clip(AbstractFuzzy::min, Y_MIN); phenotypic_target_->fuzzy()->clip(AbstractFuzzy::max, Y_MAX); // Simplify (get rid of useless points) phenotypic_target_->fuzzy()->simplify(); // Compute areas (total and by feature) phenotypic_target_->ComputeArea(); } void PhenotypicTargetHandler::ApplyVariation() { switch (var_method_) { case NO_VAR : return; case AUTOREGRESSIVE_MEAN_VAR : ApplyAutoregressiveMeanVariation(); break; case AUTOREGRESSIVE_HEIGHT_VAR : ApplyAutoregressiveHeightVariation(); break; default : Utils::ExitWithDevMsg("Unknown variation method", __FILE__, __LINE__); } // Phenotypic target has changed, recompute its area phenotypic_target_->ComputeArea(); } void PhenotypicTargetHandler::ApplyAutoregressiveMeanVariation() { // For each gaussian : // current_mean = ref_mean + delta_m, where // delta_m follows an autoregressive stochastic process // with the parameters var_sigma_ and var_tau_ for (auto cur_gaussian = current_gaussians_.begin(), initial_gaussian = initial_gaussians_.begin() ; cur_gaussian != current_gaussians_.end() ; cur_gaussian++, initial_gaussian++) { // Find the current delta_mean = current_mean - ref_mean double delta_mean = cur_gaussian->mean() - initial_gaussian->mean(); // Compute the next value : // Dm(t+1) = Dm(t)*(1-1/tau) + ssd/tau*sqrt(2*tau-1)*normal_random() Utils::ApplyAutoregressiveStochasticProcess(delta_mean, var_sigma_, var_tau_, *var_prng_); // Deduce the new value of the mean : ref_mean + delta_m cur_gaussian->set_mean(initial_gaussian->mean() + delta_mean); } BuildPhenotypicTarget(); } void PhenotypicTargetHandler::ApplyAutoregressiveHeightVariation() { // For each gaussian : // current_height = ref_height + delta_h, where // delta_h follows an autoregressive stochastic process // with the parameters var_sigma_ and var_tau_ for (auto cur_gaussian = current_gaussians_.begin(), initial_gaussian = initial_gaussians_.begin() ; cur_gaussian != current_gaussians_.end() ; cur_gaussian++, initial_gaussian++) { // Find the current delta_height = current_height - ref_height double delta_height = cur_gaussian->height() - initial_gaussian->height(); // Compute the next value : // Dm(t+1) = Dm(t)*(1-1/tau) + ssd/tau*sqrt(2*tau-1)*normal_random() Utils::ApplyAutoregressiveStochasticProcess(delta_height, var_sigma_, var_tau_, *var_prng_); // Deduce the new value of the height : ref_height + delta_h cur_gaussian->set_height(initial_gaussian->height() + delta_height); } BuildPhenotypicTarget(); } void PhenotypicTargetHandler::save(gzFile backup_file) const { //printf("Appel a la sauvegarde de PhenotypicTargetHandler\n"); // -------------------------------------------------------------------------- // Write phenotypic target segmentation phenotypic_target_->SaveSegmentation(backup_file); // -------------------------------------------------------------------------- // Write current gaussians (initial gaussians will be stored later if // necessary) int8_t nb_gaussians = current_gaussians_.size(); gzwrite(backup_file, &nb_gaussians, sizeof(nb_gaussians)); for (const Gaussian & g: current_gaussians_) g.save(backup_file); // -------------------------------------------------------------------------- // Write sampling gzwrite(backup_file, &sampling_, sizeof(sampling_)); // -------------------------------------------------------------------------- // Write variation data int8_t tmp_var_method = var_method_; gzwrite(backup_file, &tmp_var_method, sizeof(tmp_var_method)); if (var_method_ != NO_VAR) { var_prng_->save(backup_file); gzwrite(backup_file, &var_sigma_, sizeof(var_sigma_)); gzwrite(backup_file, &var_tau_, sizeof(var_tau_)); } // -------------------------------------------------------------------------- // Write noise data int8_t tmp_noise_method = noise_method_; gzwrite(backup_file, &tmp_noise_method, sizeof(tmp_noise_method)); if (noise_method_ != NO_NOISE) { int8_t tmp_save_cur_noise = (cur_noise_ != NULL); gzwrite(backup_file, &tmp_save_cur_noise, sizeof(tmp_save_cur_noise)); if (tmp_save_cur_noise) cur_noise_->save(backup_file); noise_prng_->save(backup_file); gzwrite(backup_file, &noise_alpha_, sizeof(noise_alpha_)); gzwrite(backup_file, &noise_sigma_, sizeof(noise_sigma_)); gzwrite(backup_file, &noise_prob_, sizeof(noise_prob_)); gzwrite(backup_file, &noise_sampling_log_, sizeof(noise_sampling_log_)); } // --------------------------------------------------------------- // If needed, keep a copy of the initial state of the gaussians // --------------------------------------------------------------- if (var_method_ != NO_VAR || noise_method_ != NO_NOISE) { size_t nb_gaussians = initial_gaussians_.size(); gzwrite(backup_file, &nb_gaussians, sizeof(nb_gaussians)); for (const Gaussian & g: initial_gaussians_) g.save(backup_file); } } void PhenotypicTargetHandler::load(gzFile backup_file) { //printf("Appel au chargement de PhenotypicTargetHandler\n"); // -------------------------------------------------------------------------- // Retrieve phenotypic target segmentation #if __cplusplus == 201103L phenotypic_target_ = make_unique(); #else phenotypic_target_ = std::make_unique(); #endif phenotypic_target_->LoadSegmentation(backup_file); // -------------------------------------------------------------------------- // Retrieve current gaussians int8_t nb_gaussians; gzread(backup_file, &nb_gaussians, sizeof(nb_gaussians)); for (int8_t i = 0 ; i < nb_gaussians ; i++) current_gaussians_.push_back(Gaussian(backup_file)); // -------------------------------------------------------------------------- // Retrieve sampling gzread(backup_file, &sampling_, sizeof(sampling_)); // -------------------------------------------------------------------------- // Retrieve variation data int8_t tmp_var_method; gzread(backup_file, &tmp_var_method, sizeof(tmp_var_method)); var_method_ = (PhenotypicTargetVariationMethod) tmp_var_method; if (var_method_ != NO_VAR) { var_prng_ = std::make_shared(backup_file); gzread(backup_file, &var_sigma_, sizeof(var_sigma_)); gzread(backup_file, &var_tau_, sizeof(var_tau_)); } // -------------------------------------------------------------------------- // Retrieve noise data int8_t tmp_noise_method; gzread(backup_file, &tmp_noise_method, sizeof(tmp_noise_method)); noise_method_ = (PhenotypicTargetNoiseMethod) tmp_noise_method; if (noise_method_ != NO_NOISE) { int8_t tmp_cur_noise_saved; gzread(backup_file, &tmp_cur_noise_saved, sizeof(tmp_cur_noise_saved)); if (tmp_cur_noise_saved) cur_noise_ = FuzzyFactory::fuzzyFactory->create_fuzzy(backup_file); noise_prng_ = std::make_shared(backup_file); gzread(backup_file, &noise_alpha_, sizeof(noise_alpha_)); gzread(backup_file, &noise_sigma_, sizeof(noise_sigma_)); gzread(backup_file, &noise_prob_, sizeof(noise_prob_)); gzread(backup_file, &noise_sampling_log_, sizeof(noise_sampling_log_)); } // -------------------------------------------------------------------------- // If needed, retrieve a copy of the initial state of the gaussians if (var_method_ != NO_VAR || noise_method_ != NO_NOISE) { size_t nb_gaussians; gzread(backup_file, &nb_gaussians, sizeof(nb_gaussians)); for (size_t i = 0 ; i < nb_gaussians ; i++) initial_gaussians_.emplace_back(backup_file); } // -------------------------------------------------------------------------- // Build the phenotypic target BuildPhenotypicTarget(); } // ============================================================================ // Non inline accessors // ============================================================================ } // namespace aevol aevol-5.0/src/libaevol/Individual.h0000644000175000017500000004372212724051151014240 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_INDIVIDUAL_H_ #define AEVOL_INDIVIDUAL_H_ // ================================================================= // Includes // ================================================================= #include #include #include #include #include #include #include #include "Metrics.h" #include "NonCodingMetrics.h" #include "GeneticUnit.h" #include "Dna.h" #include "Rna.h" #include "Protein.h" #include "Phenotype.h" #include "MutationParams.h" #include "Fuzzy.h" #include "PhenotypicTarget.h" #include "Habitat.h" #include "Observable.h" namespace aevol { // ================================================================= // Class declarations // ================================================================= class ExpManager; class GridCell; /// Models an individual cell. /// /// Proteins and RNAs are shared with descent. /// Genetic units are an individual's own. class Individual : public Observable { friend class Dna; public : // ================================================================= // Constructors // ================================================================= Individual() = delete; Individual(const Individual& other); Individual(ExpManager* exp_m, std::shared_ptr mut_prng, std::shared_ptr stoch_prng, std::shared_ptr param_mut, double w_max, int32_t min_genome_length, int32_t max_genome_length, bool allow_plasmids, int32_t id, const char* strain_name, int32_t age); Individual(ExpManager* exp_m, gzFile backup_file); Individual(const Individual* parent, int32_t id, std::shared_ptr mut_prng, std::shared_ptr stoch_prng); static Individual* CreateIndividual(ExpManager* exp_m, gzFile backup_file); /** * \brief Create of clone of an Individual * * A clone is ... TODO * * \param dolly original individual to be cloned * \param id ID of the clone in the population * \return clone of dolly */ static Individual* CreateClone(const Individual* dolly, int32_t id); // ================================================================= // Destructors // ================================================================= virtual ~Individual() noexcept(true); // ================================================================= // Accessors: Getters // ================================================================= const char* strain_name() const; int32_t age() const; ExpManager* exp_m() const; int16_t nb_genetic_units() const; int32_t nb_plasmids() const; int32_t amount_of_dna() const; const GeneticUnit& genetic_unit(int16_t num_unit) const; GeneticUnit& genetic_unit_nonconst(int16_t num_unit); double dist_to_target_by_feature(PhenotypicFeature feature) const; double fitness() const; double fitness_by_feature(PhenotypicFeature feature) const; GridCell* grid_cell() const; const Habitat& habitat() const; bool placed_in_population() const; std::shared_ptr mut_prng() const; std::shared_ptr stoch_prng() const; const std::list& genetic_unit_list() const; std::list& genetic_unit_list_nonconst(); /// Keep only the first (main chromosome) and the last chromosomes from the GU. void drop_nested_genetic_units(); const char* genetic_unit_sequence(int16_t num_unit) const; int32_t genetic_unit_seq_length(int16_t num_unit) const; int32_t id() const; int32_t rank() const; Phenotype* phenotype() const; AbstractFuzzy* phenotype_activ() const; AbstractFuzzy* phenotype_inhib() const; const PhenotypicTarget& phenotypic_target() const; double* dist_to_target_by_segment() const; const std::list& protein_list() const; const std::list& rna_list() const; double w_max() const; // Genome size constraints int32_t min_genome_length() const; int32_t max_genome_length() const; // Plasmids settings bool allow_plasmids() const; // Mutation rates etc... double point_mutation_rate() const; double small_insertion_rate() const; double small_deletion_rate() const; int16_t max_indel_size() const; double duplication_rate() const; double deletion_rate() const; double translocation_rate() const; double inversion_rate() const; double neighbourhood_rate() const; double duplication_proportion() const; double deletion_proportion() const; double translocation_proportion() const; double inversion_proportion() const; // Transfer bool with_4pts_trans() const; bool with_HT() const; bool repl_HT_with_close_points() const; double HT_ins_rate() const; double HT_repl_rate() const; double repl_HT_detach_rate() const; // ------------------------------------------------------------ Alignements bool with_alignments() const; AlignmentFunctionShape align_fun_shape() const; double align_sigm_lambda() const; int16_t align_sigm_mean() const; int16_t align_lin_min() const; int16_t align_lin_max() const; // Maximum shift of one seq on the other int16_t align_max_shift() const; // Work zone half length int16_t align_w_zone_h_len() const; // Corresponding residues match bonus int16_t align_match_bonus() const; // Corresponding residues mismatch cost int16_t align_mismatch_cost() const; // ----------------------------------------------- Phenotypic stochasticity bool with_stochasticity() const; // Statistical data int32_t total_genome_size() const; // TODO: duplicate with amount_of_dna? int16_t nb_coding_RNAs() const; int16_t nb_non_coding_RNAs() const; int32_t overall_size_coding_RNAs() const; double av_size_coding_RNAs() const; int32_t overall_size_non_coding_RNAs() const; double av_size_non_coding_RNAs() const; int16_t nb_genes_activ() const; int16_t nb_genes_inhib() const; int16_t nb_functional_genes() const; int16_t nb_non_functional_genes() const; int32_t overall_size_functional_genes() const; double av_size_functional_genes() const; int32_t overall_size_non_functional_genes() const; double av_size_non_functional_genes() const; int32_t nb_bases_in_0_CDS() const; int32_t nb_bases_in_0_functional_CDS() const; int32_t nb_bases_in_0_non_functional_CDS() const; int32_t nb_bases_in_0_RNA() const; int32_t nb_bases_in_0_coding_RNA() const; int32_t nb_bases_in_0_non_coding_RNA() const; int32_t nb_bases_in_neutral_regions() const; int32_t nb_neutral_regions() const; double modularity(); // Not const int32_t* int_probes() const; double* double_probes() const; // ================================================================= // Accessors: Setters // ================================================================= void set_strain_name(char* name); void set_exp_m(ExpManager* exp_m); void set_id(int32_t id); void set_rank(int32_t rank); void set_grid_cell(GridCell* grid_cell); void set_placed_in_population(bool placed_in_population); void reset_dist_to_target_by_segment(double* dist_to_target_by_segment); void set_w_max(double w_max); // Genome size constraints void set_min_genome_length(int32_t min_genome_length); void set_max_genome_length(int32_t max_genome_length); // Plasmids void set_allow_plasmids(bool allow_plasmids); // Mutation rates etc... void set_point_mutation_rate(double point_mutation_rate); void set_small_insertion_rate(double small_insertion_rate); void set_small_deletion_rate(double small_deletion_rate); void set_max_indel_size(int16_t max_indel_size); void set_duplication_rate(double duplication_rate); void set_deletion_rate(double deletion_rate); void set_translocation_rate(double translocation_rate); void set_inversion_rate(double inversion_rate); void set_neighbourhood_rate(double neighbourhood_rate); void set_duplication_proportion(double duplication_proportion); void set_deletion_proportion(double deletion_proportion); void set_translocation_proportion(double translocation_proportion); void set_inversion_proportion(double inversion_proportion); // Transfer void set_with_4pts_trans(bool with_4pts_trans); void set_with_alignments(bool with_alignments); void set_with_HT(bool with_HT); void set_repl_HT_with_close_points(bool repl_HT_with_close_points); void set_HT_ins_rate(double HT_ins_rate); void set_HT_repl_rate(double HT_repl_rate); void set_repl_HT_detach_rate(double repl_HT_detach_rate); // ----------------------------------------------- Phenotypic stochasticity void set_with_stochasticity(bool with_stoch); void set_mut_prng(std::shared_ptr prng); void set_stoch_prng(std::shared_ptr prng); //------------------------------------------------ Generic probes void set_int_probes(int32_t* int_probes); void set_double_probes(double* double_probes); // ================================================================= // Public Methods // ================================================================= // warning: the individual is left in a totally "cleared" state but not // reevaluated void add_GU(char*& sequence, int32_t length); // void add_GU(GeneticUnit&& unit); // warning: the individual is left in // a totally "cleared" state but not reevaluated void add_GU(Individual* indiv, int32_t chromosome_length, std::shared_ptr prng); // void add_GU(Individual* indiv, int32_t length, JumpingMT* prng); // warning: the individual is left in a totally "cleared" state but not // reevaluated void remove_GU(int16_t num_unit); void renew_dist_to_target_by_feature(); void renew_fitness_by_feature(); void inject_GU(Individual* donor); void inject_2GUs(Individual* partner); /** * Main evaluation method */ virtual void Evaluate(); /** * Evaluate within the provided context */ virtual void EvaluateInContext(const Habitat& habitat); /** * Reset expression, proteins, phenotype and so on and evaluate */ virtual void Reevaluate(); /** * Reset expression, proteins, phenotype and so on and evaluate in context */ virtual void ReevaluateInContext(const Habitat& habitat); virtual void clear_everything_except_dna_and_promoters(); void do_transcription_translation_folding(); void do_transcription(); void do_translation(); void do_folding(); void compute_phenotype(); void compute_distance_to_target(const PhenotypicTarget& target); // Computation of a "proper" fitness value (one that increases when the individual is fitter) // The behaviour of this function depends on many parameters and most notably on whether it is // a "composite" fitness or not, and on the selection scheme. void compute_fitness(const PhenotypicTarget& target); void compute_statistical_data(); void compute_non_coding(); virtual void save(gzFile backup_file) const; int32_t nb_terminators(); #ifdef DEBUG void assert_promoters(); void assert_promoters_order(); #endif double compute_theoritical_f_nu(); // These functions compute the probability of neutral reproduction (F_nu). // The first method replicates the individual "nb_children" times and counts how often // a child has the same fitness as its parent (and if second argument not NULL, how often // a child has same or better fitness and stores the result at the adress contained in the // pointer). Results are proportions. // The second is an estimate based on genome structure as defined by Carole. // They have been implemented on the chromosome only ! void remove_non_coding_bases(); void double_non_coding_bases(); // ================================================================= // Public Attributes // ================================================================= protected : // ================================================================= // Protected Methods // ================================================================= virtual void make_protein_list(); virtual void make_rna_list(); // ================================================================= // Protected Attributes // ================================================================= ExpManager* exp_m_; // Name and "Age" of the strain char* strain_name_; int32_t age_; // Random number generators // These are shared pointers because depending on the configuration, // they can either be exclusive to the individual or grid cell, or they // can be mutualized (shared) for all or part of the population std::shared_ptr mut_prng_; std::shared_ptr stoch_prng_; // Individual ID and rank of the individual in the population // WARNING : The ID is no longer corresponding to the rank of the individual. // The reason for this change is that we now need an identifier for the individuals // as soon as they are created (the rank is only known when all the individuals have been evaluated). // The rank will now be handled in a specific new attribute. (1 for the worst indiv, POP_SIZE for the best) int32_t id_; // [0 ; POP_SIZE[ int32_t rank_; // [1 ; POP_SIZE] // Total activation (resp. inhibition) of metabolic functions AbstractFuzzy* phenotype_activ_; AbstractFuzzy* phenotype_inhib_; // The phenotype, roughly corresponding to the sum of activ and inhib Phenotype* phenotype_; // Array containing the partial area of the "gap" (difference between the // phenotype and the target) for each phenotypic target segment. // Note: if the phenotypic target is not segmented, there will be a single // cell in this array double* dist_to_target_by_segment_; // This array contains the aggregated area of the gap for each type of // segment (PhenotypicFeature). // When the phenotypic target is not segmented, the only meaningful value // will be held in dist_to_target_[METABOLISM] double* dist_to_target_by_feature_; // This array contains the fitness contribution for each type of segment // (PhenotypicFeature). // For metabolic segment, this is the metabolic fitness contribution; // For secretion segment, this is the amount of compound that gets secreted // into the phenotypic target; // Note: total fitness is the combination of metabolic fitness and the amount // of compound present in the habitat, not the amount of compound secreted by // the individual. double* fitness_by_feature_; // THE fitness double fitness_; // When using structured population, this is the cell the individual is in GridCell* grid_cell_ = nullptr; // int16_t x, y; // The chromosome and plasmids (if allowed) std::list genetic_unit_list_; // Access lists to all the proteins/RNAs of the individual. // Please note that these proteins/RNAs are actually managed (i.e. newed and deleted) via genetic units. std::list protein_list_; std::list rna_list_; // Generic probes int32_t* int_probes_; // Array of 5 int32_t values to be used as one wishes double* double_probes_; // Array of 5 double values to be used as one wishes // Mutation rates etc... std::shared_ptr mut_params_; // ----------------------------------------------- Phenotypic stochasticity bool with_stochasticity_; // Artificial chemistry double w_max_; // Genome size constraints int32_t min_genome_length_; int32_t max_genome_length_; // Plasmids settings bool allow_plasmids_; // -------------------------------------------------- // "State" of the individual // -------------------------------------------------- // We keep trace of what we have already computed to avoid double computation (mainly in post-treaments) bool evaluated_; bool transcribed_; bool translated_; bool folded_; bool phenotype_computed_; bool distance_to_target_computed_; bool fitness_computed_; bool placed_in_population_; // TODO: spatial ? // ---------------------------------------- // Statistical data // ---------------------------------------- // Genome, RNAs and genes size and stuff Metrics* metrics_ = nullptr; // Coding / non-coding NonCodingMetrics* nc_metrics_ = nullptr; // Mutation/Rearrangement statistics are managed in the replication report double modularity_; // Ratio between the pairwise distance between genes whose corresponding // phenotypic triangles overlap and the average intergenic distance // (ignoring non-functional genes)void compute_phenotype(); }; } // namespace aevol #endif // AEVOL_INDIVIDUAL_H_ aevol-5.0/src/libaevol/Mutation.h0000644000175000017500000001225612724051151013746 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_MUTATION_H_ #define AEVOL_MUTATION_H_ // ================================================================= // Libraries // ================================================================= #include // ================================================================= // Project Files // ================================================================= #include #include #include #include #include "ae_enums.h" #include namespace aevol { // ================================================================= // Class declarations // ================================================================= enum MutationType { // Simple mutation types. SWITCH = 0, S_INS, S_DEL, DUPL, DEL, TRANS, INV, INSERT, INS_HT, REPL_HT, // Composite mutation types follow. They represent categories of // several simple mutation types. Therefore, they should not be used // as array index for counters. // // The composite mutations should extend MutationType but // C++ enums can't be inherited directly. S_MUT, // SWITCH or S_INS or S_DEL REARR, // DUPL or DEL or TRANS or INV H_T, // INS_HT or REPL_HT INDEL // S_INS or S_DEL }; class Mutation { public : // ================================================================= // Constructors // ================================================================= Mutation() = default; Mutation(const Mutation& model) = default; Mutation(Mutation&& model) = default; virtual Mutation* Clone() const = 0; static Mutation* Load(gzFile backup); // ================================================================= // Destructor // ================================================================= virtual ~Mutation() noexcept = default; // ========================================================================== // Operators // ========================================================================== /// Copy assignment Mutation& operator=(const Mutation& other) = delete; /// Move assignment Mutation& operator=(Mutation&& other) = delete; // ================================================================= // Public Methods // ================================================================= virtual void save(gzFile backup_file) const = 0; virtual void load(gzFile backup_file) = 0; virtual void generic_description_string(char* str) const = 0; // ================================================================= // Accessors: Getters // ================================================================= virtual MutationType mut_type() const = 0; virtual bool is_local_mut() const { return false; }; virtual bool is_rear() const { return false; }; virtual bool is_ht() const { return false; }; // ================================================================= // Accessors: Setters // ================================================================= protected : // ================================================================= // Protected Methods // ================================================================= // ================================================================= // Protected Attributes // ================================================================= }; // ===================================================================== // Accessors' definitions // ===================================================================== // ===================================================================== // Inline functions' definition // ===================================================================== } // namespace aevol #endif // AEVOL_MUTATION_H_ aevol-5.0/src/libaevol/Tree.cpp0000644000175000017500000001604412724051151013377 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ================================================================= // Libraries // ================================================================= // ================================================================= // Project Files // ================================================================= #include "Tree.h" #include "macros.h" #include "ExpManager.h" #include "ExpSetup.h" #include "Individual.h" #include "Utils.h" namespace aevol { //############################################################################## // # // Class Tree # // # //############################################################################## // ================================================================= // Definition of static attributes // ================================================================= const int32_t Tree::NO_PARENT = -1; // ================================================================= // Constructors // ================================================================= Tree::Tree(ExpManager* exp_m, int64_t tree_step) { exp_m_ = exp_m; tree_step_ = tree_step; replics_ = new ReplicationReport** [tree_step_]; for (int32_t time = 0 ; time < tree_step ; time++) { replics_[time] = new ReplicationReport* [exp_m->nb_indivs()]; for (int32_t num_indiv = 0 ; num_indiv < exp_m->nb_indivs() ; num_indiv++) { replics_[time][num_indiv] = new ReplicationReport(); } } } /** * */ Tree::Tree(ExpManager* exp_m, char* tree_file_name) { exp_m_ = exp_m; tree_step_ = exp_m_->tree_step(); gzFile tree_file = gzopen(tree_file_name, "r"); if (tree_file == Z_NULL) { printf("ERROR : Could not read tree file %s\n", tree_file_name); exit(EXIT_FAILURE); } replics_ = new ReplicationReport** [tree_step_]; for (int64_t t = 0 ; t < tree_step_ ; t++) { replics_[t] = new ReplicationReport* [exp_m_->nb_indivs()]; for (int32_t indiv_i = 0 ; indiv_i < exp_m_->nb_indivs() ; indiv_i++) { // Retrieve a replication report ReplicationReport* replic_report = new ReplicationReport(tree_file, nullptr); // Put it at its rightful position replics_[t][replic_report->id()] = replic_report; } } gzclose(tree_file); } // ================================================================= // Destructors // ================================================================= Tree::~Tree() { if (replics_ != NULL) { for (int32_t i = 0 ; i < tree_step_ ; i++) if (replics_[i] != NULL) { for (int32_t j = 0 ; j < exp_m_->nb_indivs() ; j++) delete replics_[i][j]; delete [] replics_[i]; } delete [] replics_; } } // ================================================================= // Public Methods // ================================================================= ReplicationReport** Tree::reports(int64_t t) const { return replics_[Utils::mod(t - 1, tree_step_)]; } ReplicationReport* Tree::report_by_index(int64_t t, int32_t index) const { return replics_[Utils::mod(t - 1, tree_step_)][index]; } ReplicationReport* Tree::report_by_rank(int64_t t, int32_t rank) const { int32_t nb_indivs = exp_m_->nb_indivs(); assert(rank <= nb_indivs); for (int32_t i = 0 ; i < nb_indivs ; i++) { if (replics_[Utils::mod(t - 1, tree_step_)][i]->rank() == rank) { return replics_[Utils::mod(t - 1, tree_step_)][i]; } } fprintf(stderr, "ERROR: Couldn't find indiv with rank %" PRId32 " in file %s:%d\n", rank, __FILE__, __LINE__); return NULL; } void Tree::signal_end_of_generation() { auto cur_reports = reports(AeTime::time()); for (int32_t i = 0; i < exp_m_->nb_indivs(); i++) { cur_reports[i]->signal_end_of_generation(); } } void Tree::write_to_tree_file(gzFile tree_file) { // Write the tree in the backup for (int64_t t = 0 ; t < tree_step_ ; t++) for (int32_t indiv_i = 0 ; indiv_i < exp_m_->nb_indivs() ; indiv_i++) { assert(replics_[t][indiv_i] != NULL); replics_[t][indiv_i]->write_to_tree_file(tree_file); } // Reinitialize the tree for (int32_t t = 0 ; t < tree_step_ ; t++) for (int32_t indiv_i = 0 ; indiv_i < exp_m_->nb_indivs() ; indiv_i++) { delete replics_[t][indiv_i]; replics_[t][indiv_i] = new ReplicationReport(); } } /** * This method is called whenever an observed object calls notifyObservers * * \param o the observable that has called notifyObservers * \param e type of event triggered * \param arg array containing a pointer to the new indiv and its parent */ void Tree::update(Observable& o, ObservableEvent e, void* arg) { switch (e) { case NEW_INDIV : { // Initialize the replication report corresponding to the new individual auto indivs = reinterpret_cast(arg); Individual* new_indiv = indivs[0]; Individual* parent = indivs[1]; report_by_index(AeTime::time(), new_indiv->id())->init(new_indiv, parent); break; } case END_GENERATION : signal_end_of_generation(); break; default : Utils::ExitWithDevMsg("Event not handled", __FILE__, __LINE__); } } // ================================================================= // Non-inline accessors' definition // ================================================================= // ================================================================= // Protected Methods // ================================================================= } // namespace aevol aevol-5.0/src/libaevol/Translocation.h0000644000175000017500000001127512724051151014766 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_TRANSLOCATION_H_ #define AEVOL_TRANSLOCATION_H_ // ============================================================================ // Includes // ============================================================================ #include "Rearrangement.h" namespace aevol { /** * */ class Translocation : public Rearrangement { public : // ========================================================================== // Constructors // ========================================================================== Translocation() = default; //< Default ctor Translocation(const Translocation&) = default; //< Copy ctor Translocation(Translocation&&) = delete; //< Move ctor Translocation(int32_t pos1, int32_t pos2, int32_t pos3, int32_t pos4, int32_t length, bool invert, int16_t align_score_1 = -1, int16_t align_score_2 = -1); virtual Mutation* Clone() const override { return new Translocation(*this); }; // ========================================================================== // Destructor // ========================================================================== virtual ~Translocation() noexcept = default; //< Destructor // ========================================================================== // Operators // ========================================================================== /// Copy assignment Translocation& operator=(const Translocation& other) = default; /// Move assignment Translocation& operator=(Translocation&& other) = delete; // ========================================================================== // Public Methods // ========================================================================== virtual void save(gzFile backup_file) const override; virtual void load(gzFile backup_file) override; void generic_description_string(char* str) const override; // ========================================================================== // Getters // ========================================================================== virtual MutationType mut_type() const override { return TRANS; }; int32_t pos1() const { return pos1_; } int32_t pos2() const { return pos2_; } int32_t pos3() const { return pos3_; } int32_t pos4() const { return pos4_; } int32_t length() const { return length_; } bool invert() const { return invert_; } int16_t align_score_1() const { return align_score_1_; } int16_t align_score_2() const { return align_score_2_; } // ========================================================================== // Setters // ========================================================================== protected : // ========================================================================== // Protected Methods // ========================================================================== // ========================================================================== // Attributes // ========================================================================== int32_t pos1_, pos2_, pos3_, pos4_; int32_t length_; bool invert_; int16_t align_score_1_ = -1; int16_t align_score_2_ = -1; }; } // namespace aevol #endif //AEVOL_TRANSLOCATION_H_ aevol-5.0/src/libaevol/Rna.cpp0000644000175000017500000001110712724051151013213 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ================================================================= // Libraries // ================================================================= #include // ================================================================= // Project Files // ================================================================= #include "Rna.h" #include "GeneticUnit.h" #include "Individual.h" namespace aevol { //############################################################################## // # // Class Rna # // # //############################################################################## // ================================================================= // Definition of static attributes // ================================================================= // ================================================================= // Constructors // ================================================================= Rna::Rna(GeneticUnit* gen_unit, const Rna &model) { // Copy "trivial" attributes gen_unit_ = gen_unit; strand_ = model.strand_; pos_ = model.pos_; transcript_length_ = model.transcript_length_; basal_level_ = model.basal_level_; // Copy transcribed proteins // WARNING : Since this list do not "own" the proteins (they will not be deleted) // proteins must NOT be CREATED here. // TODO : Not needed for the moment... // for (const auto& protein: model.transcribed_proteins_) // transcribed_proteins_.push_back(protein); } Rna::Rna(GeneticUnit* gen_unit, Strand strand, int32_t pos, int8_t diff) { gen_unit_ = gen_unit; strand_ = strand; pos_ = pos; transcript_length_ = -1; basal_level_ = 1 - (double)diff / (PROM_MAX_DIFF + 1); } /* Rna::Rna(Rna* parent) { gen_unit_ = parent->gen_unit_; strand_ = parent->strand_; pos_ = parent->pos_; transcript_length_ = parent->transcript_length_; basal_level_ = parent->basal_level_; } */ // ================================================================= // Destructors // ================================================================= Rna::~Rna() { } // ================================================================= // Public Methods // ================================================================= int32_t Rna::first_transcribed_pos() const { if (strand_ == LEADING) { return Utils::mod(pos_ + PROM_SIZE, gen_unit_->dna()->length()); } else { return Utils::mod(pos_ - PROM_SIZE, gen_unit_->dna()->length()); } } int32_t Rna::last_transcribed_pos() const { if (strand_ == LEADING) { return Utils::mod(pos_ + PROM_SIZE + transcript_length_ - 1, gen_unit_->dna()->length()); } else { return Utils::mod(pos_ - (PROM_SIZE + transcript_length_ - 1), gen_unit_->dna()->length()); } } // ================================================================= // Protected Methods // ================================================================= } // namespace aevol aevol-5.0/src/libaevol/FuzzyFactory.cpp0000644000175000017500000001076212724051151015160 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // //***************************************************************************** // ============================================================================ // Includes // ============================================================================ #include "FuzzyFactory.h" #include "Fuzzy.h" #include "HybridFuzzy.h" #include "ExpSetup.h" namespace aevol { //############################################################################## // # // Class IndividualFactory # // # //############################################################################## // ============================================================================ // Definition of static attributes // ============================================================================ // ============================================================================ // Constructors // ============================================================================ // ============================================================================ // Destructor // ============================================================================ // ============================================================================ // Methods // ============================================================================ /** * Create an individual with random sequences */ /*static AbstractFuzzy* FuzzyFactory::create_fuzzy(ExpSetup* exp_s) { AbstractFuzzy* fuzzy; if (exp_s->get_fuzzy_flavor() == 0) { fuzzy = new Fuzzy(); } else { fuzzy = new HybridFuzzy(); } return fuzzy; } static AbstractFuzzy* FuzzyFactory::create_fuzzy(ExpSetup* exp_s, const AbstractFuzzy& copy) { AbstractFuzzy* fuzzy; if (exp_s->get_fuzzy_flavor() == 0) { fuzzy = new Fuzzy((Fuzzy&)(copy)); } else { fuzzy = new HybridFuzzy((HybridFuzzy&)(copy)); } return fuzzy; } static AbstractFuzzy* FuzzyFactory::create_fuzzy(ExpSetup* exp_s, const gzFile backup) { AbstractFuzzy* fuzzy; if (exp_s->get_fuzzy_flavor() == 0) { fuzzy = new Fuzzy(backup); } else { fuzzy = new HybridFuzzy(backup); } return fuzzy; }*/ AbstractFuzzy* FuzzyFactory::create_fuzzy() { AbstractFuzzy* fuzzy; if (_exp_s->get_fuzzy_flavor() == 0) { fuzzy = new Fuzzy(); } else { fuzzy = new HybridFuzzy(); } return fuzzy; } AbstractFuzzy* FuzzyFactory::create_fuzzy(const AbstractFuzzy& copy) { AbstractFuzzy* fuzzy; if (_exp_s->get_fuzzy_flavor() == 0) { fuzzy = new Fuzzy((Fuzzy&)(copy)); } else { fuzzy = new HybridFuzzy((HybridFuzzy&)(copy)); } return fuzzy; } AbstractFuzzy* FuzzyFactory::create_fuzzy(const gzFile backup) { AbstractFuzzy* fuzzy; if (_exp_s->get_fuzzy_flavor() == 0) { fuzzy = new Fuzzy(backup); } else { fuzzy = new HybridFuzzy(backup); } return fuzzy; } int FuzzyFactory::get_fuzzy_flavor() { return _exp_s->get_fuzzy_flavor(); } // ============================================================================ // Non inline accessors // ============================================================================ } // namespace aevol aevol-5.0/src/libaevol/Point.cpp0000644000175000017500000000300512724051151013562 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #include "Point.h" namespace aevol { Point readpoint(gzFile backup_file) { Point p; gzread(backup_file, &p.x, sizeof(p.x)); gzread(backup_file, &p.y, sizeof(p.y)); return p; } void writepoint(const Point& p, gzFile backup_file) { gzwrite(backup_file, &p.x, sizeof(p.x)); gzwrite(backup_file, &p.y, sizeof(p.y)); } } // namespace aevol aevol-5.0/src/libaevol/HybridFuzzy.cpp0000644000175000017500000001407112724051151014767 00000000000000// // Created by arrouan on 31/07/15. // #include #ifdef __BLAS__ #include #endif #include #include "HybridFuzzy.h" namespace aevol { HybridFuzzy::HybridFuzzy( ) { _pheno_size = PHENO_SIZE; _points = new double[_pheno_size]; for (int i = 0; i < _pheno_size; i++) _points[i] = 0.0; } HybridFuzzy::HybridFuzzy( const HybridFuzzy& model ) { _pheno_size = PHENO_SIZE; _points = new double[_pheno_size]; #ifdef __BLAS__ cblas_dcopy(_pheno_size,model._points,1,_points,1); #else for (int i=0; i < _pheno_size; i++) _points[i] = model._points[i]; #endif } HybridFuzzy::HybridFuzzy( gzFile backup_file ) { _pheno_size = PHENO_SIZE; _points = new double[_pheno_size]; for (int i = 0; i < _pheno_size; i++) _points[i] = 0.0; load( backup_file ); } // ================================================================= // Destructors // ================================================================= HybridFuzzy::~HybridFuzzy( void ) { if (_points != NULL) delete [] _points; _points = NULL; } // ================================================================= // Public Methods // ================================================================= void HybridFuzzy::simplify( ) { } void HybridFuzzy::reset( ) { for (int i = 0; i < _pheno_size; i++) _points[i] = 0.0; } void HybridFuzzy::add_triangle( double mean, double width, double height ) { if ( fabs(width) < 1e-15 || fabs(height) < 1e-15 ) return; // Compute triangle points' coordinates double x0 = mean - width; double x1 = mean; double x2 = mean + width; int ix0 = (int) (x0 * _pheno_size); int ix1 = (int) (x1 * _pheno_size); int ix2 = (int) (x2 * _pheno_size); if (ix0 < 0) ix0 = 0; else if (ix0 > (_pheno_size-1)) ix0 = _pheno_size-1; if (ix1 < 0) ix1 = 0; else if (ix1 > (_pheno_size-1)) ix1 = _pheno_size-1; if (ix2 < 0) ix2 = 0; else if (ix2 > (_pheno_size-1)) ix2 = _pheno_size-1; // Compute the first equation of the triangle double incY = height / (ix1 - ix0); int count = 1; // Updating value between x0 and x1 // _points[ix0] = 0.0; for (int i = ix0+1; i < ix1; i++) { _points[i]+=incY*(count++); } _points[ix1]+= height; // Compute the second equation of the triangle incY = height / (ix2 - ix1); count = 1; // Updating value between x1 and x2 for (int i = ix1+1; i < ix2; i++) { _points[i]+=(height-(incY*(count++))); } } void HybridFuzzy::add( const AbstractFuzzy& f ) { const HybridFuzzy to_add = (HybridFuzzy&)(f); #ifdef __BLAS__ cblas_daxpy(_pheno_size, 1.0, to_add.points(), 1, _points, 1); #else for (int i = 0; i < _pheno_size; i++) { if (to_add._points[i] != 0) _points[i] = _points[i] + to_add._points[i]; } #endif } void HybridFuzzy::sub( const AbstractFuzzy& f ) { const HybridFuzzy to_sub = (HybridFuzzy&)(f); #ifdef __BLAS__ cblas_daxpy(_pheno_size, -1.0, to_sub.points(), 1, _points, 1); #else for (int i = 0; i < _pheno_size; i++) { if (to_sub._points[i] !=0 ) _points[i] = _points[i] - to_sub._points[i]; } #endif } double HybridFuzzy::get_geometric_area( ) const { return get_geometric_area(X_MIN,X_MAX); } double HybridFuzzy::get_geometric_area( double start_segment, double end_segment ) const { double area = 0; int istart_segment = (int) (start_segment * _pheno_size); int iend_segment = (int) (end_segment * _pheno_size); if (istart_segment < 0) istart_segment = 0; else if (istart_segment > (_pheno_size-1)) istart_segment = _pheno_size-1; if (iend_segment < 0) iend_segment = 0; else if (iend_segment > (_pheno_size-1)) iend_segment = _pheno_size-1; for (int i = istart_segment; i < iend_segment; i++) { area+=((fabs(_points[i]) + fabs(_points[i+1])) / (2.0*_pheno_size)); } return area; } bool HybridFuzzy::is_identical_to( const AbstractFuzzy& f, double tolerance ) const { const HybridFuzzy fs = (HybridFuzzy&)(f); // Since list::size() has constant complexity since C++ 11, checking // size is an inexpensive first step. if (get_pheno_size() != fs.get_pheno_size()) return false; for (int i = 0; i < _pheno_size; i++) if (fabs(_points[i] - fs.points()[i]) > tolerance * (fabs(_points[i]) + fabs(fs.points()[i])) or fabs(_points[i] - fs.points()[i]) > tolerance * (fabs(_points[i]) + fabs(fs.points()[i]))) return false; return true; } void HybridFuzzy::save( gzFile backup_file ) const { gzwrite(backup_file, &_pheno_size, sizeof(_pheno_size)); std::cout << __FILE__ << ":" << __LINE__ << ":" << gztell(backup_file) << std::endl; std::cout << __FILE__ << ":" << __LINE__ << ":" << _pheno_size << std::endl; for (int i = 0; i < _pheno_size; i++) gzwrite(backup_file, &_points[i], sizeof(_points[i])); } void HybridFuzzy::load( gzFile backup_file ) { gzread(backup_file, &_pheno_size, sizeof(_pheno_size)); std::cout << __FILE__ << ":" << __LINE__ << ":" << gztell(backup_file) << std::endl; std::cout << __FILE__ << ":" << __LINE__ << ":" << _pheno_size << std::endl; for (int i = 0; i < _pheno_size; i++) { gzread(backup_file, &_points[i], sizeof(_points[i])); } } void HybridFuzzy::clip(clipping_direction direction, double bound) { if (direction == clipping_direction::min) for (int i = 0; i < _pheno_size; i++) _points[i] = _points[i] < bound ? bound : _points[i]; else if (direction == clipping_direction::max) for (int i = 0; i < _pheno_size; i++) _points[i] = _points[i] > bound ? bound : _points[i]; } void HybridFuzzy::add_point(double x, double y) { int ix = (int) ( x * _pheno_size); _points[ix] = y; } // ================================================================= // Protected Methods // ================================================================= double HybridFuzzy::get_y( double x ) const { int ix = (int) ( x * _pheno_size); double retValue = _points[ix]; return retValue; } void HybridFuzzy::print() const { for (int i = 0; i < _pheno_size; i++) if (_points[i]!=0) printf("[%d : %f] ",i,_points[i]); printf("\n"); } } aevol-5.0/src/libaevol/PhenotypicTarget.h0000644000175000017500000001315412724051151015435 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_PHENOTYPIC_TARGET_H_ #define AEVOL_PHENOTYPIC_TARGET_H_ // ============================================================================ // Includes // ============================================================================ #include #include #include #include #include "Fuzzy.h" #include "PhenotypicSegment.h" #include "ae_enums.h" namespace aevol { // ============================================================================ // Class declarations // ============================================================================ class PhenotypicTarget { friend class PhenotypicTargetHandler; public : // ========================================================================== // Constructors // ========================================================================== PhenotypicTarget(); //< Default ctor PhenotypicTarget(const PhenotypicTarget&); //< Copy ctor PhenotypicTarget(PhenotypicTarget&&) = delete; //< Move ctor // ========================================================================== // Destructor // ========================================================================== virtual ~PhenotypicTarget(); //< Destructor // ========================================================================== // Operators // ========================================================================== // ========================================================================== // Public Methods // ========================================================================== void ComputeArea(); void SaveSegmentation(gzFile backup_file) const; void LoadSegmentation(gzFile backup_file); // ========================================================================== // Getters // ========================================================================== double area_by_feature(int8_t feature) const { return area_by_feature_[feature]; } int8_t nb_segments() const { return nb_segments_; } PhenotypicSegment ** segments() const { return segments_; } AbstractFuzzy* fuzzy() const { return fuzzy_; } // ========================================================================== // Setters // ========================================================================== void set_segmentation(int8_t nb_segments, double* boundaries, PhenotypicFeature * features, bool separate_segments); protected : // ========================================================================== // Protected Methods // ========================================================================== // ========================================================================== // Attributes // ========================================================================== /// Number segments. int8_t nb_segments_; /// Ordered array of segments. /// Each PhenotypicSegment knows its boundaries and corresponding feature. /// When the phenotypic target is not segmented, this array contains a single /// segment with feature METABOLIC and boundaries MIN_X and MAX_X PhenotypicSegment ** segments_; /// Geometric area of each feature double* area_by_feature_; AbstractFuzzy* fuzzy_; }; // ============================================================================ // Getters' definitions // ============================================================================ // ============================================================================ // Setters' definitions // ============================================================================ // ============================================================================ // Operators' definitions // ============================================================================ // ============================================================================ // Inline functions' definition // ============================================================================ } // namespace aevol #endif // AEVOL_PHENOTYPIC_TARGET_H_ aevol-5.0/src/libaevol/ObservableEvent.h0000644000175000017500000000255612724051151015236 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_OBSERVABLEEVENT_H_ #define AEVOL_OBSERVABLEEVENT_H_ /** * */ enum ObservableEvent { NEW_INDIV, MUTATION, END_REPLICATION, END_GENERATION }; #endif //AEVOL_OBSERVABLEEVENT_H_ aevol-5.0/src/libaevol/Point.h0000644000175000017500000000305612724051151013235 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #ifndef AEVOL_POINT_H_ #define AEVOL_POINT_H_ #include #include namespace aevol { struct Point { double x; double y; Point(double x_, double y_): x(x_), y(y_) {}; Point() {}; Point(Point* p): x(p->x), y(p->y) {}; }; Point readpoint(const gzFile backup_file); void writepoint(const Point& p, gzFile backup_file); } // namespace aevol #endif // AEVOL_POINT_H_ aevol-5.0/src/Makefile.am0000644000175000017500000000373012735463403012242 00000000000000############################################ # Variables # ############################################ AM_CPPFLAGS = $(AEVOLCPPFLAGS) AM_CXXFLAGS = $(AEVOLCXXFLAGS) AM_LDFLAGS = $(AEVOLLDFLAGS) SUBDIRS = libaevol post_treatments AM_CPPFLAGS += -I$(top_srcdir)/src/libaevol ############################################ # C99 exact-width integer specific support # ############################################ # __STDC_FORMAT_MACROS allows us to use exact-width integer format specifiers e.g. PRId32 (for printf etc) # __STDC_CONSTANT_MACROS allows us to define exact-width integer macros with e.g. INT32_C( ) # __STDC_LIMIT_MACROS allows us to use exact-width integer limit macros with e.g. INT32_MAX AM_CPPFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS #################################### # Add hardening option to compiler # #################################### # This replaces insecure unlimited length buffer function calls with # length-limited ones (required for debian and not a bad idea anyway). AM_CPPFLAGS += -D_FORTIFY_SOURCE=2 ############################################ # Set programs to build and library to use # ############################################ ##### The solution below is no longer used since it generates a dependency problem ##### #AM_LDFLAGS = -L$(top_srcdir)/src/libaevol # LDADD = -laevol ##### ##### LDADD = $(top_srcdir)/src/libaevol/libaevol.a $(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a bin_PROGRAMS = aevol_run aevol_create aevol_modify aevol_propagate CLEANFILES = aevol_run aevol_create aevol_modify aevol_propagate aevol_propagate_CPPFLAGS = $(AM_CPPFLAGS) $(BOOST_CPPFLAGS) aevol_propagate_LDFLAGS = $(AM_LDFLAGS) $(BOOST_LDFLAGS) aevol_propagate_LDADD = $(LDADD) $(BOOST_SYSTEM_LIB) $(BOOST_FILESYSTEM_LIB) aevol_run_SOURCES = aevol_run.cpp aevol_create_SOURCES = aevol_create.cpp aevol_modify_SOURCES = aevol_modify.cpp aevol_propagate_SOURCES = aevol_propagate.cpp aevol-5.0/src/aevol_run.cpp0000644000175000017500000002121512724051151012671 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ============================================================================ // Includes // ============================================================================ #include #include #include #include #include #include #include #ifdef _OPENMP #include #endif #ifdef __X11 #include "ExpManager_X11.h" #else #include "ExpManager.h" #endif #include "macros.h" using namespace aevol; #ifndef __NO_X void catch_usr1(int sig_num); #endif // Helper functions void print_help(char* prog_path); void interpret_cmd_line_options(int argc, char* argv[]); // Command-line option variables // static bool pause_on_startup = false; static bool verbose = false; static int64_t t0 = -1; static int64_t t_end = -1; static int64_t nb_steps = -1; #ifndef __NO_X static bool show_display_on_startup = true; #endif static bool run_in_parallel = false; // Other file-scope variables static ExpManager* exp_manager = nullptr; int main(int argc, char* argv[]) { // Set handlers for signals to be caught #ifndef __NO_X signal(SIGUSR1, catch_usr1); #endif // Print warning for debug mode #ifdef DEBUG printf("aevol is being run in DEBUG mode\n"); #endif interpret_cmd_line_options(argc, argv); // ================================================================= // Load the simulation // ================================================================= #ifndef __NO_X exp_manager = new ExpManager_X11(); #else exp_manager = new ExpManager(); #endif exp_manager->load(t0, verbose, true); exp_manager->set_t_end(t_end); // Make a numbered copy of each static input file // (dynamic files are saved elsewhere) // TODO (?) #ifndef __NO_X if (show_display_on_startup) { ((ExpManager_X11*) exp_manager)->toggle_display_on_off(); } #endif // ================================================================= // Run the simulation // ================================================================= exp_manager->run_evolution(); delete exp_manager; //~ return EXIT_SUCCESS; } #ifndef __NO_X void catch_usr1(int sig_num) { signal(SIGUSR1, catch_usr1); printf("display on/off\n"); if (exp_manager != nullptr) { ((ExpManager_X11*) exp_manager)->toggle_display_on_off(); } } #endif /*! \brief */ void print_help(char* prog_path) { // Get the program file-name in prog_name (strip prog_path of the path) char* prog_name; // No new, it will point to somewhere inside prog_path if ((prog_name = strrchr(prog_path, '/'))) { prog_name++; } else { prog_name = prog_path; } printf("******************************************************************************\n"); printf("* *\n"); printf("* aevol - Artificial Evolution *\n"); printf("* *\n"); printf("* Aevol is a simulation platform that allows one to let populations of *\n"); printf("* digital organisms evolve in different conditions and study experimentally *\n"); printf("* the mechanisms responsible for the structuration of the genome and the *\n"); printf("* transcriptome. *\n"); printf("* *\n"); printf("******************************************************************************\n"); printf("\n"); printf("%s: run an aevol simulation.\n", prog_name); printf("\n"); printf("Usage : %s -h or --help\n", prog_name); printf(" or : %s -V or --version\n", prog_name); printf(" or : %s [-b TIMESTEP] [-e TIMESTEP|-n NB_TIMESTEPS] [-p NB_THREADS] [-vwx]\n", prog_name); printf("\nOptions\n"); printf(" -h, --help\n\tprint this help, then exit\n"); printf(" -V, --version\n\tprint version number, then exit\n"); printf(" -b, --begin TIMESTEP\n"); printf("\tspecify time t0 to resume simulation at (default read in last_gener.txt)\n"); printf(" -e, --end TIMESTEP\n"); printf("\tspecify time of the end of the simulation\n"); printf(" -n, --nb-timesteps NB_TIMESTEPS\n"); printf("\tspecify number of timesteps to be simulated (default 1000)\n"); printf(" -p, --parallel NB_THREADS\n"); printf("\trun on NB_THREADS threads (use -1 for system default)\n"); printf(" -v, --verbose\n\tbe verbose\n"); printf(" -w, --wait\n\tpause after loading\n"); printf(" -x, --noX\n\tdon't display X outputs upon start\n"); printf("\tsend SIGUSR1 to switch X output on/off\n"); } void interpret_cmd_line_options(int argc, char* argv[]) { // Define allowed options const char* options_list = "hVb:e:n:vwxp:"; static struct option long_options_list[] = { {"help", no_argument, nullptr, 'h'}, {"version", no_argument, nullptr, 'V'}, {"begin", required_argument, nullptr, 'b'}, {"end", required_argument, nullptr, 'e'}, {"nb-timesteps", required_argument, nullptr, 'n'}, {"verbose", no_argument, nullptr, 'v'}, {"wait", no_argument, nullptr, 'w'}, {"noX", no_argument, nullptr, 'x'}, {"parallel", required_argument, nullptr, 'p'}, {0, 0, 0, 0} }; // Get actual values of the CLI options int option; while ((option = getopt_long(argc, argv, options_list, long_options_list, nullptr)) != -1) { switch (option) { case 'h' : { print_help(argv[0]); exit(EXIT_SUCCESS); } case 'V' : { Utils::PrintAevolVersion(); exit(EXIT_SUCCESS); } case 'b' : { t0 = atol(optarg); break; } case 'e' : { if (nb_steps != -1) { Utils::ExitWithUsrMsg("use either option -n or -e, not both"); } t_end = atol(optarg); break; } case 'n' : { if (t_end != -1) { Utils::ExitWithUsrMsg("use either option -n or -e, not both"); } nb_steps = atol(optarg); break; } case 'v' : { verbose = true; break; } case 'w' : { // pause_on_startup = true; break; } case 'x' : { #ifdef __NO_X printf("%s: error: Program was compiled with __NO_X option, " "no visualisation available.\n", argv[0]); exit(EXIT_FAILURE); #else show_display_on_startup = false; #endif break; } case 'p' : { #ifdef _OPENMP run_in_parallel = true; if (atoi(optarg) > 0) { omp_set_num_threads(atoi(optarg)); } #endif break; } default : { // An error message is printed in getopt_long, we just need to exit exit(EXIT_FAILURE); } } } // If t0 wasn't provided, use default if (t0 < 0) { t0 = OutputManager::last_gener(); } // If t_end_ wasn't provided, set it according to nb_steps or use default // (run for 1000 timesteps) if (t_end < 0) { if (nb_steps >= 0) { t_end = t0 + nb_steps; } else { t_end = t0 + 1000; } } // It the user didn't ask for a parallel run, set number of threads to 1 #ifdef _OPENMP if (not run_in_parallel) { omp_set_num_threads(1); } #endif } aevol-5.0/src/aevol_modify.cpp0000644000175000017500000011434412724051151013362 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** const char* DEFAULT_PARAM_FILE_NAME = "param.in"; // ============================================================================ // Includes // ============================================================================ #include #include #include #include #include #if __cplusplus == 201103L #include "make_unique.h" #endif #include "ParameterLine.h" #ifdef __X11 #include "ExpManager_X11.h" #else #include "ExpManager.h" #include "libaevol/ParameterLine.h" #include "libaevol/JumpingMT.h" #endif using namespace aevol; enum population_change_type { SUBPOPULATIONS_BASED_ON_NON_CODING_BASES = 3, REMOVE_NON_CODING_BASES_BEST_IND = 4, REMOVE_NON_CODING_BASES_POPULATION = 5, DOUBLE_NON_CODING_BASES_BEST_IND = 6, DOUBLE_NON_CODING_BASES_POPULATION = 7 }; // Helper functions void print_help(char* prog_path); void interpret_cmd_line_options(int argc, char* argv[]); ParameterLine* get_line(FILE* param_file); void format_line(ParameterLine* formatted_line, char* line, bool* line_is_interpretable); // void change_by_cloning_best(ae_population* pop, ae_exp_manager* exp_m); // void change_based_on_non_coding_bases_of_best_individual(ae_population* pop, ae_exp_manager* exp_m, population_change_type type); // void change_based_on_non_coding_bases_in_population(ae_population* pop, ae_exp_manager* exp_m, population_change_type type); // Command-line option variables char* param_file_name = nullptr; bool verbose = false; int64_t timestep = -1; int main(int argc, char* argv[]) { interpret_cmd_line_options(argc, argv); // Initialize the experiment manager #ifndef __NO_X ExpManager* exp_manager = new ExpManager_X11(); #else ExpManager* exp_manager = new ExpManager(); #endif exp_manager->load(timestep, false, verbose); // Define shorthands //Environment* env = exp_manager->env(); Selection* sel = exp_manager->sel(); World* world = exp_manager->world(); // If relevant, load the tree information char tree_file_name[50]; Tree* tree = nullptr; bool take_care_of_the_tree = exp_manager->record_tree() && time() > 0; if (take_care_of_the_tree) { // If a tree is available, assign the replication reports to the individuals #ifdef __REGUL sprintf(tree_file_name,"tree/tree_" TIMESTEP_FORMAT ".rae", timestep); #else sprintf(tree_file_name, "tree/tree_" TIMESTEP_FORMAT ".ae", timestep); #endif tree = new Tree(exp_manager, tree_file_name); } // Interpret and apply changes printf("Interpret and apply changes\n"); FILE* param_file = fopen(param_file_name, "r"); if (param_file == nullptr) { printf("%s:%d: error: could not open parameter file %s\n", __FILE__, __LINE__, param_file_name); exit(EXIT_FAILURE); } std::list new_gaussians; bool phen_target_change = false; bool start_to_record_tree = false; bool set_tree_step = false; int32_t tree_step = 100; ParameterLine* line; int32_t cur_line = 0; while ((line = get_line(param_file)) != nullptr) { cur_line++; if (strcmp(line->words[0], "ENV_AXIS_FEATURES") == 0) { // TODO adapt to new organization printf( "%s:%d: error: ENV_AXIS_FEATURES has to be adapted to the new organization.\n", __FILE__, __LINE__); exit(EXIT_FAILURE); // int16_t env_axis_nb_segments = line->nb_words / 2; // double* env_axis_segment_boundaries = new double [env_axis_nb_segments + 1]; // env_axis_segment_boundaries[0] = X_MIN; // for (int16_t i = 1 ; i < env_axis_nb_segments ; i++) // { // env_axis_segment_boundaries[i] = atof(line->words[2*i]); // } // env_axis_segment_boundaries[env_axis_nb_segments] = X_MAX; // // // Set segment features // PhenotypicFeature* env_axis_features = new PhenotypicFeature[env_axis_nb_segments]; // for (int16_t i = 0 ; i < env_axis_nb_segments ; i++) // { // if (strcmp(line->words[2*i+1], "NEUTRAL") == 0) // { // env_axis_features[i] = NEUTRAL; // } // else if (strcmp(line->words[2*i+1], "METABOLISM") == 0) // { // env_axis_features[i] = METABOLISM; // } // else if (strcmp(line->words[2*i+1], "SECRETION") == 0) // { // exp_manager->exp_s()->set_with_secretion(true); // env_axis_features[i] = SECRETION; // } // else if (strcmp(line->words[2*i+1], "DONOR") == 0) // { // env_axis_features[i] = DONOR; // } // else if (strcmp(line->words[2*i+1], "RECIPIENT") == 0) // { // env_axis_features[i] = RECIPIENT; // } // else // { // printf("ERROR in param file \"%s\" on line %" PRId32 " : unknown axis feature \"%s\".\n", // param_file_name, cur_line, line->words[2*i+1]); // exit(EXIT_FAILURE); // } // } // env->set_segmentation(env_axis_nb_segments, // env_axis_segment_boundaries, // env_axis_features); // env_hasbeenmodified = true; // delete env_axis_segment_boundaries; // delete env_axis_features; } else if (strcmp(line->words[0], "RECORD_TREE") == 0) { if (strncmp(line->words[1], "true", 4) == 0) { start_to_record_tree = true; } else if (strncmp(line->words[1], "false", 5) == 0) { printf("ERROR stop recording tree is not implemented yet.\n"); exit(EXIT_FAILURE); } else { printf("ERROR in param file \"%s\" on line %" PRId32 " : unknown tree recording option (use true/false).\n", param_file_name, cur_line); exit(EXIT_FAILURE); } if (exp_manager->output_m()->record_tree()) { printf( "ERROR modification of already existing tree not impemented yet\n"); exit(EXIT_FAILURE); } } else if (strcmp(line->words[0], "TREE_STEP") == 0) { tree_step = atol(line->words[1]); set_tree_step = true; } else if (strcmp(line->words[0], "TREE_MODE") == 0) { printf("ERROR : Tree mode management has been removed.\n"); exit(EXIT_FAILURE); } else if (strcmp(line->words[0], "DUMP_STEP") == 0) { int step = atoi(line->words[1]); if (step > 0) { exp_manager->output_m()->set_dump_step(step); } } else if (strcmp(line->words[0], "BACKUP_STEP") == 0) { exp_manager->output_m()->set_backup_step(atol(line->words[1])); } else if (strcmp(line->words[0], "BIG_BACKUP_STEP") == 0) { exp_manager->output_m()->set_big_backup_step(atol(line->words[1])); } else if (strcmp(line->words[0], "POPULATION_SIZE") == 0) { printf("ERROR in param file \"%s\" on line %" PRId32 ": the change of population size is not implemented yet\n" " for spatially structured populations", param_file_name, cur_line); exit(EXIT_FAILURE); } else if (strcmp(line->words[0], "SELECTION_SCHEME") == 0) { if (strncmp(line->words[1], "lin", 3) == 0) { if (line->nb_words != 3) { printf("ERROR in param file \"%s\" on line %" PRId32 " : selection pressure parameter is missing.\n", param_file_name, cur_line); exit(EXIT_FAILURE); } sel->set_selection_scheme(RANK_LINEAR); sel->set_selection_pressure(atof(line->words[2])); } else if (strncmp(line->words[1], "exp", 3) == 0) { if (line->nb_words != 3) { printf("ERROR in param file \"%s\" on line %" PRId32 " : selection pressure parameter is missing.\n", param_file_name, cur_line); exit(EXIT_FAILURE); } sel->set_selection_scheme(RANK_EXPONENTIAL); sel->set_selection_pressure(atof(line->words[2])); } else if (strncmp(line->words[1], "fitness", 7) == 0) { if (line->nb_words != 3) { printf("ERROR in param file \"%s\" on line %" PRId32 " : selection pressure parameter is missing.\n", param_file_name, cur_line); exit(EXIT_FAILURE); } sel->set_selection_scheme(FITNESS_PROPORTIONATE); sel->set_selection_pressure(atof(line->words[2])); } else if (strcmp(line->words[1], "fittest") == 0) { sel->set_selection_scheme(FITTEST); } else { printf("ERROR in param file \"%s\" on line %" PRId32 " : unknown selection scheme \"%s\".\n", param_file_name, cur_line, line->words[1]); exit(EXIT_FAILURE); } } else if (strcmp(line->words[0], "SELECTION_PRESSURE") == 0) { printf( "WARNING: SELECTION_PRESSURE keyword is outdated, you should\n" "specify a value for selection pressure using SELECTION_SCHEME\n"); sel->set_selection_pressure(atof(line->words[1])); printf("\tChange of selection pressure to %f\n", atof(line->words[1])); } else if (strcmp(line->words[0], "POINT_MUTATION_RATE") == 0) { double point_mutation_rate = atof(line->words[1]); for (auto& indiv: exp_manager->indivs()) indiv->set_point_mutation_rate(point_mutation_rate); printf("\tChange of overall point mutation rate to %f\n", point_mutation_rate); } else if (strcmp(line->words[0], "SMALL_INSERTION_RATE") == 0) { double small_insertion_rate = atof(line->words[1]); for (auto& indiv: exp_manager->indivs()) indiv->set_small_insertion_rate(small_insertion_rate); printf("\tChange of overall small insertion rate to %f\n", small_insertion_rate); } else if (strcmp(line->words[0], "SMALL_DELETION_RATE") == 0) { double small_deletion_rate = atof(line->words[1]); for (auto& indiv: exp_manager->indivs()) indiv->set_small_deletion_rate(small_deletion_rate); printf("\tChange of overall small deletion rate to %f\n", small_deletion_rate); } else if (strcmp(line->words[0], "MAX_INDEL_SIZE") == 0) { int16_t max_indel_size = atol(line->words[1]); for (auto& indiv: exp_manager->indivs()) indiv->set_max_indel_size(max_indel_size); printf("\tChange of overall maximum indel size to %d\n", max_indel_size); } else if (strcmp(line->words[0], "DUPLICATION_RATE") == 0) { double duplication_rate = atof(line->words[1]); for (auto& indiv: exp_manager->indivs()) indiv->set_duplication_rate(duplication_rate); printf("\tChange of overall duplication rate to %f\n", duplication_rate); } else if (strcmp(line->words[0], "DELETION_RATE") == 0) { double deletion_rate = atof(line->words[1]); for (auto& indiv: exp_manager->indivs()) indiv->set_deletion_rate(deletion_rate); printf("\tChange of overall deletion rate to %f\n", deletion_rate); } else if (strcmp(line->words[0], "TRANSLOCATION_RATE") == 0) { double translocation_rate = atof(line->words[1]); for (auto& indiv: exp_manager->indivs()) indiv->set_translocation_rate(translocation_rate); printf("\tChange of overall translocation rate to %f\n", translocation_rate); } else if (strcmp(line->words[0], "INVERSION_RATE") == 0) { double inversion_rate = atof(line->words[1]); for (auto& indiv: exp_manager->indivs()) indiv->set_inversion_rate(inversion_rate); printf("\tChange of overall inversion to %f\n", inversion_rate); } else if (strcmp(line->words[0], "TRANSFER_INS_RATE") == 0) { double transfer_ins_rate = atof(line->words[1]); for (auto& indiv: exp_manager->indivs()) indiv->set_HT_ins_rate(transfer_ins_rate); exp_manager->set_HT_ins_rate(transfer_ins_rate); printf("\tChange of overall transfer insertion rate to %f\n", transfer_ins_rate); } else if (strcmp(line->words[0], "TRANSFER_REPL_RATE") == 0) { double transfer_repl_rate = atof(line->words[1]); for (auto& indiv: exp_manager->indivs()) indiv->set_HT_repl_rate(transfer_repl_rate); exp_manager->set_HT_repl_rate(transfer_repl_rate); printf("\tChange of overall transfer replacement rate to %f\n", transfer_repl_rate); } else if ((strcmp(line->words[0], "ENV_ADD_GAUSSIAN") == 0) || (strcmp(line->words[0], "ENV_GAUSSIAN") == 0)) { // TODO adapt to new organization // printf("%s:%d: error: ENV_ADD_GAUSSIAN has to be adapted to the new organization.\n", __FILE__, __LINE__); // exit(EXIT_FAILURE); new_gaussians.emplace_back(atof(line->words[1]), atof(line->words[2]), atof(line->words[3])); printf("\tAdding a gaussian with %f, %f, %f \n", atof(line->words[1]), atof(line->words[2]), atof(line->words[3])); phen_target_change = true; } else if (strcmp(line->words[0], "ENV_ADD_POINT") == 0) { // custom_points printf("%s:%d: error: Custom points_ management has been removed.\n", __FILE__, __LINE__); exit(EXIT_FAILURE); } else if (strcmp(line->words[0], "ENV_VARIATION") == 0) { // TODO adapt to new organization // printf("%s:%d: error: ENV_VARIATION has to be adapted to the new organization.\n", __FILE__, __LINE__); // exit(EXIT_FAILURE); static bool env_var_already_set = false; if (env_var_already_set) { printf("%s:%d: ERROR in param file : duplicate entry for %s.\n", __FILE__, __LINE__, line->words[0]); exit(EXIT_FAILURE); } env_var_already_set = true; if (strcmp(line->words[1], "none") == 0) { assert(line->nb_words == 2); exp_manager->world()->phenotypic_target_handler()->set_var_method( NO_VAR); printf("\tNo more environmental variation\n"); } else if (strcmp(line->words[1], "autoregressive_mean_variation") == 0) { assert(line->nb_words == 5); auto pt_handler = exp_manager->world()->phenotypic_target_handler(); pt_handler->set_var_method(AUTOREGRESSIVE_MEAN_VAR); pt_handler->set_var_sigma_tau(atof(line->words[2]), atol(line->words[3])); pt_handler->set_var_prng( std::make_shared(atoi(line->words[4]))); printf( "\tChange of environmental variation to a autoregressive mean variation with sigma=%f, tau=%ld and seed=%d\n", atof(line->words[2]), atol(line->words[3]), atoi(line->words[4])); } else if (strcmp(line->words[1], "autoregressive_height_variation") == 0) { assert(line->nb_words == 5); auto pt_handler = exp_manager->world()->phenotypic_target_handler(); pt_handler->set_var_method(AUTOREGRESSIVE_HEIGHT_VAR); pt_handler->set_var_sigma_tau(atof(line->words[2]), atol(line->words[3])); pt_handler->set_var_prng( std::make_shared(atoi(line->words[4]))); printf( "\tChange of environmental variation to a autoregressive height variation with sigma=%f, tau=%ld and seed=%d\n", atof(line->words[2]), atol(line->words[3]), atoi(line->words[4])); } else if (strcmp(line->words[1], "add_local_gaussians") == 0) { assert(line->nb_words == 3); auto pt_handler = exp_manager->world()->phenotypic_target_handler(); pt_handler->set_var_method(LOCAL_GAUSSIANS_VAR); pt_handler->set_var_prng( std::make_shared(atoi(line->words[2]))); printf( "\tChange of environmental variation to a local gaussians variation with seed=%d\n", atoi(line->words[2])); } else { Utils::ExitWithUsrMsg("unknown environment variation method"); } } else if (strcmp(line->words[0], "SECRETION_CONTRIB_TO_FITNESS") == 0) { exp_manager->exp_s()->set_secretion_contrib_to_fitness( atof(line->words[1])); } else if (strcmp(line->words[0], "SECRETION_COST") == 0) { exp_manager->exp_s()->set_secretion_cost(atof(line->words[1])); } else if (strcmp(line->words[0], "PLASMID_MINIMAL_LENGTH") == 0) { if (not exp_manager->with_plasmids()) { printf( "ERROR: option PLASMID_MINIMAL_LENGTH has no sense because there are no plasmids in this population.\n"); exit(EXIT_FAILURE); } int32_t plasmid_minimal_length = atoi(line->words[1]); for (const auto& indiv: exp_manager->indivs()) { if (indiv->genetic_unit(1).seq_length() < plasmid_minimal_length) { printf( "ERROR: there is one genetic unit with a smaller length than the new minimum.\n"); exit(EXIT_FAILURE); } indiv->genetic_unit_nonconst(1).set_min_gu_length( plasmid_minimal_length); } } else if (strcmp(line->words[0], "PLASMID_MAXIMAL_LENGTH") == 0) { if (!exp_manager->with_plasmids()) { printf( "ERROR: option PLASMID_MAXIMAL_LENGTH has no sense because there are no plasmids in this population.\n"); exit(EXIT_FAILURE); } int32_t plasmid_maximal_length = atoi(line->words[1]); for (const auto& indiv: exp_manager->indivs()) { if (indiv->genetic_unit_nonconst(1).seq_length() > plasmid_maximal_length) { printf( "ERROR: there is one genetic unit with a higher length than the new maximum.\n"); exit(EXIT_FAILURE); } indiv->genetic_unit_nonconst(1).set_max_gu_length( plasmid_maximal_length); } } else if (strcmp(line->words[0], "CHROMOSOME_MINIMAL_LENGTH") == 0) { int32_t chromosome_minimal_length = atoi(line->words[1]); for (const auto& indiv: exp_manager->indivs()) { if (indiv->genetic_unit_nonconst(0).seq_length() < chromosome_minimal_length) { printf( "ERROR: there is one genetic unit with a smaller length than the new minimum.\n"); exit(EXIT_FAILURE); } indiv->genetic_unit_nonconst(0).set_min_gu_length( chromosome_minimal_length); } } else if (strcmp(line->words[0], "CHROMOSOME_MAXIMAL_LENGTH") == 0) { int32_t chromosome_maximal_length = atoi(line->words[1]); for (const auto& indiv: exp_manager->indivs()) { if (indiv->genetic_unit_nonconst(0).seq_length() > chromosome_maximal_length) { printf( "ERROR: there is one genetic unit with a higher length than the new maximum.\n"); exit(EXIT_FAILURE); } indiv->genetic_unit_nonconst(0).set_max_gu_length( chromosome_maximal_length); } } else if (strcmp(line->words[0], "SEED") == 0) { int32_t seed = atoi(line->words[1]); // Change prngs #if __cplusplus == 201103L sel->set_prng(make_unique(seed)); world->set_prng(make_unique(seed)); #else sel->set_prng(std::make_unique(seed)); world->set_prng(std::make_unique(seed)); #endif printf("\tChange of the seed to %d in selection and world \n", atoi(line->words[1])); } else if (strcmp(line->words[0], "MUT_SEED") == 0) { int32_t mut_seed = atoi(line->words[1]); // Change mutation prng world->set_mut_prng(std::make_shared(mut_seed)); for (int16_t x = 0; x < world->width(); x++) { for (int16_t y = 0; y < world->height(); y++) { world->grid(x, y)->set_mut_prng( std::make_shared(world->mut_prng()->random(1000000))); world->grid(x, y)->individual()->set_mut_prng( world->grid(x, y)->mut_prng()); } } printf("\tChange of the seed to %d in mutations \n", atoi(line->words[1])); } else if (strcmp(line->words[0], "STOCH_SEED") == 0) { int32_t stoch_seed = atoi(line->words[1]); // Change stochasticity prng world->set_stoch_prng(std::make_shared(stoch_seed)); for (int16_t x = 0; x < world->width(); x++) { for (int16_t y = 0; y < world->height(); y++) { world->grid(x, y)->set_stoch_prng(std::make_shared( world->stoch_prng()->random(1000000))); world->grid(x, y)->individual()->set_stoch_prng( world->grid(x, y)->stoch_prng()); } } printf("\tChange of the seed to %d in individuals' stochasticity \n", atoi(line->words[1])); } else if (strcmp(line->words[0], "CLONE_BEST") == 0) { exp_manager->FillGridWithClones(*(exp_manager->best_indiv())); printf("\tChange of the population for a population with %" PRId32 " individuals, all clones of the best one\n", exp_manager->nb_indivs()); } // TODO: re-enable these options // else if (strcmp(line->words[0], "CREATE_3_SUBPOPULATIONS_BASED_ON_NON_CODING_BASES") == 0) // { // change_based_on_non_coding_bases_of_best_individual(pop, exp_manager, SUBPOPULATIONS_BASED_ON_NON_CODING_BASES); // printf("\tChange of the population for a population with %" PRId32 " individuals in 3 equal subpopulations (A: clones of the previous best individual, B: clones of the previous best individual without any non coding bases, C: clones of the previous best individual with twice non bases\n",pop->nb_indivs()); // printf("WARNING: lineage will not work properly if called with \n"); // printf(" a begin generation anterior to this modification \n"); // } // else if (strcmp(line->words[0], "REMOVE_NON_CODING_BASES_BEST") == 0) // { // change_based_on_non_coding_bases_of_best_individual(pop, exp_manager, REMOVE_NON_CODING_BASES_BEST_IND); // printf("\tChange of the population for a population with %" PRId32 " clones of the best individual ancestor without any non coding bases\n",pop->nb_indivs()); // printf("WARNING: lineage will not work properly if called with \n"); // printf(" a begin generation anterior to this modification \n"); // } // else if (strcmp(line->words[0], "REMOVE_NON_CODING_BASES_POP") == 0) // { // change_based_on_non_coding_bases_in_population(pop, exp_manager, REMOVE_NON_CODING_BASES_POPULATION); // printf("\tChange of the population for a population with %" PRId32 " individuals without any non coding bases\n",pop->nb_indivs()); // printf("WARNING: lineage will not work properly if called with \n"); // printf(" a begin generation anterior to this modification \n"); // } // else if (strcmp(line->words[0], "DOUBLE_NON_CODING_BASES_BEST") == 0) // { // change_based_on_non_coding_bases_of_best_individual(pop, exp_manager, DOUBLE_NON_CODING_BASES_BEST_IND); // printf("\tChange of the population for a population with %" PRId32 " clones of the best individual ancestor with twice the non coding bases number \n",pop->nb_indivs()); // printf("WARNING: lineage will not work properly if called with \n"); // printf(" a begin generation anterior to this modification \n"); // } // else if (strcmp(line->words[0], "DOUBLE_NON_CODING_BASES_POP") == 0) // { // change_based_on_non_coding_bases_in_population(pop, exp_manager, DOUBLE_NON_CODING_BASES_POPULATION); // printf("\tChange of the population for a population with %" PRId32 " individuals with twice the non coding bases number\n",pop->nb_indivs()); // printf("WARNING: lineage will not work properly if called with \n"); // printf(" a begin generation anterior to this modification \n"); // } else { printf("%s:%d: error: the change %s is not implemented yet \n", __FILE__, __LINE__, line->words[0]); exit(EXIT_FAILURE); } delete line; } fclose(param_file); printf("OK\n"); if (phen_target_change) { // The current version doesn't allow for phenotypic variation nor for // different phenotypic targets among the grid if (not exp_manager->world()->phenotypic_target_shared()) { Utils::ExitWithUsrMsg("sorry, aevol_modify has not yet been implemented " "for per grid-cell phenotypic target"); } auto phenotypicTargetHandler = exp_manager->world()->phenotypic_target_handler(); phenotypicTargetHandler->set_gaussians(new_gaussians); phenotypicTargetHandler->BuildPhenotypicTarget(); } // 9) Save the modified experiment if (start_to_record_tree) { if (!set_tree_step) { printf("WARNING: you modifed parameter RECORD_TREE without specifying " "TREE_STEP in the same parameter modification file. TREE_STEP will " "be set to its default value even if you previously gave another " "value.\n"); } exp_manager->output_m()->init_tree(exp_manager, tree_step); } if (take_care_of_the_tree) { printf("Save the modified replication reports into tree...\t"); #ifdef __REGUL sprintf(tree_file_name,"tree/tree_" TIMESTEP_FORMAT ".rae", timestep); #else sprintf(tree_file_name, "tree/tree_" TIMESTEP_FORMAT ".ae", timestep); #endif gzFile tree_file = gzopen(tree_file_name, "w"); tree->write_to_tree_file(tree_file); gzclose(tree_file); printf("OK\n"); } printf("Save the modified experiment into backup...\t"); exp_manager->WriteSetupFiles(); exp_manager->WriteDynamicFiles(); printf("OK\n"); delete exp_manager; } /*! \brief Get a line in a file and format it \param param_file file with param in which a line is reading \return line (pointer) \see format_line(ParameterLine* formatted_line, char* line, bool* line_is_interpretable) */ ParameterLine* get_line(FILE* param_file) { char line[255]; ParameterLine* formatted_line = new ParameterLine(); bool found_interpretable_line = false; while (!feof(param_file) && !found_interpretable_line) { if (!fgets(line, 255, param_file)) { delete formatted_line; return nullptr; } format_line(formatted_line, line, &found_interpretable_line); } if (found_interpretable_line) { return formatted_line; } else { delete formatted_line; return nullptr; } } /*! \brief Format a line by parsing it and the words inside \param formatted_line the resulted formatted line \param line original line in char* \param line_is_interpretable boolean with about the possible intrepretation of the line */ void format_line(ParameterLine* formatted_line, char* line, bool* line_is_interpretable) { int16_t i = 0; int16_t j; // Parse line while (line[i] != '\n' && line[i] != '\0' && line[i] != '\r') { j = 0; // Flush white spaces and tabs while (line[i] == ' ' || line[i] == 0x09) i++; // 0x09 is the ASCII code for TAB // Check comments if (line[i] == '#') break; // If we got this far, there is content in the line *line_is_interpretable = true; // Parse word while (line[i] != ' ' && line[i] != '\n' && line[i] != '\0' && line[i] != '\r') { formatted_line->words[formatted_line->nb_words][j++] = line[i++]; } // Add '\0' at end of word if it's not empty (line ending with space or tab) if (j != 0) { formatted_line->words[formatted_line->nb_words++][j] = '\0'; } } } // /*! // \brief Change in the population based on non coding bases on the best individual. 3 types of changes // SUBPOPULATIONS_BASED_ON_NON_CODING_BASES: // Create the 3 subpopulations in the population. The definition of 3 subpopulations is based on non coding bases. // The subpopulation are clonal and based on the ancestor of best individual of pop at begin. // The individuals in first subpopulation are clones of the best individual. // The individuals in second subpopulation are clones of the best individual without any bases that are not in coding RNA. // The individuals in third subpopulation are clones of the best individual with addition of bases that are not in coding RNA to double them. // pop is changed into the new population with the 3 subpopulations // REMOVE_NON_CODING_BASES_BEST_IND: // The individuals of the new population are clones of the best individual but without any bases that are not in coding RNA. // DOUBLE_NON_CODING_BASES_BEST_IND: // The individuals of the new population are clones of the best individual but with addition of bases that are not in coding RNA to double them. // \param pop population to change // \param exp_m global exp_manager // \param type type of change in the population // */ // void change_based_on_non_coding_bases_of_best_individual(ae_population* pop, ExpManager* exp_m, population_change_type type) // { // if(type == SUBPOPULATIONS_BASED_ON_NON_CODING_BASES || type == REMOVE_NON_CODING_BASES_BEST_IND || type == DOUBLE_NON_CODING_BASES_BEST_IND) // { // // 1) Compute the population size // int32_t subpopulation_size = (int)floor(pop->nb_indivs()/3); // // 2) Get the best individual // ae_individual* best_indiv = exp_m->best_indiv(); // // 3) Create the new population // std::list new_generation; // ae_individual* indiv = create_clone(best_indiv, -1); // ae_individual* only_coding_indiv = create_clone(best_indiv, -1); //one individual being the clone of the chosen individual but without any non coding bases // only_coding_indiv->remove_non_coding_bases(); // ae_individual* twice_non_coding_indiv = create_clone(best_indiv, -1); //one individual being the clone of the chosen individual but without any non coding bases // twice_non_coding_indiv->double_non_coding_bases(); // int32_t* probe_A = new int32_t[5]; // int32_t* probe_B = new int32_t[5]; // int32_t* probe_C = new int32_t[5]; // for(int32_t i = 0 ; i<5; i++) // { // probe_A[i] = 1; // probe_B[i] = 10; // probe_C[i] = 100; // } // indiv->set_int_probes(probe_A); // only_coding_indiv->set_int_probes(probe_B); // twice_non_coding_indiv->set_int_probes(probe_C); // double* probe_double_A = new double[5]; // double* probe_double_B = new double[5]; // double* probe_double_C = new double[5]; // for(int32_t i = 0 ; i<5; i++) // { // probe_double_A[i] = 1; // probe_double_B[i] = 10; // probe_double_C[i] = 100; // } // indiv->set_double_probes(probe_double_A); // only_coding_indiv->set_double_probes(probe_double_B); // twice_non_coding_indiv->set_double_probes(probe_double_C); // switch(type) // { // case SUBPOPULATIONS_BASED_ON_NON_CODING_BASES: // { // int32_t index_new_indiv = 0; // for (int32_t i = 0 ; i < subpopulation_size ; i++) // clones of the 3 individuals // { // new_generation.push_back(create_clone(indiv, index_new_indiv++)); // new_generation.push_back(create_clone(only_coding_indiv, index_new_indiv++)); // new_generation.push_back(create_clone(twice_non_coding_indiv, index_new_indiv++)); // } // break; // } // case REMOVE_NON_CODING_BASES_BEST_IND: // { // for (int32_t i = 0 ; i < pop->nb_indivs() ; i++) // { // new_generation.push_back(create_clone(only_coding_indiv, i)); // } // break; // } // case DOUBLE_NON_CODING_BASES_BEST_IND: // { // for (int32_t i = 0 ; i < pop->nb_indivs() ; i++) // { // new_generation.push_back(create_clone(twice_non_coding_indiv, i)); // } // break; // } // default: // { // fprintf(stderr, "%s:%d: error: wrong population_change_type %d\n", __FILE__, __LINE__, type); // exit(EXIT_FAILURE); // break; // } // } // // 4) Replace the current population by the new one // // -> Useless since it is done by replace_population. // pop->replace_population(std::move(new_generation)); // // TODO // // If the population is spatially structured, set each individual's position // // There will be a problem however for the "3 subpopulations" type of change, // // if the population size has changed (which is likely given that we do not // // generally used population size that are multiple of 3) // pop->evaluate_individuals(exp_m->env()); // pop->sort_individuals(); // } // else // { // printf("%s:%d: error: wrong population_change_type %d\n", __FILE__, __LINE__, type); // exit(EXIT_FAILURE); // } // } // /*! // \brief Change in the population based on non coding bases. 2 types of changes // REMOVE_NON_CODING_BASES_POPULATION: // The individual of the new population are the individuals without any bases that are not in coding RNA. // DOUBLE_NON_CODING_BASES_POPULATION: // The individual of the new population are the individuals with addition of bases that are not in coding RNA to double them. // \param pop population to change // \param exp_m global exp_manager // \param type type of change in the population // */ // void change_based_on_non_coding_bases_in_population(ae_population* pop, ExpManager* exp_m, population_change_type type) // { // if(type == REMOVE_NON_CODING_BASES_POPULATION || type == DOUBLE_NON_CODING_BASES_POPULATION) // { // for (auto& indiv: pop->indivs()) // if (type == REMOVE_NON_CODING_BASES_POPULATION) // indiv->remove_non_coding_bases(); // else // indiv->double_non_coding_bases(); // } // else // { // printf("%s:%d: error: wrong population_change_type %d\n", __FILE__, __LINE__, type); // exit(EXIT_FAILURE); // } // } /*! \brief */ void print_help(char* prog_path) { // Get the program file-name in prog_name (strip prog_path of the path) char* prog_name; // No new, it will point to somewhere inside prog_path if ((prog_name = strrchr(prog_path, '/'))) { prog_name++; } else { prog_name = prog_path; } printf("******************************************************************************\n"); printf("* *\n"); printf("* aevol - Artificial Evolution *\n"); printf("* *\n"); printf("* Aevol is a simulation platform that allows one to let populations of *\n"); printf("* digital organisms evolve in different conditions and study experimentally *\n"); printf("* the mechanisms responsible for the structuration of the genome and the *\n"); printf("* transcriptome. *\n"); printf("* *\n"); printf("******************************************************************************\n"); printf("\n"); printf("%s: modify an experiment as specified in PARAM_FILE.\n", prog_name); printf("\n"); printf("Usage : %s -h or --help\n", prog_name); printf(" or : %s -V or --version\n", prog_name); printf(" or : %s [-t TIMESTEP] [-f PARAM_FILE]\n", prog_name); printf("\nOptions\n"); printf(" -h, --help\n" "\tprint this help, then exit\n"); printf(" -V, --version\n" "\tprint version number, then exit\n"); printf(" -t, --timestep TIMESTEP\n" "\tspecify timestep\n"); printf(" -f, --file PARAM_FILE\n" "\tspecify parameter file (default: param.in)\n"); } void interpret_cmd_line_options(int argc, char* argv[]) { // Define allowed options const char* options_list = "hf:t:V"; static struct option long_options_list[] = { {"help", no_argument, nullptr, 'h'}, {"version", no_argument, nullptr, 'V'}, {"file", required_argument, nullptr, 'f'}, {"timestep", required_argument, nullptr, 't'}, {0, 0, 0, 0} }; // Get actual values of the CLI options int option; while ((option = getopt_long(argc, argv, options_list, long_options_list, nullptr)) != -1) { switch (option) { case 'h' : { print_help(argv[0]); exit(EXIT_SUCCESS); } case 'V' : { Utils::PrintAevolVersion(); exit(EXIT_SUCCESS); } case 'f' : { if (strcmp(optarg, "") == 0) { printf("%s: error: Option -f or --file : missing argument.\n", argv[0]); exit(EXIT_FAILURE); } param_file_name = optarg; break; } case 't' : { timestep = atoi(optarg); break; } default : { // An error message is printed in getopt_long, we just need to exit exit(EXIT_FAILURE); } } } // If param file name wasn't provided, use default if (param_file_name == nullptr) { param_file_name = new char[strlen(DEFAULT_PARAM_FILE_NAME) + 1]; sprintf(param_file_name, "%s", DEFAULT_PARAM_FILE_NAME); } // If timestep wasn't provided, use default if (timestep == -1) { timestep = OutputManager::last_gener(); } } aevol-5.0/src/Makefile.in0000644000175000017500000007052412735464143012262 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = aevol_run$(EXEEXT) aevol_create$(EXEEXT) \ aevol_modify$(EXEEXT) aevol_propagate$(EXEEXT) subdir = src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \ $(top_srcdir)/m4/ax_boost_filesystem.m4 \ $(top_srcdir)/m4/ax_boost_system.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx_14.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am_aevol_create_OBJECTS = aevol_create.$(OBJEXT) aevol_create_OBJECTS = $(am_aevol_create_OBJECTS) aevol_create_LDADD = $(LDADD) aevol_create_DEPENDENCIES = $(top_srcdir)/src/libaevol/libaevol.a \ $(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a am_aevol_modify_OBJECTS = aevol_modify.$(OBJEXT) aevol_modify_OBJECTS = $(am_aevol_modify_OBJECTS) aevol_modify_LDADD = $(LDADD) aevol_modify_DEPENDENCIES = $(top_srcdir)/src/libaevol/libaevol.a \ $(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a am_aevol_propagate_OBJECTS = \ aevol_propagate-aevol_propagate.$(OBJEXT) aevol_propagate_OBJECTS = $(am_aevol_propagate_OBJECTS) am__DEPENDENCIES_1 = aevol_propagate_DEPENDENCIES = $(LDADD) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) aevol_propagate_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ $(aevol_propagate_LDFLAGS) $(LDFLAGS) -o $@ am_aevol_run_OBJECTS = aevol_run.$(OBJEXT) aevol_run_OBJECTS = $(am_aevol_run_OBJECTS) aevol_run_LDADD = $(LDADD) aevol_run_DEPENDENCIES = $(top_srcdir)/src/libaevol/libaevol.a \ $(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) am__v_CXX_0 = @echo " CXX " $@; am__v_CXX_1 = CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) am__v_CXXLD_0 = @echo " CXXLD " $@; am__v_CXXLD_1 = SOURCES = $(aevol_create_SOURCES) $(aevol_modify_SOURCES) \ $(aevol_propagate_SOURCES) $(aevol_run_SOURCES) DIST_SOURCES = $(aevol_create_SOURCES) $(aevol_modify_SOURCES) \ $(aevol_propagate_SOURCES) $(aevol_run_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AEVOLCPPFLAGS = @AEVOLCPPFLAGS@ AEVOLCXXFLAGS = @AEVOLCXXFLAGS@ AEVOLLDFLAGS = @AEVOLLDFLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@ BOOST_LDFLAGS = @BOOST_LDFLAGS@ BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ HAVE_CXX11 = @HAVE_CXX11@ HAVE_CXX14 = @HAVE_CXX14@ HAVE_DOXYGEN = @HAVE_DOXYGEN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ XMKMF = @XMKMF@ X_CFLAGS = @X_CFLAGS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_LIBS = @X_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ ############################################ # Variables # ############################################ ############################################ # C99 exact-width integer specific support # ############################################ # __STDC_FORMAT_MACROS allows us to use exact-width integer format specifiers e.g. PRId32 (for printf etc) # __STDC_CONSTANT_MACROS allows us to define exact-width integer macros with e.g. INT32_C( ) # __STDC_LIMIT_MACROS allows us to use exact-width integer limit macros with e.g. INT32_MAX #################################### # Add hardening option to compiler # #################################### # This replaces insecure unlimited length buffer function calls with # length-limited ones (required for debian and not a bad idea anyway). AM_CPPFLAGS = $(AEVOLCPPFLAGS) -I$(top_srcdir)/src/libaevol \ -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS \ -D__STDC_LIMIT_MACROS -D_FORTIFY_SOURCE=2 AM_CXXFLAGS = $(AEVOLCXXFLAGS) AM_LDFLAGS = $(AEVOLLDFLAGS) SUBDIRS = libaevol post_treatments ############################################ # Set programs to build and library to use # ############################################ ##### The solution below is no longer used since it generates a dependency problem ##### #AM_LDFLAGS = -L$(top_srcdir)/src/libaevol # LDADD = -laevol ##### ##### LDADD = $(top_srcdir)/src/libaevol/libaevol.a $(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a CLEANFILES = aevol_run aevol_create aevol_modify aevol_propagate aevol_propagate_CPPFLAGS = $(AM_CPPFLAGS) $(BOOST_CPPFLAGS) aevol_propagate_LDFLAGS = $(AM_LDFLAGS) $(BOOST_LDFLAGS) aevol_propagate_LDADD = $(LDADD) $(BOOST_SYSTEM_LIB) $(BOOST_FILESYSTEM_LIB) aevol_run_SOURCES = aevol_run.cpp aevol_create_SOURCES = aevol_create.cpp aevol_modify_SOURCES = aevol_modify.cpp aevol_propagate_SOURCES = aevol_propagate.cpp all: all-recursive .SUFFIXES: .SUFFIXES: .cpp .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) aevol_create$(EXEEXT): $(aevol_create_OBJECTS) $(aevol_create_DEPENDENCIES) $(EXTRA_aevol_create_DEPENDENCIES) @rm -f aevol_create$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(aevol_create_OBJECTS) $(aevol_create_LDADD) $(LIBS) aevol_modify$(EXEEXT): $(aevol_modify_OBJECTS) $(aevol_modify_DEPENDENCIES) $(EXTRA_aevol_modify_DEPENDENCIES) @rm -f aevol_modify$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(aevol_modify_OBJECTS) $(aevol_modify_LDADD) $(LIBS) aevol_propagate$(EXEEXT): $(aevol_propagate_OBJECTS) $(aevol_propagate_DEPENDENCIES) $(EXTRA_aevol_propagate_DEPENDENCIES) @rm -f aevol_propagate$(EXEEXT) $(AM_V_CXXLD)$(aevol_propagate_LINK) $(aevol_propagate_OBJECTS) $(aevol_propagate_LDADD) $(LIBS) aevol_run$(EXEEXT): $(aevol_run_OBJECTS) $(aevol_run_DEPENDENCIES) $(EXTRA_aevol_run_DEPENDENCIES) @rm -f aevol_run$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(aevol_run_OBJECTS) $(aevol_run_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aevol_create.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aevol_modify.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aevol_propagate-aevol_propagate.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aevol_run.Po@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` aevol_propagate-aevol_propagate.o: aevol_propagate.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(aevol_propagate_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT aevol_propagate-aevol_propagate.o -MD -MP -MF $(DEPDIR)/aevol_propagate-aevol_propagate.Tpo -c -o aevol_propagate-aevol_propagate.o `test -f 'aevol_propagate.cpp' || echo '$(srcdir)/'`aevol_propagate.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/aevol_propagate-aevol_propagate.Tpo $(DEPDIR)/aevol_propagate-aevol_propagate.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='aevol_propagate.cpp' object='aevol_propagate-aevol_propagate.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(aevol_propagate_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o aevol_propagate-aevol_propagate.o `test -f 'aevol_propagate.cpp' || echo '$(srcdir)/'`aevol_propagate.cpp aevol_propagate-aevol_propagate.obj: aevol_propagate.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(aevol_propagate_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT aevol_propagate-aevol_propagate.obj -MD -MP -MF $(DEPDIR)/aevol_propagate-aevol_propagate.Tpo -c -o aevol_propagate-aevol_propagate.obj `if test -f 'aevol_propagate.cpp'; then $(CYGPATH_W) 'aevol_propagate.cpp'; else $(CYGPATH_W) '$(srcdir)/aevol_propagate.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/aevol_propagate-aevol_propagate.Tpo $(DEPDIR)/aevol_propagate-aevol_propagate.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='aevol_propagate.cpp' object='aevol_propagate-aevol_propagate.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(aevol_propagate_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o aevol_propagate-aevol_propagate.obj `if test -f 'aevol_propagate.cpp'; then $(CYGPATH_W) 'aevol_propagate.cpp'; else $(CYGPATH_W) '$(srcdir)/aevol_propagate.cpp'; fi` # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(PROGRAMS) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-binPROGRAMS clean-generic cscopelist-am \ ctags ctags-am distclean distclean-compile distclean-generic \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-binPROGRAMS install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am uninstall-binPROGRAMS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: aevol-5.0/src/post_treatments/0000755000175000017500000000000012735464421013517 500000000000000aevol-5.0/src/post_treatments/ancestor_stats.cpp0000644000175000017500000007026612732772533017215 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // The input file is produced by the lineage post-treatment, please refer to it // for e.g. the file format/content // ============================================================================ // Includes // ============================================================================ #include #include #include #include #include #include #include #include #include #include #include #include #include "aevol.h" using namespace aevol; // Helper functions void interpret_cmd_line_options(int argc, char* argv[]); void print_help(char* prog_path); FILE* open_environment_stat_file(const char* prefix, const char* postfix); void write_environment_stats(int64_t t, const PhenotypicTargetHandler* pth, FILE* env_file); FILE* open_terminators_stat_file(const char* prefix, const char* postfix); void write_terminators_stats(int64_t t, Individual* indiv, FILE* terminator_file); FILE* open_zones_stat_file(const char* prefix, const char* postfix); void write_zones_stats(int64_t t, Individual* indiv, const PhenotypicTargetHandler* phenotypicTargetHandler, FILE* zone_file); FILE* open_operons_stat_file(const char* prefix, const char* postfix); void write_operons_stats(int64_t t, Individual* indiv, FILE* operon_file); // Command-line option variables static char* lineage_file_name = nullptr; static bool verbose = false; static bool full_check = false; static bool trace_mutations = false; int main(int argc, char* argv[]) { interpret_cmd_line_options(argc, argv); printf("\n" "WARNING : Parameter change during simulation is not managed in general.\n" " Only changes in environmental target done with aevol_modify are handled.\n" "\n"); // ======================= // Open the lineage file // ======================= gzFile lineage_file = gzopen(lineage_file_name, "r"); if (lineage_file == Z_NULL) { fprintf(stderr, "ERROR : Could not read the lineage file %s\n", lineage_file_name); exit(EXIT_FAILURE); } int64_t t0 = 0; int64_t t_end = 0; int32_t final_indiv_index = 0; int32_t final_indiv_rank = 0; gzread(lineage_file, &t0, sizeof(t0)); gzread(lineage_file, &t_end, sizeof(t_end)); gzread(lineage_file, &final_indiv_index, sizeof(final_indiv_index)); gzread(lineage_file, &final_indiv_rank, sizeof(final_indiv_rank)); if (verbose) { printf("\n\n""===============================================================================\n"); printf(" Statistics of the ancestors of indiv. %" PRId32 " (rank %" PRId32 ") from time %" PRId64 " to %" PRId64 "\n", final_indiv_index, final_indiv_rank, t0, t_end); printf("================================================================================\n"); } // ============================= // Open the experiment manager // ============================= ExpManager* exp_manager = new ExpManager(); exp_manager->load(t0, true, false); // The current version doesn't allow for phenotypic variation nor for // different phenotypic targets among the grid if (not exp_manager->world()->phenotypic_target_shared()) Utils::ExitWithUsrMsg("sorry, ancestor stats has not yet been implemented " "for per grid-cell phenotypic target"); auto phenotypicTargetHandler = exp_manager->world()->phenotypic_target_handler(); if (not (phenotypicTargetHandler->var_method() == NO_VAR)) Utils::ExitWithUsrMsg("sorry, ancestor stats has not yet been implemented " "for variable phenotypic targets"); int64_t backup_step = exp_manager->backup_step(); // ========================= // Open the output file(s) // ========================= // Create missing directories int status; status = mkdir("stats/ancestor_stats/", 0755); if ((status == -1) && (errno != EEXIST)) { err(EXIT_FAILURE, "stats/ancestor_stats/"); } // Open main output files (uses the Stats utility class) auto prefix = "ancestor_stats/ancestor_stats"; char postfix[255]; snprintf(postfix, 255, "-b" TIMESTEP_FORMAT "-e" TIMESTEP_FORMAT "-i%" PRId32 "-r%" PRId32, t0, t_end, final_indiv_index, final_indiv_rank); bool best_indiv_only = true; bool addition_old_stats = false; bool delete_old_stats = true; Stats* mystats = new Stats(exp_manager, t0, best_indiv_only, prefix, postfix, addition_old_stats, delete_old_stats); // Optional additional outputs FILE* env_output_file = open_environment_stat_file(prefix, postfix); FILE* term_output_file = open_terminators_stat_file(prefix, postfix); FILE* zones_output_file = NULL; // Next line patchy (specific for the constraints mentioned earlier, i.e. // works only for shared and unvarying phenotypic target) if (phenotypicTargetHandler->phenotypic_target().nb_segments() > 1) { zones_output_file = open_zones_stat_file(prefix, postfix); } FILE* operons_output_file = open_operons_stat_file(prefix, postfix); // Open optional output files FILE* fixed_mutations_file = nullptr; if (trace_mutations) { char fixed_mutations_file_name[255]; snprintf(fixed_mutations_file_name, 60, "stats/fixedmut-b" TIMESTEP_FORMAT "-e" TIMESTEP_FORMAT "-i%" PRId32 "-r%" PRId32 ".out", t0, t_end, final_indiv_index, final_indiv_rank); fixed_mutations_file = fopen(fixed_mutations_file_name, "w"); if (fixed_mutations_file == nullptr) { Utils::ExitWithUsrMsg(std::string("Could not create the output file ") + fixed_mutations_file_name); } // Write the header fprintf(fixed_mutations_file, "# #################################################################\n"); fprintf(fixed_mutations_file, "# Mutations in the lineage of the best indiv at generation %" PRId64 "\n", t_end); fprintf(fixed_mutations_file, "# #################################################################\n"); fprintf(fixed_mutations_file, "# 1. Generation (mut. occurred when producing the indiv. of this generation)\n"); fprintf(fixed_mutations_file, "# 2. Genetic unit (which underwent the mutation, 0 = chromosome) \n"); fprintf(fixed_mutations_file, "# 3. Mutation type (0: switch, 1: smallins, 2: smalldel, 3:dupl, 4: del, 5:trans, 6:inv, 7:insert, 8:ins_HT, 9:repl_HT) \n"); fprintf(fixed_mutations_file, "# 4. pos_0 (position for the small events, begin_segment for the rearrangements, begin_segment of the inserted segment for ins_HT, begin_segment of replaced segment for repl_HT) \n"); fprintf(fixed_mutations_file, "# 5. pos_1 (-1 for the small events, end_segment for the rearrangements, end_segment of the inserted segment for ins_HT, begin_segment of donor segment for repl_HT) \n"); fprintf(fixed_mutations_file, "# 6. pos_2 (reinsertion point for duplic., cutting point in segment for transloc., insertion point in the receiver for ins_HT, end_segment of the replaced segment for repl_HT, -1 for other events)\n"); fprintf(fixed_mutations_file, "# 7. pos_3 (reinsertion point for transloc., breakpoint in the donor for ins_HT, end_segment of the donor segment for repl_HT, -1 for other events)\n"); fprintf(fixed_mutations_file, "# 8. invert (transloc, was the segment inverted (0/1)?, sense of insertion for ins_HT (0=DIRECT, 1=INDIRECT), sense of the donor segment for repl_HT (0=DIRECT, 1=INDIRECT),-1 for other events)\n"); fprintf(fixed_mutations_file, "# 9. align_score (score that was needed for the rearrangement to occur, score of the first alignment for ins_HT and repl_HT)\n"); fprintf(fixed_mutations_file, "# 10. align_score2 (score for the reinsertion for transloc, score of the second alignment for ins_HT and repl_HT)\n"); fprintf(fixed_mutations_file, "# 11. seg_len (segment length for rearrangement, donor segment length for ins_HT and repl_HT)\n"); fprintf(fixed_mutations_file, "# 12. repl_seg_len (replaced segment length for repl_HT, -1 for the others)\n"); fprintf(fixed_mutations_file, "# 13. GU_length (before the event)\n"); fprintf(fixed_mutations_file, "# 14. Impact of the mutation on the metabolic error (negative value = smaller gap after = beneficial mutation) \n"); fprintf(fixed_mutations_file, "# 15. Number of coding RNAs possibly disrupted by the breakpoints \n"); fprintf(fixed_mutations_file, "# 16. Number of coding RNAs completely included in the segment (donor segment in the case of a transfer) \n"); fprintf(fixed_mutations_file, "# 17. Number of coding RNAs that were completely included in the replaced segment (meaningful only for repl_HT) \n"); fprintf(fixed_mutations_file, "####################################################################################################################\n"); fprintf(fixed_mutations_file, "#\n"); fprintf(fixed_mutations_file, "# Header for R\n"); fprintf(fixed_mutations_file, "gener gen_unit mut_type pos_0 pos_1 pos_2 pos_3 invert align_score align_score_2 seg_len repl_seg_len GU_len impact nbgenesatbreak nbgenesinseg nbgenesinreplseg\n"); } // ================================================== // Prepare the initial ancestor and write its stats // ================================================== GridCell* grid_cell = new GridCell(lineage_file, exp_manager, nullptr); auto* indiv = grid_cell->individual(); indiv->Evaluate(); indiv->compute_statistical_data(); indiv->compute_non_coding(); mystats->write_statistics_of_this_indiv(indiv, nullptr); // Additional outputs write_environment_stats(t0, phenotypicTargetHandler, env_output_file); write_terminators_stats(t0, indiv, term_output_file); if(phenotypicTargetHandler->phenotypic_target().nb_segments() > 1) { write_zones_stats(t0, indiv, phenotypicTargetHandler, zones_output_file); } write_operons_stats(t0, indiv, operons_output_file); if (verbose) { printf("Initial fitness = %f\n", indiv->fitness()); printf("Initial genome size = %" PRId32 "\n", indiv->total_genome_size()); } // ========================================================================== // Replay the mutations to get the successive ancestors and analyze them // ========================================================================== ReplicationReport* rep = nullptr; int32_t index; ExpManager* exp_manager_backup = nullptr; int32_t unitlen_before; double metabolic_error_before; double impact_on_metabolic_error; char mut_descr_string[255]; bool check_now = false; aevol::AeTime::plusplus(); while (time() <= t_end) { rep = new ReplicationReport(lineage_file, indiv); index = rep->id(); // who we are building... // Check now? check_now = time() == t_end || (full_check && Utils::mod(time(), backup_step) == 0); if (verbose) printf("Rebuilding ancestor at generation %" PRId64 " (index %" PRId32 ")...", time(), index); indiv->Reevaluate(); // 2) Replay replication (create current individual's child) GeneticUnit& gen_unit = indiv->genetic_unit_nonconst(0); GeneticUnit* stored_gen_unit = nullptr; Individual* stored_indiv = nullptr; if (check_now) { exp_manager_backup = new ExpManager(); exp_manager_backup->load(time(), true, false); stored_indiv = new Individual( *(Individual*) exp_manager_backup->indiv_by_id(index)); stored_gen_unit = &(stored_indiv->genetic_unit_nonconst(0)); } // For each genetic unit, replay the replication (undergo all mutations) // TODO disabled for multiple GUs const auto& dnarep = rep->dna_replic_report(); // TODO(dpa) The following 3 for loops should be factorized. // However, this is not as easy as it sounds :-D // see std::list::splice for (const auto& mut: dnarep.HT()) gen_unit.dna()->undergo_this_mutation(*mut); for (const auto& mut: dnarep.rearrangements()) { if (trace_mutations) { // Store initial values before the mutation metabolic_error_before = indiv->dist_to_target_by_feature(METABOLISM); unitlen_before = gen_unit.dna()->length(); } // Apply mutation gen_unit.dna()->undergo_this_mutation(*mut); if (trace_mutations) { indiv->Reevaluate(); // Compute the metabolic impact of the mutation impact_on_metabolic_error = indiv->dist_to_target_by_feature(METABOLISM) - metabolic_error_before; mut->generic_description_string(mut_descr_string); fprintf(fixed_mutations_file, "%" PRId64 " %" PRId32 " %s %" PRId32 " %.15f \n", time(), 0, mut_descr_string, unitlen_before, impact_on_metabolic_error); } } for (const auto& mut: dnarep.mutations()) { if (trace_mutations) { // Store initial values before the mutation metabolic_error_before = indiv->dist_to_target_by_feature(METABOLISM); unitlen_before = gen_unit.dna()->length(); } // Apply mutation gen_unit.dna()->undergo_this_mutation(*mut); if (trace_mutations) { indiv->Reevaluate(); // Compute the metabolic impact of the mutation impact_on_metabolic_error = indiv->dist_to_target_by_feature(METABOLISM) - metabolic_error_before; mut->generic_description_string(mut_descr_string); fprintf(fixed_mutations_file, "%" PRId64 " %" PRId32 " %s %" PRId32 " %.15f \n", time(), 0, mut_descr_string, unitlen_before, impact_on_metabolic_error); } } if (check_now) { if (verbose) { printf("Checking the sequence of the unit..."); fflush(NULL); } char * str1 = new char[gen_unit.dna()->length() + 1]; memcpy(str1, gen_unit.dna()->data(), \ gen_unit.dna()->length()*sizeof(char)); str1[gen_unit.dna()->length()] = '\0'; char * str2 = new char[(stored_gen_unit->dna())->length() + 1]; memcpy(str2, (stored_gen_unit->dna())->data(), (stored_gen_unit->dna())->length()*sizeof(char)); str2[(stored_gen_unit->dna())->length()] = '\0'; if (strncmp(str1, str2, stored_gen_unit->dna()->length()) == 0) { if (verbose) printf(" OK\n"); } else { if (verbose) printf(" ERROR !\n"); fprintf(stderr, "Error: the rebuilt genetic unit is not the same as \n"); fprintf(stderr, "the one saved at generation %" PRId64 "... ", time()); fprintf(stderr, "Rebuilt unit : %" PRId32 " bp\n %s\n", (int32_t)strlen(str1), str1); fprintf(stderr, "Stored unit : %" PRId32 " bp\n %s\n", (int32_t)strlen(str2), str2); delete [] str1; delete [] str2; gzclose(lineage_file); if (trace_mutations) gzclose(lineage_file); delete indiv; delete stored_indiv; delete exp_manager_backup; delete exp_manager; exit(EXIT_FAILURE); } delete [] str1; delete [] str2; } // 3) All the mutations have been replayed, we can now evaluate the new individual indiv->Reevaluate(); indiv->compute_statistical_data(); indiv->compute_non_coding(); mystats->write_statistics_of_this_indiv(indiv, rep); // Additional outputs write_environment_stats(time(), phenotypicTargetHandler, env_output_file); write_terminators_stats(time(), indiv, term_output_file); if(phenotypicTargetHandler->phenotypic_target().nb_segments() > 1) { write_zones_stats(time(), indiv, phenotypicTargetHandler, zones_output_file); } write_operons_stats(time(), indiv, operons_output_file); if (verbose) printf(" OK\n"); delete rep; if (check_now) { delete stored_indiv; delete exp_manager_backup; } aevol::AeTime::plusplus(); } gzclose(lineage_file); // Additional outputs fclose(env_output_file); fclose(term_output_file); if(phenotypicTargetHandler->phenotypic_target().nb_segments() > 1) { fclose(zones_output_file); } fclose(operons_output_file); delete exp_manager; delete mystats; delete indiv; return EXIT_SUCCESS; } FILE* open_environment_stat_file(const char* prefix, const char* postfix) { // Open file char* env_output_file_name = new char[80]; sprintf(env_output_file_name, "stats/%s_envir%s.out", prefix, postfix); FILE* env_output_file = fopen(env_output_file_name, "w"); delete[] env_output_file_name; // Write headers // TODO vld: was limited to "if environment->gaussians_provided" // are gaussians always available now? fprintf(env_output_file, "# Each line contains: Generation, and then, for each gaussian: M W H.\n"); fprintf(env_output_file, "#\n"); return env_output_file; } void write_environment_stats(int64_t t, const PhenotypicTargetHandler* pth, FILE* env_output_file) { // Num gener fprintf(env_output_file, "%" PRId64, t); for (const Gaussian& g: pth->gaussians()) fprintf(env_output_file, " %.16f %.16f %.16f", g.mean(), g.width(), g.height()); fprintf(env_output_file, "\n"); } FILE* open_terminators_stat_file(const char* prefix, const char* postfix) { std::string term_output_file_name{std::string("stats/") + prefix + "_nb_term" + postfix + ".out"}; FILE* term_output_file = fopen(term_output_file_name.c_str(), "w"); // Write headers fprintf(term_output_file, "# Each line contains : \n"); fprintf(term_output_file, "# * Generation\n"); fprintf(term_output_file, "# * Genome size\n"); fprintf(term_output_file, "# * Terminator number\n"); fprintf(term_output_file, "#\n"); return term_output_file; } void write_terminators_stats(int64_t t, Individual* indiv, FILE* term_output_file) { fprintf(term_output_file, "%" PRId64 " %" PRId32 " %" PRId32 "\n", t, indiv->total_genome_size(), indiv->nb_terminators()); } FILE* open_zones_stat_file(const char* prefix, const char* postfix) { // Open file char* zones_output_file_name = new char[80]; sprintf(zones_output_file_name, "stats/%s_zones%s.out", prefix, postfix); FILE* zones_output_file = fopen(zones_output_file_name, "w"); delete [] zones_output_file_name; // Write headers fprintf(zones_output_file, "# Each line contains : Generation, and then, for each zone:\n"); fprintf(zones_output_file, "# * Number of activation genes\n"); fprintf(zones_output_file, "# * Number of inhibition genes\n"); fprintf(zones_output_file, "# * Geometric area of the activation genes\n"); fprintf(zones_output_file, "# * Geometric area of the inhibition genes\n"); fprintf(zones_output_file, "# * Geometric area of the resulting phenotype\n"); fprintf(zones_output_file, "#\n"); return zones_output_file; } void write_zones_stats(int64_t t, Individual* indiv, const PhenotypicTargetHandler* phenotypicTargetHandler, FILE* zones_output_file) { assert(phenotypicTargetHandler->phenotypic_target().nb_segments() > 1); int16_t nb_segments = phenotypicTargetHandler->phenotypic_target().nb_segments(); int16_t num_segment = 0; PhenotypicSegment** segments = phenotypicTargetHandler->phenotypic_target().segments(); // Tables : index 0 for the 0 segment // 1 for the neutral segment int32_t nb_genes_activ[nb_segments]; int32_t nb_genes_inhib[nb_segments]; double geom_area_activ[nb_segments]; double geom_area_inhib[nb_segments]; double geom_area_phen[nb_segments]; for (num_segment = 0 ; num_segment < nb_segments ; num_segment++) { nb_genes_activ[num_segment] = 0; nb_genes_inhib[num_segment] = 0; geom_area_activ[num_segment] = 0.0; geom_area_inhib[num_segment] = 0.0; geom_area_phen[num_segment] = 0.0; } AbstractFuzzy* activ = NULL; AbstractFuzzy* inhib = NULL; Phenotype* phen = NULL; // Compute number of genes in each segment for (const auto& prot: indiv->protein_list()) { // Go to the corresponding segment num_segment = 0; while (prot->mean() > segments[num_segment]->stop) { num_segment++; } // Add a genes (activ or inhib) if (prot->is_functional()) { if (prot->height() > 0) { nb_genes_activ[num_segment]++; } else if (prot->height() < 0) { nb_genes_inhib[num_segment]++; } // It the gene is exactly at the frontier between 2 zones, mark it in both if (prot->mean() == segments[num_segment]->stop && num_segment < nb_segments - 1) { if (prot->height() > 0) { nb_genes_activ[num_segment+1]++; } else if (prot->height() < 0) { nb_genes_inhib[num_segment+1]++; } } } } // Compute the geometric areas activ = indiv->phenotype_activ(); inhib = indiv->phenotype_inhib(); phen = indiv->phenotype(); for (num_segment = 0 ; num_segment < nb_segments ; num_segment++) { geom_area_activ[num_segment] = activ->get_geometric_area(segments[num_segment]->start, segments[num_segment]->stop); geom_area_inhib[num_segment] = inhib->get_geometric_area(segments[num_segment]->start, segments[num_segment]->stop); geom_area_phen[num_segment] = phen->get_geometric_area(segments[num_segment]->start, segments[num_segment]->stop); } // Print stats to file fprintf(zones_output_file, "%" PRId64, t); for (num_segment = 0 ; num_segment < nb_segments ; num_segment++) { fprintf(zones_output_file, " %" PRId32 " %" PRId32 " %lf %lf %lf", nb_genes_activ[num_segment], nb_genes_inhib[num_segment], geom_area_activ[num_segment], geom_area_inhib[num_segment], geom_area_phen[num_segment]); } fprintf(zones_output_file, "\n"); } FILE* open_operons_stat_file(const char* prefix, const char* postfix) { std::string operons_output_file_name{std::string("stats/") + prefix + "_operons" + postfix + ".out"}; FILE* operons_output_file = fopen(operons_output_file_name.c_str(), "w"); // Write headers fprintf(operons_output_file, "# Each line contains : Generation, and then, for 20 RNA, the number of genes inside the RNA\n"); return operons_output_file; } void write_operons_stats(int64_t t, Individual* indiv, FILE* operons_output_file) { int32_t nb_genes_per_rna[20]; for (int i = 0 ; i < 20 ; i++) { nb_genes_per_rna[i] = 0; } for (const auto& rna: indiv->rna_list()) { if (rna->transcribed_proteins().size() >= 20) { printf("Found operon with 20 genes or more : %zu\n", rna->transcribed_proteins().size()); } nb_genes_per_rna[rna->transcribed_proteins().size()]++; } fprintf(operons_output_file, "%" PRId64 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 "\n", t, nb_genes_per_rna[0], nb_genes_per_rna[1], nb_genes_per_rna[2], nb_genes_per_rna[3], nb_genes_per_rna[4], nb_genes_per_rna[5], nb_genes_per_rna[6], nb_genes_per_rna[7], nb_genes_per_rna[8], nb_genes_per_rna[9], nb_genes_per_rna[10], nb_genes_per_rna[11], nb_genes_per_rna[12], nb_genes_per_rna[13], nb_genes_per_rna[14], nb_genes_per_rna[15], nb_genes_per_rna[16], nb_genes_per_rna[17], nb_genes_per_rna[18], nb_genes_per_rna[19]); } void interpret_cmd_line_options(int argc, char* argv[]) { // ===================== // Parse command line // ===================== const char * short_options = "hVF:vM"; static struct option long_options[] = { {"help", no_argument, NULL, 'h'}, {"version", no_argument, NULL, 'V'}, {"full-check", no_argument, NULL, 'F'}, {"trace-mutations", no_argument, NULL, 'M'}, {"verbose", no_argument, NULL, 'v'}, {0, 0, 0, 0} }; int option; while((option = getopt_long(argc, argv, short_options, long_options, nullptr)) != -1) { switch(option) { case 'h': print_help(argv[0]); exit(EXIT_SUCCESS); case 'V': Utils::PrintAevolVersion(); exit(EXIT_SUCCESS); case 'v': verbose = true; break; case 'F': full_check = true; break; case 'M': trace_mutations = true; break; default: // An error message is printed in getopt_long, we just need to exit exit(EXIT_FAILURE); } } // There should be only one remaining arg: the lineage file if (optind != argc - 1) { Utils::ExitWithUsrMsg("please specify a lineage file"); } lineage_file_name = new char[strlen(argv[optind]) + 1]; sprintf(lineage_file_name, "%s", argv[optind]); } void print_help(char* prog_path) { // Get the program file-name in prog_name (strip prog_path of the path) char* prog_name; // No new, it will point to somewhere inside prog_path if ((prog_name = strrchr(prog_path, '/'))) { prog_name++; } else { prog_name = prog_path; } printf("******************************************************************************\n"); printf("* *\n"); printf("* aevol - Artificial Evolution *\n"); printf("* *\n"); printf("* Aevol is a simulation platform that allows one to let populations of *\n"); printf("* digital organisms evolve in different conditions and study experimentally *\n"); printf("* the mechanisms responsible for the structuration of the genome and the *\n"); printf("* transcriptome. *\n"); printf("* *\n"); printf("******************************************************************************\n"); printf("\n"); printf("%s: create an experiment with setup as specified in PARAM_FILE.\n", prog_name); printf("\n"); printf("Usage : %s -h or --help\n", prog_name); printf(" or : %s -V or --version\n", prog_name); printf(" or : %s LINEAGE_FILE [-FMv]\n", prog_name); printf("\nOptions\n"); printf(" -h, --help\n\tprint this help, then exit\n"); printf(" -V, --version\n\tprint version number, then exit\n"); printf(" -F, --full-check\n"); printf("\tperform genome checks whenever possible\n"); printf(" -M, --trace-mutations\n"); printf("\toutputs the fixed mutations (in a separate file)\n"); printf(" -v, --verbose\n\tbe verbose\n"); } aevol-5.0/src/post_treatments/lineage.cpp0000644000175000017500000004522412724051151015544 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ============================================================================ // Includes // ============================================================================ #include #include #include #include #include #include #include #include #include #include "aevol.h" using namespace aevol; // Helper functions void print_help(char* prog_path); void interpret_cmd_line_options(int argc, char* argv[]); // Command-line option variables static bool full_check = false; static bool verbose = false; static int64_t t0 = 0; static int64_t t_end = -1; static int32_t final_indiv_index = -1; static int32_t final_indiv_rank = -1; static char tree_file_name[255]; // TODO(dpa) remove magic number int main(int argc, char** argv) { // The output file (lineage.ae) contains the following information: // You may check that this information is up-to-date by searching // "lineage_file" in this source file // // - t0 // - t_end // - final individual index // - final individual rank // - initial_ancestor information (including its genome) // - replication report of ancestor at generation t0+1 // - replication report of ancestor at generation t0+2 // - replication report of ancestor at generation t0+3 // - ... // - replication report of ancestor at generation t_end interpret_cmd_line_options(argc, argv); printf("\n WARNING : Parameter change in the middle of a simulation is not managed.\n"); // Load the simulation ExpManager* exp_manager = new ExpManager(); exp_manager->load(t_end, true, false); // Check that the tree was recorded if (not exp_manager->record_tree()) { Utils::ExitWithUsrMsg("The phylogenetic tree wasn't recorded during " "evolution, could not reconstruct the lineage"); } int64_t tree_step = exp_manager->tree_step(); //delete exp_manager; // The tree Tree* tree = nullptr; // Indices, ranks and replication reports of the individuals in the lineage int32_t* indices = new int32_t[t_end - t0 + 1]; ReplicationReport** reports = new ReplicationReport*[t_end - t0]; // NB: we do not need the report of the ancestor at time t0 since we have // retrieved the individual itself from the initial backup // (plus it might be the generation 0, for which we have no reports) // reports[0] = how ancestor at t0 + 1 was created // reports[i] = how ancestor at t0 + i + 1 was created // reports[t_end - t0 - 1] = how the final individual was created // // --------------------------------------------------------------- // reports | t0 => t1 | t1 => t2 |...| t_n-1 => t_n | XXXXXXXXXXXX | // --------------------------------------------------------------- // indices | index at t0 | index at t1 |...| index at t_n-1 | index at t_n | // --------------------------------------------------------------- // ========================= // Load the last tree file // ========================= if (verbose) { printf("\n\n"); printf("====================================\n"); printf(" Loading the last tree file ... "); fflush(stdout); } // Example for ae_common::rec_params->tree_step() == 100 : // // tree_000100.ae ==> timesteps 1 to 100. // tree_000200.ae ==> timesteps 101 to 200. // tree_000300.ae ==> timesteps 201 to 300. // etc. // #ifdef __REGUL sprintf(tree_file_name,"tree/tree_" TIMESTEP_FORMAT ".rae", t_end); #else sprintf(tree_file_name,"tree/tree_" TIMESTEP_FORMAT ".ae", t_end); #endif tree = new Tree(exp_manager, tree_file_name); if (verbose) { printf("OK\n"); printf("====================================\n"); } // ============================================================================ // Find the index of the final individual and retrieve its replication report // ============================================================================ if (final_indiv_index != -1) { // The index was directly provided, get the replication report and update the indices and ranks tables reports[t_end - t0 - 1] = new ReplicationReport(*(tree->report_by_index(t_end, final_indiv_index))); final_indiv_rank = reports[t_end - t0 - 1]->rank(); indices[t_end - t0] = final_indiv_index; } else { if (final_indiv_rank == -1) { // No index nor rank was given in the command line. // By default, we construct the lineage of the best individual, the rank of which // is simply the number of individuals in the population. final_indiv_rank = exp_manager->nb_indivs(); } // Retrieve the replication report of the individual of interest (at t_end) reports[t_end - t0 - 1] = new ReplicationReport(*(tree->report_by_rank(t_end, final_indiv_rank))); final_indiv_index = reports[t_end - t0 - 1]->id(); indices[t_end - t0] = final_indiv_index; //~ ranks[end_gener - begin_gener] = final_indiv_rank; } if (verbose) { printf("The final individual has index %" PRId32 " (rank %" PRId32 ")\n", final_indiv_index, final_indiv_rank); } // ======================= // Open the output file // ======================= char output_file_name[101]; #ifdef __REGUL snprintf(output_file_name, 100, "lineage-b" TIMESTEP_FORMAT "-e" TIMESTEP_FORMAT "-i%" PRId32 "-r%" PRId32 ".rae", t0, t_end, final_indiv_index, final_indiv_rank); #else snprintf(output_file_name, 100, "lineage-b" TIMESTEP_FORMAT "-e" TIMESTEP_FORMAT "-i%" PRId32 "-r%" PRId32 ".ae", t0, t_end, final_indiv_index, final_indiv_rank); #endif gzFile lineage_file = gzopen(output_file_name, "w"); if (lineage_file == nullptr) { fprintf(stderr, "File %s could not be created.\n", output_file_name); fprintf(stderr, "Please check your permissions in this directory.\n"); exit(EXIT_FAILURE); } // =================================================== // Retrieve the replication reports of the ancestors // =================================================== if (verbose) { printf("\n\n\n"); printf("======================================================================\n"); printf(" Parsing tree files to retrieve the ancestors' replication reports... \n"); printf("======================================================================\n"); } // Retrieve the index of the first ancestor from the last replication report indices[t_end - t0 -1] = reports[t_end - t0 - 1]->parent_id(); // For each generation (going backwards), retrieve the index of the parent and // the corresponding replication report for (int64_t i = t_end - t0 - 2 ; i >= 0 ; i--) { int64_t t = t0 + i + 1; // We want to fill reports[i], that is to say, how the ancestor // at generation begin_gener + i + 1 was created if (verbose) printf("Getting the replication report for the ancestor at generation %" PRId64 "\n", t); // If we've exhausted the current tree file, load the next one if (Utils::mod(t, tree_step) == 0) { // Change the tree file delete tree; #ifdef __REGUL sprintf(tree_file_name,"tree/tree_" TIMESTEP_FORMAT ".rae", t); #else sprintf(tree_file_name,"tree/tree_" TIMESTEP_FORMAT ".ae", t); #endif tree = new Tree(exp_manager, tree_file_name); } // Copy the replication report of the ancestor reports[i] = new ReplicationReport(*(tree->report_by_index(t, indices[i + 1]))); // Retreive the index and rank of the next ancestor from the report indices[i] = reports[i]->parent_id(); } delete exp_manager; if (verbose) printf("OK\n"); // ============================================================================= // Get the initial genome from the backup file and write it in the output file // ============================================================================= if (verbose) { printf("\n\n\n"); printf("=============================================== \n"); printf(" Getting the initial genome sequence... "); fflush(nullptr); } // Load the simulation exp_manager = new ExpManager(); exp_manager->load(t0, true, false); // Copy the initial ancestor // NB : The list of individuals is sorted according to the index const Individual& initial_ancestor = *(exp_manager->indiv_by_id(indices[0])); // Write file "header" gzwrite(lineage_file, &t0, sizeof(t0)); gzwrite(lineage_file, &t_end, sizeof(t_end)); gzwrite(lineage_file, &final_indiv_index, sizeof(final_indiv_index)); gzwrite(lineage_file, &final_indiv_rank, sizeof(final_indiv_rank)); initial_ancestor.grid_cell()->save(lineage_file); if (verbose) { printf("OK\n"); printf("=============================================== \n"); } // =============================================================================== // Write the replication reports of the successive ancestors in the output file // (and, optionally, check that the rebuilt genome is correct each time a backup // is available) // =============================================================================== if (verbose) { printf("\n\n\n"); printf("============================================================ \n"); printf(" Write the replication reports in the output file... \n"); printf("============================================================ \n"); } std::list::const_iterator unit; Individual* stored_indiv = nullptr; std::list::const_iterator stored_gen_unit; ExpManager* exp_manager_backup = nullptr; // NB: I must keep the genome encapsulated inside an Individual, because // replaying the mutations has side effects on the list of promoters, // which is stored in the individual bool check_genome_now = false; for (int64_t i = 0 ; i < t_end - t0 ; i++) { // Where are we in time... int64_t t = t0 + i + 1; // Do we need to check the genome now? check_genome_now = t == t_end || (full_check && Utils::mod(t, exp_manager->backup_step()) == 0); // Write the replication report of the ancestor for current generation if (verbose) { printf("Writing the replication report for t= %" PRId64 " (built from indiv %" PRId32 " at t= %" PRId64 ")\n", t, indices[i], t-1); } reports[i]->write_to_tree_file(lineage_file); if (verbose) printf(" OK\n"); if (check_genome_now) { // Load the simulation exp_manager_backup = new ExpManager(); exp_manager_backup->load(t, true, false); // Copy the ancestor from the backup stored_indiv = exp_manager_backup->indiv_by_id(indices[i + 1]); stored_gen_unit = stored_indiv->genetic_unit_list().cbegin(); } // Warning: this portion of code won't work if the number of units changes // during the evolution // Replay the mutations stored in the current replication report on the // current genome unit = initial_ancestor.genetic_unit_list().cbegin(); for (const auto& mut: reports[i]->dna_replic_report().HT()) { (unit->dna())->undergo_this_mutation(*mut); } for (const auto& mut: reports[i]->dna_replic_report().rearrangements()) { (unit->dna())->undergo_this_mutation(*mut); } for (const auto& mut: reports[i]->dna_replic_report().mutations()) { unit->dna()->undergo_this_mutation(*mut); } if (check_genome_now) { if (verbose) { printf("Checking the sequence of the unit..."); fflush(stdout); } assert(stored_gen_unit != stored_indiv->genetic_unit_list().cend()); char * str1 = new char[unit->dna()->length() + 1]; memcpy(str1, unit->dna()->data(), unit->dna()->length() * sizeof(char)); str1[unit->dna()->length()] = '\0'; char * str2 = new char[stored_gen_unit->dna()->length() + 1]; memcpy(str2, stored_gen_unit->dna()->data(), stored_gen_unit->dna()->length() * sizeof(char)); str2[stored_gen_unit->dna()->length()] = '\0'; if (strncmp(str1, str2, stored_gen_unit->dna()->length()) == 0) { if (verbose) printf(" OK\n"); } else { if (verbose) printf(" ERROR !\n"); fprintf(stderr, "Error: the rebuilt unit is not the same as \n"); fprintf(stderr, "the one stored in backup file at %" PRId64 "\n", t); fprintf(stderr, "Rebuilt unit : %" PRId32 " bp\n %s\n", (int32_t)strlen(str1), str1); fprintf(stderr, "Stored unit : %" PRId32 " bp\n %s\n", (int32_t)strlen(str2), str2); delete [] str1; delete [] str2; gzclose(lineage_file); delete exp_manager_backup; delete exp_manager; delete [] reports; fflush(stdout); exit(EXIT_FAILURE); } delete [] str1; delete [] str2; ++stored_gen_unit; } ++unit; assert(unit == initial_ancestor.genetic_unit_list().cend()); if (check_genome_now) { assert(stored_gen_unit == stored_indiv->genetic_unit_list().cend()); delete exp_manager_backup; } } gzclose(lineage_file); delete [] reports; delete exp_manager; exit(EXIT_SUCCESS); } /** * \brief print help and exist */ void print_help(char* prog_path) { // Get the program file-name in prog_name (strip prog_path of the path) char* prog_name; // No new, it will point to somewhere inside prog_path if ((prog_name = strrchr(prog_path, '/'))) { prog_name++; } else { prog_name = prog_path; } printf("******************************************************************************\n"); printf("* *\n"); printf("* aevol - Artificial Evolution *\n"); printf("* *\n"); printf("* Aevol is a simulation platform that allows one to let populations of *\n"); printf("* digital organisms evolve in different conditions and study experimentally *\n"); printf("* the mechanisms responsible for the structuration of the genome and the *\n"); printf("* transcriptome. *\n"); printf("* *\n"); printf("******************************************************************************\n"); printf("\n"); printf("%s:\n", prog_name); printf("\tReconstruct the lineage of a given individual from the tree files\n"); printf("\n"); printf("Usage : %s -h or --help\n", prog_name); printf(" or : %s -V or --version\n", prog_name); printf(" or : %s [-b TIMESTEP] [-e TIMESTEP] [-I INDEX | -R RANK] [-F] [-v]\n", prog_name); printf("\nOptions\n"); printf(" -h, --help\n\tprint this help, then exit\n"); printf(" -V, --version\n\tprint version number, then exit\n"); printf(" -b, --begin TIMESTEP\n"); printf("\tspecify time t0 up to which to reconstruct the lineage\n"); printf(" -e, --end TIMESTEP\n"); printf("\tspecify time t_end of the indiv whose lineage is to be reconstructed\n"); printf(" -I, --index INDEX\n"); printf("\tspecify the index of the indiv whose lineage is to be reconstructed\n"); printf(" -R, --rank RANK\n"); printf("\tspecify the rank of the indiv whose lineage is to be reconstructed\n"); printf(" -F, --full-check\n"); printf("\tperform genome checks whenever possible\n"); printf(" -v, --verbose\n\tbe verbose\n"); } void interpret_cmd_line_options(int argc, char* argv[]) { // Define allowed options const char * short_options = "hVb:e:FI:R:v"; static struct option long_options[] = { {"help", no_argument, nullptr, 'h'}, {"version", no_argument, nullptr, 'V'}, {"begin", required_argument, nullptr, 'b'}, {"end", required_argument, nullptr, 'e'}, {"fullcheck", no_argument, nullptr, 'F'}, {"index", required_argument, nullptr, 'I'}, {"rank", required_argument, nullptr, 'R'}, {"verbose", no_argument, nullptr, 'v'}, {0, 0, 0, 0} }; // Get actual values of the command-line options int option; while((option = getopt_long(argc, argv, short_options, long_options, nullptr)) != -1) { switch(option) { case 'h' : { print_help(argv[0]); exit(EXIT_SUCCESS); } case 'V' : { Utils::PrintAevolVersion(); exit(EXIT_SUCCESS); } case 'b' : { if (strcmp(optarg, "") == 0) { printf("%s: error: Option -b or --begin : missing argument.\n", argv[0]); exit(EXIT_FAILURE); } t0 = atol(optarg); break; } case 'e' : { if (strcmp(optarg, "") == 0) { printf("%s: error: Option -e or --end : missing argument.\n", argv[0]); exit(EXIT_FAILURE); } t_end = atol(optarg); break; } case 'F' : { full_check = true; break; } case 'I' : { final_indiv_index = atoi(optarg); break; } case 'R' : { final_indiv_rank = atoi(optarg); break; } case 'v' : { verbose = true; break; } default : { // An error message is printed in getopt_long, we just need to exit exit(EXIT_FAILURE); } } } // If t_end wasn't provided, use default if (t_end < 0) { t_end = OutputManager::last_gener(); } } aevol-5.0/src/post_treatments/mutagenesis.cpp0000644000175000017500000012701312724051151016461 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** #include #include #include #include #include #include #include #include #include #include #include #include "aevol.h" using std::list; using namespace aevol; // ================================================================= // Command line option variables // ================================================================= int32_t wanted_rank = -1; int32_t wanted_index = -1; int64_t num_gener = 0; int32_t mutation_type = 0; int32_t nb_mutants = -1; // ================================================================= // Function declarations // ================================================================= void print_help(char* prog_path); void interpret_cmd_line_options(int argc, char* argv[]); int main(int argc, char* argv[]) { interpret_cmd_line_options(argc, argv); // ------------------------------------------------------ // Load the backup and get the individual to be mutated // ------------------------------------------------------ ExpManager* exp_manager = new ExpManager(); exp_manager->load(num_gener, true, false); if (exp_manager->output_m()->record_tree() == false) { // The following instruction is needed to ensure that methods // like ae_dna::do_deletion, ae_dna::do_inversion, etc // will create ae_mutation objects (otherwise they return NULL) exp_manager->output_m()->init_tree(exp_manager, 100); } if ((wanted_rank == -1) && (wanted_index == -1)) { wanted_rank = exp_manager->nb_indivs(); // the best one has rank N } // TODO: factor with duplicated code in robustness.cpp Individual* initial_indiv = nullptr; { // (local scope for variable `indivs` used as a shorthand) bool found = false; int32_t current_rank = -1; int32_t current_index = -1; list indivs = exp_manager->indivs(); for (auto indiv = indivs.rbegin(); not found and indiv != indivs.rend(); ++indiv) { current_index = (*indiv)->id(); current_rank = (*indiv)->rank(); if (wanted_index != -1 and current_index == wanted_index) { found = true; initial_indiv = (*indiv); wanted_rank = current_rank; } else if (current_rank == wanted_rank) { // no index was specified, we use the desired rank found = true; initial_indiv = (*indiv); wanted_index = current_index; } } if (not found) { Utils::ExitWithUsrMsg("sorry, the individual you have requested has not " "been found"); } } initial_indiv->Evaluate(); initial_indiv->compute_statistical_data(); initial_indiv->compute_non_coding(); // --------------------- // Prepare the output // --------------------- char mutation_type_name[24]; switch (mutation_type) { case SWITCH: { snprintf(mutation_type_name, 23, "point-mutation"); break; } case S_INS: { snprintf(mutation_type_name, 23, "small-insertion"); break; } case S_DEL: { snprintf(mutation_type_name, 23, "small-deletion"); break; } case DUPL: { snprintf(mutation_type_name, 23, "duplication"); break; } case DEL: { snprintf(mutation_type_name, 23, "large-deletion"); break; } case TRANS: { snprintf(mutation_type_name, 23, "translocation"); break; } case INV: { snprintf(mutation_type_name, 23, "inversion"); break; } default: { fprintf(stderr, "Error, unexpected mutation type.\n"); exit(EXIT_FAILURE); } } char directory_name[64]; snprintf(directory_name, 63, "analysis-generation_" TIMESTEP_FORMAT, num_gener); // Check whether the directory already exists and is writable if (access(directory_name, F_OK) == 0) { if (access(directory_name, X_OK | W_OK) != 0) { fprintf(stderr, "Error: cannot enter or write in directory %s.\n", directory_name); exit(EXIT_FAILURE); } } else { // Create the directory with permissions : rwx r-x r-x if (mkdir(directory_name, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) != 0) { fprintf(stderr, "Error: cannot create directory %s.\n", directory_name); exit(EXIT_FAILURE); } } char output_file_name[256]; snprintf(output_file_name, 255, "%s/mutagenesis-t" TIMESTEP_FORMAT "-i%" PRId32 "-r%" PRId32 "-%s.out", \ directory_name, num_gener, wanted_index, wanted_rank, mutation_type_name); FILE* output = fopen(output_file_name, "w"); if (output == NULL) { fprintf(stderr, "ERROR : Could not create the output file %s\n", output_file_name); exit(EXIT_FAILURE); } // Write the header int16_t col = 1; fprintf(output, "# ####################################################################################################\n"); fprintf(output, "# Single %s mutants of individual %" PRId32 " (rank %" PRId32 ") at generation %" PRId64 "\n", mutation_type_name, wanted_index, wanted_rank, num_gener); fprintf(output, "# ####################################################################################################\n"); fprintf(output, "# %" PRId16 ". Mutation type (0: switch, 1: smallins, 2: smalldel, 3:dupl, 4: del, 5:trans, 6:inv) \n", col); col++; fprintf(output, "# %" PRId16 ". Genetic unit which underwent the mutation (0 = chromosome) \n", col); col++; fprintf(output, "# %" PRId16 ". Length of this genetic unit before the event \n", col); col++; switch (mutation_type) { case SWITCH: { // Even though not all five columns are relevant for point mutations, we still write them all // to make the statistical analysis easier if other types of mutants are to be generated. // This way, for a given experiment, the number of columns will be the same for all types of mutants. fprintf(output, "# %" PRId16 ". pos0 (position of the point mutation on the genetic unit) \n", col); col++; fprintf(output, "# %" PRId16 ". pos1 (irrelevant for point mutations) \n", col); col++; fprintf(output, "# %" PRId16 ". pos2 (irrelevant for point mutations) \n", col); col++; fprintf(output, "# %" PRId16 ". pos3 (irrelevant for point mutations) \n", col); col++; fprintf(output, "# %" PRId16 ". invert (irrelevant for point mutations) \n", col); col++; break; } case S_INS: { fprintf(output, "# %" PRId16 ". pos0 (position of the small insertion on the genetic unit) \n", col); col++; fprintf(output, "# %" PRId16 ". pos1 (irrelevant for small insertions) \n", col); col++; fprintf(output, "# %" PRId16 ". pos2 (irrelevant for small insertions) \n", col); col++; fprintf(output, "# %" PRId16 ". pos3 (irrelevant for small insertions) \n", col); col++; fprintf(output, "# %" PRId16 ". invert (irrelevant for small insertions) \n", col); col++; break; } case S_DEL: { fprintf(output, "# %" PRId16 ". pos0 (position of the small deletion on the genetic unit) \n", col); col++; fprintf(output, "# %" PRId16 ". pos1 (irrelevant for small deletions) \n", col); col++; fprintf(output, "# %" PRId16 ". pos2 (irrelevant for small deletions) \n", col); col++; fprintf(output, "# %" PRId16 ". pos3 (irrelevant for small deletions) \n", col); col++; fprintf(output, "# %" PRId16 ". invert (irrelevant for small deletions) \n", col); col++; break; } case DUPL: { fprintf(output, "# %" PRId16 ". pos0 (begin of the duplicated segment) \n", col); col++; fprintf(output, "# %" PRId16 ". pos1 (end of the duplicated segment) \n", col); col++; fprintf(output, "# %" PRId16 ". pos2 (reinsertion point of the duplicate in the genetic unit) \n", col); col++; fprintf(output, "# %" PRId16 ". pos3 (irrelevant for duplications) \n", col); col++; fprintf(output, "# %" PRId16 ". invert (irrelevant for duplications) \n", col); col++; break; } case DEL: { fprintf(output, "# %" PRId16 ". pos0 (begin of the deleted segment) \n", col); col++; fprintf(output, "# %" PRId16 ". pos1 (end of the deleted segment) \n", col); col++; fprintf(output, "# %" PRId16 ". pos2 (irrelevant for large deletions) \n", col); col++; fprintf(output, "# %" PRId16 ". pos3 (irrelevant for large deletions) \n", col); col++; fprintf(output, "# %" PRId16 ". invert (irrelevant for large deletions) \n", col); col++; break; } case TRANS: { fprintf(output, "# %" PRId16 ". pos0 (begin of the excised segment) \n", col); col++; fprintf(output, "# %" PRId16 ". pos1 (end of the excised segment) \n", col); col++; fprintf(output, "# %" PRId16 ". pos2 (cutting point in the excised segment when reinserted) \n", col); col++; fprintf(output, "# %" PRId16 ". pos3 (reinsertion point of the segment in the genetic unit) \n", col); col++; fprintf(output, "# %" PRId16 ". invert (was the segment inverted when reinserted (0: no, 1: yes)) \n", col); col++; break; } case INV: { fprintf(output, "# %" PRId16 ". pos0 (begin of the inverted segment) \n", col); col++; fprintf(output, "# %" PRId16 ". pos1 (end of the inverted segment) \n", col); col++; fprintf(output, "# %" PRId16 ". pos2 (irrelevant for inversions) \n", col); col++; fprintf(output, "# %" PRId16 ". pos3 (irrelevant for inversions) \n", col); col++; fprintf(output, "# %" PRId16 ". invert (irrelevant for inversions) \n", col); col++; break; } default: { fprintf(stderr, "Error: unexpected mutation type.\n"); exit(EXIT_FAILURE); } } if (initial_indiv->with_alignments()) { fprintf(output, "# %" PRId16 ". align_score1 (score that was needed for the rearrangement to occur)\n", col); col++; fprintf(output, "# %" PRId16 ". align_score2 (score for the reinsertion for translocations)\n", col); col++; } fprintf(output, "# %" PRId16 ". Length of the {inserted, deleted, duplicated, translocated, inverted} segment \n", col); col++; fprintf(output, "# %" PRId16 ". Number of coding RNAs possibly disrupted by the breakpoint(s) \n", col); col++; fprintf(output, "# %" PRId16 ". Number of coding RNAs completely included in the segment \n", col); col++; fprintf(output, "# %" PRId16 ". Metabolic error after the mutation \n", col); col++; if (exp_manager->with_secretion()) { fprintf(output, "# %" PRId16 ". Secretion error after the mutation \n", col); col++; } if ((exp_manager->with_plasmids()) && (exp_manager->tune_donor_ability() != 0.0)) { fprintf(output, "# %" PRId16 ". Error on the donor ability after the mutation \n", col); col++; } if ((exp_manager->with_plasmids()) && (exp_manager->tune_recipient_ability() != 0.0)) { fprintf(output, "# %" PRId16 ". Error on the recipient ability after the mutation \n", col); col++; } fprintf(output, "# %" PRId16 ". Total genome size after the mutation \n", col); col++; fprintf(output, "# %" PRId16 ". Number of coding RNAs after the mutation \n", col); col++; fprintf(output, "# %" PRId16 ". Number of non coding RNAs after the mutation \n", col); col++; fprintf(output, "# %" PRId16 ". Number of functional coding sequences after the mutation \n", col); col++; fprintf(output, "# %" PRId16 ". Number of non functional coding sequences after the mutation \n", col); col++; fprintf(output, "# %" PRId16 ". Number of coding bases after the mutation \n", col); col++; fprintf(output, "# %" PRId16 ". Number of transcribed but not translated bases after the mutation\n", col); col++; fprintf(output, "# %" PRId16 ". Number of non transcribed bases after the mutation \n", col); col++; fprintf(output, "# %" PRId16 ". Number of bases belonging to at least one coding RNA, after the mutation \n", col); col++; fprintf(output, "# %" PRId16 ". Number of bases not belonging to any coding RNA, after the mutation \n", col); col++; fprintf(output, "####################################################################################################################\n"); fprintf(output, "# Values for the initial individual [irr = irrelevant]: \n"); fprintf(output, "####################################################################################################################\n"); fprintf(output, "# "); fprintf(output, "irr "); fprintf(output, "irr "); // genetic unit number (0 for the chromosome) fprintf(output, "irr "); fprintf(output, "irr "); fprintf(output, "irr "); fprintf(output, "irr "); fprintf(output, "irr "); fprintf(output, "irr "); if (initial_indiv->with_alignments()) { fprintf(output, "irr "); fprintf(output, "irr "); } fprintf(output, "irr "); fprintf(output, "irr "); fprintf(output, "irr "); fprintf(output, "%e ", initial_indiv->dist_to_target_by_feature(METABOLISM)); if (exp_manager->with_secretion()) { fprintf(output, "%e ", initial_indiv->dist_to_target_by_feature(SECRETION)); } if ((exp_manager->with_plasmids()) && (exp_manager->tune_donor_ability() != 0.0)) { fprintf(output, "%e ", initial_indiv->dist_to_target_by_feature(DONOR)); } if ((exp_manager->with_plasmids()) && (exp_manager->tune_recipient_ability() != 0.0)) { fprintf(output, "%e ", initial_indiv->dist_to_target_by_feature(RECIPIENT)); } fprintf(output, "%" PRId32 " ", initial_indiv->total_genome_size()); fprintf(output, "%" PRId32 " ", initial_indiv->nb_coding_RNAs()); fprintf(output, "%" PRId32 " ", initial_indiv->nb_non_coding_RNAs()); fprintf(output, "%" PRId32 " ", initial_indiv->nb_functional_genes()); fprintf(output, "%" PRId32 " ", initial_indiv->nb_non_functional_genes()); fprintf(output, "%" PRId32 " ", initial_indiv->total_genome_size() - initial_indiv->nb_bases_in_0_CDS()); // coding bp fprintf(output, "%" PRId32 " ", initial_indiv->total_genome_size() - initial_indiv->nb_bases_in_0_RNA() - (initial_indiv->total_genome_size() - initial_indiv->nb_bases_in_0_CDS())); // transcribed but not translated bp fprintf(output, "%" PRId32 " ", initial_indiv->nb_bases_in_0_RNA()); // not transcribed bp fprintf(output, "%" PRId32 " ", initial_indiv->total_genome_size() - initial_indiv->nb_bases_in_0_coding_RNA()); fprintf(output, "%" PRId32 " ", initial_indiv->nb_bases_in_0_coding_RNA()); fprintf(output, "\n"); fprintf(output, "####################################################################################################################\n"); // --------------------------------------- // Create the mutants and evaluate them // --------------------------------------- Individual* mutant = NULL; Mutation* mut = NULL; int32_t nb_genetic_units = initial_indiv->nb_genetic_units(); double* relative_lengths_genetic_units = NULL; int32_t u = 0; double alea, cumul; int32_t pos, pos0, pos1, pos2, pos3; int32_t mut_length; int16_t align_score1, align_score2; bool invert; VisAVis* alignment_1 = NULL; VisAVis* alignment_2 = NULL; int32_t nb_pairs; Dna* initial_dna = NULL; int32_t initial_len; bool rear_done; int32_t nb_genes_at_breakpoints; int32_t nb_genes_in_segment; int32_t nb_genes_in_replaced_segment; double metabolic_error_after = -1.0, secretion_error_after = -1.0; if (mutation_type == SWITCH) { // ********************* Exhaustive mutagenesis ************************* pos0 = pos1 = pos2 = pos3 = -1; mut_length = -1; align_score1 = align_score2 = -1; invert = false; metabolic_error_after = -1.0; secretion_error_after = -1.0; for (const auto& gu: initial_indiv->genetic_unit_list()) { initial_len = gu.dna()->length(); for (pos = 0; pos < initial_len; pos++) { mutant = new Individual(*initial_indiv); mutant->genetic_unit(u).dna()->do_switch(pos); mut = new PointMutation(pos); mut_length = 1; pos0 = pos; initial_indiv->genetic_unit_nonconst( u).compute_nb_of_affected_genes(mut, nb_genes_at_breakpoints, nb_genes_in_segment, nb_genes_in_replaced_segment); // Evaluate the mutant, compute its statistics mutant->ReevaluateInContext(initial_indiv->habitat()); mutant->compute_statistical_data(); mutant->compute_non_coding(); metabolic_error_after = mutant->dist_to_target_by_feature( METABOLISM); if (exp_manager->with_secretion()) { secretion_error_after = mutant->dist_to_target_by_feature( SECRETION); } // Write the description of the mutant in the output file fprintf(output, "%" PRId32 " ", mutation_type); fprintf(output, "%" PRId32 " ", u); // genetic unit number (0 for the chromosome) fprintf(output, "%" PRId32 " ", initial_indiv->genetic_unit( u).dna()->length()); // Length of GU before the event fprintf(output, "%" PRId32 " ", pos0); fprintf(output, "%" PRId32 " ", pos1); fprintf(output, "%" PRId32 " ", pos2); fprintf(output, "%" PRId32 " ", pos3); if (invert) fprintf(output, "1 "); else fprintf(output, "0 "); if (mutant->with_alignments()) { fprintf(output, "%" PRId16 " ", align_score1); fprintf(output, "%" PRId16 " ", align_score2); } fprintf(output, "%" PRId32 " ", mut_length); fprintf(output, "%" PRId32 " ", nb_genes_at_breakpoints); fprintf(output, "%" PRId32 " ", nb_genes_in_segment); fprintf(output, "%e ", metabolic_error_after); if (exp_manager->with_secretion()) { fprintf(output, "%e ", secretion_error_after); } if ((exp_manager->with_plasmids()) && (exp_manager->tune_donor_ability() != 0.0)) { fprintf(output, "%e ", mutant->dist_to_target_by_feature(DONOR)); } if ((exp_manager->with_plasmids()) && (exp_manager->tune_recipient_ability() != 0.0)) { fprintf(output, "%e ", mutant->dist_to_target_by_feature(RECIPIENT)); } fprintf(output, "%" PRId32 " ", mutant->total_genome_size()); fprintf(output, "%" PRId32 " ", mutant->nb_coding_RNAs()); fprintf(output, "%" PRId32 " ", mutant->nb_non_coding_RNAs()); fprintf(output, "%" PRId32 " ", mutant->nb_functional_genes()); fprintf(output, "%" PRId32 " ", mutant->nb_non_functional_genes()); fprintf(output, "%" PRId32 " ", mutant->total_genome_size() - mutant->nb_bases_in_0_CDS()); // coding bp fprintf(output, "%" PRId32 " ", mutant->total_genome_size() - mutant->nb_bases_in_0_RNA() - (mutant->total_genome_size() - mutant->nb_bases_in_0_CDS())); // transcribed but not translated bp fprintf(output, "%" PRId32 " ", mutant->nb_bases_in_0_RNA()); // not transcribed bp fprintf(output, "%" PRId32 " ", mutant->total_genome_size() - mutant->nb_bases_in_0_coding_RNA()); fprintf(output, "%" PRId32 " ", mutant->nb_bases_in_0_coding_RNA()); fprintf(output, "\n"); delete mutant; delete mut; } u++; } } else { // ******************************* Sampling nb_mutants mutants ********************************** relative_lengths_genetic_units = new double[nb_genetic_units]; for (const auto& gu: initial_indiv->genetic_unit_list()) relative_lengths_genetic_units[u++] = gu.dna()->length() / static_cast(initial_indiv->total_genome_size()); for (int32_t i = 0; i < nb_mutants; i++) { mutant = new Individual(*initial_indiv); // Pick the genetic unit which will undergo the mutation alea = mutant->mut_prng()->random(); u = 0; cumul = relative_lengths_genetic_units[0]; while (alea > cumul) { u++; cumul += relative_lengths_genetic_units[u]; } // Ask the genetic unit to perform the mutation and store it pos0 = pos1 = pos2 = pos3 = -1; mut_length = -1; align_score1 = align_score2 = -1; invert = false; alignment_1 = NULL; alignment_2 = NULL; initial_dna = initial_indiv->genetic_unit(u).dna(); initial_len = initial_dna->length(); metabolic_error_after = -1.0; secretion_error_after = -1.0; switch (mutation_type) { // Locally we need the precise type of the mutation. Outside of the // switch, we will need the generic 'mut'. We could have static_casted // 'mut' here but it felt better declaring a specific variable // instead... case S_INS: { // cf. comment at top of switch statement SmallInsertion* small_ins; do { mut = small_ins = mutant->genetic_unit(u).dna()-> do_small_insertion(); } while (mut == NULL); pos0 = small_ins->pos(); mut_length = small_ins->length(); break; } case S_DEL: { // cf. comment at top of switch statement SmallDeletion* small_del; do { mut = small_del = mutant->genetic_unit(u).dna()-> do_small_deletion(); } while (mut == NULL); pos0 = small_del->pos(); mut_length = small_del->length(); break; } case DUPL: { // cf. comment at top of switch statement Duplication* duplication; if (mutant->with_alignments()) { // TODO(dpa) Encapsulate in method do_duplication_align() rear_done = false; do { do { nb_pairs = initial_len; alignment_1 = initial_dna->search_alignment(initial_dna, nb_pairs, DIRECT); } while (alignment_1 == NULL); mut_length = Utils::mod( alignment_1->i_2() - alignment_1->i_1(), initial_len); rear_done = mutant->genetic_unit(u).dna()->do_duplication( alignment_1->i_1(), alignment_1->i_2(), alignment_1->i_2()); } while (!rear_done); mut = duplication = new Duplication(alignment_1->i_1(), alignment_1->i_2(), alignment_1->i_2(), mut_length, alignment_1->score()); } else { do { mut = duplication = mutant->genetic_unit(u).dna()-> do_duplication(); } while (mut == NULL); } pos0 = duplication->pos1(); pos1 = duplication->pos2(); pos2 = duplication->pos3(); align_score1 = duplication->align_score(); mut_length = duplication->length(); break; } case DEL: { // cf. comment at top of switch statement Deletion* deletion; if (mutant->with_alignments()) { rear_done = false; do { do { nb_pairs = initial_len; alignment_1 = initial_dna->search_alignment(initial_dna, nb_pairs, DIRECT); } while (alignment_1 == NULL); mut_length = Utils::mod( alignment_1->i_2() - alignment_1->i_1(), initial_len); rear_done = mutant->genetic_unit(u).dna()->do_deletion( alignment_1->i_1(), alignment_1->i_2()); } while (!rear_done); mut = deletion = new Deletion(alignment_1->i_1(), alignment_1->i_2(), mut_length, alignment_1->score()); } else { do { mut = deletion = mutant->genetic_unit(u).dna()-> do_deletion(); } while (mut == NULL); } pos0 = deletion->pos1(); pos1 = deletion->pos2(); align_score1 = deletion->align_score(); mut_length = deletion->length(); break; } case TRANS: { // cf. comment at top of switch statement Translocation* translocation; // TO DO: problems might arise because the ae_mutation does not // record whether it was an intra- or interGU translocation if (mutant->with_alignments()) { // TODO(dpa) Encapsulate in method do_duplication_align() rear_done = false; do { do { nb_pairs = initial_len; alignment_1 = initial_dna->search_alignment(initial_dna, nb_pairs, DIRECT); } while (alignment_1 == NULL); // Make sure the segment to be translocated doesn't contain OriC // TODO(dpa) is that still necessary? if (alignment_1->i_1() > alignment_1->i_2()) { alignment_1->swap(); } mut_length = Utils::mod( alignment_1->i_2() - alignment_1->i_1(), initial_len); // Extract the segment to be translocated GeneticUnit* tmp_segment = mutant->genetic_unit( u).dna()->extract_into_new_GU(alignment_1->i_1(), alignment_1->i_2()); // Look for a "new" alignment between this segment and the // remaining of the chromosome do { nb_pairs = initial_len; alignment_2 = tmp_segment->dna()->search_alignment( mutant->genetic_unit(u).dna(), nb_pairs, BOTH_SENSES); } while (alignment_2 == NULL); invert = (alignment_2->sense() == INDIRECT); // Reinsert the segment into the genetic unit mutant->genetic_unit(u).dna()-> insert_GU(tmp_segment, alignment_2->i_2(), alignment_2->i_1(), invert); rear_done = true; delete tmp_segment; } while (!rear_done); mut = translocation = new Translocation(alignment_1->i_1(), alignment_1->i_2(), alignment_2->i_1(), alignment_2->i_2(), mut_length, invert, alignment_1->score(), alignment_2->score()); } else { do { mut = translocation = mutant->genetic_unit(u).dna()-> do_translocation(); } while (mut == NULL); } pos0 = translocation->pos1(); pos1 = translocation->pos2(); pos2 = translocation->pos3(); pos3 = translocation->pos4(); align_score1 = translocation->align_score_1(); align_score2 = translocation->align_score_2(); invert = translocation->invert(); mut_length = translocation->length(); break; } case INV: { // cf. comment at top of switch statement Inversion* inversion; if (mutant->with_alignments()) { // TODO(dpa) Encapsulate in method do_duplication_align() rear_done = false; do { do { nb_pairs = initial_len; alignment_1 = initial_dna->search_alignment(initial_dna, nb_pairs, INDIRECT); } while (alignment_1 == NULL); // Make sure the segment to be inverted doesn't contain OriC if (alignment_1->i_1() > alignment_1->i_2()) { alignment_1->swap(); } mut_length = Utils::mod( alignment_1->i_2() - alignment_1->i_1(), initial_len); rear_done = mutant->genetic_unit(u).dna()->do_inversion( alignment_1->i_1(), alignment_1->i_2()); } while (!rear_done); mut = inversion = new Inversion(alignment_1->i_1(), alignment_1->i_2(), mut_length, alignment_1->score()); } else { do { mut = inversion = mutant->genetic_unit(u).dna()-> do_inversion(); } while (mut == NULL); } pos0 = inversion->pos1(); pos1 = inversion->pos2(); align_score1 = inversion->align_score(); mut_length = inversion->length(); break; } default: { fprintf(stderr, "Error, unexpected mutation type\n"); break; } } // TO DO: improve this method to make it work also with // interGU translocations initial_indiv->genetic_unit_nonconst(u).compute_nb_of_affected_genes( mut, nb_genes_at_breakpoints, nb_genes_in_segment, nb_genes_in_replaced_segment); // Evaluate the mutant, compute its statistics mutant->Reevaluate(); mutant->compute_statistical_data(); mutant->compute_non_coding(); metabolic_error_after = mutant->dist_to_target_by_feature(METABOLISM); if (exp_manager->with_secretion()) { secretion_error_after = mutant->dist_to_target_by_feature( SECRETION); } // Write the description of the mutant in the output file fprintf(output, "%" PRId32 " ", mutation_type); fprintf(output, "%" PRId32 " ", u); // genetic unit number (0 for the chromosome) fprintf(output, "%" PRId32 " ", initial_indiv->genetic_unit( u).dna()->length()); // Length of GU before the event fprintf(output, "%" PRId32 " ", pos0); fprintf(output, "%" PRId32 " ", pos1); fprintf(output, "%" PRId32 " ", pos2); fprintf(output, "%" PRId32 " ", pos3); if (invert) fprintf(output, "1 "); else fprintf(output, "0 "); if (mutant->with_alignments()) { fprintf(output, "%" PRId16 " ", align_score1); fprintf(output, "%" PRId16 " ", align_score2); } fprintf(output, "%" PRId32 " ", mut_length); fprintf(output, "%" PRId32 " ", nb_genes_at_breakpoints); fprintf(output, "%" PRId32 " ", nb_genes_in_segment); fprintf(output, "%e ", metabolic_error_after); if (exp_manager->with_secretion()) { fprintf(output, "%e ", secretion_error_after); } if ((exp_manager->with_plasmids()) && (exp_manager->tune_donor_ability() != 0.0)) { fprintf(output, "%e ", mutant->dist_to_target_by_feature(DONOR)); } if ((exp_manager->with_plasmids()) && (exp_manager->tune_recipient_ability() != 0.0)) { fprintf(output, "%e ", mutant->dist_to_target_by_feature(RECIPIENT)); } fprintf(output, "%" PRId32 " ", mutant->total_genome_size()); fprintf(output, "%" PRId32 " ", mutant->nb_coding_RNAs()); fprintf(output, "%" PRId32 " ", mutant->nb_non_coding_RNAs()); fprintf(output, "%" PRId32 " ", mutant->nb_functional_genes()); fprintf(output, "%" PRId32 " ", mutant->nb_non_functional_genes()); fprintf(output, "%" PRId32 " ", mutant->total_genome_size() - mutant->nb_bases_in_0_CDS()); // coding bp fprintf(output, "%" PRId32 " ", mutant->total_genome_size() - mutant->nb_bases_in_0_RNA() - (mutant->total_genome_size() - mutant->nb_bases_in_0_CDS())); // transcribed but not translated bp fprintf(output, "%" PRId32 " ", mutant->nb_bases_in_0_RNA()); // not transcribed bp fprintf(output, "%" PRId32 " ", mutant->total_genome_size() - mutant->nb_bases_in_0_coding_RNA()); fprintf(output, "%" PRId32 " ", mutant->nb_bases_in_0_coding_RNA()); fprintf(output, "\n"); delete mutant; delete mut; } delete[] relative_lengths_genetic_units; } delete exp_manager; return EXIT_SUCCESS; } void interpret_cmd_line_options(int argc, char* argv[]) { const char* options_list = "hVg:r:i:m:n:"; static struct option long_options_list[] = { {"help", no_argument, NULL, 'h'}, {"version", no_argument, NULL, 'V'}, {"gener", required_argument, NULL, 'g'}, {"rank", required_argument, NULL, 'r'}, {"index", required_argument, NULL, 'i'}, {"mutation-type", required_argument, NULL, 'm'}, {"nb-mutants", required_argument, NULL, 'n'}, {0, 0, 0, 0} }; int option = -1; bool rank_already_set = false; bool index_already_set = false; while ((option = getopt_long(argc, argv, options_list, long_options_list, NULL)) != -1) { switch (option) { case 'h': print_help(argv[0]); exit(EXIT_SUCCESS); case 'V': Utils::PrintAevolVersion(); exit(EXIT_SUCCESS); case 'g': if (strcmp(optarg, "") == 0) { fprintf(stderr, "%s: error: Option -g or --gener : missing argument.\n", argv[0]); exit(EXIT_FAILURE); } num_gener = atol(optarg); break; case 'r': if (index_already_set) { fprintf(stderr, "%s: error: Options -r and -i are incompatible. Please choose one of them only.\n", argv[0]); exit(EXIT_FAILURE); } wanted_rank = atol(optarg); rank_already_set = true; break; case 'i': if (rank_already_set) { fprintf(stderr, "%s: error: Options -r and -i are incompatible. Please choose one of them only.\n", argv[0]); fprintf(stderr, " Use %s --help for more information.\n", argv[0]); exit(EXIT_FAILURE); } wanted_index = atol(optarg); index_already_set = true; break; case 'm': mutation_type = (MutationType) atol(optarg); if (mutation_type == SWITCH) { } else if ((mutation_type == S_INS) || (mutation_type == S_DEL) || (mutation_type == DUPL) || (mutation_type == DEL) || (mutation_type == TRANS) || (mutation_type == INV)) { } else { fprintf(stderr, "%s: error: So far, mutagenesis is implemented only for " "point mutations, small insertions, \n" " small deletions, duplications, deletions, " "translocations or inversions.\n" " It is not available yet for lateral transfer.\n", argv[0]); exit(EXIT_FAILURE); } break; case 'n': nb_mutants = atol(optarg); if (nb_mutants <= 0) { fprintf(stderr, "%s: error: The number of mutants (option -n) must be " "positive.\n", argv[0]); exit(EXIT_FAILURE); } break; } } if ((mutation_type == SWITCH) && (nb_mutants != -1)) { printf("For point mutations, the mutagenesis will be exhaustive, " "the number of \n" "mutants will be ignored.\n"); } else if ((mutation_type != SWITCH) && (nb_mutants == -1)) { nb_mutants = 1000; printf("Mutagenesis cannot be exhaustive in a reasonable time for " "mutations \n"); printf("other than point mutations. A sample of %" PRId32 " mutants will " "be generated.\n", nb_mutants); } } /*! \brief */ void print_help(char* prog_path) { // Get the program file-name in prog_name (strip prog_path of the path) char* prog_name; // No new, it will point to somewhere inside prog_path if ((prog_name = strrchr(prog_path, '/'))) { prog_name++; } else { prog_name = prog_path; } printf("\n"); printf( "*********************** aevol - Artificial Evolution ******************* \n"); printf( "* * \n"); printf( "* Mutagenesis post-treatment program * \n"); printf( "* * \n"); printf( "************************************************************************ \n"); printf("\n\n"); printf("This program is Free Software. No Warranty.\n"); printf("\n"); printf("Usage : %s -h\n", prog_name); printf(" or : %s -V or --version\n", prog_name); printf( " or : %s -g NUMGENER [-r RANK | -i INDEX] [-m MUTATIONTYPE] [-n NBMUTANTS]\n", prog_name); printf("\n"); printf( "This program creates and evaluates single mutants of an individual saved in a backup, \n"); printf( "by default the best of its generation. Use either the -r or the -i option to\n"); printf( "select another individual than the best one: with -i, you have to provide the\n"); printf( "ID of the individual, and with -r the rank (1 for the individual with the lowest\n"); printf("fitness, N for the fittest one). \n\n"); printf( "The type of mutations to perform must be specified with the -m option. \n"); printf( "Choose 0 to create mutants with a point mutation, 1 for a small insertion, \n"); printf( "2 for a small deletion, 3 for a duplication, 4 for a large deletion, \n"); printf("5 for a translocation or 6 for an inversion. \n\n"); printf( "For the point mutations, all single mutants will be created and evaluated. For the\n"); printf( "other mutation types, an exhaustive mutagenesis would be too long, hence only a\n"); printf( "sample of mutants (1000 by default) will be generated. Use option -n to specify\n"); printf("another sample size.\n\n"); printf( "The output file will be placed in a subdirectory called analysis-generationNUMGENER.\n"); printf("\n"); printf("\n"); printf("\t-h or --help : Display this help, then exit\n"); printf("\n"); printf("\t-V or --version : Print version number, then exit\n"); printf("\n"); printf("\t-g NUMGENER or --gener NUMGENER : \n"); printf( "\t Generation of the backup containing the individual of interest\n"); printf("\n"); printf("\t-i INDEX or --index INDEX : \n"); printf( "\t Index of individual of interest. Should be comprised between 0 and N-1, where\n"); printf("\t N is the size of the population.\n"); printf("\n"); printf("\t-r RANK or --rank RANK : \n"); printf( "\t Rank of individual of interest. Should be comprised between 1 and N, where\n"); printf( "\t N is the size of the population. Default = N (fittest individual).\n"); printf("\n"); printf("\t-m MUTATIONTYPE or --mutation-type MUTATIONTYPE : \n"); printf( "\t Integer type of the mutation carried by each mutant: 0 for a point mutation, 1 for a \n"); printf( "\t small insertion, 2 for small deletions, 3 for a duplication, 4 for a large deletion, \n"); printf("\t 5 for a translocation or 6 for an inversion. \n"); printf("\n"); printf("\t-n NBMUTANTS or --nb-mutants NBMUTANTS : \n"); printf( "\t Number of single mutants to create and evaluate. Default = 1000. Note that this option\n"); printf( "\t is ignored in the case of point mutations, where all single mutants are created \n"); printf("\t (exhaustive mutagenesis). \n"); printf("\n"); printf("\n"); } aevol-5.0/src/post_treatments/ancestor_robustness.cpp0000644000175000017500000002546112724051151020246 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ============================================================================ // Includes // ============================================================================ #include #include #include "aevol.h" #include "IndivAnalysis.h" using namespace aevol; // Helper functions void interpret_cmd_line_options(int argc, char* argv[]); void print_help(char* prog_path); // Command-line option variables static char* lineage_file_name = nullptr; static int32_t nb_mutants = 1000; //< Number of mutants per individual static int32_t begin = 0; //< First generation to analyse static int32_t end = -1; //< Last generation to analyse static int32_t period = 1; //< Period of analysis static char* output_file_name = "robustness_summary.txt"; static bool verbose = false; int main(int argc, char* argv[]) { interpret_cmd_line_options(argc, argv); // ======================= // Open the lineage file // ======================= gzFile lineage_file = gzopen(lineage_file_name, "r"); if (lineage_file == Z_NULL) { Utils::ExitWithUsrMsg(std::string("Could not read lineage file ") + lineage_file_name + "\n"); } int64_t t0 = 0; int64_t t_end = 0; int32_t final_indiv_index = 0; int32_t final_indiv_rank = 0; gzread(lineage_file, &t0, sizeof(t0)); gzread(lineage_file, &t_end, sizeof(t_end)); gzread(lineage_file, &final_indiv_index, sizeof(final_indiv_index)); gzread(lineage_file, &final_indiv_rank, sizeof(final_indiv_rank)); if (verbose) { printf("\n\n"); printf( "===============================================================================\n"); printf(" Robustness of the ancestors of indiv. %" PRId32 " (rank %" PRId32 ") from time %" PRId64 " to %" PRId64 "\n", final_indiv_index, final_indiv_rank, t0, t_end); printf( "================================================================================\n"); } // ============================= // Open the experience manager // ============================= ExpManager* exp_manager = new ExpManager(); exp_manager->load(t0, true, false); // The current version doesn't allow for phenotypic variation nor for // different phenotypic targets among the grid if (not exp_manager->world()->phenotypic_target_shared()) { Utils::ExitWithUsrMsg("sorry, ancestor stats has not yet been implemented " "for per grid-cell phenotypic target\n"); } auto phenotypicTargetHandler = exp_manager->world()->phenotypic_target_handler(); if (phenotypicTargetHandler->var_method() != NO_VAR) { Utils::ExitWithUsrMsg("sorry, ancestor stats has not yet been implemented " "for variable phenotypic targets\n"); } // ========================= // Open the output file(s) // ========================= // // Create missing directories // int status; // status = mkdir("stats/ancestor_stats/", 0755); // if ((status == -1) && (errno != EEXIST)) // err(EXIT_FAILURE, "stats/ancestor_stats/"); FILE* output_summary = fopen(output_file_name, "w"); if (output_summary == nullptr) { Utils::ExitWithUsrMsg(std::string("Could not create ") + output_file_name); } std::shared_ptr prng = std::make_shared(9695); // ============================== // Prepare the initial ancestor // ============================== GridCell* grid_cell = new GridCell(lineage_file, exp_manager, nullptr); IndivAnalysis indiv(*(grid_cell->individual())); indiv.Evaluate(); // indiv->compute_statistical_data(); // indiv->compute_non_coding(); // ============================== // Compute robustness of the initial ancestor // ============================== if (begin == 0) { indiv.compute_experimental_f_nu(nb_mutants, prng, output_summary, nullptr, verbose); } // ========================================================================== // Replay the mutations to get the successive ancestors and analyze them // ========================================================================== ReplicationReport* rep = nullptr; int32_t index; aevol::AeTime::plusplus(); while ((time() <= t_end) && (((time() < end) || (end == -1)))) { rep = new ReplicationReport(lineage_file, &indiv); index = rep->id(); // who we are building... indiv.Reevaluate(); if (verbose) { printf("Ancestor at generation %" PRId64 " has index %" PRId32 "\n", time(), index); } // 2) Replay replication (create current individual's child) GeneticUnit& gen_unit = indiv.genetic_unit_nonconst(0); // For each genetic unit, replay the replication (undergo all mutations) // TODO disabled for multiple GUs const auto& dnarep = rep->dna_replic_report(); for (const auto& mut: dnarep.HT()) gen_unit.dna()->undergo_this_mutation(*mut); for (const auto& mut: dnarep.rearrangements()) gen_unit.dna()->undergo_this_mutation(*mut); for (const auto& mut: dnarep.mutations()) gen_unit.dna()->undergo_this_mutation(*mut); // 3) All the mutations have been replayed, we can now evaluate the new individual indiv.Reevaluate(); // if we are between "begin" and "end" and at the correct period, compute robustness if ((time() >= begin) && ((time() < end) || (end == -1)) && (((time() - begin) % period) == 0)) { indiv.compute_experimental_f_nu(nb_mutants, prng, output_summary, nullptr, verbose); } delete rep; aevol::AeTime::plusplus(); } gzclose(lineage_file); fclose(output_summary); delete exp_manager; return EXIT_SUCCESS; } void interpret_cmd_line_options(int argc, char* argv[]) { const char* short_options = "hVvn:b:e:p:o:"; static struct option long_options[] = { {"help", no_argument, nullptr, 'h'}, {"version", no_argument, nullptr, 'V'}, {"verbose", no_argument, nullptr, 'v'}, {"nb-mutants", required_argument, nullptr, 'n'}, {"begin", required_argument, nullptr, 'b'}, {"end", required_argument, nullptr, 'e'}, {"period", required_argument, nullptr, 'P'}, {"output", required_argument, nullptr, 'o'}, {0, 0, 0, 0} }; int option; while ((option = getopt_long(argc, argv, short_options, long_options, nullptr)) != -1) { switch (option) { case 'h' : print_help(argv[0]); exit(EXIT_SUCCESS); case 'V' : Utils::PrintAevolVersion(); exit(EXIT_SUCCESS); case 'v' : verbose = true; break; case 'b' : begin = atol(optarg); break; case 'e' : end = atol(optarg); break; case 'n' : nb_mutants = atol(optarg); break; case 'P' : period = atol(optarg); break; case 'o' : output_file_name = new char[strlen(optarg) + 1]; sprintf(output_file_name, "%s", optarg); break; default: // An error message is printed in getopt_long, we just need to exit exit(EXIT_FAILURE); } } // There should be only one remaining arg: the lineage file if (optind != argc - 1) { Utils::ExitWithUsrMsg("please specify a lineage file"); } lineage_file_name = new char[strlen(argv[optind]) + 1]; sprintf(lineage_file_name, "%s", argv[optind]); } void print_help(char* prog_path) { // Get the program file-name in prog_name (strip prog_path of the path) char* prog_name; // No new, it will point to somewhere inside prog_path if ((prog_name = strrchr(prog_path, '/'))) { prog_name++; } else { prog_name = prog_path; } printf("******************************************************************************\n"); printf("* *\n"); printf("* aevol - Artificial Evolution *\n"); printf("* *\n"); printf("* Aevol is a simulation platform that allows one to let populations of *\n"); printf("* digital organisms evolve in different conditions and study experimentally *\n"); printf("* the mechanisms responsible for the structuration of the genome and the *\n"); printf("* transcriptome. *\n"); printf("* *\n"); printf("******************************************************************************\n"); printf("\n"); printf("%s: generate and analyse mutants for the provided lineage.\n", prog_name); printf("\n"); printf("Usage : %s -h or --help\n", prog_name); printf(" or : %s -V or --version\n", prog_name); printf(" or : %s LINEAGE_FILE [-b TIMESTEP] [-e TIMESTEP] [-n NB_MUTANTS] [-P PERIOD] [-o output] [-v]\n", prog_name); printf("\nOptions\n"); printf(" -h, --help\n\tprint this help, then exit\n"); printf(" -V, --version\n\tprint version number, then exit\n"); printf(" -b, --begin TIMESTEP\n"); printf("\ttimestep at which to start the analysis\n"); printf(" -e, --end TIMESTEP\n"); printf("\ttimestep at which to stop the analysis\n"); printf(" -n, --nb-mutants NB_MUTANTS\n"); printf("\tnumber of mutants to be generated\n"); printf(" -P, --period\n"); printf("\tperiod with which to perform the analysis\n"); printf(" -o, --output\n"); printf("\toutput file name\n"); printf(" -v, --verbose\n\tbe verbose\n"); } aevol-5.0/src/post_treatments/Makefile.am0000644000175000017500000000514112724051151015462 00000000000000############################################ # Set a few variables # ############################################ AM_CPPFLAGS = $(AEVOLCPPFLAGS) AM_CXXFLAGS = $(AEVOLCXXFLAGS) AM_LDFLAGS = $(AEVOLLDFLAGS) AM_CPPFLAGS += -I$(top_srcdir)/src/libaevol AM_LDFLAGS += -L$(top_srcdir)/src/libaevol ############################################ # Set aevol library to use # ############################################ LDADD = $(top_srcdir)/src/libaevol/libaevol.a $(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a ############################################ # C99 exact-width integer specific support # ############################################ # __STDC_FORMAT_MACROS allows us to use exact-width integer format specifiers e.g. PRId32 (for printf etc) # __STDC_CONSTANT_MACROS allows us to define exact-width integer macros with e.g. INT32_C( ) # __STDC_LIMIT_MACROS allows us to use exact-width integer limit macros with e.g. INT32_MAX AM_CPPFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS #################################### # Add hardening option to compiler # #################################### # This replaces insecure unlimited length buffer function calls with # length-limited ones (required for debian and not a bad idea anyway). AM_CPPFLAGS += -D_FORTIFY_SOURCE=2 ############################################ # Set programs to build # ############################################ bin_PROGRAMS = \ aevol_misc_ancestor_stats \ aevol_misc_ancestor_robustness \ aevol_misc_create_eps \ aevol_misc_extract \ aevol_misc_lineage \ aevol_misc_mutagenesis \ aevol_misc_robustness # aevol_misc_gene_families # aevol_misc_transform_plasmid if WITH_X bin_PROGRAMS += aevol_misc_view endif # X # noinst_PROGRAMS = aevol_misc_template CLEANFILES = $(bin_PROGRAMS) aevol_misc_ancestor_stats_SOURCES = ancestor_stats.cpp aevol_misc_ancestor_robustness_SOURCES = ancestor_robustness.cpp IndivAnalysis.cpp aevol_misc_ancestor_robustness_SOURCES += IndivAnalysis.h # hack to get make dist to include IndivAnalysis.h aevol_misc_create_eps_SOURCES = create_eps.cpp aevol_misc_extract_SOURCES = extract.cpp # aevol_misc_gene_families_SOURCES = gene_families.cpp aevol_misc_lineage_SOURCES = lineage.cpp aevol_misc_mutagenesis_SOURCES = mutagenesis.cpp aevol_misc_robustness_SOURCES = robustness.cpp IndivAnalysis.cpp aevol_misc_robustness_SOURCES += IndivAnalysis.h # hack to get make dist to include IndivAnalysis.h # aevol_misc_template_SOURCES = template.cpp # aevol_misc_transform_plasmid_SOURCES = transform_plasmid.cpp aevol_misc_view_SOURCES = view.cpp aevol-5.0/src/post_treatments/robustness.cpp0000644000175000017500000002525012724051151016344 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ============================================================================ // Includes // ============================================================================ #include #include #include #include #include #include #include #include #include #include #include "aevol.h" #include "IndivAnalysis.h" using std::list; using namespace aevol; // Helper functions void print_help(char* prog_path); void interpret_cmd_line_options(int argc, char* argv[]); // Command-line option variables static int32_t nb_children = 1000; static int32_t wanted_rank = -1; static int32_t wanted_index = -1; static int64_t timestep = -1; int main(int argc, char* argv[]) { interpret_cmd_line_options(argc, argv); // ---------------------- // Prepare the outputs // ---------------------- char directory_name[255]; snprintf(directory_name, 255, "analysis-generation_" TIMESTEP_FORMAT, timestep); // Check whether the directory already exists and is writable if (access(directory_name, F_OK) == 0) { if (access(directory_name, X_OK | W_OK) != 0) { fprintf(stderr, "Error: cannot enter or write in directory %s.\n", directory_name); exit(EXIT_FAILURE); } } else { // Create the directory with permissions : rwx r-x r-x if (mkdir(directory_name, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) != 0) { fprintf(stderr, "Error: cannot create directory %s.\n", directory_name); exit(EXIT_FAILURE); } } // ----------------------------------------------------------------------------------- // Load the backup and get the individual for which detailed information is desired // ----------------------------------------------------------------------------------- ExpManager* exp_manager = new ExpManager(); exp_manager->load(timestep, true, false); Individual* indiv_tmp = nullptr; // If neither a rank nor an index was provided, consider the best indiv if ((wanted_rank == -1) && (wanted_index == -1)) { indiv_tmp = exp_manager->best_indiv(); } else if (wanted_index != -1) { indiv_tmp = exp_manager->indiv_by_id(wanted_index); } else { indiv_tmp = exp_manager->indiv_by_rank(wanted_rank); } // Update id and rank wanted_index = indiv_tmp->id(); wanted_rank = indiv_tmp->rank(); IndivAnalysis wanted_indiv(*indiv_tmp); indiv_tmp = nullptr; // Now that we have the index and rank of the indiv of interest, we can // generate the output file name and hence open that file char filename[255]; snprintf(filename, 255, "%s/robustness-summary-%" PRId64 "-i%" PRId32 "-r%" PRId32, directory_name, timestep, wanted_index, wanted_rank); FILE* output_summary = fopen(filename, "w"); if (output_summary == nullptr) { Utils::ExitWithUsrMsg(std::string("Could not open file ") + filename); } snprintf(filename, 255, "%s/robustness-detailed-%" PRId64 "-i%" PRId32 "-r%" PRId32, directory_name, timestep, wanted_index, wanted_rank); FILE* output_detailed = fopen(filename, "w"); if (output_detailed == nullptr) { Utils::ExitWithUsrMsg(std::string("Could not open file ") + filename); } fprintf(output_summary, "###############################################################################\n"); fprintf(output_summary, "# Summary of the mutants generated from individual with rank %" PRId32 " and index %" PRId32 " at timestep %" PRId64 " \n", wanted_rank, wanted_index, timestep); fprintf(output_summary, "###############################################################################\n"); fprintf(output_summary, "# 1. Timestep\n"); fprintf(output_summary, "# 2. Proportion of mutants that are better than their parent\n"); fprintf(output_summary, "# 3. Proportion of mutants that are as good as their parent was\n"); fprintf(output_summary, "# 4. Proportion of mutants that are worse than their parent\n"); fprintf(output_summary, "# 5. Average difference in metabolic error btw good mutants and their parent\n"); fprintf(output_summary, "# 6. Average difference in metabolic error btw bad mutants and their parent\n"); fprintf(output_summary, "# 7. Maximum gain in metabolic error among good mutants\n"); fprintf(output_summary, "# 8. Maximum loss of metabolic error among bad mutants\n"); fprintf(output_summary, "###############################################################################\n"); fprintf(output_detailed, "###############################################################################\n"); fprintf(output_detailed, "# Mutants generated from individual with rank %" PRId32 " and index %" PRId32 " at timestep %" PRId64 " \n", wanted_rank, wanted_index, timestep); fprintf(output_detailed, "###############################################################################\n"); fprintf(output_detailed, "# 1. Parent id\n"); fprintf(output_detailed, "# 2. Parent metabolic error\n"); fprintf(output_detailed, "# 3. Parent secretion\n"); fprintf(output_detailed, "# 4. Mutant metabolic error\n"); fprintf(output_detailed, "# 5. Mutant secretion\n"); fprintf(output_detailed, "# 6. Mutant genome size\n"); fprintf(output_detailed, "# 7. Mutant number of functional genes\n"); fprintf(output_detailed, "###############################################################################\n"); wanted_indiv.Evaluate(); wanted_indiv.compute_statistical_data(); wanted_indiv.compute_non_coding(); wanted_indiv.compute_experimental_f_nu( nb_children, std::make_shared(time(nullptr)), output_summary, output_detailed); fclose(output_summary); fclose(output_detailed); delete exp_manager; return EXIT_SUCCESS; } /** * \brief print help and exist */ void print_help(char* prog_path) { // Get the program file-name in prog_name (strip prog_path of the path) char* prog_name; // No new, it will point to somewhere inside prog_path if ((prog_name = strrchr(prog_path, '/'))) { prog_name++; } else { prog_name = prog_path; } printf("******************************************************************************\n"); printf("* *\n"); printf("* aevol - Artificial Evolution *\n"); printf("* *\n"); printf("* Aevol is a simulation platform that allows one to let populations of *\n"); printf("* digital organisms evolve in different conditions and study experimentally *\n"); printf("* the mechanisms responsible for the structuration of the genome and the *\n"); printf("* transcriptome. *\n"); printf("* *\n"); printf("******************************************************************************\n"); printf("\n"); printf("%s:\n", prog_name); printf("\tComputes replication statistics of a given individual\n"); printf("\tThis is achieved by performing NB_MUTANTS replications\n"); printf("\tof the individual of interest and evaluating them\n"); printf("\n"); printf("Usage : %s -h or --help\n", prog_name); printf(" or : %s -V or --version\n", prog_name); printf(" or : %s [-t TIMESTEP] [-I INDEX | -R RANK] [-n NB_MUTANTS]\n", prog_name); printf("\nOptions\n"); printf(" -h, --help\n\tprint this help, then exit\n"); printf(" -V, --version\n\tprint version number, then exit\n"); printf(" -t, --timestep TIMESTEP\n"); printf("\tspecify timestep of the individual of interest\n"); printf(" -I, --index INDEX\n"); printf("\tspecify the index of the individual of interest\n"); printf(" -R, --rank RANK\n"); printf("\tspecify the rank of the individual of interest\n"); printf(" -n, --nb-mutants NB_MUTANTS\n"); printf("\tspecify the number of mutants to be generated\n"); } void interpret_cmd_line_options(int argc, char* argv[]) { const char* options_list = "hVt:n:R:I:"; static struct option long_options_list[] = { {"help", no_argument, NULL, 'h'}, {"version", no_argument, NULL, 'V'}, {"timestep", required_argument, NULL, 't'}, {"nb-mutants", required_argument, NULL, 'n'}, {"rank", required_argument, NULL, 'R'}, {"index", required_argument, NULL, 'I'}, {0, 0, 0, 0} }; int option; while ((option = getopt_long(argc, argv, options_list, long_options_list, NULL)) != -1) { switch (option) { case 'h' : print_help(argv[0]); exit(EXIT_SUCCESS); case 'V' : Utils::PrintAevolVersion(); exit(EXIT_SUCCESS); case 't' : timestep = atol(optarg); break; case 'n' : nb_children = atol(optarg); break; case 'R' : if (wanted_index != -1) { Utils::ExitWithUsrMsg("Options -R and -I are incompatible"); } wanted_rank = atol(optarg); break; case 'I' : if (wanted_rank != -1) { Utils::ExitWithUsrMsg("Options -R and -I are incompatible"); } wanted_index = atol(optarg); break; default : // An error message is printed in getopt_long, we just need to exit exit(EXIT_FAILURE); } } // If timestep wasn't provided, use default if (timestep < 0) { timestep = OutputManager::last_gener(); } } aevol-5.0/src/post_treatments/IndivAnalysis.cpp0000644000175000017500000001551612724051151016716 00000000000000// // Created by dparsons on 31/05/16. // // ============================================================================ // Includes // ============================================================================ #include "IndivAnalysis.h" #include "aevol.h" namespace aevol { // ============================================================================ // Definition of static attributes // ============================================================================ // ============================================================================ // Constructors // ============================================================================ IndivAnalysis::IndivAnalysis(const Individual& indiv) : Individual(indiv) { }; // ============================================================================ // Destructor // ============================================================================ // ============================================================================ // Methods // ============================================================================ /** * Compute reproduction theoretical proportion of neutral offsprings. * * Compute the theoretical proportion of neutral offsprings given Carole's * formula, based on the mutations and rearrangement rates and not on multiple * replications. * * \return theoretical proportion of neutral offsprings */ double IndivAnalysis::compute_theoritical_f_nu() { // We first have to collect information about genome structure. // Abbreviations are chosen according to Carole's formula. // Please notice that compared to the formula we have the beginning // and ends of neutral regions instead of 'functional regions' GeneticUnit& chromosome = genetic_unit_list_.front(); int32_t L = chromosome.dna()->length(); int32_t N_G = chromosome.nb_neutral_regions(); // which is not exactly Carole's original definition int32_t* b_i = chromosome.beginning_neutral_regions(); int32_t* e_i = chromosome.end_neutral_regions(); int32_t lambda = chromosome.nb_bases_in_neutral_regions(); int32_t l = L - lambda; // nb bases in 'functional regions' int32_t* lambda_i = NULL; // nb bases in ith neutral region if (N_G > 0) // all the chromosome may be functional { lambda_i = new int32_t[N_G]; for (int32_t i = 0; i < N_G - 1; i++) { lambda_i[i] = e_i[i] - b_i[i] + 1; } if (b_i[N_G - 1] > e_i[N_G - 1]) // last neutral region is overlapping on the beginning of chromosome { lambda_i[N_G - 1] = (e_i[N_G - 1] + L) - b_i[N_G - 1] + 1; } else // no overlap { lambda_i[N_G - 1] = e_i[N_G - 1] - b_i[N_G - 1] + 1; } } // we now compute the probabilities of neutral reproduction for // each type of mutation and rearrangement and update Fv double Fv = 1; // mutation + insertion + deletion double nu_local_mutation = 1 - ((double) l) / L; Fv = pow(1 - point_mutation_rate() * (1 - nu_local_mutation), L); Fv *= pow(1 - small_insertion_rate() * (1 - nu_local_mutation), L); Fv *= pow(1 - small_deletion_rate() * (1 - nu_local_mutation), L); // inversion ~ two local mutations double nu_inversion = nu_local_mutation * nu_local_mutation; Fv *= pow(1 - inversion_rate() * (1 - nu_inversion), L); // translocation ~ inversion + insertion (mathematically) Fv *= pow( 1 - translocation_rate() * (1 - nu_inversion * nu_local_mutation), L); // long deletion double nu_deletion = 0; // if N_G == 0, a deletion is always not neutral for (int32_t i = 0; i < N_G; i++) { nu_deletion += lambda_i[i] * (lambda_i[i] + 1); } nu_deletion /= ((double) 2 * L * L); Fv *= pow(1 - deletion_rate() * (1 - nu_deletion), L); // duplication ~ big deletion + insertion Fv *= pow(1 - duplication_rate() * (1 - nu_deletion * nu_local_mutation), L); if (lambda_i != NULL) delete[] lambda_i; return Fv; } /** * */ void IndivAnalysis::compute_experimental_f_nu( int32_t nb_indiv, std::shared_ptr prng, FILE* output_summary /* = nullptr*/, FILE* output_detailed /* = nullptr*/, bool verbose /* = false*/) { double nb_pos = 0; double cumul_delta_err_pos = 0; double nb_neg = 0; double cumul_delta_err_neg = 0; double max_pos = 0; double max_neg = 0; double nb_neutral = 0; int32_t nb_events = 0; double parent_metabolic_error = dist_to_target_by_feature(METABOLISM); for (int32_t i = 0; i < nb_indiv; i++) { Individual mutant(this, 0, prng, prng); // Perform transfer, rearrangements and mutations if (not mutant.allow_plasmids()) { const GeneticUnit* chromosome = &(mutant.genetic_unit_list().front()); nb_events = chromosome->dna()->perform_mutations(id_); } else { printf("WARNING: Mutational Robustness does not handle multiple " "Genetic Units\n"); } mutant.EvaluateInContext(habitat()); double new_metabolic_error = mutant.dist_to_target_by_feature( METABOLISM); if (new_metabolic_error == parent_metabolic_error) { nb_neutral++; } if (new_metabolic_error > parent_metabolic_error) { nb_neg++; if ((new_metabolic_error - parent_metabolic_error) > max_neg) { max_neg = new_metabolic_error - parent_metabolic_error; } cumul_delta_err_neg += new_metabolic_error - parent_metabolic_error; } if (new_metabolic_error < parent_metabolic_error) { nb_pos++; if ((new_metabolic_error - parent_metabolic_error) < max_pos) { max_pos = new_metabolic_error - parent_metabolic_error; } cumul_delta_err_pos += new_metabolic_error - parent_metabolic_error; } if (output_detailed) { mutant.compute_statistical_data(); fprintf(output_detailed, "%" PRId32 " %.15f %.15f %.15f %.15f% " PRId32 " %" PRId16 "\n", id_, parent_metabolic_error, dist_to_target_by_feature(SECRETION), mutant.dist_to_target_by_feature(METABOLISM), mutant.dist_to_target_by_feature(SECRETION), mutant.amount_of_dna(), mutant.nb_functional_genes()); } } if (verbose) { printf("f+: %f f0: %f f-:%f\n", nb_pos, nb_neutral, nb_neg); } if (output_summary) { fprintf(output_summary, "%" PRId64 " %.15f %.15f %.15f %.15f %.15f %.15f %.15f\n", AeTime::time(), nb_pos / nb_indiv, nb_neutral / nb_indiv, nb_neg / nb_indiv, cumul_delta_err_pos / nb_pos, cumul_delta_err_neg / nb_neg, max_pos, max_neg); } } // ============================================================================ // Non inline accessors // ============================================================================ } // namespace aevol aevol-5.0/src/post_treatments/extract.cpp0000644000175000017500000002756312724051151015620 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ============================================================================ // Includes // ============================================================================ #include #include #include #include "aevol.h" using namespace aevol; // Command-line option variables static char* triangles_file_name = nullptr; static char* sequence_file_name = nullptr; static bool best_only = true; static int16_t gu = -1; static int32_t timestep = -1; // Helper functions void print_help(char* prog_path); void interpret_cmd_line_options(int argc, char* argv[]); void analyse_indiv(Individual* indiv, FILE* triangles_file, FILE* sequence_file, int16_t gu, const PhenotypicTarget& phenotypicTarget); void analyse_gu(GeneticUnit* gen_unit, int32_t gen_unit_number, FILE* triangles_file, const PhenotypicTarget& phenotypicTarget); int main(int argc, char* argv[]) { interpret_cmd_line_options(argc, argv); // Open the files FILE* triangles_file = nullptr; FILE* sequence_file = nullptr; if (triangles_file_name != nullptr) { triangles_file = fopen(triangles_file_name, "w"); // Write file headers int key = 1; fprintf(triangles_file, "# %2.d individual's identifier (id)\n", key++); fprintf(triangles_file, "# %2.d chromosome or plasmid (c_or_p)\n", key++); fprintf(triangles_file, "# %2.d strand\n", key++); fprintf(triangles_file, "# %2.d protein position (pos)\n", key++); fprintf(triangles_file, "# %2.d length (len)\n", key++); fprintf(triangles_file, "# %2.d position of last translated nucleotide (lpos)\n", key++); fprintf(triangles_file, "# %2.d primary sequence (sequence)\n", key++); fprintf(triangles_file, "# %2.d mean (m)\n", key++); fprintf(triangles_file, "# %2.d width (w)\n", key++); fprintf(triangles_file, "# %2.d height (h)\n", key++); fprintf(triangles_file, "# %2.d concentration (c)\n", key++); fprintf(triangles_file, "# %2.d feature (f)\n", key++); fprintf(triangles_file, "# %2.d promoter position (prom_pos)\n", key++); fprintf(triangles_file, "# %2.d RNA length (rna_len)\n", key++); fprintf(triangles_file, "# %2.d basal level (basal_level)\n", key++); fprintf(triangles_file, "\n"); fprintf(triangles_file, "id c_or_p strand pos len lpos sequence m w h c f " "prom_pos rna_len basal_level\n"); } if (sequence_file_name != nullptr) { sequence_file = fopen(sequence_file_name,"w"); } auto exp_manager = new ExpManager(); exp_manager->load(timestep, false, false); // The best individual is already known because it is the last in the list // Thus we do not need to know anything about the environment and to evaluate // the individuals // Parse the individuals if (best_only) { Individual* best = exp_manager->best_indiv(); analyse_indiv(best, triangles_file, sequence_file, gu, best->habitat().phenotypic_target()); } else { for (const auto& indiv: exp_manager->indivs()) { analyse_indiv(indiv, triangles_file, sequence_file, gu, indiv->habitat().phenotypic_target()); } } if (sequence_file_name != nullptr) { fclose(sequence_file); } if (triangles_file_name != nullptr) { fclose(triangles_file); } delete [] triangles_file_name; delete [] sequence_file_name; delete exp_manager; return EXIT_SUCCESS; } // Parsing an individual inline void analyse_indiv(Individual* indiv, FILE* triangles_file, FILE* sequence_file, int16_t gu, const PhenotypicTarget & phenotypicTarget) { if (gu == -1) { // We want to treat all genetic units int32_t gen_unit_number = 0; for (auto& gen_unit: indiv->genetic_unit_list_nonconst()) { if (triangles_file != nullptr) { analyse_gu(&gen_unit, gen_unit_number, triangles_file, phenotypicTarget); } if (sequence_file != nullptr) { // The sequences of different GUs are separated by a space if (gen_unit_number > 0) fprintf(sequence_file, " "); const char* dna = gen_unit.dna()->data(); int32_t length = gen_unit.dna()->length(); fprintf(sequence_file, "%.*s", length, dna); } gen_unit_number++; } } else { // User has specified a genetic unit GeneticUnit* gen_unit = &indiv->genetic_unit_nonconst(gu); if (triangles_file != nullptr) { analyse_gu(gen_unit, gu, triangles_file, phenotypicTarget); } if (sequence_file != nullptr) { const char* dna = gen_unit->dna()->data(); int32_t length = gen_unit->dna()->length(); fprintf(sequence_file, "%.*s", length, dna); } } // We go to next line in each file if (triangles_file != nullptr) { fprintf(triangles_file, "\n"); } if (sequence_file != nullptr) { fprintf(sequence_file, "\n"); } } // Parsing a GU inline void analyse_gu(GeneticUnit* gen_unit, int32_t gen_unit_number, FILE* triangles_file, const PhenotypicTarget& phenotypicTarget) { // Construct the list of all rnas auto llrnas = gen_unit->rna_list(); auto lrnas = llrnas[LEADING]; lrnas.splice(lrnas.end(), llrnas[LAGGING]); // Parse this list int rna_nb = 0; for (const auto& rna: lrnas) { for (const auto& protein: rna.transcribed_proteins()) { double mean = protein->mean(); int nfeat = -1; for (size_t i = 0 ; i <= static_cast(phenotypicTarget.nb_segments()) - 1 ; ++i) { if ((mean > phenotypicTarget.segments()[i]->start) and (mean < phenotypicTarget.segments()[i]->stop)) { nfeat = phenotypicTarget.segments()[i]->feature; break; } } char *dummy; fprintf(triangles_file, "%" PRId32 " %s %s %" PRId32 " %" PRId32 " %" PRId32 " %s %f %f %f %f %d %" PRId32 " %" PRId32 " %f\n", gen_unit->indiv()->id(), gen_unit_number != 0 ? "PLASMID" : "CHROM ", protein->strand() == LEADING ? "LEADING" : "LAGGING", protein->first_translated_pos(), protein->length(), protein->last_translated_pos(), dummy = protein->AA_sequence('_'), mean, protein->width(), protein->height(), protein->concentration(), nfeat, rna.promoter_pos(), rna.transcript_length(), rna.basal_level()); delete dummy; } rna_nb++; } } void print_help(char* prog_path) { // Get the program file-name in prog_name (strip prog_path of the path) char* prog_name; // No new, it will point to somewhere inside prog_path if ((prog_name = strrchr(prog_path, '/'))) prog_name++; else prog_name = prog_path; printf("******************************************************************************\n"); printf("* *\n"); printf("* aevol - Artificial Evolution *\n"); printf("* *\n"); printf("* Aevol is a simulation platform that allows one to let populations of *\n"); printf("* digital organisms evolve in different conditions and study experimentally *\n"); printf("* the mechanisms responsible for the structuration of the genome and the *\n"); printf("* transcriptome. *\n"); printf("* *\n"); printf("******************************************************************************\n"); printf("\n"); printf("%s:\n", prog_name); printf("\tExtracts the genotype and/or data about the phenotype of individuals\n"); printf("\tin the provided population and write them into text files easy to parse\n"); printf("\twith e.g. matlab.\n"); printf("\n"); printf("Usage : %s -h\n", prog_name); printf(" or : %s -V or --version\n", prog_name); printf(" or : %s [-t TIMESTEP] [-S SEQ_FILE] [-T TRIANGLE_FILE] [-U NUM_GU] [-a]\n", prog_name); printf("\nOptions\n"); printf(" -h, --help\n\tprint this help, then exit\n"); printf(" -V, --version\n\tprint version number, then exit\n"); printf(" -t TIMESTEP\n"); printf("\tspecify timestep of the individual(s) of interest\n"); printf(" -S SEQ_FILE\n"); printf("\textract sequences into file SEQ_FILE\n"); printf(" -T TRIANGLE_FILE\n"); printf("\textract phenotypic data into file TRIANGLE_FILE\n"); printf(" -U NUM_GU\n"); printf("\tonly treat genetic unit #NUM_GU (default: treat all genetic units)\n"); printf(" -a\n"); printf("\ttreat all the individuals (default: treat only the best)\n"); } void interpret_cmd_line_options(int argc, char* argv[]) { // Define allowed options const char * options_list = "hVt:aU:S:T:"; static struct option long_options_list[] = { {"help", no_argument, nullptr, 'h'}, {"version", no_argument, nullptr, 'V'}, {"timestep", required_argument, nullptr, 't'}, {"all", no_argument, nullptr, 'a'}, {"gu", required_argument, nullptr, 'U'}, {"sequence", required_argument, nullptr, 'S'}, {"triangles", required_argument, nullptr, 'T'}, {0, 0, 0, 0} }; // Get actual values of the command-line options int option; while ((option = getopt_long(argc, argv, options_list, long_options_list, nullptr)) != -1) { switch (option) { case 'h' : { print_help(argv[0]); exit(EXIT_SUCCESS); } case 'V' : { Utils::PrintAevolVersion(); exit(EXIT_SUCCESS); } case 't' : { timestep = atol(optarg); break; } case 'a' : { best_only = false; break; } case 'U' : { gu = atoi(optarg); break; } case 'S' : { sequence_file_name = new char[strlen(optarg) + 1]; sprintf(sequence_file_name, "%s", optarg); break; } case 'T' : { triangles_file_name = new char[strlen(optarg) + 1]; sprintf(triangles_file_name, "%s", optarg); break; } } } // If timestep wasn't provided, use default if (timestep < 0) { timestep = OutputManager::last_gener(); } // If neither the sequence_file_name nor the triangles_file_name was provided, // we will output only the sequence in a default-named file if (sequence_file_name == nullptr && triangles_file_name == nullptr) { sequence_file_name = new char[255]; strcpy(sequence_file_name, "sequence"); } } aevol-5.0/src/post_treatments/view.cpp0000644000175000017500000001306712724051151015112 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ============================================================================ // Includes // ============================================================================ #include #include #include #ifdef __NO_X #error This program requires graphics libraries #else #include #endif #include "aevol.h" using namespace aevol; // Helper functions void print_help(char* prog_path); void interpret_cmd_line_options(int argc, char* argv[]); // Command-line option variables static int64_t timestep = -1; int main(int argc, char* argv[]) { interpret_cmd_line_options(argc, argv); // If timestep wasn't provided, use default if (timestep < 0) { timestep = OutputManager::last_gener(); } printf("Displaying timestep %" PRId64 "...\n", timestep); // ================================================================= // Read the backup file // ================================================================= // Load simulation from backup ExpManager_X11* exp_manager = new ExpManager_X11(); exp_manager->load(timestep, false, false); // ================================================================= // Draw the windows // ================================================================= // Display is off by default, switch it on exp_manager->toggle_display_on_off(); // Display is usually triggered in ExpManager::run_evolution(), here we want // to call it manually exp_manager->display(); // Handle user events until he quits while (not exp_manager->quit_signal_received()) { exp_manager->handle_events(); } delete exp_manager; return EXIT_SUCCESS; } void print_help(char* prog_path) { // Get the program file-name in prog_name (strip prog_path of the path) char* prog_name; // No new, it will point to somewhere inside prog_path if ((prog_name = strrchr(prog_path, '/'))) { prog_name++; } else { prog_name = prog_path; } printf("******************************************************************************\n"); printf("* *\n"); printf("* aevol - Artificial Evolution *\n"); printf("* *\n"); printf("* Aevol is a simulation platform that allows one to let populations of *\n"); printf("* digital organisms evolve in different conditions and study experimentally *\n"); printf("* the mechanisms responsible for the structuration of the genome and the *\n"); printf("* transcriptome. *\n"); printf("* *\n"); printf("******************************************************************************\n"); printf("\n"); printf("%s: view the simulation at the provided timestep\n", prog_name); printf("\n"); printf("Usage : %s -h or --help\n", prog_name); printf(" or : %s -V or --version\n", prog_name); printf(" or : %s [-t TIMESTEP]\n", prog_name); printf("\nOptions\n"); printf(" -h, --help\n\tprint this help, then exit\n\n"); printf(" -V, --version\n\tprint version number, then exit\n\n"); printf(" -t, --timestep TIMESTEP\n"); printf("\tspecify timestep to display (default value read in last_gener.txt)\n"); } void interpret_cmd_line_options(int argc, char* argv[]) { // Define allowed options const char* options_list = "hVt:"; static struct option long_options_list[] = { {"help", no_argument, nullptr, 'h'}, {"version", no_argument, nullptr, 'V'}, {"timestep", required_argument, nullptr, 't'}, {0, 0, 0, 0} }; // Get actual values of the CLI options int option; while ((option = getopt_long(argc, argv, options_list, long_options_list, nullptr)) != -1) { switch (option) { case 'h' : { print_help(argv[0]); exit(EXIT_SUCCESS); } case 'V' : { Utils::PrintAevolVersion(); exit(EXIT_SUCCESS); } case 't' : { timestep = atol(optarg); break; } default : { // An error message is printed in getopt_long, we just need to exit exit(EXIT_FAILURE); } } } } aevol-5.0/src/post_treatments/IndivAnalysis.h0000644000175000017500000000523412724051151016357 00000000000000// // Created by dparsons on 31/05/16. // #ifndef AEVOL_INDIVANALYSIS_H__ #define AEVOL_INDIVANALYSIS_H__ // ============================================================================ // Includes // ============================================================================ #include "Individual.h" namespace aevol { /** * */ class IndivAnalysis : public Individual { public : // ========================================================================== // Constructors // ========================================================================== IndivAnalysis() = default; //< Default ctor IndivAnalysis(const IndivAnalysis&) = delete; //< Copy ctor IndivAnalysis(IndivAnalysis&&) = delete; //< Move ctor IndivAnalysis(const Individual&); // ========================================================================== // Destructor // ========================================================================== virtual ~IndivAnalysis() = default; //< Destructor // ========================================================================== // Operators // ========================================================================== /// Copy assignment IndivAnalysis& operator=(const IndivAnalysis& other) = delete; /// Move assignment IndivAnalysis& operator=(IndivAnalysis&& other) = delete; // ========================================================================== // Public Methods // ========================================================================== double compute_theoritical_f_nu(); void compute_experimental_f_nu(int32_t nb_indiv, std::shared_ptr prng, FILE* output_summary = nullptr, FILE* output_detailed = nullptr, bool verbose = false); // ========================================================================== // Accessors // ========================================================================== protected : // ========================================================================== // Protected Methods // ========================================================================== // ========================================================================== // Attributes // ========================================================================== }; } // namespace aevol #endif //AEVOL_INDIVANALYSIS_H__ aevol-5.0/src/post_treatments/Makefile.in0000644000175000017500000006430212735464144015513 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = aevol_misc_ancestor_stats$(EXEEXT) \ aevol_misc_ancestor_robustness$(EXEEXT) \ aevol_misc_create_eps$(EXEEXT) aevol_misc_extract$(EXEEXT) \ aevol_misc_lineage$(EXEEXT) aevol_misc_mutagenesis$(EXEEXT) \ aevol_misc_robustness$(EXEEXT) $(am__EXEEXT_1) # aevol_misc_gene_families # aevol_misc_transform_plasmid @WITH_X_TRUE@am__append_1 = aevol_misc_view subdir = src/post_treatments ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \ $(top_srcdir)/m4/ax_boost_filesystem.m4 \ $(top_srcdir)/m4/ax_boost_system.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx_14.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @WITH_X_TRUE@am__EXEEXT_1 = aevol_misc_view$(EXEEXT) am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am_aevol_misc_ancestor_robustness_OBJECTS = \ ancestor_robustness.$(OBJEXT) IndivAnalysis.$(OBJEXT) aevol_misc_ancestor_robustness_OBJECTS = \ $(am_aevol_misc_ancestor_robustness_OBJECTS) aevol_misc_ancestor_robustness_LDADD = $(LDADD) aevol_misc_ancestor_robustness_DEPENDENCIES = \ $(top_srcdir)/src/libaevol/libaevol.a \ $(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a am_aevol_misc_ancestor_stats_OBJECTS = ancestor_stats.$(OBJEXT) aevol_misc_ancestor_stats_OBJECTS = \ $(am_aevol_misc_ancestor_stats_OBJECTS) aevol_misc_ancestor_stats_LDADD = $(LDADD) aevol_misc_ancestor_stats_DEPENDENCIES = \ $(top_srcdir)/src/libaevol/libaevol.a \ $(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a am_aevol_misc_create_eps_OBJECTS = create_eps.$(OBJEXT) aevol_misc_create_eps_OBJECTS = $(am_aevol_misc_create_eps_OBJECTS) aevol_misc_create_eps_LDADD = $(LDADD) aevol_misc_create_eps_DEPENDENCIES = \ $(top_srcdir)/src/libaevol/libaevol.a \ $(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a am_aevol_misc_extract_OBJECTS = extract.$(OBJEXT) aevol_misc_extract_OBJECTS = $(am_aevol_misc_extract_OBJECTS) aevol_misc_extract_LDADD = $(LDADD) aevol_misc_extract_DEPENDENCIES = \ $(top_srcdir)/src/libaevol/libaevol.a \ $(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a am_aevol_misc_lineage_OBJECTS = lineage.$(OBJEXT) aevol_misc_lineage_OBJECTS = $(am_aevol_misc_lineage_OBJECTS) aevol_misc_lineage_LDADD = $(LDADD) aevol_misc_lineage_DEPENDENCIES = \ $(top_srcdir)/src/libaevol/libaevol.a \ $(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a am_aevol_misc_mutagenesis_OBJECTS = mutagenesis.$(OBJEXT) aevol_misc_mutagenesis_OBJECTS = $(am_aevol_misc_mutagenesis_OBJECTS) aevol_misc_mutagenesis_LDADD = $(LDADD) aevol_misc_mutagenesis_DEPENDENCIES = \ $(top_srcdir)/src/libaevol/libaevol.a \ $(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a am_aevol_misc_robustness_OBJECTS = robustness.$(OBJEXT) \ IndivAnalysis.$(OBJEXT) aevol_misc_robustness_OBJECTS = $(am_aevol_misc_robustness_OBJECTS) aevol_misc_robustness_LDADD = $(LDADD) aevol_misc_robustness_DEPENDENCIES = \ $(top_srcdir)/src/libaevol/libaevol.a \ $(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a am_aevol_misc_view_OBJECTS = view.$(OBJEXT) aevol_misc_view_OBJECTS = $(am_aevol_misc_view_OBJECTS) aevol_misc_view_LDADD = $(LDADD) aevol_misc_view_DEPENDENCIES = $(top_srcdir)/src/libaevol/libaevol.a \ $(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) am__v_CXX_0 = @echo " CXX " $@; am__v_CXX_1 = CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) am__v_CXXLD_0 = @echo " CXXLD " $@; am__v_CXXLD_1 = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(aevol_misc_ancestor_robustness_SOURCES) \ $(aevol_misc_ancestor_stats_SOURCES) \ $(aevol_misc_create_eps_SOURCES) $(aevol_misc_extract_SOURCES) \ $(aevol_misc_lineage_SOURCES) \ $(aevol_misc_mutagenesis_SOURCES) \ $(aevol_misc_robustness_SOURCES) $(aevol_misc_view_SOURCES) DIST_SOURCES = $(aevol_misc_ancestor_robustness_SOURCES) \ $(aevol_misc_ancestor_stats_SOURCES) \ $(aevol_misc_create_eps_SOURCES) $(aevol_misc_extract_SOURCES) \ $(aevol_misc_lineage_SOURCES) \ $(aevol_misc_mutagenesis_SOURCES) \ $(aevol_misc_robustness_SOURCES) $(aevol_misc_view_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AEVOLCPPFLAGS = @AEVOLCPPFLAGS@ AEVOLCXXFLAGS = @AEVOLCXXFLAGS@ AEVOLLDFLAGS = @AEVOLLDFLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@ BOOST_LDFLAGS = @BOOST_LDFLAGS@ BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ HAVE_CXX11 = @HAVE_CXX11@ HAVE_CXX14 = @HAVE_CXX14@ HAVE_DOXYGEN = @HAVE_DOXYGEN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ XMKMF = @XMKMF@ X_CFLAGS = @X_CFLAGS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_LIBS = @X_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ ############################################ # Set a few variables # ############################################ ############################################ # C99 exact-width integer specific support # ############################################ # __STDC_FORMAT_MACROS allows us to use exact-width integer format specifiers e.g. PRId32 (for printf etc) # __STDC_CONSTANT_MACROS allows us to define exact-width integer macros with e.g. INT32_C( ) # __STDC_LIMIT_MACROS allows us to use exact-width integer limit macros with e.g. INT32_MAX #################################### # Add hardening option to compiler # #################################### # This replaces insecure unlimited length buffer function calls with # length-limited ones (required for debian and not a bad idea anyway). AM_CPPFLAGS = $(AEVOLCPPFLAGS) -I$(top_srcdir)/src/libaevol \ -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS \ -D__STDC_LIMIT_MACROS -D_FORTIFY_SOURCE=2 AM_CXXFLAGS = $(AEVOLCXXFLAGS) AM_LDFLAGS = $(AEVOLLDFLAGS) -L$(top_srcdir)/src/libaevol ############################################ # Set aevol library to use # ############################################ LDADD = $(top_srcdir)/src/libaevol/libaevol.a $(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a # noinst_PROGRAMS = aevol_misc_template CLEANFILES = $(bin_PROGRAMS) aevol_misc_ancestor_stats_SOURCES = ancestor_stats.cpp aevol_misc_ancestor_robustness_SOURCES = ancestor_robustness.cpp \ IndivAnalysis.cpp IndivAnalysis.h # hack to get make dist to \ include IndivAnalysis.h aevol_misc_create_eps_SOURCES = create_eps.cpp aevol_misc_extract_SOURCES = extract.cpp # aevol_misc_gene_families_SOURCES = gene_families.cpp aevol_misc_lineage_SOURCES = lineage.cpp aevol_misc_mutagenesis_SOURCES = mutagenesis.cpp aevol_misc_robustness_SOURCES = robustness.cpp IndivAnalysis.cpp \ IndivAnalysis.h # hack to get make dist to include \ IndivAnalysis.h # aevol_misc_template_SOURCES = template.cpp # aevol_misc_transform_plasmid_SOURCES = transform_plasmid.cpp aevol_misc_view_SOURCES = view.cpp all: all-am .SUFFIXES: .SUFFIXES: .cpp .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/post_treatments/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/post_treatments/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) aevol_misc_ancestor_robustness$(EXEEXT): $(aevol_misc_ancestor_robustness_OBJECTS) $(aevol_misc_ancestor_robustness_DEPENDENCIES) $(EXTRA_aevol_misc_ancestor_robustness_DEPENDENCIES) @rm -f aevol_misc_ancestor_robustness$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(aevol_misc_ancestor_robustness_OBJECTS) $(aevol_misc_ancestor_robustness_LDADD) $(LIBS) aevol_misc_ancestor_stats$(EXEEXT): $(aevol_misc_ancestor_stats_OBJECTS) $(aevol_misc_ancestor_stats_DEPENDENCIES) $(EXTRA_aevol_misc_ancestor_stats_DEPENDENCIES) @rm -f aevol_misc_ancestor_stats$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(aevol_misc_ancestor_stats_OBJECTS) $(aevol_misc_ancestor_stats_LDADD) $(LIBS) aevol_misc_create_eps$(EXEEXT): $(aevol_misc_create_eps_OBJECTS) $(aevol_misc_create_eps_DEPENDENCIES) $(EXTRA_aevol_misc_create_eps_DEPENDENCIES) @rm -f aevol_misc_create_eps$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(aevol_misc_create_eps_OBJECTS) $(aevol_misc_create_eps_LDADD) $(LIBS) aevol_misc_extract$(EXEEXT): $(aevol_misc_extract_OBJECTS) $(aevol_misc_extract_DEPENDENCIES) $(EXTRA_aevol_misc_extract_DEPENDENCIES) @rm -f aevol_misc_extract$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(aevol_misc_extract_OBJECTS) $(aevol_misc_extract_LDADD) $(LIBS) aevol_misc_lineage$(EXEEXT): $(aevol_misc_lineage_OBJECTS) $(aevol_misc_lineage_DEPENDENCIES) $(EXTRA_aevol_misc_lineage_DEPENDENCIES) @rm -f aevol_misc_lineage$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(aevol_misc_lineage_OBJECTS) $(aevol_misc_lineage_LDADD) $(LIBS) aevol_misc_mutagenesis$(EXEEXT): $(aevol_misc_mutagenesis_OBJECTS) $(aevol_misc_mutagenesis_DEPENDENCIES) $(EXTRA_aevol_misc_mutagenesis_DEPENDENCIES) @rm -f aevol_misc_mutagenesis$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(aevol_misc_mutagenesis_OBJECTS) $(aevol_misc_mutagenesis_LDADD) $(LIBS) aevol_misc_robustness$(EXEEXT): $(aevol_misc_robustness_OBJECTS) $(aevol_misc_robustness_DEPENDENCIES) $(EXTRA_aevol_misc_robustness_DEPENDENCIES) @rm -f aevol_misc_robustness$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(aevol_misc_robustness_OBJECTS) $(aevol_misc_robustness_LDADD) $(LIBS) aevol_misc_view$(EXEEXT): $(aevol_misc_view_OBJECTS) $(aevol_misc_view_DEPENDENCIES) $(EXTRA_aevol_misc_view_DEPENDENCIES) @rm -f aevol_misc_view$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(aevol_misc_view_OBJECTS) $(aevol_misc_view_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IndivAnalysis.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ancestor_robustness.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ancestor_stats.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/create_eps.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/extract.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lineage.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mutagenesis.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/robustness.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/view.Po@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ clean-binPROGRAMS clean-generic cscopelist-am ctags ctags-am \ distclean distclean-compile distclean-generic distclean-tags \ distdir dvi dvi-am html html-am info info-am install \ install-am install-binPROGRAMS install-data install-data-am \ install-dvi install-dvi-am install-exec install-exec-am \ install-html install-html-am install-info install-info-am \ install-man install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ ps ps-am tags tags-am uninstall uninstall-am \ uninstall-binPROGRAMS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: aevol-5.0/src/post_treatments/create_eps.cpp0000644000175000017500000012723312724051151016253 00000000000000// **************************************************************************** // // Aevol - An in silico experimental evolution platform // // **************************************************************************** // // Copyright: See the AUTHORS file provided with the package or // Web: http://www.aevol.fr/ // E-mail: See // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons // // 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 2 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 . // // **************************************************************************** // ============================================================================ // Includes // ============================================================================ #include #include #include #include #include #include #include // for the permission symbols used with mkdir #include "aevol.h" using namespace aevol; // ======== // TO DO // ======== // // * option --color ? // * Raevol-specific output (EPS file with the network) ? // Command-line option variables static int64_t timestep = -1; static int32_t indiv_index = -1; static int32_t indiv_rank = -1; // Helper functions void print_help(char* prog_path); void interpret_cmd_line_options(int argc, char* argv[]); // The height of each triangle is proportional to the product c*m, // where c is the concentration of the protein and m its intrinsic efficacy // (depending on its aminoacid sequence). // In the case of Raevol, the concentration used here is the final one, // i.e. the one reached after all the time steps of the lifetime. // If a coding sequence has several promoters, only one triangle is drawn. void draw_triangles(Individual* indiv, const PhenotypicTarget& target, char* directoryName); // In the case of Raevol, the profile is drawn using the final concentrations // of the proteins, i.e. the ones reached after all the time steps of the // lifetime. void draw_pos_neg_profiles(Individual* indiv, const PhenotypicTarget& target, char* directoryName); // In the case of Raevol, the phenotype is drawn using the final concentrations // of the proteins, i.e. the ones reached after all the time steps of the // lifetime. void draw_phenotype(Individual* indiv, const PhenotypicTarget& target, char* directoryName); // The chromosome is drawn as a circle. Coding sequences are represented by // arcs starting at the start codon and ending at the stop codon. // Coding sequences that are on the leading (resp. lagging) strand are // drawn outside (resp. inside) the circle. If a coding sequence has several // promoters, only one arc is drawn. void draw_genetic_unit_with_CDS(GeneticUnit* gen_unit, char* directoryName); // The chromosome is drawn as a circle. Transcribed sequences are represented // by arcs starting at the first transcribed position and ending at the last // transcribed position. mRNAs that are on the leading (resp. lagging) strand // are drawn outside (resp. inside) the circle. // mRNAs that include at least one coding sequence are black, // the others are gray. void draw_genetic_unit_with_mRNAs(GeneticUnit* gen_unit, char* directoryName); int main(int argc, char* argv[]) { interpret_cmd_line_options(argc, argv); printf("Creating eps files for generation %" PRId64 "...\n", timestep); // ================================================================= // Read the backup file // ================================================================= Individual* indiv; // Load the simulation ExpManager* exp_manager = new ExpManager(); exp_manager->load(timestep, true, false); if (indiv_index == -1 && indiv_rank == -1) { indiv = exp_manager->best_indiv(); } else { // TODO tmp disabled // if (indiv_rank != -1) { // indiv = new Individual(*exp_manager->indiv_by_rank(indiv_rank), false); // } // else { // indiv = new Individual(*exp_manager->indiv_by_id(indiv_index), false); // } } // The constructor of the exp_manager has read the genomes of the individuals // and located their promoters, but has not performed the translation nor the // phenotype computation. We must do it now. // However, as the individuals in the backups are sorted, we don't need to // evaluate all the individuals, only the one we are interested in indiv->Evaluate(); // ================================================================= // Create the EPS files // ================================================================= char directory_name[64]; snprintf(directory_name, 63, "analysis-generation_" TIMESTEP_FORMAT, timestep); // Check whether the directory already exists and is writable if (access(directory_name, F_OK) == 0) { // struct stat status; // stat(directory_name, &status); // if (status.st_mode & S_IFDIR) cout << "The directory exists." << endl; // else cout << "This path is a file." << endl; if (access(directory_name, X_OK | W_OK) != 0) { fprintf(stderr, "Error: cannot enter or write in directory %s.\n", directory_name); exit(EXIT_FAILURE); } } else { // Create the directory with permissions : rwx r-x r-x if (mkdir(directory_name, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) != 0) { fprintf(stderr, "Error: cannot create directory %s.\n", directory_name); exit(EXIT_FAILURE); } } // ================================================================= // Write the data in the EPS files // ================================================================= GeneticUnit* indiv_main_genome = &indiv->genetic_unit_nonconst(0); printf("Creating the EPS file with the triangles of the chosen individual... "); fflush(stdout); draw_triangles(indiv, indiv->phenotypic_target(), directory_name); printf("OK\n"); printf("Creating the EPS file with the positive and negatives profiles of the chosen individual... "); fflush(stdout); draw_pos_neg_profiles(indiv, indiv->phenotypic_target(), directory_name); printf("OK\n"); printf("Creating the EPS file with the phenotype of the chosen individual... "); fflush(stdout); draw_phenotype(indiv, indiv->phenotypic_target(), directory_name); printf("OK\n"); printf("Creating the EPS file with the CDS of the chosen individual... "); fflush(stdout); draw_genetic_unit_with_CDS(indiv_main_genome, directory_name); printf("OK\n"); printf("Creating the EPS file with the mRNAs of the chosen individual... "); fflush(stdout); draw_genetic_unit_with_mRNAs(indiv_main_genome, directory_name); printf("OK\n"); delete exp_manager; return EXIT_SUCCESS; } void draw_triangles(Individual* indiv, const PhenotypicTarget& target, char* directoryName) { const uint8_t bbsize = 200; // a4 paper: 595*842 double margin = 0.1; double scalex = 0.8*(1 - 2*margin); double scaley = 0.4*(1 - 2*margin); char filename[128]; snprintf(filename, 127, "%s/best_triangles.eps", directoryName); FILE * drawingfile = fopen(filename, "w"); fprintf(drawingfile, "%%!PS-Adobe-3.0 EPSF-3.0\n"); fprintf(drawingfile, "%%%%BoundingBox: 0 0 %d %d\n", bbsize, bbsize); fprintf(drawingfile, "%d %d scale\n", bbsize, bbsize); fprintf(drawingfile, "%d %d 8 [100 0 0 -100 0 100]\n",bbsize, bbsize); fprintf(drawingfile, "{currentfile 3 100 mul string readhexstring pop} bind\n"); // ----------------------------- // paint neutral zones in grey // ----------------------------- if (target.nb_segments() > 1) { int16_t nb_segments = target.nb_segments(); PhenotypicSegment** segments = target.segments(); for (int16_t i = 0 ; i < nb_segments ; i++) { if (segments[i]->feature == NEUTRAL) { fprintf(drawingfile, "%lf 0 moveto\n", margin + scalex * segments[i]->start); fprintf(drawingfile, "%lf 1 lineto\n", margin + scalex * segments[i]->start); fprintf(drawingfile, "%lf 1 lineto\n", margin + scalex * segments[i]->stop); fprintf(drawingfile, "%lf 0 lineto\n", margin + scalex * segments[i]->stop); fprintf(drawingfile, "closepath\n"); fprintf(drawingfile, "0.8 setgray\n"); fprintf(drawingfile, "fill\n"); fprintf(drawingfile, "0 setgray\n"); } } } // ----------- // draw axis // ----------- double arrowsize = 0.03; double arrowangle = 3.14/6; fprintf(drawingfile, "0.001 setlinewidth\n"); fprintf(drawingfile, "0 0 0 setrgbcolor\n"); // axis X + arrow fprintf(drawingfile, "%lf %lf moveto\n", margin/2, 0.5); fprintf(drawingfile, "%lf %lf lineto\n", 1-margin, 0.5); fprintf(drawingfile, "stroke\n"); fprintf(drawingfile, "%lf %lf moveto\n", 1-margin, 0.5); fprintf(drawingfile, "%lf %lf lineto\n", 1-margin-arrowsize*cos(arrowangle), 0.5 + arrowsize*sin(arrowangle)); fprintf(drawingfile, "stroke\n"); fprintf(drawingfile, "%lf %lf moveto\n", 1-margin, 0.5); fprintf(drawingfile, "%lf %lf lineto\n", 1-margin-arrowsize*cos(arrowangle), 0.5 - arrowsize*sin(arrowangle)); fprintf(drawingfile, "stroke\n"); // axis Y + arrow fprintf(drawingfile, "%lf %lf moveto\n", margin, margin/2); fprintf(drawingfile, "%lf %lf lineto\n", margin, 1-margin); fprintf(drawingfile, "%lf %lf moveto\n", margin, 1-margin); fprintf(drawingfile, "%lf %lf lineto\n", margin-arrowsize*sin(arrowangle), 1 - margin - arrowsize*cos(arrowangle)); fprintf(drawingfile, "stroke\n"); fprintf(drawingfile, "%lf %lf moveto\n", margin, 1-margin); fprintf(drawingfile, "%lf %lf lineto\n", margin+arrowsize*sin(arrowangle), 1 - margin - arrowsize*cos(arrowangle)); fprintf(drawingfile, "stroke\n"); // max degree = 1 fprintf(drawingfile, "[0.02 0.02] 0 setdash\n"); fprintf(drawingfile, "%lf %lf moveto\n", margin, 0.5 + 1.0*scaley); fprintf(drawingfile, "%lf %lf lineto\n", 1-margin, 0.5 + 1.0*scaley); fprintf(drawingfile, "stroke\n"); // ---------------- // draw triangles // ---------------- fprintf(drawingfile,"[ ] 0 setdash\n"); double h; for (auto& gu: indiv->genetic_unit_list_nonconst()) { // should use const version for (const auto& prot: gu.protein_list(LEADING)) { h = prot.height() * prot.concentration(); fprintf(drawingfile, "%lf %lf moveto\n", margin, 0.5); fprintf(drawingfile, "%lf %lf lineto\n", margin + scalex*(prot.mean() - prot.width()), 0.5); fprintf(drawingfile, "%lf %lf lineto\n", margin + scalex*(prot.mean()), 0.5 + scaley*(h)); fprintf(drawingfile, "%lf %lf lineto\n", margin + scalex*(prot.mean() + prot.width()), 0.5); fprintf(drawingfile, "%lf %lf moveto\n", margin + scalex*(1), 0.5); fprintf(drawingfile, "stroke\n"); } for (const auto& prot: gu.protein_list(LAGGING)) { h = prot.height() * prot.concentration(); fprintf(drawingfile, "%lf %lf moveto\n", margin, 0.5); fprintf(drawingfile, "%lf %lf lineto\n", margin + scalex*(prot.mean() - prot.width()), 0.5); fprintf(drawingfile, "%lf %lf lineto\n", margin + scalex*(prot.mean()), 0.5 + scaley*(h)); fprintf(drawingfile, "%lf %lf lineto\n", margin + scalex*(prot.mean() + prot.width()), 0.5); fprintf(drawingfile, "%lf %lf moveto\n", margin + scalex*(1), 0.5); fprintf(drawingfile, "stroke\n"); } } fprintf(drawingfile,"%%%%EOF\n"); fclose(drawingfile); } void draw_pos_neg_profiles(Individual* indiv, const PhenotypicTarget& target, char* directoryName) { const uint8_t bbsize = 200; // a4 paper: 595*842 double margin = 0.1; double scale = 0.8*(1 - 2*margin); char filename[128]; snprintf(filename, 127, "%s/best_pos_neg_profiles.eps", directoryName); FILE * drawingfile = fopen(filename, "w"); fprintf(drawingfile, "%%!PS-Adobe-3.0 EPSF-3.0\n"); fprintf(drawingfile, "%%%%BoundingBox: 0 0 %d %d\n", bbsize, bbsize); fprintf(drawingfile, "%d %d scale\n", bbsize, bbsize); fprintf(drawingfile, "%d %d 8 [100 0 0 -100 0 100]\n",bbsize, bbsize); fprintf(drawingfile, "{currentfile 3 100 mul string readhexstring pop} bind\n"); // ----------------------------- // paint neutral zones in grey // ----------------------------- if (target.nb_segments() > 1) { int16_t nb_segments = target.nb_segments(); PhenotypicSegment** segments = target.segments(); for (int16_t i = 0 ; i < nb_segments ; i++) { if (segments[i]->feature == NEUTRAL) { fprintf(drawingfile, "%lf 0 moveto\n", margin + scale * segments[i]->start); fprintf(drawingfile, "%lf 1 lineto\n", margin + scale * segments[i]->start); fprintf(drawingfile, "%lf 1 lineto\n", margin + scale * segments[i]->stop); fprintf(drawingfile, "%lf 0 lineto\n", margin + scale * segments[i]->stop); fprintf(drawingfile, "closepath\n"); fprintf(drawingfile, "0.8 setgray\n"); fprintf(drawingfile, "fill\n"); fprintf(drawingfile, "0 setgray\n"); } } } // ----------- // draw axis // ----------- double arrowsize = 0.03; double arrowangle = 3.14/6; fprintf(drawingfile, "0.001 setlinewidth\n"); fprintf(drawingfile, "0 0 0 setrgbcolor\n"); // axis X + arrow fprintf(drawingfile, "%lf %lf moveto\n", margin/2, 0.5); fprintf(drawingfile, "%lf %lf lineto\n", 1-margin, 0.5); fprintf(drawingfile, "stroke\n"); fprintf(drawingfile, "%lf %lf moveto\n", 1-margin, 0.5); fprintf(drawingfile, "%lf %lf lineto\n", 1-margin-arrowsize*cos(arrowangle), 0.5 + arrowsize*sin(arrowangle)); fprintf(drawingfile, "stroke\n"); fprintf(drawingfile, "%lf %lf moveto\n", 1-margin, 0.5); fprintf(drawingfile, "%lf %lf lineto\n", 1-margin-arrowsize*cos(arrowangle), 0.5 - arrowsize*sin(arrowangle)); fprintf(drawingfile, "stroke\n"); // axis Y + arrow fprintf(drawingfile, "%lf %lf moveto\n", margin, margin/2); fprintf(drawingfile, "%lf %lf lineto\n", margin, 1-margin); fprintf(drawingfile, "%lf %lf moveto\n", margin, 1-margin); fprintf(drawingfile, "%lf %lf lineto\n", margin-arrowsize*sin(arrowangle), 1 - margin - arrowsize*cos(arrowangle)); fprintf(drawingfile, "stroke\n"); fprintf(drawingfile, "%lf %lf moveto\n", margin, 1-margin); fprintf(drawingfile, "%lf %lf lineto\n", margin+arrowsize*sin(arrowangle), 1 - margin - arrowsize*cos(arrowangle)); fprintf(drawingfile, "stroke\n"); // ----------------------- // draw positive profile // ----------------------- fprintf(drawingfile,"[ ] 0 setdash\n"); fprintf(drawingfile, "0.002 setlinewidth\n"); fprintf(drawingfile, "%lf %lf moveto\n", margin, 0.5); if (indiv->exp_m()->exp_s()->get_fuzzy_flavor() == 0) for (const auto& p: ((Fuzzy*)indiv->phenotype_activ())->points()) fprintf(drawingfile, "%lf %lf lineto\n", margin + scale * p.x, 0.5 + scale * p.y); else for (int i=0; i < ((HybridFuzzy*)indiv->phenotype_activ())->get_pheno_size(); i++) { int xi = (int) ( i / ((HybridFuzzy*)indiv->phenotype_activ())->get_pheno_size()); fprintf(drawingfile, "%lf %lf lineto\n", margin + scale * xi, 0.5 + scale * ((HybridFuzzy*) indiv->phenotype_activ())->points()[i]); } fprintf(drawingfile, "stroke\n" ); // ----------------------- // draw negative profile // ----------------------- fprintf(drawingfile,"[ ] 0 setdash\n"); fprintf(drawingfile, "0.002 setlinewidth\n"); fprintf(drawingfile, "%lf %lf moveto\n", margin, 0.5); if (indiv->exp_m()->exp_s()->get_fuzzy_flavor() == 0) for (const auto& p: ((Fuzzy*)indiv->phenotype_inhib())->points()) fprintf( drawingfile, "%lf %lf lineto\n", margin + scale * p.x, 0.5 + scale * p.y); else for (int i=0; i < ((HybridFuzzy*)indiv->phenotype_inhib())->get_pheno_size(); i++) { int xi = (int) ( i / ((HybridFuzzy*)indiv->phenotype_inhib())->get_pheno_size()); fprintf(drawingfile, "%lf %lf lineto\n", margin + scale * xi, 0.5 + scale * ((HybridFuzzy*) indiv->phenotype_inhib())->points()[i]); } fprintf( drawingfile, "stroke\n" ); fprintf(drawingfile,"%%%%EOF\n"); fclose(drawingfile); } void draw_phenotype(Individual* indiv, const PhenotypicTarget& target, char* directoryName) { const uint8_t bbsize = 200; // a4 paper: 595*842 double margin = 0.1; double scale = 0.8*(1 - 2*margin); char filename[128]; snprintf(filename, 127, "%s/best_phenotype.eps", directoryName); FILE * drawingfile = fopen(filename, "w"); if (drawingfile == NULL) { fprintf(stderr, "Error: could not create the file %s\n", filename); return; } fprintf(drawingfile, "%%!PS-Adobe-3.0 EPSF-3.0\n"); fprintf(drawingfile, "%%%%BoundingBox: 0 0 %d %d\n", bbsize, bbsize); fprintf(drawingfile, "%d %d scale\n", bbsize, bbsize); fprintf(drawingfile, "%d %d 8 [100 0 0 -100 0 100]\n",bbsize, bbsize); fprintf(drawingfile, "{currentfile 3 100 mul string readhexstring pop} bind\n"); // ----------------------------- // paint neutral zones in grey // ----------------------------- if (target.nb_segments() > 1) { int16_t nb_segments = target.nb_segments(); PhenotypicSegment** segments = target.segments(); for (int16_t i = 0 ; i < nb_segments ; i++) { if (segments[i]->feature == NEUTRAL) { fprintf(drawingfile, "%lf 0 moveto\n", margin + scale * segments[i]->start); fprintf(drawingfile, "%lf 1 lineto\n", margin + scale * segments[i]->start); fprintf(drawingfile, "%lf 1 lineto\n", margin + scale * segments[i]->stop); fprintf(drawingfile, "%lf 0 lineto\n", margin + scale * segments[i]->stop); fprintf(drawingfile, "closepath\n"); fprintf(drawingfile, "0.8 setgray\n"); fprintf(drawingfile, "fill\n"); fprintf(drawingfile, "0 setgray\n"); } } } // ----------- // draw axis // ----------- double arrowsize = 0.03; double arrowangle = 3.14/6; fprintf(drawingfile, "0.001 setlinewidth\n"); fprintf(drawingfile, "0 0 0 setrgbcolor\n"); // axis X + arrow fprintf(drawingfile, "%lf %lf moveto\n", margin/2, margin); fprintf(drawingfile, "%lf %lf lineto\n", 1-margin, margin); fprintf(drawingfile, "stroke\n"); fprintf(drawingfile, "%lf %lf moveto\n", 1-margin, margin); fprintf(drawingfile, "%lf %lf lineto\n", 1-margin-arrowsize*cos(arrowangle), margin + arrowsize*sin(arrowangle)); fprintf(drawingfile, "stroke\n"); fprintf(drawingfile, "%lf %lf moveto\n", 1-margin, margin); fprintf(drawingfile, "%lf %lf lineto\n", 1-margin-arrowsize*cos(arrowangle), margin - arrowsize*sin(arrowangle)); fprintf(drawingfile, "stroke\n"); // axis Y + arrow fprintf(drawingfile, "%lf %lf moveto\n", margin, margin/2); fprintf(drawingfile, "%lf %lf lineto\n", margin, 1-margin); fprintf(drawingfile, "%lf %lf moveto\n", margin, 1-margin); fprintf(drawingfile, "%lf %lf lineto\n", margin-arrowsize*sin(arrowangle), 1 - margin - arrowsize*cos(arrowangle)); fprintf(drawingfile, "stroke\n"); fprintf(drawingfile, "%lf %lf moveto\n", margin, 1-margin); fprintf(drawingfile, "%lf %lf lineto\n", margin+arrowsize*sin(arrowangle), 1 - margin - arrowsize*cos(arrowangle)); fprintf(drawingfile, "stroke\n"); // max degree = 1 fprintf(drawingfile, "[0.02 0.02] 0 setdash\n"); fprintf(drawingfile, "%lf %lf moveto\n", margin, margin + 1*scale); fprintf(drawingfile, "%lf %lf lineto\n", 1-margin, margin + 1*scale); fprintf(drawingfile, "stroke\n"); // ---------------- // draw phenotype // ---------------- fprintf( drawingfile,"[ ] 0 setdash\n" ); fprintf( drawingfile, "0.002 setlinewidth\n" ); fprintf( drawingfile, "%lf %lf moveto\n", margin, margin); if (indiv->exp_m()->exp_s()->get_fuzzy_flavor() == 0) for (const auto& p: ((Fuzzy*)indiv->phenotype_activ())->points()) fprintf(drawingfile, "%lf %lf lineto\n", margin + scale * p.x, margin + scale * p.y); else for (int i=0; i < ((HybridFuzzy*)indiv->phenotype_activ())->get_pheno_size(); i++) { int xi = (int) ( i / ((HybridFuzzy*)indiv->phenotype_activ())->get_pheno_size()); fprintf(drawingfile, "%lf %lf lineto\n", margin + scale * xi, margin + scale * ((HybridFuzzy*) indiv->phenotype_activ())->points()[i]); } fprintf( drawingfile, "stroke\n" ); // ------------------ // draw environment // ------------------ fprintf( drawingfile,"[ ] 0 setdash\n" ); fprintf( drawingfile, "0.001 setlinewidth\n" ); fprintf( drawingfile, "%lf %lf moveto\n", margin, margin); if (indiv->exp_m()->exp_s()->get_fuzzy_flavor() == 0) for (const auto& p: ((Fuzzy*)target.fuzzy())->points()) fprintf(drawingfile, "%lf %lf lineto\n", margin + scale * p.x, margin + scale * p.y); else for (int i=0; i < ((HybridFuzzy*)target.fuzzy())->get_pheno_size(); i++) { int xi = (int) ( i / ((HybridFuzzy*)target.fuzzy())->get_pheno_size()); fprintf(drawingfile, "%lf %lf lineto\n", margin + scale * xi, margin + scale * ((HybridFuzzy*) target.fuzzy())->points()[i]); } fprintf( drawingfile, "stroke\n" ); fprintf(drawingfile,"%%%%EOF\n"); fclose(drawingfile); } void draw_genetic_unit_with_CDS(GeneticUnit* gen_unit, char* directoryName) { const uint8_t bbsize = 200; // a4 paper: 595*842 int32_t gen_length = (gen_unit->dna())->length(); double r = 0.35; double scale = 2*M_PI*r/gen_length; char filename[128]; snprintf(filename, 127, "%s/best_genome_with_CDS.eps", directoryName); FILE * drawingfile = fopen(filename, "w"); fprintf(drawingfile, "%%!PS-Adobe-3.0 EPSF-3.0\n"); fprintf(drawingfile, "%%%%BoundingBox: 0 0 %d %d\n", bbsize, bbsize); fprintf(drawingfile, "%d %d scale\n", bbsize, bbsize); fprintf(drawingfile, "%d %d 8 [100 0 0 -100 0 100]\n",bbsize, bbsize); fprintf(drawingfile, "{currentfile 3 100 mul string readhexstring pop} bind\n"); // ----------- // chromosome // ----------- fprintf(drawingfile, "0.001 setlinewidth\n"); fprintf(drawingfile, "0 0 0 setrgbcolor\n"); fprintf(drawingfile, "%lf %lf %lf 0 360 arc\n", 0.5, 0.5, r); // arcn = clockwise arc fprintf(drawingfile, "stroke\n"); // ----------- // scale // ----------- double scalesize = 0.15; fprintf(drawingfile, "%lf %lf moveto\n", 0.5-scalesize/2, 0.5); fprintf(drawingfile, "%lf %lf lineto\n", 0.5+scalesize/2, 0.5); fprintf(drawingfile, "stroke\n"); fprintf(drawingfile, "/Helvetica findfont\n"); fprintf(drawingfile, "0.035 scalefont\n"); fprintf(drawingfile, "setfont\n"); fprintf(drawingfile, "newpath\n"); fprintf(drawingfile, "%lf %lf moveto\n", 0.5-scalesize/3, 0.52); fprintf(drawingfile, "(scale : %.0lf bp) show\n", scalesize/scale); // ----------- // genes // ----------- int32_t first; int32_t last; int8_t layer = 0; int8_t outmost_layer = 1; int16_t nb_sect; int16_t rho; int16_t angle; bool sectors_free; int16_t alpha_first; int16_t alpha_last; int16_t theta_first; int16_t theta_last; // To handle gene overlaps, we remember where we have aldready drawn // something, with a precision of 1 degree. We handle up to 100 layers: // - 50 layers inside the circle (lagging strand), // - 50 layers outside the cricle (leading strand). // At first, only one layer is created, we create new layers when we // need them. bool* occupied_sectors[2][50]; occupied_sectors[LEADING][0] = new bool[360]; occupied_sectors[LAGGING][0] = new bool[360]; for (int16_t angle = 0 ; angle < 360 ; angle++) { occupied_sectors[LEADING][0][angle] = false; occupied_sectors[LAGGING][0][angle] = false; } // printf("LEADING\n"); for (const auto& prot: gen_unit->protein_list(LEADING)) { first = prot.first_translated_pos(); last = prot.last_translated_pos(); // h = prot.height() * prot.concentration(); alpha_first = (int16_t) round((double)(360 * first) / (double)gen_length); // == sect1 == alphaB alpha_last = (int16_t) round((double)(360 * last) / (double)gen_length); // == sect2 == alphaA theta_first = Utils::mod(90 - alpha_first, 360); // == tetaB theta_last = Utils::mod(90 - alpha_last, 360); // == tetaA if (theta_first == theta_last) theta_first = Utils::mod(theta_first + 1, 360); nb_sect = Utils::mod(theta_first - theta_last + 1, 360); // Outside the circle, look for the inmost layer that has all the sectors between // theta_first and theta_last free layer = 0; sectors_free = false; while (! sectors_free) { sectors_free = true; for (rho = 0 ; rho < nb_sect ; rho++) { if (occupied_sectors[LEADING][layer][Utils::mod(theta_first - rho, 360)]) { sectors_free = false; break; } } if (sectors_free) { break; // All the needed sectors are free on the current layer } else { layer++; if ((layer >= outmost_layer) && (layer < 49)) { // Add a new layer (actually, 2 layers, to maintain the symmetry) occupied_sectors[LEADING][outmost_layer] = new bool[360]; occupied_sectors[LAGGING][outmost_layer] = new bool[360]; for (int16_t angle = 0 ; angle < 360 ; angle++) { occupied_sectors[LEADING][outmost_layer][angle] = false; occupied_sectors[LAGGING][outmost_layer][angle] = false; } outmost_layer++; break; // A new layer is necessarily free, no need to look further } if (layer == 49) { // We shall not create a 51th layer, the CDS will be drawn on the // layer, probably over another CDS break; } } } // printf("f %d, l %d, af %d, al %d, tf %d, tl %d, nbsect %d, layer %d\n", first, last, alpha_first, alpha_last, theta_first, theta_last, nb_sect, layer); // Mark sectors to be drawn as occupied for (rho = 0 ; rho < nb_sect ; rho++) { occupied_sectors[LEADING][layer][Utils::mod(theta_first - rho, 360)] = true; } // Mark flanking sectors as occupied occupied_sectors[LEADING][layer][Utils::mod(theta_first + 1, 360)] = true; occupied_sectors[LEADING][layer][Utils::mod(theta_first - nb_sect, 360)] = true; // draw ! fprintf(drawingfile, "0.018 setlinewidth\n"); // fprintf(drawingfile, "%lf %lf %lf setrgbcolor\n", 1-(0.8*h/max_height + 0.2), 1-(0.8*h/max_height + 0.2),1-(0.8*h/max_height + 0.2)); layer++; // index starting at 0 but needed to start at 1 if (theta_last > theta_first) { fprintf(drawingfile, "newpath\n"); fprintf(drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r + layer*0.02, theta_last, 360); fprintf(drawingfile, "stroke\n"); fprintf(drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r + layer*0.02, 0, theta_first); fprintf(drawingfile, "stroke\n"); } else { fprintf(drawingfile, "newpath\n"); fprintf(drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r + layer*0.02, theta_last, theta_first); fprintf(drawingfile, "stroke\n"); } } // printf("LAGGING\n"); for (const auto& prot: gen_unit->protein_list(LAGGING)) { first = prot.first_translated_pos(); last = prot.last_translated_pos(); // h = prot.height() * prot.concentration(); alpha_first = (int16_t) round((double)(360 * first) / (double)gen_length); alpha_last = (int16_t) round((double)(360 * last) / (double)gen_length); theta_first = Utils::mod(90 - alpha_first, 360); theta_last = Utils::mod(90 - alpha_last, 360); if (theta_first == theta_last) theta_last = Utils::mod(theta_last + 1, 360); nb_sect = Utils::mod(theta_last - theta_first + 1, 360); // Inside the circle, look for the inmost layer that has all the sectors between // theta_first and theta_last free layer = 0; sectors_free = false; while (! sectors_free) { sectors_free = true; for (rho = 0 ; rho < nb_sect ; rho++) { if (occupied_sectors[LAGGING][layer][Utils::mod(theta_first + rho, 360)]) { sectors_free = false; break; } } if (sectors_free) { break; // All the needed sectors are free on the current layer } else { layer++; if ((layer >= outmost_layer) && (layer < 49)) { // Add a new layer (actually, 2 layers, to maintain the symmetry) occupied_sectors[LEADING][outmost_layer] = new bool[360]; occupied_sectors[LAGGING][outmost_layer] = new bool[360]; for (angle = 0 ; angle < 360 ; angle++) { occupied_sectors[LEADING][outmost_layer][angle] = false; occupied_sectors[LAGGING][outmost_layer][angle] = false; } outmost_layer++; break; // A new layer is necessarily free, no need to look further } if (layer == 49) { // We shall not create a 51th layer, the CDS will be drawn on the // layer, probably over another CDS break; } } } // printf("f %d, l %d, af %d, al %d, tf %d, tl %d, nbsect %d, layer %d\n", first, last, alpha_first, alpha_last, theta_first, theta_last, nb_sect, layer); // Mark sectors to be drawn as occupied for (rho = 0 ; rho < nb_sect ; rho++) { occupied_sectors[LAGGING][layer][Utils::mod(theta_first + rho, 360)] = true; } // Mark flanking sectors as occupied occupied_sectors[LAGGING][layer][Utils::mod(theta_first - 1, 360)] = true; occupied_sectors[LAGGING][layer][Utils::mod(theta_first + nb_sect, 360)] = true; // draw ! fprintf(drawingfile, "0.018 setlinewidth\n"); // fprintf(drawingfile, "%lf %lf %lf setrgbcolor\n", 1-(0.8*h/max_height + 0.2), 1-(0.8*h/max_height + 0.2),1-(0.8*h/max_height + 0.2)); layer++; // index starting at 0 but needed to start at 1 if (theta_first > theta_last) { fprintf(drawingfile, "newpath\n"); fprintf(drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r - layer*0.02, theta_first, 360); fprintf(drawingfile, "stroke\n"); fprintf(drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r - layer*0.02, 0, theta_last); fprintf(drawingfile, "stroke\n"); } else { fprintf(drawingfile, "newpath\n"); fprintf(drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r - layer*0.02, theta_first, theta_last); fprintf(drawingfile, "stroke\n"); } } fprintf(drawingfile,"showpage\n"); fprintf(drawingfile,"%%%%EOF\n"); fclose(drawingfile); for (layer = 0 ; layer < outmost_layer ; layer++) { delete occupied_sectors[LEADING][layer]; delete occupied_sectors[LAGGING][layer]; } } void draw_genetic_unit_with_mRNAs(GeneticUnit* gen_unit, char* directoryName) { const uint8_t bbsize = 200; // a4 paper: 595*842 int32_t gen_length = (gen_unit->dna())->length(); double r = 0.35; double scale = 2*M_PI*r/gen_length; char filename[128]; snprintf(filename, 127, "%s/best_genome_with_mRNAs.eps", directoryName); FILE * drawingfile = fopen(filename, "w"); fprintf(drawingfile, "%%!PS-Adobe-3.0 EPSF-3.0\n"); fprintf(drawingfile, "%%%%BoundingBox: 0 0 %d %d\n", bbsize, bbsize); fprintf(drawingfile, "%d %d scale\n", bbsize, bbsize); fprintf(drawingfile, "%d %d 8 [100 0 0 -100 0 100]\n",bbsize, bbsize); fprintf(drawingfile, "{currentfile 3 100 mul string readhexstring pop} bind\n"); // ----------- // chromosome // ----------- fprintf(drawingfile, "0.001 setlinewidth\n"); fprintf(drawingfile, "0 0 0 setrgbcolor\n"); fprintf(drawingfile, "%lf %lf %lf 0 360 arc\n", 0.5, 0.5, r); // arcn = clockwise arc fprintf(drawingfile, "stroke\n"); // ----------- // scale // ----------- double scalesize = 0.15; fprintf(drawingfile, "%lf %lf moveto\n", 0.5-scalesize/2, 0.5); fprintf(drawingfile, "%lf %lf lineto\n", 0.5+scalesize/2, 0.5); fprintf(drawingfile, "stroke\n"); fprintf(drawingfile, "/Helvetica findfont\n"); fprintf(drawingfile, "0.035 scalefont\n"); fprintf(drawingfile, "setfont\n"); fprintf(drawingfile, "newpath\n"); fprintf(drawingfile, "%lf %lf moveto\n", 0.5-scalesize/3, 0.52); fprintf(drawingfile, "(scale : %.0lf bp) show\n", scalesize/scale); // ----------- // mRNAs // ----------- int32_t first; int32_t last; int8_t layer = 0; int8_t outmost_layer = 1; int16_t nb_sect; int16_t rho; int16_t angle; bool sectors_free; int16_t alpha_first; int16_t alpha_last; int16_t theta_first; int16_t theta_last; // To handle gene overlaps, we remember where we have aldready drawn // something, with a precision of 1 degree. We handle up to 100 layers: // - 50 layers inside the circle (lagging strand), // - 50 layers outside the cricle (leading strand). // At first, only one layer is created, we create new layers when we // need them. bool* occupied_sectors[2][50]; occupied_sectors[LEADING][0] = new bool[360]; occupied_sectors[LAGGING][0] = new bool[360]; for (int16_t angle = 0 ; angle < 360 ; angle++) { occupied_sectors[LEADING][0][angle] = false; occupied_sectors[LAGGING][0][angle] = false; } for (const auto& rna: gen_unit->rna_list()[LEADING]) { first = rna.first_transcribed_pos(); last = rna.last_transcribed_pos(); alpha_first = (int16_t) round((double)(360 * first) / (double)gen_length); // == sect1 == alphaB alpha_last = (int16_t) round((double)(360 * last) / (double)gen_length); // == sect2 == alphaA theta_first = Utils::mod(90 - alpha_first, 360); // == tetaB theta_last = Utils::mod(90 - alpha_last, 360); // == tetaA if (theta_first == theta_last) theta_first = Utils::mod(theta_first + 1, 360); nb_sect = Utils::mod(theta_first - theta_last + 1, 360); // Outside the circle, look for the inmost layer that has all the sectors between // theta_first and theta_last free layer = 0; sectors_free = false; while (! sectors_free) { sectors_free = true; for (rho = 0 ; rho < nb_sect ; rho++) { if (occupied_sectors[LEADING][layer][Utils::mod(theta_first - rho, 360)]) { sectors_free = false; break; } } if (sectors_free) { break; // All the needed sectors are free on the current layer } else { layer++; if ((layer >= outmost_layer) && (layer < 49)) { // Add a new layer (actually, 2 layers, to maintain the symmetry) occupied_sectors[LEADING][outmost_layer] = new bool[360]; occupied_sectors[LAGGING][outmost_layer] = new bool[360]; for (int16_t angle = 0 ; angle < 360 ; angle++) { occupied_sectors[LEADING][outmost_layer][angle] = false; occupied_sectors[LAGGING][outmost_layer][angle] = false; } outmost_layer++; break; // A new layer is necessarily free, no need to look further } if (layer == 49) { // We shall not create a 51th layer, the CDS will be drawn on the // layer, probably over another CDS break; } } } // Mark sectors to be drawn as occupied for (rho = 0 ; rho < nb_sect ; rho++) { occupied_sectors[LEADING][layer][Utils::mod(theta_first - rho, 360)] = true; } // Mark flanking sectors as occupied occupied_sectors[LEADING][layer][Utils::mod(theta_first + 1, 360)] = true; occupied_sectors[LEADING][layer][Utils::mod(theta_first - nb_sect, 360)] = true; // draw ! fprintf(drawingfile, "0.018 setlinewidth\n"); if (rna.is_coding()) fprintf(drawingfile, "0 0 0 setrgbcolor\n"); else fprintf(drawingfile, "0.7 0.7 0.7 setrgbcolor\n"); layer++; // index starting at 0 but needed to start at 1 if (theta_last > theta_first) { fprintf(drawingfile, "newpath\n"); fprintf(drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r + layer*0.02, theta_last, 360); fprintf(drawingfile, "stroke\n"); fprintf(drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r + layer*0.02, 0, theta_first); fprintf(drawingfile, "stroke\n"); } else { fprintf(drawingfile, "newpath\n"); fprintf(drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r + layer*0.02, theta_last, theta_first); fprintf(drawingfile, "stroke\n"); } } for (const auto& rna: gen_unit->rna_list()[LAGGING]) { first = rna.first_transcribed_pos(); last = rna.last_transcribed_pos(); alpha_first = (int16_t) round((double)(360 * first) / (double)gen_length); alpha_last = (int16_t) round((double)(360 * last) / (double)gen_length); theta_first = Utils::mod(90 - alpha_first, 360); theta_last = Utils::mod(90 - alpha_last, 360); nb_sect = Utils::mod(alpha_first - alpha_last + 1, 360); // Inside the circle, look for the inmost layer that has all the sectors between // theta_first and theta_last free layer = 0; sectors_free = false; while (! sectors_free) { sectors_free = true; for (rho = 0 ; rho < nb_sect ; rho++) { if (occupied_sectors[LAGGING][layer][Utils::mod(theta_first + rho, 360)]) { sectors_free = false; break; } } if (sectors_free) { break; // All the needed sectors are free on the current layer } else { layer++; if ((layer >= outmost_layer) && (layer < 49)) { // Add a new layer (actually, 2 layers, to maintain the symmetry) occupied_sectors[LEADING][outmost_layer] = new bool[360]; occupied_sectors[LAGGING][outmost_layer] = new bool[360]; for (angle = 0 ; angle < 360 ; angle++) { occupied_sectors[LEADING][outmost_layer][angle] = false; occupied_sectors[LAGGING][outmost_layer][angle] = false; } outmost_layer++; break; // A new layer is necessarily free, no need to look further } if (layer == 49) { // We shall not create a 51th layer, the CDS will be drawn on the // layer, probably over another CDS break; } } } // Mark sectors to be drawn as occupied for (rho = 0 ; rho < nb_sect ; rho++) { occupied_sectors[LAGGING][layer][Utils::mod(theta_first + rho, 360)] = true; } // Mark flanking sectors as occupied occupied_sectors[LAGGING][layer][Utils::mod(theta_first - 1, 360)] = true; occupied_sectors[LAGGING][layer][Utils::mod(theta_first + nb_sect, 360)] = true; // draw ! fprintf(drawingfile, "0.018 setlinewidth\n"); if (rna.is_coding()) fprintf(drawingfile, "0 0 0 setrgbcolor\n"); else fprintf(drawingfile, "0.7 0.7 0.7 setrgbcolor\n"); layer++; // index starting at 0 but needed to start at 1 if (theta_first > theta_last) { fprintf(drawingfile, "newpath\n"); fprintf(drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r - layer*0.02, theta_first, 360); fprintf(drawingfile, "stroke\n"); fprintf(drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r - layer*0.02, 0, theta_last); fprintf(drawingfile, "stroke\n"); } else { fprintf(drawingfile, "newpath\n"); fprintf(drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r - layer*0.02, theta_first, theta_last); fprintf(drawingfile, "stroke\n"); } } fprintf(drawingfile,"showpage\n"); fprintf(drawingfile,"%%%%EOF\n"); fclose(drawingfile); for (layer = 0 ; layer < outmost_layer ; layer++) { delete occupied_sectors[LEADING][layer]; delete occupied_sectors[LAGGING][layer]; } } /** * \brief print help and exist */ void print_help(char* prog_path) { // Get the program file-name in prog_name (strip prog_path of the path) char* prog_name; // No new, it will point to somewhere inside prog_path if ((prog_name = strrchr(prog_path, '/'))) { prog_name++; } else { prog_name = prog_path; } printf("******************************************************************************\n"); printf("* *\n"); printf("* aevol - Artificial Evolution *\n"); printf("* *\n"); printf("* Aevol is a simulation platform that allows one to let populations of *\n"); printf("* digital organisms evolve in different conditions and study experimentally *\n"); printf("* the mechanisms responsible for the structuration of the genome and the *\n"); printf("* transcriptome. *\n"); printf("* *\n"); printf("******************************************************************************\n"); printf("\n"); printf("%s:\n", prog_name); printf("\tCreates EPS files with the triangles, the positive and negative\n"); printf("\tprofiles, the phenotype, the CDS and the mRNAs of the\n"); printf("\tindividual of interest.\n"); printf("\n"); printf("Usage : %s -h or --help\n", prog_name); printf(" or : %s -V or --version\n", prog_name); printf(" or : %s [-t TIMESTEP] [-I INDEX | -R RANK]\n", prog_name); printf("\nOptions\n"); printf(" -h, --help\n\tprint this help, then exit\n"); printf(" -V, --version\n\tprint version number, then exit\n"); printf(" -t, --timestep TIMESTEP\n"); printf("\tspecify timestep of the individual of interest\n"); printf(" -I, --index INDEX\n"); printf("\tspecify the index of the individual of interest\n"); printf(" -R, --rank RANK\n"); printf("\tspecify the rank of the individual of interest\n"); } void interpret_cmd_line_options(int argc, char* argv[]) { // Define allowed options const char * options_list = "hVI:R:t:"; static struct option long_options_list[] = { {"help", no_argument, NULL, 'h'}, {"version", no_argument, NULL, 'V' }, {"index", required_argument, NULL, 'I'}, {"rank", required_argument, NULL, 'R'}, {"timestep", required_argument, NULL, 't' }, { 0, 0, 0, 0 } }; // Get actual values of the command-line options int option; while ((option = getopt_long(argc, argv, options_list, long_options_list, NULL)) != -1) { switch (option) { case 'h' : { print_help(argv[0]); exit(EXIT_SUCCESS); } case 'V' : { Utils::PrintAevolVersion(); exit(EXIT_SUCCESS); } case 'I' : { indiv_index = atol(optarg); break; } case 'R' : { indiv_rank = atol(optarg); break; } case 't' : { if (strcmp(optarg, "") == 0) { printf("%s: error: Option -t or --timestep: missing argument.\n", argv[0]); exit(EXIT_FAILURE); } timestep = atol(optarg); break; } } } // If timestep wasn't provided, use default if (timestep < 0) { timestep = OutputManager::last_gener(); } // If neither the rank nor the index were provided, the individual of interest // will be the best individual at the provided timestep } aevol-5.0/examples/0000755000175000017500000000000012735464421011313 500000000000000aevol-5.0/examples/workflow/0000755000175000017500000000000012735464421013165 500000000000000aevol-5.0/examples/workflow/wild_type/0000755000175000017500000000000012735464421015165 500000000000000aevol-5.0/examples/workflow/wild_type/param.in0000644000175000017500000000241412730777745016551 00000000000000################################### # AEVOL PARAMATERS # ################################### ##### 1. Initial setup ############ SEED 486343 INIT_POP_SIZE 400 WORLD_SIZE 20 20 INIT_METHOD ONE_GOOD_GENE CLONE MAX_TRIANGLE_WIDTH 0.01 CHROMOSOME_INITIAL_LENGTH 5000 ##### 2. Selection ################ SELECTION_SCHEME fitness_proportionate 1000 ##### 3. Mutation rates ########### POINT_MUTATION_RATE 1e-5 SMALL_INSERTION_RATE 1e-5 SMALL_DELETION_RATE 1e-5 MAX_INDEL_SIZE 6 ##### 4. Rearrangement rates (w/o alignements) DUPLICATION_RATE 1e-5 DELETION_RATE 1e-5 TRANSLOCATION_RATE 1e-5 INVERSION_RATE 1e-5 ##### 5. Population Structure ##### ##### 6. Target function ########## ENV_SAMPLING 300 ENV_GAUSSIAN 0.5 0.2 0.05 ENV_GAUSSIAN 0.5 0.6 0.05 ENV_GAUSSIAN 0.5 0.8 0.05 ##### 7. Recording ################ RECORD_TREE true TREE_STEP 100 MORE_STATS false DUMP_STEP 0 BACKUP_STEP 1000 ##### 8. Environment variation #### ENV_VARIATION autoregressive_height_variation 0.05 5000 7687534 ##### 9. Phenotypic axis ########## ENV_AXIS_FEATURES METABOLISM aevol-5.0/examples/workflow/README0000644000175000017500000001500512730777745014001 00000000000000############################################################################### # The Workflow example ############################################################################### # This is the workflow example. It provides an example of one of the many # different workflows that can be used for experiments with Aevol. # # The main idea underlying this workflow is to parallel wet lab experiments, # which are conducted on evolved organisms. # To use already evolved organisms for Aevol experiments, one can either use # an evolved genome provided by the community or evolve his own. # This example does the latter (more complete) case. # # ################### # RECOMMENDATIONS # ################### # # It is strongly recommended you read the corresponding section in the user # manual while following this example since it contains an explanation for # each step of the example. # # The following set of commands should work as is if you have installed aevol # with make install, which is recommended. # # If you haven't installed aevol, you will nedd to either add the binaries' # locations in your PATH or to specify where to find them at each step. # They should be in /src for the 4 main executables # and in /src/post_treatments for the rest, being the # main aevol directory you have downloaded. # E.g. if your is /home/login/aevol, then the command # aevol_run -n 5000 will become /home/login/aevol/src/aevol_run -n 5000 # and ae_misc_lineage -e 10000 will become # /home/login/aevol/src/post_treatments/ae_misc_lineage -e 10000 # ############################################################################### # ========== Wild-Type generation ========== # #mkdir wild_type cd wild_type aevol_create aevol_run -n 5000 -p -1 # "-p -1" means you ask aevol to be run on n threads, with n # being determined by your system's settings # ========== Experimental setup ========== # # Propagate the experiment, meaning prepare directories for different # runs starting from the wild type # By default, the random generator states are modified so that you # don't end up with the exact same simulation repeated several times # but rather different repetitions with the same set of parameters # outdirsA="line01 line02 line03 line04 line05" outdirsB="line06 line07 line08 line09 line10" outdirsC="line11 line12 line13 line14 line15" for mydir in $outdirsA $outdirsB $outdirsC do aevol_propagate -o ../$mydir done # Go back to the workflow example directory cd .. # For each experiment, create a file with the parameters to change echo "# New environment ENV_GAUSSIAN 0.5 0.2 0.05 ENV_GAUSSIAN 0.5 0.4 0.05 ENV_GAUSSIAN 0.5 0.8 0.05 ENV_VARIATION none # New rearrangement rates DUPLICATION_RATE 1e-4 DELETION_RATE 1e-4 TRANSLOCATION_RATE 1e-4 INVERSION_RATE 1e-4" > newparam-groupA.in echo "# New environment ENV_GAUSSIAN 0.5 0.2 0.05 ENV_GAUSSIAN 0.5 0.4 0.05 ENV_GAUSSIAN 0.5 0.8 0.05 ENV_VARIATION none # New rearrangement rates DUPLICATION_RATE 1e-6 DELETION_RATE 1e-6 TRANSLOCATION_RATE 1e-6 INVERSION_RATE 1e-6" > newparam-groupB.in echo "# New environment ENV_GAUSSIAN 0.5 0.2 0.05 ENV_GAUSSIAN 0.5 0.4 0.05 ENV_GAUSSIAN 0.5 0.8 0.05 ENV_VARIATION none" > newparam-groupC.in # Apply these modifications # for mydir in $outdirsA do cd $mydir aevol_modify -f ../newparam-groupA.in cd .. done for mydir in $outdirsB do cd $mydir aevol_modify -f ../newparam-groupB.in cd .. done for mydir in $outdirsC do cd $mydir aevol_modify -f ../newparam-groupC.in cd .. done # ========== Run the simulations ========== # for mydir in $outdirsA $outdirsB $outdirsC do cd $mydir aevol_run -e 20000 -p -1 cd .. done # You can stop any simulation at any time and resume it from where you've # stopped it with the exact same command (from within the same directory) # e.g. # cd line01 # aevol_run -e 20000 -p -1 # ========== Analyse the outcome ========== # # A set of post-treatment tools is available to help analyse the outcome. # # ---------- aevol_misc_view ---------- # # The simplest miscellaneous tool is view. It allows one to # visualize a simulation at a given timestep using the exact # same graphical outputs used in aevol_run. # However, since it relies on graphics, it is only available when aevol is # compiled with x enabled (which is the default). # #cd line01 #aevol_misc_view #cd .. # ---------- aevol_misc_create_eps ---------- # # Similarly, one can obtain eps outputs for a given generation with the # create_eps tool. Files will be outputted in eps_files_xxxxxx (with # xxxxxx the generation number) # for mydir in $outdirsA $outdirsB $outdirsC do cd $mydir aevol_misc_create_eps & cd .. done # ---------- aevol_misc_robustness ---------- # # The robustness tool computes the replication statistics of all the # individuals of a given generation, like the proportion of neutral, beneficial, # deleterious offsprings. This is done by simulating nbchildren replications # for each individual (1000 replications by default), with its mutation, # rearrangement and transfer rates. Depending on those rates and genome # size, there can be several mutations per replication. Those global statistics # are written in stat/robustness_numgener.out, with one line per individual # in the specified generation. # The program also outputs detailed statistics for one of the individuals (the # best one by default). The detailed statistics for this individual are written in # stats/replication_numgener.out, with one line per simulated child of this # particular individual. # for mydir in $outdirsA $outdirsB $outdirsC do cd $mydir aevol_misc_robustness & cd .. done # ---------- aevol_misc_lineage ---------- # # One can reconstruct the lineage of an evolved individual. # This will generate a lineage file whose name will look like # lineage-b000000-e010000-i999-r1000.ae containing the complete mutational # history of a given individual of a given generation. # This file can then be used as the input for subsequent post-treatments. # for mydir in $outdirsA $outdirsB $outdirsC do cd $mydir aevol_misc_lineage cd .. done # ---------- aevol_misc_ancstats ---------- # # Statistics of a lineage can be obtained with this tool. # The generated output is in stats/ancstats/ # # The option -M adds the list of mutational events that occurred # on the lineage as an additional output (in stats/). # for mydir in $outdirsA $outdirsB $outdirsC do cd $mydir aevol_misc_ancestor_stats lineage-*.ae -M & cd .. done aevol-5.0/examples/basic/0000755000175000017500000000000012735464421012374 500000000000000aevol-5.0/examples/basic/param.in0000644000175000017500000000266412735461414013753 00000000000000################################### # AEVOL PARAMETERS # ################################### ##### 1. Initial setup ############ STRAIN_NAME basic_example SEED 7250909 INIT_POP_SIZE 1024 WORLD_SIZE 32 32 INIT_METHOD ONE_GOOD_GENE CLONE CHROMOSOME_INITIAL_LENGTH 5000 FUZZY_FLAVOR 0 ##### 2. Selection ################ SELECTION_SCHEME fitness_proportionate 1000 ##### 3. Mutation rates ########### POINT_MUTATION_RATE 1e-6 SMALL_INSERTION_RATE 1e-6 SMALL_DELETION_RATE 1e-6 MAX_INDEL_SIZE 6 ##### 4. Rearrangement rates (w/o alignements) WITH_ALIGNMENTS false DUPLICATION_RATE 1e-5 DELETION_RATE 1e-5 TRANSLOCATION_RATE 1e-5 INVERSION_RATE 1e-5 ##### 5. Population Structure ##### ##### 6. Target function ########## ENV_SAMPLING 300 ENV_ADD_GAUSSIAN 1.2 0.52 0.12 ENV_ADD_GAUSSIAN -1.4 0.5 0.07 ENV_ADD_GAUSSIAN 0.3 0.8 0.03 MAX_TRIANGLE_WIDTH 0.033333333 ##### 7. Recording ################ BACKUP_STEP 100 RECORD_TREE false MORE_STATS false ##### 8. Environment variation #### ENV_VARIATION none ##### 9. Phenotypic axis ########## ENV_AXIS_FEATURES METABOLISM ##### 10. Secretion ############### ##### 11. Plasmids ################ ALLOW_PLASMIDS false WITH_TRANSFER false aevol-5.0/Makefile.in0000644000175000017500000006056212735464143011474 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \ $(top_srcdir)/m4/ax_boost_filesystem.m4 \ $(top_srcdir)/m4/ax_boost_system.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx_14.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ $(am__configure_deps) $(am__DIST_COMMON) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope distdir dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in AUTHORS COPYING ChangeLog \ INSTALL NEWS README compile config.guess config.sub depcomp \ install-sh missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best DIST_TARGETS = dist-gzip distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AEVOLCPPFLAGS = @AEVOLCPPFLAGS@ AEVOLCXXFLAGS = @AEVOLCXXFLAGS@ AEVOLLDFLAGS = @AEVOLLDFLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@ BOOST_LDFLAGS = @BOOST_LDFLAGS@ BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ HAVE_CXX11 = @HAVE_CXX11@ HAVE_CXX14 = @HAVE_CXX14@ HAVE_DOXYGEN = @HAVE_DOXYGEN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ XMKMF = @XMKMF@ X_CFLAGS = @X_CFLAGS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_LIBS = @X_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # Specify the location of additional local Autoconf macros ACLOCAL_AMFLAGS = -I m4 SUBDIRS = src doc EXTRA_DIST = examples/basic/param.in \ examples/workflow/wild_type/param.in examples/workflow/README all: all-recursive .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build/sub \ && ../../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--refresh check check-am clean clean-cscope clean-generic \ cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \ distcheck distclean distclean-generic distclean-tags \ distcleancheck distdir distuninstallcheck dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: aevol-5.0/install-sh0000755000175000017500000003325512724051151011417 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2011-11-20.07; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: