mirror of
https://github.com/johrpan/geposan.git
synced 2025-10-26 02:37:25 +01:00
preset: Make reference genes the first parameter
This commit is contained in:
parent
8cda3e8e83
commit
c8f1e522f9
2 changed files with 13 additions and 13 deletions
18
R/preset.R
18
R/preset.R
|
|
@ -9,18 +9,18 @@
|
|||
#' methods: [clustering()], [correlation()], [neural()], [adjacency()] and
|
||||
#' [proximity()].
|
||||
#'
|
||||
#' @param reference_gene_ids IDs of reference genes to compare to.
|
||||
#' @param methods List of methods to apply.
|
||||
#' @param species_ids IDs of species to include.
|
||||
#' @param gene_ids IDs of genes to screen.
|
||||
#' @param reference_gene_ids IDs of reference genes to compare to.
|
||||
#'
|
||||
#' @return The preset to use with [analyze()].
|
||||
#'
|
||||
#' @export
|
||||
preset <- function(methods = all_methods(),
|
||||
preset <- function(reference_gene_ids,
|
||||
methods = all_methods(),
|
||||
species_ids = geposan::species$id,
|
||||
gene_ids = geposan::genes$id,
|
||||
reference_gene_ids) {
|
||||
gene_ids = geposan::genes$id) {
|
||||
# Count included species per gene.
|
||||
genes_n_species <- geposan::distances[
|
||||
species %chin% species_ids,
|
||||
|
|
@ -39,10 +39,10 @@ preset <- function(methods = all_methods(),
|
|||
# for the object later.
|
||||
structure(
|
||||
list(
|
||||
reference_gene_ids = sort(reference_gene_ids),
|
||||
methods = methods,
|
||||
species_ids = sort(species_ids),
|
||||
gene_ids = sort(gene_ids_filtered),
|
||||
reference_gene_ids = sort(reference_gene_ids)
|
||||
gene_ids = sort(gene_ids_filtered)
|
||||
),
|
||||
class = "geposan_preset"
|
||||
)
|
||||
|
|
@ -60,16 +60,16 @@ print.geposan_preset <- function(x, ...) {
|
|||
cat(sprintf(
|
||||
paste0(
|
||||
"geposan preset:",
|
||||
"\n Reference genes: %i",
|
||||
"\n Included methods: %s",
|
||||
"\n Number of species: %i",
|
||||
"\n Number of genes: %i",
|
||||
"\n Reference genes: %i",
|
||||
"\n"
|
||||
),
|
||||
length(x$reference_gene_ids),
|
||||
paste(sapply(x$methods, function(m) m$id), collapse = ", "),
|
||||
length(x$species_ids),
|
||||
length(x$gene_ids),
|
||||
length(x$reference_gene_ids)
|
||||
length(x$gene_ids)
|
||||
))
|
||||
|
||||
invisible(x)
|
||||
|
|
|
|||
|
|
@ -5,20 +5,20 @@
|
|||
\title{Create a new preset.}
|
||||
\usage{
|
||||
preset(
|
||||
reference_gene_ids,
|
||||
methods = all_methods(),
|
||||
species_ids = geposan::species$id,
|
||||
gene_ids = geposan::genes$id,
|
||||
reference_gene_ids
|
||||
gene_ids = geposan::genes$id
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
\item{reference_gene_ids}{IDs of reference genes to compare to.}
|
||||
|
||||
\item{methods}{List of methods to apply.}
|
||||
|
||||
\item{species_ids}{IDs of species to include.}
|
||||
|
||||
\item{gene_ids}{IDs of genes to screen.}
|
||||
|
||||
\item{reference_gene_ids}{IDs of reference genes to compare to.}
|
||||
}
|
||||
\value{
|
||||
The preset to use with \code{\link[=analyze]{analyze()}}.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue