diff --git a/NAMESPACE b/NAMESPACE index adb35de..934d60c 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -14,6 +14,7 @@ export(clustering) export(compare) export(correlation) export(densest) +export(distance) export(method) export(neural) export(optimal_weights) @@ -24,7 +25,6 @@ export(plot_rankings) export(plot_scores) export(plot_scores_by_position) export(preset) -export(proximity) export(ranking) export(result) export(validate) diff --git a/R/method.R b/R/method.R index b7dd34c..ea1ecda 100644 --- a/R/method.R +++ b/R/method.R @@ -33,11 +33,11 @@ method <- function(id, name, description, func) { #' @export all_methods <- function() { list( + distance(), + adjacency(), clustering(), correlation(), - neural(), - adjacency(), - proximity() + neural() ) } diff --git a/R/method_proximity.R b/R/method_distance.R similarity index 82% rename from R/method_proximity.R rename to R/method_distance.R index f5d7713..0557787 100644 --- a/R/method_proximity.R +++ b/R/method_distance.R @@ -13,9 +13,9 @@ #' @return An object of class `geposan_method`. #' #' @export -proximity <- function(id = "proximity", - name = "Proximity", - description = "Proximity to telomeres", +distance <- function(id = "distance", + name = "Distance", + description = "Distance to telomeres", summarize = stats::median) { method( id = id, @@ -25,7 +25,7 @@ proximity <- function(id = "proximity", species_ids <- preset$species_ids gene_ids <- preset$gene_ids - cached("proximity", c(species_ids, gene_ids), { + cached("distance", c(species_ids, gene_ids), { # Prefilter distances by species and gene. data <- geposan::distances[ species %chin% preset$species_ids & @@ -39,12 +39,12 @@ proximity <- function(id = "proximity", ] # Normalize scores. - data[, score := 1 - combined_distance / max(combined_distance)] + data[, score := combined_distance / max(combined_distance)] progress(1.0) result( - method = "proximity", + method = "distance", scores = data[, .(gene, score)], details = list(data = data) ) diff --git a/man/proximity.Rd b/man/distance.Rd similarity index 80% rename from man/proximity.Rd rename to man/distance.Rd index d75cc2b..2633ccb 100644 --- a/man/proximity.Rd +++ b/man/distance.Rd @@ -1,13 +1,13 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/method_proximity.R -\name{proximity} -\alias{proximity} +% Please edit documentation in R/method_distance.R +\name{distance} +\alias{distance} \title{Score the distance of genes to the telomeres across species.} \usage{ -proximity( - id = "proximity", - name = "Proximity", - description = "Proximity to telomeres", +distance( + id = "distance", + name = "Distance", + description = "Distance to telomeres", summarize = stats::median ) }