diff --git a/.travis.yml b/.travis.yml index d361d3a..fb72bf5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,13 +6,18 @@ r: - release - devel -r_github_packages: - - jimhester/lintr - - jimhester/covr +r_packages: + - lintr + - covr after_success: - - Rscript tools/lint-and-covr.R + - Rscript -e "lintr::lint_package()" + - Rscript -e "library(covr); coveralls()" notifications: email: false +# Set CXX1X for R-devel, as R-devel does currently not detect CXX1X support for gcc 4.6.3 +# Check if we can remove this at some point in 2017 +before_install: +- if [[ "$TRAVIS_R_VERSION_STRING" = 'devel' ]]; then mkdir ~/.R && echo 'CXX1X=g++ -std=c++0x -g -O2 -fPIC' > ~/.R/Makevars; fi diff --git a/R/RcppExports.R b/R/RcppExports.R index 0b7c910..16f0280 100644 --- a/R/RcppExports.R +++ b/R/RcppExports.R @@ -1,4 +1,4 @@ -# This file was generated by Rcpp::compileAttributes +# Generated by using Rcpp::compileAttributes() -> do not edit by hand # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 #' Simulate the evolution of biological sequences diff --git a/scrmr.Rproj b/scrm-r.Rproj similarity index 59% rename from scrmr.Rproj rename to scrm-r.Rproj index 6608f32..21a4da0 100644 --- a/scrmr.Rproj +++ b/scrm-r.Rproj @@ -1,8 +1,8 @@ Version: 1.0 -RestoreWorkspace: No -SaveWorkspace: No -AlwaysSaveHistory: Yes +RestoreWorkspace: Default +SaveWorkspace: Default +AlwaysSaveHistory: Default EnableCodeIndexing: Yes UseSpacesForTab: Yes @@ -12,10 +12,6 @@ Encoding: UTF-8 RnwWeave: Sweave LaTeX: pdfLaTeX -AutoAppendNewline: Yes -StripTrailingWhitespace: Yes - BuildType: Package PackageUseDevtools: Yes PackageInstallArgs: --no-multiarch --with-keep.source -PackageRoxygenize: rd,collate,namespace diff --git a/src/RcppExports.cpp b/src/RcppExports.cpp index 20be6a2..f04480e 100644 --- a/src/RcppExports.cpp +++ b/src/RcppExports.cpp @@ -1,4 +1,4 @@ -// This file was generated by Rcpp::compileAttributes +// Generated by using Rcpp::compileAttributes() -> do not edit by hand // Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 #include @@ -9,44 +9,44 @@ using namespace Rcpp; List scrm(std::string args, std::string file); RcppExport SEXP scrm_scrm(SEXP argsSEXP, SEXP fileSEXP) { BEGIN_RCPP - Rcpp::RObject __result; - Rcpp::RNGScope __rngScope; + Rcpp::RObject rcpp_result_gen; + Rcpp::RNGScope rcpp_rngScope_gen; Rcpp::traits::input_parameter< std::string >::type args(argsSEXP); Rcpp::traits::input_parameter< std::string >::type file(fileSEXP); - __result = Rcpp::wrap(scrm(args, file)); - return __result; + rcpp_result_gen = Rcpp::wrap(scrm(args, file)); + return rcpp_result_gen; END_RCPP } // test_RRG_sample double test_RRG_sample(); RcppExport SEXP scrm_test_RRG_sample() { BEGIN_RCPP - Rcpp::RObject __result; - Rcpp::RNGScope __rngScope; - __result = Rcpp::wrap(test_RRG_sample()); - return __result; + Rcpp::RObject rcpp_result_gen; + Rcpp::RNGScope rcpp_rngScope_gen; + rcpp_result_gen = Rcpp::wrap(test_RRG_sample()); + return rcpp_result_gen; END_RCPP } // test_RRG_sampleUnitExpo double test_RRG_sampleUnitExpo(); RcppExport SEXP scrm_test_RRG_sampleUnitExpo() { BEGIN_RCPP - Rcpp::RObject __result; - Rcpp::RNGScope __rngScope; - __result = Rcpp::wrap(test_RRG_sampleUnitExpo()); - return __result; + Rcpp::RObject rcpp_result_gen; + Rcpp::RNGScope rcpp_rngScope_gen; + rcpp_result_gen = Rcpp::wrap(test_RRG_sampleUnitExpo()); + return rcpp_result_gen; END_RCPP } // test_RRG_sampleExpoExpoLimit double test_RRG_sampleExpoExpoLimit(double lambda, double b, double limit); RcppExport SEXP scrm_test_RRG_sampleExpoExpoLimit(SEXP lambdaSEXP, SEXP bSEXP, SEXP limitSEXP) { BEGIN_RCPP - Rcpp::RObject __result; - Rcpp::RNGScope __rngScope; + Rcpp::RObject rcpp_result_gen; + Rcpp::RNGScope rcpp_rngScope_gen; Rcpp::traits::input_parameter< double >::type lambda(lambdaSEXP); Rcpp::traits::input_parameter< double >::type b(bSEXP); Rcpp::traits::input_parameter< double >::type limit(limitSEXP); - __result = Rcpp::wrap(test_RRG_sampleExpoExpoLimit(lambda, b, limit)); - return __result; + rcpp_result_gen = Rcpp::wrap(test_RRG_sampleExpoExpoLimit(lambda, b, limit)); + return rcpp_result_gen; END_RCPP } diff --git a/src/scrm/model.cc b/src/scrm/model.cc index bd08d31..22d5f37 100644 --- a/src/scrm/model.cc +++ b/src/scrm/model.cc @@ -489,7 +489,7 @@ std::ostream& operator<<(std::ostream& os, Model& model) { for (size_t i = 0; i < n_pops; ++i) { for (size_t j = 0; j < n_pops; ++j) { if (model.single_mig_pop(i, j) != 0) { - os << " " << model.single_mig_pop(i, j) * 100 << "% of pop " + os << " " << model.single_mig_pop(i, j) << " of pop " << i + 1 << " move to pop " << j + 1 << std::endl; } } diff --git a/tools/update-source.sh b/tools/update-source.sh index 902e616..27930a7 100755 --- a/tools/update-source.sh +++ b/tools/update-source.sh @@ -4,8 +4,15 @@ # with files from scrm's git repo supposed to be at # ../scrm +mkdir tmp +git clone https://github.com/scrm/scrm tmp/ + + rsync -rvcA --exclude '.*'\ --include '*/'\ --include '*.cc' --include '*.h'\ --exclude='*'\ - ../scrm/src/* src/scrm/ + tmp/src/* src/scrm/ + +rm -rf tmp + diff --git a/vignettes/scrm-Arguments.Rmd b/vignettes/scrm-Arguments.Rmd index 27266a2..bc028f6 100644 --- a/vignettes/scrm-Arguments.Rmd +++ b/vignettes/scrm-Arguments.Rmd @@ -59,9 +59,10 @@ decline in population sizes. ### Summary Statistics * `-t < $\theta$ >`: Set the mutation rate to $\theta = 4N_0u$, where _u_ is the neutral mutation rate per locus. If this options is given, scrm generates the segregating sites output. +* `-transpose-segsites` or `--transpose-segsites`: If given, the segregating sites are printed with each row representing a mutation and each column representing a haplotype, rather than the other way round. Additionally, the time at which a mutation occurred is reported (in units of _4 * N0_ generations) [since v1.7.0]. * `-T`: Print the local genealogies in newick format. * `-O`: Print the local genealogies in the `oriented forest` format as described in [Kelleher _et al._ (2014)](http://dx.doi.org/10.1016/j.tpb.2014.05.001) [since v1.2]. -* `-L`: Print the TMRCA and the local tree length for each segment (behaves different to ms). +* `-L`: Print the TMRCA and the local tree length for each segment (behaves different to ms). Both values are scaled in coalescent time units, e.g. in _4 * N0_ generations. * `-oSFS`: Print the site frequency spectrum. Requires that the mutation rate $\theta$ is given with the '-t' option. * `-SC [ms|rel|abs]`: Scaling of sequence positions. Either relative to the locus length between 0 and 1 (`rel`), absolute in base pairs (`abs`) or `ms`'s scaling (default) where the positions in the _segregating sites_ output are relative, and the positions in the trees output are absolute (`ms`) [since v1.3.0].