Giter VIP home page Giter VIP logo

rmetasim's Introduction

rmetasim population genetic simulation engine

This software started as a c++ library (Strand, 2002) and has been modified to be a c++ backend and R frontend. The idea is to provide a flexible environment for designing and running forward-time genetic simulations. Populations can have complex demography and there can be arbitrary dispersal among them. Microsatellites, Infinite alleles and sequences can be simulated.

important recent changes (March 2016):

Several functions (landscape.amova.locus, landscape.locus, landscape.locus.states, landscape.mismatchdist, landscape.states) that access genetic information from landscapes had a strange order for parameters. That has been resolved to be the same as the rest of rmetasim, where the first argument is the landscape. If you have code that uses these and is based on rmetasim v<3.0, you will need to rearrange the parameters for these function calls, unless parameters were explicitly named in the calls.

Strand, A. Metasim 1.0: an individual-based environment for simulating population genetics of complex population dynamics. Mol. Ecol. Notes, 2:373-376, 2002

rmetasim's People

Contributors

stranda avatar thierrygosselin avatar ericarcher avatar robin-script avatar

Stargazers

 avatar  avatar

Watchers

James Cloos avatar  avatar  avatar  avatar

rmetasim's Issues

Speeding up landscape.setallelefreq()

I've been doing runs with the new landscape.setpopfreq() function and have noticed that for large landscapes, (e.g., five populations with 1000 individuals each), it runs very slowly. It seems like it can take up to an hour or more to set up the landscape on my MacBook Pro. I've done some profiling and it seems like the speed hit is related to multiple calls to is.landscape() in the nested for loop in landscape.setallelefreq() that calls landscape.locus.states().
What do you think of having another parameter to is.landscape() that is something like perform.check = TRUE. All functions that use it can take and pass this argument on and perform all checks by default, but if it is in a loop and doesn't need to be done each time, this can be set to FALSE and the first line is something simple, like

if(!perform.check) return(TRUE)

problem with macOS 10.15 (Catalina)

Hi Allan,
I'm running into problem installing rmetasim using R CMD INSTALL "rmetasim-master"
I'm following a code that worked very well before.

So my first guess is that it's related to specific missing/corrupted SDK library headers with macOS 10.15.

But just in case have you seen those errors before?

Compilation with clang:

* installing to library ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library’
* installing *source* package ‘rmetasim’ ...
** using staged installation
** libs
/usr/local/bin/clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include -I.  -fPIC  -Wall -g -O2  -c AlleleObj.cc -o AlleleObj.o
In file included from AlleleObj.cc:15:
In file included from ./RandLib.h:21:
In file included from ./metasim.h:29:
/usr/local/bin/../include/c++/v1/cmath:313:9: error: no member named 'signbit' in the global namespace
using ::signbit;
      ~~^
/usr/local/bin/../include/c++/v1/cmath:314:9: error: no member named 'fpclassify' in the global namespace
using ::fpclassify;
      ~~^
/usr/local/bin/../include/c++/v1/cmath:315:9: error: no member named 'isfinite' in the global namespace; did you mean 'finite'?
using ::isfinite;
      ~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/math.h:749:12: note: 'finite' declared here
extern int finite(double)
           ^
In file included from AlleleObj.cc:15:
In file included from ./RandLib.h:21:
In file included from ./metasim.h:29:
/usr/local/bin/../include/c++/v1/cmath:316:9: error: no member named 'isinf' in the global namespace
using ::isinf;
      ~~^
/usr/local/bin/../include/c++/v1/cmath:317:9: error: no member named 'isnan' in the global namespace
using ::isnan;
      ~~^
/usr/local/bin/../include/c++/v1/cmath:318:9: error: no member named 'isnormal' in the global namespace
using ::isnormal;
      ~~^
/usr/local/bin/../include/c++/v1/cmath:319:9: error: no member named 'isgreater' in the global namespace; did you mean 'greater'?
using ::isgreater;
      ~~^
/usr/local/bin/../include/c++/v1/functional:731:29: note: 'greater' declared here
struct _LIBCPP_TEMPLATE_VIS greater : binary_function<_Tp, _Tp, bool>
                            ^
In file included from AlleleObj.cc:15:
In file included from ./RandLib.h:21:
In file included from ./metasim.h:29:
/usr/local/bin/../include/c++/v1/cmath:320:9: error: no member named 'isgreaterequal' in the global namespace; did you mean 'greater_equal'?
using ::isgreaterequal;
      ~~^
/usr/local/bin/../include/c++/v1/functional:760:29: note: 'greater_equal' declared here
struct _LIBCPP_TEMPLATE_VIS greater_equal : binary_function<_Tp, _Tp, bool>
                            ^
In file included from AlleleObj.cc:15:
In file included from ./RandLib.h:21:
In file included from ./metasim.h:29:
/usr/local/bin/../include/c++/v1/cmath:321:9: error: no member named 'isless' in the global namespace
using ::isless;
      ~~^
/usr/local/bin/../include/c++/v1/cmath:322:9: error: no member named 'islessequal' in the global namespace; did you mean 'less_equal'?
using ::islessequal;
      ~~^
/usr/local/bin/../include/c++/v1/functional:787:29: note: 'less_equal' declared here
struct _LIBCPP_TEMPLATE_VIS less_equal : binary_function<_Tp, _Tp, bool>
                            ^
In file included from AlleleObj.cc:15:
In file included from ./RandLib.h:21:
In file included from ./metasim.h:29:
/usr/local/bin/../include/c++/v1/cmath:323:9: error: no member named 'islessgreater' in the global namespace
using ::islessgreater;
      ~~^
/usr/local/bin/../include/c++/v1/cmath:324:9: error: no member named 'isunordered' in the global namespace
using ::isunordered;
      ~~^
/usr/local/bin/../include/c++/v1/cmath:325:9: error: no member named 'isunordered' in the global namespace
using ::isunordered;
      ~~^
AlleleObj.cc:135:3: warning: 'random_shuffle<std::__1::__wrap_iter<char *>, int (&)(int)>' is deprecated [-Wdeprecated-declarations]
  random_shuffle(dnaseq.begin(), dnaseq.end(),randWrapper);
  ^
/usr/local/bin/../include/c++/v1/algorithm:3088:1: note: 'random_shuffle<std::__1::__wrap_iter<char *>, int (&)(int)>' has been explicitly
      marked deprecated here
_LIBCPP_DEPRECATED_IN_CXX14 void
^
/usr/local/bin/../include/c++/v1/__config:950:39: note: expanded from macro '_LIBCPP_DEPRECATED_IN_CXX14'
#  define _LIBCPP_DEPRECATED_IN_CXX14 _LIBCPP_DEPRECATED
                                      ^
/usr/local/bin/../include/c++/v1/__config:933:48: note: expanded from macro '_LIBCPP_DEPRECATED'
#    define _LIBCPP_DEPRECATED __attribute__ ((deprecated))
                                               ^
1 warning and 13 errors generated.
make: *** [AlleleObj.o] Error 1
ERROR: compilation failed for package ‘rmetasim’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rmetasim’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rmetasim’

compilation with gcc:

* installing to library ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library’
* installing *source* package ‘rmetasim’ ...
** using staged installation
** libs
/usr/local/bin/g++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fopenmp -std=c++11 -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c AlleleObj.cc -o AlleleObj.o
AlleleObj.cc:15:9: fatal error: RandLib.h: No such file or directory
   15 | #include<RandLib.h>
      |         ^~~~~~~~~~~
compilation terminated.
make: *** [AlleleObj.o] Error 1
ERROR: compilation failed for package ‘rmetasim’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rmetasim’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rmetasim’

I get the same thing with/without modifying rmetasim-master/src/const.h to get more loci

Best
Thierry

problem during development version install

Hi Allan, I tried to install the new version with the pull request merged and I'm getting this error while doing devtools::install_github("stranda/rmetasim")

Downloading GitHub repo stranda/rmetasim@master
from URL https://api.github.com/repos/stranda/rmetasim/zipball/master
Installing rmetasim
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL  \
  '/private/var/folders/l_/vmf27bgn4yv1fbdc_kghmzy00000gn/T/Rtmpi7pWp8/devtools1c14cc0efea/stranda-rmetasim-e9cb6b5'  \
  --library='/Library/Frameworks/R.framework/Versions/3.3/Resources/library' --install-tests 

* installing *source* packagermetasim...
** libs
/usr/local/bin/g++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include   -fopenmp -std=c++11 -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c AlleleObj.cc -o AlleleObj.o
AlleleObj.cc:15:20: fatal error: RandLib.h: No such file or directory
 #include<RandLib.h>
                    ^
compilation terminated.
make: *** [AlleleObj.o] Error 1
ERROR: compilation failed for packagermetasim* removing/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rmetasimError: Command failed (1)

devtools::system_info(pkgs = NULL)

Session info ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.3.1 (2016-06-21)
 system   x86_64, darwin13.4.0        
 ui       RStudio (0.99.1277)         
 language (EN)                        
 collate  en_CA.UTF-8                 
 tz       America/Montreal            
 date     2016-08-31   

hope this helps
Thierry

Separate allele frequencies for each population

Allan,
I'm getting back to setting up some rmetasim simulations. I'm using it to condition fastsimcoal2 simulations over a few generations to establish linkage disequilibrium. As such, I'd like to specify allele frequencies for each population separately, but I can't seem to work out if that's possible. The ability doesn't seem to be part of rmetasim::landscape.new.locus(). I thought it used to be in rmetasim::landscape.new.individuals(), but that seems to only take the number of individuals in stages and populations now. Is this possible in the current version?

Cheers,
Eric

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.