mirror of
https://github.com/johrpan/geposan.git
synced 2025-10-26 18:57:25 +01:00
ranking: Add optimization for median
This commit is contained in:
parent
61422a6a06
commit
7d3bedb436
2 changed files with 6 additions and 3 deletions
|
|
@ -24,6 +24,7 @@
|
|||
#' Available optimization targets are:
|
||||
#'
|
||||
#' - `mean` Mean rank of the reference genes.
|
||||
#' - `median` Median rank of the reference genes.
|
||||
#' - `max` First rank of the reference genes.
|
||||
#' - `min` Last rank of the reference genes.
|
||||
#'
|
||||
|
|
|
|||
|
|
@ -51,8 +51,8 @@ ranking <- function(analysis, weights) {
|
|||
#' @param analysis Results from [analyze()] or [ranking()].
|
||||
#' @param methods Methods to include in the score.
|
||||
#' @param reference_gene_ids IDs of the reference genes.
|
||||
#' @param target The optimization target. It may be one of "mean", "min" or
|
||||
#' "max" and results in the respective rank being optimized.
|
||||
#' @param target The optimization target. It may be one of "mean", "median",
|
||||
#' "min" or "max" and results in the respective rank being optimized.
|
||||
#'
|
||||
#' @returns Named list pairing method names with their optimal weights. This
|
||||
#' can be used as an argument to [ranking()].
|
||||
|
|
@ -72,8 +72,10 @@ optimal_weights <- function(analysis, methods, reference_gene_ids,
|
|||
min(rank)
|
||||
} else if (target == "max") {
|
||||
max(rank)
|
||||
} else {
|
||||
} else if (target == "mean") {
|
||||
mean(rank)
|
||||
} else {
|
||||
median(rank)
|
||||
}]
|
||||
|
||||
if (result > 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue