Skip to content

Commit

Permalink
Cleanup legacy code
Browse files Browse the repository at this point in the history
  • Loading branch information
juliangehring committed Oct 16, 2015
1 parent 97ec03b commit d9bc118
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 155 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: HighSpeedStats
Type: Package
Title: High Speed Stats
Version: 1.0.0
Version: 1.1.0
Author: Julian Gehring
Maintainer: Julian Gehring <[email protected]>
Imports: Rcpp (>= 0.11.0)
Expand Down
10 changes: 0 additions & 10 deletions R/fisher-exact-test-functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,11 @@ fisherExactTest <- function(a, b, c, d) {
}


.fastfet <- function(a, b, c, d) {
.Call('HighSpeedStats_fastfet', PACKAGE = 'HighSpeedStats', a, b, c, d)
}


ultrafastfet <- function(a, b, c, d) {
.Call('HighSpeedStats_ultrafastfet', PACKAGE = 'HighSpeedStats', a, b, c, d)
}


.jltrafastfet <- function(a, b, c, d) {
.Call('HighSpeedStats_jltrafastfet', PACKAGE = 'HighSpeedStats', a, b, c, d)
}


feTestR <- function (a, b, c, d, relErr = 1 + 1e-07) {

pval = mapply(function(x1, x2, n1, n2) {
Expand Down
3 changes: 0 additions & 3 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
[[https://codecov.io/github/julian-gehring/HighSpeedStats?branch=master][file:https://codecov.io/github/julian-gehring/HighSpeedStats/coverage.svg?branch=master]]


[[file:https:/codecov.io/github/julian-gehring/HighSpeedStats/coverage.svg?branch=master][https://codecov.io]]


** Motivation

The amount of data in the field of computational biology increases at a fast
Expand Down
40 changes: 0 additions & 40 deletions src/RcppExports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,6 @@ END_RCPP
}


// fastfet
SEXP fastfet(SEXP a, SEXP b, SEXP c, SEXP d);
RcppExport SEXP HighSpeedStats_fastfet(SEXP aSEXP, SEXP bSEXP, SEXP cSEXP, SEXP dSEXP) {
BEGIN_RCPP
SEXP __sexp_result;
{
Rcpp::RNGScope __rngScope;
Rcpp::traits::input_parameter< SEXP >::type a(aSEXP );
Rcpp::traits::input_parameter< SEXP >::type b(bSEXP );
Rcpp::traits::input_parameter< SEXP >::type c(cSEXP );
Rcpp::traits::input_parameter< SEXP >::type d(dSEXP );
SEXP __result = fastfet(a, b, c, d);
PROTECT(__sexp_result = Rcpp::wrap(__result));
}
UNPROTECT(1);
return __sexp_result;
END_RCPP
}


// ultrafastfet
SEXP ultrafastfet(SEXP a, SEXP b, SEXP c, SEXP d);
RcppExport SEXP HighSpeedStats_ultrafastfet(SEXP aSEXP, SEXP bSEXP, SEXP cSEXP, SEXP dSEXP) {
Expand All @@ -77,23 +57,3 @@ BEGIN_RCPP
return __sexp_result;
END_RCPP
}


// jltrafastfet
SEXP jltrafastfet(SEXP a, SEXP b, SEXP c, SEXP d);
RcppExport SEXP HighSpeedStats_jltrafastfet(SEXP aSEXP, SEXP bSEXP, SEXP cSEXP, SEXP dSEXP) {
BEGIN_RCPP
SEXP __sexp_result;
{
Rcpp::RNGScope __rngScope;
Rcpp::traits::input_parameter< SEXP >::type a(aSEXP );
Rcpp::traits::input_parameter< SEXP >::type b(bSEXP );
Rcpp::traits::input_parameter< SEXP >::type c(cSEXP );
Rcpp::traits::input_parameter< SEXP >::type d(dSEXP );
SEXP __result = jltrafastfet(a, b, c, d);
PROTECT(__sexp_result = Rcpp::wrap(__result));
}
UNPROTECT(1);
return __sexp_result;
END_RCPP
}
56 changes: 0 additions & 56 deletions src/fastFisherExactTest.cpp

This file was deleted.

45 changes: 0 additions & 45 deletions src/ultraFastFisherExactTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,48 +58,3 @@ SEXP ultrafastfet(SEXP a, SEXP b, SEXP c, SEXP d) {

return wrap(pval);
}


double jfet(int a, int b, int c, int d, double* logFacs) {
double logpCutoff = ulogHypergeometricProb(logFacs, a, b, c, d);
double pFraction = 0;
int n = a + b + c + d;
for(int x=0; x <= n; ++x) {
if ( a+b-x >= 0 && a+c-x >= 0 && d-a+x >=0 ) {
double l = ulogHypergeometricProb(logFacs, x, a+b-x, a+c-x, d-a+x);
if ( l <= logpCutoff ) {
pFraction += exp(l - logpCutoff);
}
}
}
double logpValue = logpCutoff + log(pFraction); // normalization: p_i = p_i / sum_i(p_i)
double pval = exp(logpValue);

return pval;
}



// [[Rcpp::export]]
SEXP jltrafastfet(SEXP a, SEXP b, SEXP c, SEXP d) {

Rcpp::IntegerVector a_(a), b_(b), c_(c), d_(d);
Rcpp::NumericVector pval(a);
int n = a_.size();

int m = 0;
for(int i = 0; i < n; i++) {
m = fmax(m, a_(i) + b_(i) + c_(i) + d_(i));
}

double* ulogFacs = new double[m+1];
uinitLogFacs(ulogFacs, m);

for(int i = 0; i < n; i++) {
pval(i) = jfet(a_(i), b_(i), c_(i), d_(i), ulogFacs);
}

delete [] ulogFacs;

return wrap(pval);
}

0 comments on commit d9bc118

Please sign in to comment.