mirror of
https://github.com/johrpan/ubigen.git
synced 2025-10-26 19:57:24 +01:00
Use package's ranking function for included data
This commit is contained in:
parent
698ea5086a
commit
a6f0a64c2c
3 changed files with 18 additions and 16 deletions
10
R/ranking.R
10
R/ranking.R
|
|
@ -3,22 +3,26 @@
|
|||
#' This function will compute a weighted average across multiple metrics that
|
||||
#' define how ubiquitous a gene is based on its expression across samples.
|
||||
#'
|
||||
#' @param data The input data to use. This should either be the result of a
|
||||
#' previous call to this function or the return value of [analyze()].
|
||||
#'
|
||||
#' @return A `data.table` with gene data as well as the scores, ranks and
|
||||
#' percentiles for each gene.
|
||||
#'
|
||||
#' @export
|
||||
rank_genes <- function(cross_sample_metric = "above_95",
|
||||
rank_genes <- function(data = ubigen::genes,
|
||||
cross_sample_metric = "above_95",
|
||||
cross_sample_weight = 0.5,
|
||||
level_metric = "median_expression_normalized",
|
||||
level_weight = 0.25,
|
||||
variation_metric = "qcv_expression_normalized",
|
||||
variation_weight = -0.25) {
|
||||
data <- copy(data)
|
||||
|
||||
total_weight <- abs(cross_sample_weight) +
|
||||
abs(level_weight) +
|
||||
abs(variation_weight)
|
||||
|
||||
data <- copy(ubigen::genes)
|
||||
|
||||
data[, score :=
|
||||
(cross_sample_weight * get(cross_sample_metric) +
|
||||
level_weight * get(level_metric) +
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue