mirror of
https://github.com/johrpan/geposan.git
synced 2025-10-26 02:37:25 +01:00
Fix some package issues
This commit is contained in:
parent
28f9834984
commit
6d9511fa2e
6 changed files with 41 additions and 19 deletions
|
|
@ -2,3 +2,4 @@
|
||||||
^\.Rproj\.user$
|
^\.Rproj\.user$
|
||||||
^LICENSE\.md$
|
^LICENSE\.md$
|
||||||
^scripts$
|
^scripts$
|
||||||
|
^cache$
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ compare <- function(ranking, comparison_gene_ids) {
|
||||||
|
|
||||||
comparison_ranking <- ranking[gene %chin% comparison_gene_ids]
|
comparison_ranking <- ranking[gene %chin% comparison_gene_ids]
|
||||||
|
|
||||||
p_value <- wilcox.test(
|
p_value <- stats::wilcox.test(
|
||||||
x = comparison_ranking[, score],
|
x = comparison_ranking[, score],
|
||||||
y = ranking[!gene %chin% comparison_gene_ids, score],
|
y = ranking[!gene %chin% comparison_gene_ids, score],
|
||||||
alternative = "greater"
|
alternative = "greater"
|
||||||
|
|
@ -46,10 +46,13 @@ compare <- function(ranking, comparison_gene_ids) {
|
||||||
|
|
||||||
#' S3 method to print a comparison object.
|
#' S3 method to print a comparison object.
|
||||||
#'
|
#'
|
||||||
|
#' @param x The comparison to print.
|
||||||
|
#' @param ... Other parameters.
|
||||||
|
#'
|
||||||
#' @seealso [compare()]
|
#' @seealso [compare()]
|
||||||
#'
|
#'
|
||||||
#' @export
|
#' @export
|
||||||
print.geposan_comparison <- function(comparison, ...) {
|
print.geposan_comparison <- function(x, ...) {
|
||||||
cat("geposan comparison:")
|
cat("geposan comparison:")
|
||||||
cat(sprintf(
|
cat(sprintf(
|
||||||
paste(
|
paste(
|
||||||
|
|
@ -62,14 +65,14 @@ print.geposan_comparison <- function(comparison, ...) {
|
||||||
"\n\n p-value for better ranking: %.4f\n",
|
"\n\n p-value for better ranking: %.4f\n",
|
||||||
sep = ""
|
sep = ""
|
||||||
),
|
),
|
||||||
comparison$mean,
|
x$mean,
|
||||||
comparison$min,
|
x$min,
|
||||||
comparison$max,
|
x$max,
|
||||||
comparison$mean_rank,
|
x$mean_rank,
|
||||||
comparison$first_rank,
|
x$first_rank,
|
||||||
comparison$last_rank,
|
x$last_rank,
|
||||||
comparison$p_value
|
x$p_value
|
||||||
))
|
))
|
||||||
|
|
||||||
invisible(comparison)
|
invisible(x)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,12 @@ plot_scores <- function(ranking, gene_sets = NULL, labels = NULL) {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Include gene information which will be used for labeling
|
# Include gene information which will be used for labeling
|
||||||
gene_set_data <- merge(gene_set_data, genes, by.x = "gene", by.y = "id")
|
gene_set_data <- merge(
|
||||||
|
gene_set_data,
|
||||||
|
geposan::genes,
|
||||||
|
by.x = "gene",
|
||||||
|
by.y = "id"
|
||||||
|
)
|
||||||
|
|
||||||
plot <- plot |> plotly::add_trace(
|
plot <- plot |> plotly::add_trace(
|
||||||
data = gene_set_data,
|
data = gene_set_data,
|
||||||
|
|
|
||||||
15
R/preset.R
15
R/preset.R
|
|
@ -43,24 +43,27 @@ preset <- function(methods = c(
|
||||||
|
|
||||||
#' S3 method to print a preset object.
|
#' S3 method to print a preset object.
|
||||||
#'
|
#'
|
||||||
|
#' @param x The preset to print.
|
||||||
|
#' @param ... Other parameters.
|
||||||
|
#'
|
||||||
#' @seealso [preset()]
|
#' @seealso [preset()]
|
||||||
#'
|
#'
|
||||||
#' @export
|
#' @export
|
||||||
print.geposan_preset <- function(preset, ...) {
|
print.geposan_preset <- function(x, ...) {
|
||||||
cat("geposan preset:")
|
cat("geposan preset:")
|
||||||
cat("\n Included methods: ")
|
cat("\n Included methods: ")
|
||||||
cat(preset$method_ids, sep = ", ")
|
cat(x$method_ids, sep = ", ")
|
||||||
|
|
||||||
cat(sprintf(
|
cat(sprintf(
|
||||||
"\n Input data: %i species, %i genes",
|
"\n Input data: %i species, %i genes",
|
||||||
length(preset$species_ids),
|
length(x$species_ids),
|
||||||
length(preset$gene_ids)
|
length(x$gene_ids)
|
||||||
))
|
))
|
||||||
|
|
||||||
cat(sprintf(
|
cat(sprintf(
|
||||||
"\n Comparison data: %i reference genes\n",
|
"\n Comparison data: %i reference genes\n",
|
||||||
length(preset$reference_gene_ids)
|
length(x$reference_gene_ids)
|
||||||
))
|
))
|
||||||
|
|
||||||
invisible(preset)
|
invisible(x)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,12 @@
|
||||||
\alias{print.geposan_comparison}
|
\alias{print.geposan_comparison}
|
||||||
\title{S3 method to print a comparison object.}
|
\title{S3 method to print a comparison object.}
|
||||||
\usage{
|
\usage{
|
||||||
\method{print}{geposan_comparison}(comparison, ...)
|
\method{print}{geposan_comparison}(x, ...)
|
||||||
|
}
|
||||||
|
\arguments{
|
||||||
|
\item{x}{The comparison to print.}
|
||||||
|
|
||||||
|
\item{...}{Other parameters.}
|
||||||
}
|
}
|
||||||
\description{
|
\description{
|
||||||
S3 method to print a comparison object.
|
S3 method to print a comparison object.
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,12 @@
|
||||||
\alias{print.geposan_preset}
|
\alias{print.geposan_preset}
|
||||||
\title{S3 method to print a preset object.}
|
\title{S3 method to print a preset object.}
|
||||||
\usage{
|
\usage{
|
||||||
\method{print}{geposan_preset}(preset, ...)
|
\method{print}{geposan_preset}(x, ...)
|
||||||
|
}
|
||||||
|
\arguments{
|
||||||
|
\item{x}{The preset to print.}
|
||||||
|
|
||||||
|
\item{...}{Other parameters.}
|
||||||
}
|
}
|
||||||
\description{
|
\description{
|
||||||
S3 method to print a preset object.
|
S3 method to print a preset object.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue