Rename method proximity to distance

This commit is contained in:
Elias Projahn 2022-08-11 12:39:21 +02:00
parent 463faf0fbe
commit 0f53c3e798
4 changed files with 17 additions and 17 deletions

View file

@ -14,6 +14,7 @@ export(clustering)
export(compare) export(compare)
export(correlation) export(correlation)
export(densest) export(densest)
export(distance)
export(method) export(method)
export(neural) export(neural)
export(optimal_weights) export(optimal_weights)
@ -24,7 +25,6 @@ export(plot_rankings)
export(plot_scores) export(plot_scores)
export(plot_scores_by_position) export(plot_scores_by_position)
export(preset) export(preset)
export(proximity)
export(ranking) export(ranking)
export(result) export(result)
export(validate) export(validate)

View file

@ -33,11 +33,11 @@ method <- function(id, name, description, func) {
#' @export #' @export
all_methods <- function() { all_methods <- function() {
list( list(
distance(),
adjacency(),
clustering(), clustering(),
correlation(), correlation(),
neural(), neural()
adjacency(),
proximity()
) )
} }

View file

@ -13,9 +13,9 @@
#' @return An object of class `geposan_method`. #' @return An object of class `geposan_method`.
#' #'
#' @export #' @export
proximity <- function(id = "proximity", distance <- function(id = "distance",
name = "Proximity", name = "Distance",
description = "Proximity to telomeres", description = "Distance to telomeres",
summarize = stats::median) { summarize = stats::median) {
method( method(
id = id, id = id,
@ -25,7 +25,7 @@ proximity <- function(id = "proximity",
species_ids <- preset$species_ids species_ids <- preset$species_ids
gene_ids <- preset$gene_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. # Prefilter distances by species and gene.
data <- geposan::distances[ data <- geposan::distances[
species %chin% preset$species_ids & species %chin% preset$species_ids &
@ -39,12 +39,12 @@ proximity <- function(id = "proximity",
] ]
# Normalize scores. # Normalize scores.
data[, score := 1 - combined_distance / max(combined_distance)] data[, score := combined_distance / max(combined_distance)]
progress(1.0) progress(1.0)
result( result(
method = "proximity", method = "distance",
scores = data[, .(gene, score)], scores = data[, .(gene, score)],
details = list(data = data) details = list(data = data)
) )

View file

@ -1,13 +1,13 @@
% Generated by roxygen2: do not edit by hand % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/method_proximity.R % Please edit documentation in R/method_distance.R
\name{proximity} \name{distance}
\alias{proximity} \alias{distance}
\title{Score the distance of genes to the telomeres across species.} \title{Score the distance of genes to the telomeres across species.}
\usage{ \usage{
proximity( distance(
id = "proximity", id = "distance",
name = "Proximity", name = "Distance",
description = "Proximity to telomeres", description = "Distance to telomeres",
summarize = stats::median summarize = stats::median
) )
} }