-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jakob Russel
committed
Mar 31, 2018
1 parent
57f809c
commit d6179c2
Showing
8 changed files
with
120 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Package: DAtest | ||
Title: Comparing Differential Abundance methods | ||
Version: 2.7.8 | ||
Version: 2.7.9 | ||
Authors@R: person("Jakob", "Russel", email = "[email protected]", role = c("aut", "cre")) | ||
Description: What the title says. | ||
Depends: R (>= 3.2.5) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#' Summary of results from \code{testDA} | ||
#' | ||
#' @param object The output from the \code{testDA} function | ||
#' @param sort Sort methods by \code{c("AUC","FPR","Spike.detect.rate","Score")} | ||
#' @param boot If TRUE will use bootstrap for confidence limits of the Score, else will compute the limits from the original table. Recommended to be TRUE unless \code{R >= 100} in \code{testDA} | ||
#' @param prob Confidence limits for Score. Default \code{90\%} = \code{c(0.05,0.095)} | ||
#' @param N Number of bootstraps. Default 1000 | ||
#' @param boot.seed Random seed for reproducibility of bootstraps | ||
#' @param ... Additional arguments for \code{print} | ||
#' @import stats | ||
#' @import methods | ||
#' @import utils | ||
#' @export | ||
|
||
summary.DA <- function(object, sort = "Score", boot = TRUE, prob = c(0.05,0.95), N = 1000, boot.seed = 1, ...){ | ||
|
||
# Find medians | ||
output.summary.auc <- aggregate(AUC ~ Method, data = object$table, FUN = function(x) round(median(x),3)) | ||
output.summary.fpr <- aggregate(FPR ~ Method, data = object$table, FUN = function(x) round(median(x),3)) | ||
output.summary.sdr <- aggregate(Spike.detect.rate ~ Method, data = object$table, FUN = function(x) round(median(x),3)) | ||
output.summary.fdr <- aggregate(FDR ~ Method, data = object$table, FUN = function(x) round(median(x),3)) | ||
|
||
# Merge | ||
df <- merge(merge(merge(output.summary.auc,output.summary.fpr, by = "Method", all = TRUE),output.summary.fdr, by = "Method"),output.summary.sdr, by = "Method") | ||
|
||
# Score | ||
df$Score <- round((df$AUC-0.5) * df$Spike.detect.rate - df$FDR,3) | ||
|
||
# Interval | ||
object$table$Score <- (object$table$AUC-0.5) * object$table$Spike.detect.rate - object$table$FDR | ||
|
||
if(boot){ | ||
set.seed(boot.seed) | ||
boots <- lapply(unique(object$table$Method), function(x) object$table[object$table$Method == x,][ | ||
sample(rownames(object$table[object$table$Method == x,]),N,replace = TRUE), | ||
]) | ||
boot.score <- lapply(boots,function(y) aggregate(Score ~ Method, data = y, FUN = function(x) round(quantile(x,probs = prob),3))) | ||
score.cl <- do.call(rbind,boot.score) | ||
} else { | ||
score.cl <- aggregate(Score ~ Method, data = object$table, FUN = function(x) round(quantile(x,probs = prob),3)) | ||
} | ||
|
||
df <- merge(df, as.matrix(score.cl), by = "Method") | ||
|
||
# Sort | ||
if(sort == "AUC") df <- df[order(df$AUC, decreasing = TRUE),] | ||
if(sort == "FPR") df <- df[order(df$FPR, decreasing = FALSE),] | ||
if(sort == "Spike.detect.rate") df <- df[order(df$Spike.detect.rate, decreasing = TRUE),] | ||
if(sort == "Score") { | ||
df <- df[order(df$Score,df[,7],df[,8], decreasing = TRUE),] | ||
if(df[1,"Score"] <= 0) warning("Best Score is less or equal to zero!\nYou might want to rerun with a higher effectSize or pruned dataset (see preDA)") | ||
} | ||
|
||
print(df, row.names = FALSE, ...) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
|
||
.onLoad <- function(libname, pkgname){ | ||
message("DAtest version 2.7.8") | ||
message("DAtest version 2.7.9") | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.