mirror of
https://github.com/johrpan/geposan.git
synced 2025-10-26 18:57:25 +01:00
Properly access distance data
This commit is contained in:
parent
c0a1d965d7
commit
21a5817988
5 changed files with 12 additions and 18 deletions
14
R/analyze.R
14
R/analyze.R
|
|
@ -45,9 +45,8 @@ analyze <- function(preset, progress = NULL) {
|
|||
#
|
||||
# A method describes a way to perform a computation on gene distance data
|
||||
# that results in a single score per gene. The function should accept the
|
||||
# distances data, the preset to apply (see [preset()]) and an optional
|
||||
# progress function (that may be called with a number between 0.0 and 1.0)
|
||||
# as its parameters.
|
||||
# preset to apply (see [preset()]) and an optional progress function (that
|
||||
# may be called with a number between 0.0 and 1.0) as its parameters.
|
||||
#
|
||||
# The function should return a [data.table] with the following columns:
|
||||
#
|
||||
|
|
@ -62,19 +61,14 @@ analyze <- function(preset, progress = NULL) {
|
|||
|
||||
total_progress <- 0.0
|
||||
method_count <- length(preset$method_ids)
|
||||
results <- data.table(gene = genes$id)
|
||||
results <- data.table(gene = preset$gene_ids)
|
||||
|
||||
for (method_id in preset$method_ids) {
|
||||
method_progress <- if (!is.null(progress)) function(p) {
|
||||
progress(total_progress + p / method_count)
|
||||
}
|
||||
|
||||
method_results <- methods[[method_id]](
|
||||
distances,
|
||||
preset,
|
||||
method_progress
|
||||
)
|
||||
|
||||
method_results <- methods[[method_id]](preset, method_progress)
|
||||
setnames(method_results, "score", method_id)
|
||||
|
||||
results <- merge(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue