mirror of
https://github.com/johrpan/geposan.git
synced 2025-10-25 19:37:23 +02:00
Allow customizing method metadata
This commit is contained in:
parent
0e4f4621ed
commit
c6ca93b009
12 changed files with 139 additions and 30 deletions
|
|
@ -28,6 +28,9 @@ densest <- function(data) {
|
|||
#' combined. The resulting value is compared to the reference genes and
|
||||
#' determines the gene's score in relation to other genes.
|
||||
#'
|
||||
#' @param id Unique ID for the method and its results.
|
||||
#' @param name Human readable name for the method.
|
||||
#' @param description Method description.
|
||||
#' @param distance_estimate A function that will be used to summarize the
|
||||
#' distance values for each gene. See [densest()] for the default
|
||||
#' implementation.
|
||||
|
|
@ -39,11 +42,15 @@ densest <- function(data) {
|
|||
#' @seealso [species_adjacency()]
|
||||
#'
|
||||
#' @export
|
||||
adjacency <- function(distance_estimate = densest, summarize = stats::median) {
|
||||
adjacency <- function(id = "adjacency",
|
||||
name = "Adjacency",
|
||||
description = "Adjacency to reference genes",
|
||||
distance_estimate = densest,
|
||||
summarize = stats::median) {
|
||||
method(
|
||||
id = "adjacency",
|
||||
name = "Adjacency",
|
||||
description = "Adjacency to reference genes",
|
||||
id = id,
|
||||
name = name,
|
||||
description = description,
|
||||
function(preset, progress) {
|
||||
species_ids <- preset$species_ids
|
||||
gene_ids <- preset$gene_ids
|
||||
|
|
|
|||
|
|
@ -70,16 +70,22 @@ clusteriness <- function(data,
|
|||
#' The result will be cached and can be reused for different presets, because
|
||||
#' it is independent of the reference genes in use.
|
||||
#'
|
||||
#' @param id Unique ID for the method and its results.
|
||||
#' @param name Human readable name for the method.
|
||||
#' @param description Method description.
|
||||
#'
|
||||
#' @return An object of class `geposan_method`.
|
||||
#'
|
||||
#' @seealso [clusteriness()]
|
||||
#'
|
||||
#' @export
|
||||
clustering <- function() {
|
||||
method(
|
||||
id = "clustering",
|
||||
clustering <- function(id = "clustering",
|
||||
name = "Clustering",
|
||||
description = "Clustering of genes",
|
||||
description = "Clustering of genes") {
|
||||
method(
|
||||
id = id,
|
||||
name = name,
|
||||
description = description,
|
||||
function(preset, progress) {
|
||||
species_ids <- preset$species_ids
|
||||
gene_ids <- preset$gene_ids
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
#' Score genes based on their correlation with the reference genes.
|
||||
#'
|
||||
#' @param id Unique ID for the method and its results.
|
||||
#' @param name Human readable name for the method.
|
||||
#' @param description Method description.
|
||||
#' @param summarize A function for combining the different correlation
|
||||
#' coefficients into one metric. By default, [stats::median()] is used. Other
|
||||
#' suggested options include [max()] and [mean()].
|
||||
|
|
@ -7,11 +10,14 @@
|
|||
#' @return An object of class `geposan_method`.
|
||||
#'
|
||||
#' @export
|
||||
correlation <- function(summarize = stats::median) {
|
||||
correlation <- function(id = "correlation",
|
||||
name = "Correlation",
|
||||
description = "Correlation with reference genes",
|
||||
summarize = stats::median) {
|
||||
method(
|
||||
id = "correlation",
|
||||
name = "Correlation",
|
||||
description = "Correlation with reference genes",
|
||||
id = id,
|
||||
name = name,
|
||||
description = description,
|
||||
function(preset, progress) {
|
||||
species_ids <- preset$species_ids
|
||||
gene_ids <- preset$gene_ids
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
#' Find genes by training and applying a neural network.
|
||||
#'
|
||||
#' @param id Unique ID for the method and its results.
|
||||
#' @param name Human readable name for the method.
|
||||
#' @param description Method description.
|
||||
#' @param seed The seed will be used to make the results reproducible.
|
||||
#' @param n_models This number specifies how many sets of training data should
|
||||
#' be created. For each set, there will be a model trained on the remaining
|
||||
|
|
@ -14,11 +17,16 @@
|
|||
#' @return An object of class `geposan_method`.
|
||||
#'
|
||||
#' @export
|
||||
neural <- function(seed = 180199, n_models = 5, control_ratio = 0.5) {
|
||||
neural <- function(id = "neural",
|
||||
name = "Neural",
|
||||
description = "Assessment by neural network",
|
||||
seed = 180199,
|
||||
n_models = 5,
|
||||
control_ratio = 0.5) {
|
||||
method(
|
||||
id = "neural",
|
||||
name = "Neural",
|
||||
description = "Assessment by neural network",
|
||||
id = id,
|
||||
name = name,
|
||||
description = description,
|
||||
function(preset, progress) {
|
||||
species_ids <- preset$species_ids
|
||||
gene_ids <- preset$gene_ids
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@
|
|||
#' A score will be given to each gene such that 0.0 corresponds to the maximal
|
||||
#' distance across all genes and 1.0 corresponds to a distance of 0.
|
||||
#'
|
||||
#' @param id Unique ID for the method and its results.
|
||||
#' @param name Human readable name for the method.
|
||||
#' @param description Method description.
|
||||
#' @param summarize A function for combining the different proximities into one
|
||||
#' metric. By default, [stats::median()] is used. Other suggested options
|
||||
#' include [min()] and [mean()].
|
||||
|
|
@ -10,11 +13,14 @@
|
|||
#' @return An object of class `geposan_method`.
|
||||
#'
|
||||
#' @export
|
||||
proximity <- function(summarize = stats::median) {
|
||||
proximity <- function(id = "proximity",
|
||||
name = "Proximity",
|
||||
description = "Proximity to telomeres",
|
||||
summarize = stats::median) {
|
||||
method(
|
||||
id = "proximity",
|
||||
name = "Proximity",
|
||||
description = "Proximity to telomeres",
|
||||
id = id,
|
||||
name = name,
|
||||
description = description,
|
||||
function(preset, progress) {
|
||||
species_ids <- preset$species_ids
|
||||
gene_ids <- preset$gene_ids
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@
|
|||
#' to the reference genes within that species. Afterwards, the results are
|
||||
#' summarized across species and determine the gene's score.
|
||||
#'
|
||||
#' @param id Unique ID for the method and its results.
|
||||
#' @param name Human readable name for the method.
|
||||
#' @param description Method description.
|
||||
#' @param distance_estimate Function for combining the distance differences
|
||||
#' within one species.
|
||||
#' @param summarize Function for summarizing the distance values across species.
|
||||
|
|
@ -13,12 +16,15 @@
|
|||
#' @seealso [adjacency()]
|
||||
#'
|
||||
#' @export
|
||||
species_adjacency <- function(distance_estimate = stats::median,
|
||||
species_adjacency <- function(id = "species_adjacency",
|
||||
name = "Species adj.",
|
||||
description = "Species adjacency",
|
||||
distance_estimate = stats::median,
|
||||
summarize = stats::median) {
|
||||
method(
|
||||
id = "species_adjacency",
|
||||
name = "Species adj.",
|
||||
description = "Species adjacency",
|
||||
id = id,
|
||||
name = name,
|
||||
description = description,
|
||||
function(preset, progress) {
|
||||
species_ids <- preset$species_ids
|
||||
gene_ids <- preset$gene_ids
|
||||
|
|
|
|||
|
|
@ -4,9 +4,21 @@
|
|||
\alias{adjacency}
|
||||
\title{Score genes based on their proximity to the reference genes.}
|
||||
\usage{
|
||||
adjacency(distance_estimate = densest, summarize = stats::median)
|
||||
adjacency(
|
||||
id = "adjacency",
|
||||
name = "Adjacency",
|
||||
description = "Adjacency to reference genes",
|
||||
distance_estimate = densest,
|
||||
summarize = stats::median
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
\item{id}{Unique ID for the method and its results.}
|
||||
|
||||
\item{name}{Human readable name for the method.}
|
||||
|
||||
\item{description}{Method description.}
|
||||
|
||||
\item{distance_estimate}{A function that will be used to summarize the
|
||||
distance values for each gene. See \code{\link[=densest]{densest()}} for the default
|
||||
implementation.}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,18 @@
|
|||
\alias{clustering}
|
||||
\title{Process genes clustering their distance to telomeres.}
|
||||
\usage{
|
||||
clustering()
|
||||
clustering(
|
||||
id = "clustering",
|
||||
name = "Clustering",
|
||||
description = "Clustering of genes"
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
\item{id}{Unique ID for the method and its results.}
|
||||
|
||||
\item{name}{Human readable name for the method.}
|
||||
|
||||
\item{description}{Method description.}
|
||||
}
|
||||
\value{
|
||||
An object of class \code{geposan_method}.
|
||||
|
|
|
|||
|
|
@ -4,9 +4,20 @@
|
|||
\alias{correlation}
|
||||
\title{Score genes based on their correlation with the reference genes.}
|
||||
\usage{
|
||||
correlation(summarize = stats::median)
|
||||
correlation(
|
||||
id = "correlation",
|
||||
name = "Correlation",
|
||||
description = "Correlation with reference genes",
|
||||
summarize = stats::median
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
\item{id}{Unique ID for the method and its results.}
|
||||
|
||||
\item{name}{Human readable name for the method.}
|
||||
|
||||
\item{description}{Method description.}
|
||||
|
||||
\item{summarize}{A function for combining the different correlation
|
||||
coefficients into one metric. By default, \code{\link[stats:median]{stats::median()}} is used. Other
|
||||
suggested options include \code{\link[=max]{max()}} and \code{\link[=mean]{mean()}}.}
|
||||
|
|
|
|||
|
|
@ -4,9 +4,22 @@
|
|||
\alias{neural}
|
||||
\title{Find genes by training and applying a neural network.}
|
||||
\usage{
|
||||
neural(seed = 180199, n_models = 5, control_ratio = 0.5)
|
||||
neural(
|
||||
id = "neural",
|
||||
name = "Neural",
|
||||
description = "Assessment by neural network",
|
||||
seed = 180199,
|
||||
n_models = 5,
|
||||
control_ratio = 0.5
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
\item{id}{Unique ID for the method and its results.}
|
||||
|
||||
\item{name}{Human readable name for the method.}
|
||||
|
||||
\item{description}{Method description.}
|
||||
|
||||
\item{seed}{The seed will be used to make the results reproducible.}
|
||||
|
||||
\item{n_models}{This number specifies how many sets of training data should
|
||||
|
|
|
|||
|
|
@ -4,9 +4,20 @@
|
|||
\alias{proximity}
|
||||
\title{Score the distance of genes to the telomeres across species.}
|
||||
\usage{
|
||||
proximity(summarize = stats::median)
|
||||
proximity(
|
||||
id = "proximity",
|
||||
name = "Proximity",
|
||||
description = "Proximity to telomeres",
|
||||
summarize = stats::median
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
\item{id}{Unique ID for the method and its results.}
|
||||
|
||||
\item{name}{Human readable name for the method.}
|
||||
|
||||
\item{description}{Method description.}
|
||||
|
||||
\item{summarize}{A function for combining the different proximities into one
|
||||
metric. By default, \code{\link[stats:median]{stats::median()}} is used. Other suggested options
|
||||
include \code{\link[=min]{min()}} and \code{\link[=mean]{mean()}}.}
|
||||
|
|
|
|||
|
|
@ -4,9 +4,21 @@
|
|||
\alias{species_adjacency}
|
||||
\title{Score genes based on their adjacency to the reference genes within species.}
|
||||
\usage{
|
||||
species_adjacency(distance_estimate = stats::median, summarize = stats::median)
|
||||
species_adjacency(
|
||||
id = "species_adjacency",
|
||||
name = "Species adj.",
|
||||
description = "Species adjacency",
|
||||
distance_estimate = stats::median,
|
||||
summarize = stats::median
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
\item{id}{Unique ID for the method and its results.}
|
||||
|
||||
\item{name}{Human readable name for the method.}
|
||||
|
||||
\item{description}{Method description.}
|
||||
|
||||
\item{distance_estimate}{Function for combining the distance differences
|
||||
within one species.}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue