Skip to content

Commit

Permalink
RegisteringDynamic Symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
EricArcher committed Apr 10, 2017
1 parent 1882eb1 commit d0c9f83
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 202 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ Collate:
gtypes2phyDat.R
df2gtypes.R
sequence2gtypes.R
LazyData: true
LazyData: TRUE
VignetteBuilder: knitr
LinkingTo: Rcpp
RoxygenNote: 6.0.1
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -238,4 +238,4 @@ importFrom(utils,read.csv)
importFrom(utils,unstack)
importFrom(utils,write.csv)
importFrom(utils,write.table)
useDynLib(strataG)
useDynLib(strataG, .registration = TRUE)
24 changes: 0 additions & 24 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,6 @@ statFis_C <- function(loci, strataMat) {
.Call('strataG_statFis_C', PACKAGE = 'strataG', loci, strataMat)
}

alleleFreqCalc <- function(locVec, strataRep) {
.Call('strataG_alleleFreqCalc', PACKAGE = 'strataG', locVec, strataRep)
}

prHetCalc <- function(locus, nalleles, strata, nvec, ploidy) {
.Call('strataG_prHetCalc', PACKAGE = 'strataG', locus, nalleles, strata, nvec, ploidy)
}

varCompCalc <- function(nvec, alleleFreq, prHet, r, nbar, rnbar, nc) {
.Call('strataG_varCompCalc', PACKAGE = 'strataG', nvec, alleleFreq, prHet, r, nbar, rnbar, nc)
}

fstCalc <- function(loci, strata, ploidy) {
.Call('strataG_fstCalc', PACKAGE = 'strataG', loci, strata, ploidy)
}

statFst_C <- function(loci, strataMat) {
.Call('strataG_statFst_C', PACKAGE = 'strataG', loci, strataMat)
}
Expand All @@ -101,14 +85,6 @@ statJostD_C <- function(loci, strataMat) {
.Call('strataG_statJostD_C', PACKAGE = 'strataG', loci, strataMat)
}

ssWPCalc <- function(strataFreq, strataHapFreq, hapDist) {
.Call('strataG_ssWPCalc', PACKAGE = 'strataG', strataFreq, strataHapFreq, hapDist)
}

ssAPCalc <- function(strataFreq, strataHapFreq, hapDist) {
.Call('strataG_ssAPCalc', PACKAGE = 'strataG', strataFreq, strataHapFreq, hapDist)
}

statPhist_C <- function(hapMat, strataMat, hapDist) {
.Call('strataG_statPhist_C', PACKAGE = 'strataG', hapMat, strataMat, hapDist)
}
Expand Down
2 changes: 1 addition & 1 deletion R/popStructStat.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#' @author Eric Archer \email{eric.archer@@noaa.gov}
#'
#' @name popStructStat
#' @useDynLib strataG
#' @useDynLib strataG, .registration = TRUE
#' @importFrom Rcpp sourceCpp
#'
NULL
Expand Down
83 changes: 0 additions & 83 deletions src/RcppExports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,63 +189,6 @@ BEGIN_RCPP
return rcpp_result_gen;
END_RCPP
}
// alleleFreqCalc
NumericMatrix alleleFreqCalc(IntegerVector locVec, IntegerVector strataRep);
RcppExport SEXP strataG_alleleFreqCalc(SEXP locVecSEXP, SEXP strataRepSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< IntegerVector >::type locVec(locVecSEXP);
Rcpp::traits::input_parameter< IntegerVector >::type strataRep(strataRepSEXP);
rcpp_result_gen = Rcpp::wrap(alleleFreqCalc(locVec, strataRep));
return rcpp_result_gen;
END_RCPP
}
// prHetCalc
NumericMatrix prHetCalc(IntegerVector locus, int nalleles, IntegerVector strata, IntegerVector nvec, int ploidy);
RcppExport SEXP strataG_prHetCalc(SEXP locusSEXP, SEXP nallelesSEXP, SEXP strataSEXP, SEXP nvecSEXP, SEXP ploidySEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< IntegerVector >::type locus(locusSEXP);
Rcpp::traits::input_parameter< int >::type nalleles(nallelesSEXP);
Rcpp::traits::input_parameter< IntegerVector >::type strata(strataSEXP);
Rcpp::traits::input_parameter< IntegerVector >::type nvec(nvecSEXP);
Rcpp::traits::input_parameter< int >::type ploidy(ploidySEXP);
rcpp_result_gen = Rcpp::wrap(prHetCalc(locus, nalleles, strata, nvec, ploidy));
return rcpp_result_gen;
END_RCPP
}
// varCompCalc
NumericMatrix varCompCalc(IntegerVector nvec, NumericMatrix alleleFreq, NumericMatrix prHet, int r, double nbar, double rnbar, double nc);
RcppExport SEXP strataG_varCompCalc(SEXP nvecSEXP, SEXP alleleFreqSEXP, SEXP prHetSEXP, SEXP rSEXP, SEXP nbarSEXP, SEXP rnbarSEXP, SEXP ncSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< IntegerVector >::type nvec(nvecSEXP);
Rcpp::traits::input_parameter< NumericMatrix >::type alleleFreq(alleleFreqSEXP);
Rcpp::traits::input_parameter< NumericMatrix >::type prHet(prHetSEXP);
Rcpp::traits::input_parameter< int >::type r(rSEXP);
Rcpp::traits::input_parameter< double >::type nbar(nbarSEXP);
Rcpp::traits::input_parameter< double >::type rnbar(rnbarSEXP);
Rcpp::traits::input_parameter< double >::type nc(ncSEXP);
rcpp_result_gen = Rcpp::wrap(varCompCalc(nvec, alleleFreq, prHet, r, nbar, rnbar, nc));
return rcpp_result_gen;
END_RCPP
}
// fstCalc
double fstCalc(IntegerMatrix loci, IntegerVector strata, int ploidy);
RcppExport SEXP strataG_fstCalc(SEXP lociSEXP, SEXP strataSEXP, SEXP ploidySEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< IntegerMatrix >::type loci(lociSEXP);
Rcpp::traits::input_parameter< IntegerVector >::type strata(strataSEXP);
Rcpp::traits::input_parameter< int >::type ploidy(ploidySEXP);
rcpp_result_gen = Rcpp::wrap(fstCalc(loci, strata, ploidy));
return rcpp_result_gen;
END_RCPP
}
// statFst_C
NumericVector statFst_C(IntegerMatrix loci, IntegerMatrix strataMat);
RcppExport SEXP strataG_statFst_C(SEXP lociSEXP, SEXP strataMatSEXP) {
Expand Down Expand Up @@ -319,32 +262,6 @@ BEGIN_RCPP
return rcpp_result_gen;
END_RCPP
}
// ssWPCalc
double ssWPCalc(IntegerVector strataFreq, IntegerMatrix strataHapFreq, NumericMatrix hapDist);
RcppExport SEXP strataG_ssWPCalc(SEXP strataFreqSEXP, SEXP strataHapFreqSEXP, SEXP hapDistSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< IntegerVector >::type strataFreq(strataFreqSEXP);
Rcpp::traits::input_parameter< IntegerMatrix >::type strataHapFreq(strataHapFreqSEXP);
Rcpp::traits::input_parameter< NumericMatrix >::type hapDist(hapDistSEXP);
rcpp_result_gen = Rcpp::wrap(ssWPCalc(strataFreq, strataHapFreq, hapDist));
return rcpp_result_gen;
END_RCPP
}
// ssAPCalc
double ssAPCalc(IntegerVector strataFreq, IntegerMatrix strataHapFreq, NumericMatrix hapDist);
RcppExport SEXP strataG_ssAPCalc(SEXP strataFreqSEXP, SEXP strataHapFreqSEXP, SEXP hapDistSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< IntegerVector >::type strataFreq(strataFreqSEXP);
Rcpp::traits::input_parameter< IntegerMatrix >::type strataHapFreq(strataHapFreqSEXP);
Rcpp::traits::input_parameter< NumericMatrix >::type hapDist(hapDistSEXP);
rcpp_result_gen = Rcpp::wrap(ssAPCalc(strataFreq, strataHapFreq, hapDist));
return rcpp_result_gen;
END_RCPP
}
// statPhist_C
NumericVector statPhist_C(IntegerMatrix hapMat, IntegerMatrix strataMat, List hapDist);
RcppExport SEXP strataG_statPhist_C(SEXP hapMatSEXP, SEXP strataMatSEXP, SEXP hapDistSEXP) {
Expand Down
66 changes: 66 additions & 0 deletions src/init.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// RegisteringDynamic Symbols

#include <R.h>
#include <Rinternals.h>
#include <stdlib.h> // for NULL
#include <R_ext/Rdynload.h>

/* FIXME:
Check these declarations against the C/Fortran source code.
*/

/* .Call calls */
extern SEXP strataG_calcStrataN(SEXP, SEXP, SEXP);
extern SEXP strataG_colMeanC(SEXP);
extern SEXP strataG_colSumC(SEXP);
extern SEXP strataG_getMaxInt(SEXP);
extern SEXP strataG_HoCalc(SEXP, SEXP, SEXP, SEXP, SEXP);
extern SEXP strataG_HsCalc(SEXP, SEXP, SEXP, SEXP, SEXP);
extern SEXP strataG_Hstats_C(SEXP, SEXP);
extern SEXP strataG_idGenotype(SEXP, SEXP, SEXP);
extern SEXP strataG_idStart(SEXP, SEXP);
extern SEXP strataG_intOuterC(SEXP, SEXP);
extern SEXP strataG_numOuterC(SEXP, SEXP);
extern SEXP strataG_rowSumC(SEXP);
extern SEXP strataG_statChi2_C(SEXP, SEXP);
extern SEXP strataG_statFis_C(SEXP, SEXP);
extern SEXP strataG_statFst_C(SEXP, SEXP);
extern SEXP strataG_statFstPrime_C(SEXP, SEXP);
extern SEXP strataG_statGst_C(SEXP, SEXP);
extern SEXP strataG_statGstDblPrime_C(SEXP, SEXP);
extern SEXP strataG_statGstPrime_C(SEXP, SEXP, SEXP);
extern SEXP strataG_statJostD_C(SEXP, SEXP);
extern SEXP strataG_statPhist_C(SEXP, SEXP, SEXP);
extern SEXP strataG_table2D(SEXP, SEXP);

static const R_CallMethodDef CallEntries[] = {
{"strataG_calcStrataN", (DL_FUNC) &strataG_calcStrataN, 3},
{"strataG_colMeanC", (DL_FUNC) &strataG_colMeanC, 1},
{"strataG_colSumC", (DL_FUNC) &strataG_colSumC, 1},
{"strataG_getMaxInt", (DL_FUNC) &strataG_getMaxInt, 1},
{"strataG_HoCalc", (DL_FUNC) &strataG_HoCalc, 5},
{"strataG_HsCalc", (DL_FUNC) &strataG_HsCalc, 5},
{"strataG_Hstats_C", (DL_FUNC) &strataG_Hstats_C, 2},
{"strataG_idGenotype", (DL_FUNC) &strataG_idGenotype, 3},
{"strataG_idStart", (DL_FUNC) &strataG_idStart, 2},
{"strataG_intOuterC", (DL_FUNC) &strataG_intOuterC, 2},
{"strataG_numOuterC", (DL_FUNC) &strataG_numOuterC, 2},
{"strataG_rowSumC", (DL_FUNC) &strataG_rowSumC, 1},
{"strataG_statChi2_C", (DL_FUNC) &strataG_statChi2_C, 2},
{"strataG_statFis_C", (DL_FUNC) &strataG_statFis_C, 2},
{"strataG_statFst_C", (DL_FUNC) &strataG_statFst_C, 2},
{"strataG_statFstPrime_C", (DL_FUNC) &strataG_statFstPrime_C, 2},
{"strataG_statGst_C", (DL_FUNC) &strataG_statGst_C, 2},
{"strataG_statGstDblPrime_C", (DL_FUNC) &strataG_statGstDblPrime_C, 2},
{"strataG_statGstPrime_C", (DL_FUNC) &strataG_statGstPrime_C, 3},
{"strataG_statJostD_C", (DL_FUNC) &strataG_statJostD_C, 2},
{"strataG_statPhist_C", (DL_FUNC) &strataG_statPhist_C, 3},
{"strataG_table2D", (DL_FUNC) &strataG_table2D, 2},
{NULL, NULL, 0}
};

void R_init_strataG(DllInfo *dll)
{
R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
R_useDynamicSymbols(dll, FALSE);
}
78 changes: 0 additions & 78 deletions src/registerDynamicSymbols.cpp

This file was deleted.

9 changes: 0 additions & 9 deletions src/statFst_C.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include <Rcpp.h>
using namespace Rcpp;

// [[Rcpp::export]]
NumericMatrix alleleFreqCalc(IntegerVector locVec, IntegerVector strataRep) {
IntegerMatrix table2D(IntegerVector, IntegerVector);
NumericVector colSumC(NumericMatrix);
Expand All @@ -18,8 +17,6 @@ NumericMatrix alleleFreqCalc(IntegerVector locVec, IntegerVector strataRep) {
return alleleFreq;
}


// [[Rcpp::export]]
NumericMatrix prHetCalc(IntegerVector locus, int nalleles,
IntegerVector strata, IntegerVector nvec, int ploidy) {
IntegerVector idGenotype(IntegerVector, int, int);
Expand All @@ -44,8 +41,6 @@ NumericMatrix prHetCalc(IntegerVector locus, int nalleles,
return prHet;
}


// [[Rcpp::export]]
NumericMatrix varCompCalc(IntegerVector nvec, NumericMatrix alleleFreq,
NumericMatrix prHet, int r, double nbar,
double rnbar, double nc) {
Expand Down Expand Up @@ -88,8 +83,6 @@ NumericMatrix varCompCalc(IntegerVector nvec, NumericMatrix alleleFreq,
return varcompMat;
}


// [[Rcpp::export]]
double fstCalc(IntegerMatrix loci, IntegerVector strata, int ploidy) {
// function declarations
IntegerVector calcStrataN(IntegerVector, IntegerVector, int);
Expand Down Expand Up @@ -152,7 +145,6 @@ IntegerMatrix maxFstLoci(IntegerMatrix loci, IntegerVector strata, int ploidy, I
return maxLoci;
}


// [[Rcpp::export]]
NumericVector statFst_C(IntegerMatrix loci, IntegerMatrix strataMat) {
NumericVector estVec(strataMat.ncol());
Expand All @@ -164,7 +156,6 @@ NumericVector statFst_C(IntegerMatrix loci, IntegerMatrix strataMat) {
return estVec;
}


// [[Rcpp::export]]
NumericVector statFstPrime_C(IntegerMatrix loci, IntegerMatrix strataMat) {
IntegerVector maxAllele(loci.ncol());
Expand Down
5 changes: 0 additions & 5 deletions src/statPhist_C.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#include <Rcpp.h>
using namespace Rcpp;

//

// [[Rcpp::export]]
double ssWPCalc(IntegerVector strataFreq, IntegerMatrix strataHapFreq,
NumericMatrix hapDist) {
// function declarations
Expand All @@ -27,7 +24,6 @@ double ssWPCalc(IntegerVector strataFreq, IntegerMatrix strataHapFreq,
return sum(ssWPvec);
}

// [[Rcpp::export]]
double ssAPCalc(IntegerVector strataFreq, IntegerMatrix strataHapFreq,
NumericMatrix hapDist) {
// function declarations
Expand Down Expand Up @@ -83,7 +79,6 @@ double phistCalc(IntegerVector haps, IntegerVector strata, NumericMatrix hapDist
return est;
}


// [[Rcpp::export]]
NumericVector statPhist_C(IntegerMatrix hapMat, IntegerMatrix strataMat, List hapDist) {
// function declarations
Expand Down

0 comments on commit d0c9f83

Please sign in to comment.