From 6c1d431b83f04bfc587ce0f672c1282f03be13f4 Mon Sep 17 00:00:00 2001 From: Marcelo Mollinari Date: Tue, 5 Mar 2024 18:51:21 -0500 Subject: [PATCH] fixing C++ One Definition Rule [-Wodr] detected by LTO (part2) --- CRAN-SUBMISSION | 3 - DESCRIPTION | 2 +- MAPpoly.Rproj | 4 +- NEWS.md | 3 + R/RcppExports.R | 12 +++ R/calc_genoprob.R | 22 ++--- R/haplotype_map_utils.R | 36 ++++---- cran-comments.md | 42 +++++---- src/RcppExports.cpp | 86 +++++++++++++++---- src/calc_genoprob.cpp | 24 ++---- src/calc_genoprob.h | 17 ++-- ...genoprob_based_on_phased_marker_blocks.cpp | 56 ++++-------- ...c_genoprob_based_on_phased_marker_blocks.h | 32 +++---- 13 files changed, 192 insertions(+), 147 deletions(-) delete mode 100644 CRAN-SUBMISSION diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION deleted file mode 100644 index fb3ade70..00000000 --- a/CRAN-SUBMISSION +++ /dev/null @@ -1,3 +0,0 @@ -Version: 0.4.0 -Date: 2024-02-17 17:13:39 UTC -SHA: a3d8cc1b1792b997061b175d181e72de8716f878 diff --git a/DESCRIPTION b/DESCRIPTION index 09f34a47..e4f3f8ba 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: mappoly Type: Package Title: Genetic Linkage Maps in Autopolyploids -Version: 0.4.0 +Version: 0.4.1 Authors@R: c(person(given = "Marcelo", family = "Mollinari", role = c("aut", "cre"), diff --git a/MAPpoly.Rproj b/MAPpoly.Rproj index a9398620..29e86a75 100755 --- a/MAPpoly.Rproj +++ b/MAPpoly.Rproj @@ -14,7 +14,7 @@ LaTeX: pdfLaTeX BuildType: Package PackageUseDevtools: Yes -PackageInstallArgs: --no-multiarch --with-keep.source --resave-data +PackageInstallArgs: --no-multiarch --with-keep.source --resave-data --use-LTO PackageBuildArgs: --resave-data -PackageCheckArgs: --no-vignettes --as-cran --install-args=--build --use-LTO +PackageCheckArgs: --no-vignettes --as-cran --install-args=--build PackageRoxygenize: rd,collate,namespace,vignette diff --git a/NEWS.md b/NEWS.md index a89dbd2b..a21b37eb 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,6 @@ +# MAPpoly version 0.4.1 + - Addressed the `--use-LTO` installation failure issue + # MAPpoly version 0.4.0 - Functions to build maps in individual parents - Functions to merge individual maps diff --git a/R/RcppExports.R b/R/RcppExports.R index bc7f57bb..a591069e 100644 --- a/R/RcppExports.R +++ b/R/RcppExports.R @@ -1,6 +1,18 @@ # Generated by using Rcpp::compileAttributes() -> do not edit by hand # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 +calc_genoprob_cpp <- function(m, geno, ph1, ph2, rf, probs, verbose) { + .Call('_mappoly_calc_genoprob_cpp', PACKAGE = 'mappoly', m, geno, ph1, ph2, rf, probs, verbose) +} + +calc_genprob_haplo_cpp <- function(m, n_mrk, n_ind, haplo, emit, rf, probs, verbose) { + .Call('_mappoly_calc_genprob_haplo_cpp', PACKAGE = 'mappoly', m, n_mrk, n_ind, haplo, emit, rf, probs, verbose) +} + +calc_genprob_haplo_highprec_cpp <- function(m, n_mrk, n_ind, haplo, emit, rf, probs, verbose) { + .Call('_mappoly_calc_genprob_haplo_highprec_cpp', PACKAGE = 'mappoly', m, n_mrk, n_ind, haplo, emit, rf, probs, verbose) +} + loglike_hmm_cpp <- function(m, geno, ph1, ph2, rf, verbose) { .Call('_mappoly_loglike_hmm_cpp', PACKAGE = 'mappoly', m, geno, ph1, ph2, rf, verbose) } diff --git a/R/calc_genoprob.R b/R/calc_genoprob.R index 84c1c503..dd271f50 100755 --- a/R/calc_genoprob.R +++ b/R/calc_genoprob.R @@ -96,17 +96,17 @@ calc_genoprob <- function(input.map, step = 0, phase.config = "best", verbose = phQ[rownames(Dtemp)] <- phQtemp seq.rf.pseudo <- mf_h(diff(map.pseudo)) } - for (j in 1:nrow(D)) - D[j, D[j, ] == input.map$info$ploidy + 1] <- dp[j] + dq[j] + 1 + as.numeric(dp[j] == 0 || dq[j] == 0) - res.temp <- .Call("calc_genoprob", - ploidy, - t(D), - phP, - phQ, - seq.rf.pseudo, - as.numeric(rep(0, choose(ploidy, ploidy/2)^2 * n.mrk * n.ind)), - verbose = verbose, - PACKAGE = "mappoly") + for (j in 1:nrow(D)){ + D[j, D[j, ] == input.map$info$ploidy + 1] <- dp[j] + dq[j] + 1 + + as.numeric(dp[j] == 0 || dq[j] == 0) + } + res.temp <- calc_genoprob_cpp(ploidy, + t(D), + phP, + phQ, + seq.rf.pseudo, + as.numeric(rep(0, choose(ploidy, ploidy/2)^2 * n.mrk * n.ind)), + verbose = verbose) if(verbose) cat("\n") dim(res.temp[[1]]) <- c(choose(ploidy,ploidy/2)^2,n.mrk,n.ind) dimnames(res.temp[[1]]) <- list(kronecker(apply(combn(letters[1:ploidy],ploidy/2),2, paste, collapse = ""), diff --git a/R/haplotype_map_utils.R b/R/haplotype_map_utils.R index 98374fd3..334a2eaa 100644 --- a/R/haplotype_map_utils.R +++ b/R/haplotype_map_utils.R @@ -258,27 +258,23 @@ calc_genoprob_haplo <- function(ploidy, n.mrk, n.ind, haplo, emit = NULL, } mrk.names <- names(haplo) if(highprec){ - res.temp <- .Call("calc_genprob_haplo_highprec", - ploidy, - n.mrk, - n.ind, - haplo, - emit, - rf_vec, - as.numeric(rep(0, choose(ploidy, ploidy/2)^2 * n.mrk * n.ind)), - verbose, - PACKAGE = "mappoly") + res.temp <- calc_genprob_haplo_highprec_cpp(ploidy, + n.mrk, + n.ind, + haplo, + emit, + rf_vec, + as.numeric(rep(0, choose(ploidy, ploidy/2)^2 * n.mrk * n.ind)), + verbose) } else{ - res.temp <- .Call("calc_genprob_haplo", - ploidy, - n.mrk, - n.ind, - haplo, - emit, - rf_vec, - as.numeric(rep(0, choose(ploidy, ploidy/2)^2 * n.mrk * n.ind)), - verbose, - PACKAGE = "mappoly") + res.temp <- calc_genprob_haplo_cpp(ploidy, + n.mrk, + n.ind, + haplo, + emit, + rf_vec, + as.numeric(rep(0, choose(ploidy, ploidy/2)^2 * n.mrk * n.ind)), + verbose) } if(verbose) cat("\n") dim(res.temp[[1]]) <- c(choose(ploidy,ploidy/2)^2,n.mrk,n.ind) diff --git a/cran-comments.md b/cran-comments.md index 1b5a5968..e05ff5df 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,39 +1,51 @@ ## Re-submission of MAPpoly package -This is a re-submission of MAPpoly package. This version (0.4.0), contains the following changes +This is a re-submission of the MAPpoly package. This version includes changes to address the issues that led to its archival on CRAN, specifically the failure in installing the package using `--use-LTO`. We have made corrections to ensure compatibility and successful installation with `--use-LTO`. - - Update DESCRIPTION file - - Functions to build maps in individual parents - - Functions to merge individual maps - - Imputation functions based on map - - Functions to edit order interactively - - Fix minor bugs +Changes in this submission include: + + - Addressed the `--use-LTO` installation failure issue Thank you for reviewing our re-submission! ## Test environments -* local R installation (macOS Somona 14.3.1), R 4.3.2 +* local R installation (macOS Sonoma 14.3.1), R 4.3.3 - Apple clang version 14.0.0 (clang-1400.0.29.202) - GNU Fortran (GCC) 12.2.0 -* local R installation (Ubuntu 22.04), R 4.3.2 +* local R installation (Ubuntu 22.04), R 4.3.3 - gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0 - GNU Fortran (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0 -* local R installation (Ubuntu 22.04), R devel with - - Intel(R) oneAPI DPC++/C++ Compiler 2024.0.2 (2024.0.2.20231213) - - ifx (IFX) 2024.0.2 20231213 + - Compiled using the following configuration: + + ./configure \ + --prefix=/opt/R/${R_VERSION} \ + --enable-R-shlib \ + --enable-memory-profiling \ + --with-blas \ + --with-lapack\ + --enable-lto=R + + And installed using `R CMD INSTALL --use-LTO mappoly_0.4.1.tar.gz` +* local R installation (Ubuntu 22.04), R devel + - Intel(R) oneAPI DPC++/C++ Compiler 2024.0.2 (2024.0.2.20231213) + - ifx (IFX) 2024.0.2 20231213 + * Win-builder (release and devel) + ## R CMD check results 0 errors | 0 warnings | 2 notes - - on local macOS: R 4.3.2 + - on local macOS: R 4.3.3 * installed size is 8.2Mb sub-directories of 1Mb or more: * R: 2.8Mb * data: 3.0Mb - * GNU make is a SystemRequirements. - + * GNU make is a SystemRequirements. + + - Checked with `--use-LTO` flag: Installation successful without any errors or warnings. + ## Downstream dependencies We checked 3 reverse dependencies (3 from CRAN + 0 from Bioconductor), comparing R CMD check results across CRAN and dev versions of this package. diff --git a/src/RcppExports.cpp b/src/RcppExports.cpp index e021adc0..5853cd03 100644 --- a/src/RcppExports.cpp +++ b/src/RcppExports.cpp @@ -10,6 +10,59 @@ Rcpp::Rostream& Rcpp::Rcout = Rcpp::Rcpp_cout_get(); Rcpp::Rostream& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get(); #endif +// calc_genoprob_cpp +List calc_genoprob_cpp(int m, NumericMatrix geno, List ph1, List ph2, NumericVector rf, std::vector probs, int verbose); +RcppExport SEXP _mappoly_calc_genoprob_cpp(SEXP mSEXP, SEXP genoSEXP, SEXP ph1SEXP, SEXP ph2SEXP, SEXP rfSEXP, SEXP probsSEXP, SEXP verboseSEXP) { +BEGIN_RCPP + Rcpp::RObject rcpp_result_gen; + Rcpp::RNGScope rcpp_rngScope_gen; + Rcpp::traits::input_parameter< int >::type m(mSEXP); + Rcpp::traits::input_parameter< NumericMatrix >::type geno(genoSEXP); + Rcpp::traits::input_parameter< List >::type ph1(ph1SEXP); + Rcpp::traits::input_parameter< List >::type ph2(ph2SEXP); + Rcpp::traits::input_parameter< NumericVector >::type rf(rfSEXP); + Rcpp::traits::input_parameter< std::vector >::type probs(probsSEXP); + Rcpp::traits::input_parameter< int >::type verbose(verboseSEXP); + rcpp_result_gen = Rcpp::wrap(calc_genoprob_cpp(m, geno, ph1, ph2, rf, probs, verbose)); + return rcpp_result_gen; +END_RCPP +} +// calc_genprob_haplo_cpp +List calc_genprob_haplo_cpp(int m, int n_mrk, int n_ind, List haplo, List emit, NumericVector rf, std::vector probs, int verbose); +RcppExport SEXP _mappoly_calc_genprob_haplo_cpp(SEXP mSEXP, SEXP n_mrkSEXP, SEXP n_indSEXP, SEXP haploSEXP, SEXP emitSEXP, SEXP rfSEXP, SEXP probsSEXP, SEXP verboseSEXP) { +BEGIN_RCPP + Rcpp::RObject rcpp_result_gen; + Rcpp::RNGScope rcpp_rngScope_gen; + Rcpp::traits::input_parameter< int >::type m(mSEXP); + Rcpp::traits::input_parameter< int >::type n_mrk(n_mrkSEXP); + Rcpp::traits::input_parameter< int >::type n_ind(n_indSEXP); + Rcpp::traits::input_parameter< List >::type haplo(haploSEXP); + Rcpp::traits::input_parameter< List >::type emit(emitSEXP); + Rcpp::traits::input_parameter< NumericVector >::type rf(rfSEXP); + Rcpp::traits::input_parameter< std::vector >::type probs(probsSEXP); + Rcpp::traits::input_parameter< int >::type verbose(verboseSEXP); + rcpp_result_gen = Rcpp::wrap(calc_genprob_haplo_cpp(m, n_mrk, n_ind, haplo, emit, rf, probs, verbose)); + return rcpp_result_gen; +END_RCPP +} +// calc_genprob_haplo_highprec_cpp +List calc_genprob_haplo_highprec_cpp(int m, int n_mrk, int n_ind, List haplo, List emit, NumericVector rf, std::vector probs, int verbose); +RcppExport SEXP _mappoly_calc_genprob_haplo_highprec_cpp(SEXP mSEXP, SEXP n_mrkSEXP, SEXP n_indSEXP, SEXP haploSEXP, SEXP emitSEXP, SEXP rfSEXP, SEXP probsSEXP, SEXP verboseSEXP) { +BEGIN_RCPP + Rcpp::RObject rcpp_result_gen; + Rcpp::RNGScope rcpp_rngScope_gen; + Rcpp::traits::input_parameter< int >::type m(mSEXP); + Rcpp::traits::input_parameter< int >::type n_mrk(n_mrkSEXP); + Rcpp::traits::input_parameter< int >::type n_ind(n_indSEXP); + Rcpp::traits::input_parameter< List >::type haplo(haploSEXP); + Rcpp::traits::input_parameter< List >::type emit(emitSEXP); + Rcpp::traits::input_parameter< NumericVector >::type rf(rfSEXP); + Rcpp::traits::input_parameter< std::vector >::type probs(probsSEXP); + Rcpp::traits::input_parameter< int >::type verbose(verboseSEXP); + rcpp_result_gen = Rcpp::wrap(calc_genprob_haplo_highprec_cpp(m, n_mrk, n_ind, haplo, emit, rf, probs, verbose)); + return rcpp_result_gen; +END_RCPP +} // loglike_hmm_cpp List loglike_hmm_cpp(int m, NumericMatrix geno, List ph1, List ph2, NumericVector rf, int verbose); RcppExport SEXP _mappoly_loglike_hmm_cpp(SEXP mSEXP, SEXP genoSEXP, SEXP ph1SEXP, SEXP ph2SEXP, SEXP rfSEXP, SEXP verboseSEXP) { @@ -75,32 +128,29 @@ BEGIN_RCPP END_RCPP } -RcppExport SEXP calc_genoprob(void *, void *, void *, void *, void *, void *, void *); -RcppExport SEXP calc_genoprob_prior(void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *); -RcppExport SEXP calc_genprob_haplo(void *, void *, void *, void *, void *, void *, void *, void *); -RcppExport SEXP calc_genprob_haplo_highprec(void *, void *, void *, void *, void *, void *, void *, void *); -RcppExport SEXP calc_genprob_single_parent(void *, void *, void *, void *, void *, void *, void *, void *); -RcppExport SEXP est_haplotype_map(void *, void *, void *, void *, void *, void *, void *, void *, void *); -RcppExport SEXP est_haplotype_map_highprec(void *, void *, void *, void *, void *, void *, void *, void *, void *); -RcppExport SEXP est_hmm_map_single_parent(void *, void *, void *, void *, void *, void *, void *, void *, void *); -RcppExport SEXP est_map_hmm(void *, void *, void *, void *, void *, void *, void *, void *); -RcppExport SEXP est_map_hmm_highprec(void *, void *, void *, void *, void *, void *, void *, void *); -RcppExport SEXP get_counts_single_parent_cpp(void *, void *, void *, void *, void *, void *); -RcppExport SEXP pairwise_rf_estimation_disc(void *, void *, void *, void *, void *, void *, void *); -RcppExport SEXP pairwise_rf_estimation_disc_rcpp(void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *); -RcppExport SEXP pairwise_rf_estimation_prob(void *, void *, void *, void *, void *, void *, void *, void *); -RcppExport SEXP poly_hmm_est_CPP(void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *); +RcppExport SEXP calc_genoprob_prior(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +RcppExport SEXP calc_genprob_single_parent(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +RcppExport SEXP est_haplotype_map(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +RcppExport SEXP est_haplotype_map_highprec(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +RcppExport SEXP est_hmm_map_single_parent(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +RcppExport SEXP est_map_hmm(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +RcppExport SEXP est_map_hmm_highprec(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +RcppExport SEXP get_counts_single_parent_cpp(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +RcppExport SEXP pairwise_rf_estimation_disc(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +RcppExport SEXP pairwise_rf_estimation_disc_rcpp(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +RcppExport SEXP pairwise_rf_estimation_prob(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +RcppExport SEXP poly_hmm_est_CPP(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); static const R_CallMethodDef CallEntries[] = { + {"_mappoly_calc_genoprob_cpp", (DL_FUNC) &_mappoly_calc_genoprob_cpp, 7}, + {"_mappoly_calc_genprob_haplo_cpp", (DL_FUNC) &_mappoly_calc_genprob_haplo_cpp, 8}, + {"_mappoly_calc_genprob_haplo_highprec_cpp", (DL_FUNC) &_mappoly_calc_genprob_haplo_highprec_cpp, 8}, {"_mappoly_loglike_hmm_cpp", (DL_FUNC) &_mappoly_loglike_hmm_cpp, 6}, {"_mappoly_vcf_get_probabilities", (DL_FUNC) &_mappoly_vcf_get_probabilities, 2}, {"_mappoly_vcf_transform_dosage", (DL_FUNC) &_mappoly_vcf_transform_dosage, 2}, {"_mappoly_vcf_get_ploidy", (DL_FUNC) &_mappoly_vcf_get_ploidy, 2}, {"_mappoly_vcf_get_depth", (DL_FUNC) &_mappoly_vcf_get_depth, 2}, - {"calc_genoprob", (DL_FUNC) &calc_genoprob, 7}, {"calc_genoprob_prior", (DL_FUNC) &calc_genoprob_prior, 12}, - {"calc_genprob_haplo", (DL_FUNC) &calc_genprob_haplo, 8}, - {"calc_genprob_haplo_highprec", (DL_FUNC) &calc_genprob_haplo_highprec, 8}, {"calc_genprob_single_parent", (DL_FUNC) &calc_genprob_single_parent, 8}, {"est_haplotype_map", (DL_FUNC) &est_haplotype_map, 9}, {"est_haplotype_map_highprec", (DL_FUNC) &est_haplotype_map_highprec, 9}, diff --git a/src/calc_genoprob.cpp b/src/calc_genoprob.cpp index 24c53038..2c178bd2 100755 --- a/src/calc_genoprob.cpp +++ b/src/calc_genoprob.cpp @@ -51,23 +51,15 @@ using namespace std; using namespace Rcpp; -RcppExport SEXP calc_genoprob(SEXP ploidyR, - SEXP genoR, - SEXP phPR, - SEXP phQR, - SEXP rfR, - SEXP probsR, - SEXP verboseR) +// [[Rcpp::export]] +List calc_genoprob_cpp(int m, + NumericMatrix geno, + List ph1, + List ph2, + NumericVector rf, + std::vector probs, + int verbose) { - //*convert input to C++ types - int m = Rcpp::as(ploidyR); - Rcpp::NumericMatrix geno(genoR); //(n.ind x n.col) - Rcpp::List ph1(phPR); - Rcpp::List ph2(phQR); - Rcpp::NumericVector rf(rfR); - std::vector probs = Rcpp::as >(probsR); - int verbose = Rcpp::as(verboseR); - //*Initializing some variables int g = nChoosek(m, m/2), k, k1; int n_mrk = geno.ncol(); // markers are disposed in columns diff --git a/src/calc_genoprob.h b/src/calc_genoprob.h index 16455270..668d6a11 100755 --- a/src/calc_genoprob.h +++ b/src/calc_genoprob.h @@ -17,10 +17,13 @@ For a copy of the GNU General Public License, please visit . */ -RcppExport SEXP calc_genoprob(SEXP ploidyR, - SEXP genoR, - SEXP phPR, - SEXP phQR, - SEXP rfR, - SEXP probsR, - SEXP verboseR); +using namespace std; +using namespace Rcpp; + +List calc_genoprob_cpp(int m, + NumericMatrix geno, + List ph1, + List ph2, + NumericVector rf, + std::vector probs, + int verbose); diff --git a/src/calc_genoprob_based_on_phased_marker_blocks.cpp b/src/calc_genoprob_based_on_phased_marker_blocks.cpp index 2242ab7a..d8978aae 100644 --- a/src/calc_genoprob_based_on_phased_marker_blocks.cpp +++ b/src/calc_genoprob_based_on_phased_marker_blocks.cpp @@ -51,25 +51,16 @@ using namespace std; using namespace Rcpp; -RcppExport SEXP calc_genprob_haplo(SEXP ploidyR, - SEXP n_mrkR, - SEXP n_indR, - SEXP haploR, - SEXP emitR, - SEXP rfR, - SEXP probsR, - SEXP verboseR) +// [[Rcpp::export]] +List calc_genprob_haplo_cpp(int m, + int n_mrk, + int n_ind, + List haplo, + List emit, + NumericVector rf, + std::vector probs, + int verbose) { - //convert input to C++ types - int m = Rcpp::as(ploidyR); - int n_mrk = Rcpp::as(n_mrkR); - int n_ind = Rcpp::as(n_indR); - Rcpp::List haplo(haploR); - Rcpp::List emit(emitR); - Rcpp::NumericVector rf(rfR); - int verbose = Rcpp::as(verboseR); - std::vector probs = Rcpp::as >(probsR); - //Initializing some variables int g = nChoosek(m, m/2), k, k1, count = 0; std::vector term(n_ind); @@ -175,27 +166,16 @@ RcppExport SEXP calc_genprob_haplo(SEXP ploidyR, List z = List::create(probs); return z ; } - - -RcppExport SEXP calc_genprob_haplo_highprec(SEXP ploidyR, - SEXP n_mrkR, - SEXP n_indR, - SEXP haploR, - SEXP emitR, - SEXP rfR, - SEXP probsR, - SEXP verboseR) +// [[Rcpp::export]] +List calc_genprob_haplo_highprec_cpp(int m, + int n_mrk, + int n_ind, + List haplo, + List emit, + NumericVector rf, + std::vector probs, + int verbose) { - //convert input to C++ types - int m = Rcpp::as(ploidyR); - int n_mrk = Rcpp::as(n_mrkR); - int n_ind = Rcpp::as(n_indR); - Rcpp::List haplo(haploR); - Rcpp::List emit(emitR); - Rcpp::NumericVector rf(rfR); - int verbose = Rcpp::as(verboseR); - std::vector probs = Rcpp::as >(probsR); - //Initializing some variables int g = nChoosek(m, m/2), k, k1, count = 0; std::vector term(n_ind); diff --git a/src/calc_genoprob_based_on_phased_marker_blocks.h b/src/calc_genoprob_based_on_phased_marker_blocks.h index a1ded9e3..bb66cc75 100644 --- a/src/calc_genoprob_based_on_phased_marker_blocks.h +++ b/src/calc_genoprob_based_on_phased_marker_blocks.h @@ -31,20 +31,20 @@ using namespace std; using namespace Rcpp; -RcppExport SEXP calc_genprob_haplo(SEXP ploidyR, - SEXP n_mrkR, - SEXP n_indR, - SEXP haploR, - SEXP emitR, - SEXP rfR, - SEXP probsR, - SEXP verboseR); +List calc_genprob_haplo_cpp(int m, + int n_mrk, + int n_ind, + List haplo, + List emit, + NumericVector rf, + std::vector probs, + int verbose); -RcppExport SEXP calc_genprob_haplo_highprec(SEXP ploidyR, - SEXP n_mrkR, - SEXP n_indR, - SEXP haploR, - SEXP emitR, - SEXP rfR, - SEXP probsR, - SEXP verboseR); \ No newline at end of file +List calc_genprob_haplo_highprec(int m, + int n_mrk, + int n_ind, + List haplo, + List emit, + NumericVector rf, + std::vector probs, + int verbose); \ No newline at end of file