diff --git a/.Rbuildignore b/.Rbuildignore
index b005982..fafefbd 100644
--- a/.Rbuildignore
+++ b/.Rbuildignore
@@ -9,5 +9,6 @@ _pkgdown.yml
docs/*
^\.github/workflows/R-CMD-check\.yaml$
^\.github/workflows/pr-commands\.yaml$
+^\.github/workflows$
^CODE_OF_CONDUCT\.md$
^LICENSE\.md$
diff --git a/DESCRIPTION b/DESCRIPTION
index 776cbc4..0af07f9 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,8 +1,8 @@
Package: ideal
Type: Package
Title: Interactive Differential Expression AnaLysis
-Version: 1.29.0
-Date: 2024-04-07
+Version: 1.99.0
+Date: 2024-09-13
Authors@R: c(person("Federico", "Marini", role = c("aut", "cre"),
email ="marinif@uni-mainz.de",
comment = c(ORCID = '0000-0003-3252-7758')))
@@ -10,13 +10,15 @@ Description: This package provides functions for an Interactive
Differential Expression AnaLysis of RNA-sequencing datasets, to
extract quickly and effectively information downstream the step
of differential expression. A Shiny application encapsulates
- the whole package.
+ the whole package. Support for reproducibility of the whole analysis is
+ provided by means of a template report which gets automatically compiled
+ and can be stored/shared.
License: MIT + file LICENSE
-LazyData: TRUE
Depends: topGO
Imports:
DESeq2,
SummarizedExperiment,
+ mosdef (>= 1.1.0),
GenomicRanges,
IRanges,
S4Vectors,
@@ -24,7 +26,6 @@ Imports:
heatmaply,
plotly,
pheatmap,
- pcaExplorer,
IHW,
gplots,
UpSetR,
@@ -48,8 +49,11 @@ Imports:
shinyAce,
BiocParallel,
grDevices,
+ graphics,
base64enc,
- methods
+ methods,
+ utils,
+ stats
Suggests:
testthat,
BiocStyle,
@@ -58,6 +62,7 @@ Suggests:
org.Hs.eg.db,
TxDb.Hsapiens.UCSC.hg38.knownGene,
DEFormats,
+ htmltools,
edgeR
URL: https://github.com/federicomarini/ideal,
https://federicomarini.github.io/ideal/
@@ -67,3 +72,4 @@ biocViews: ImmunoOncology, GeneExpression, DifferentialExpression, RNASeq, Seque
VignetteBuilder: knitr
RoxygenNote: 7.3.2
Encoding: UTF-8
+Roxygen: list(markdown = TRUE)
diff --git a/NAMESPACE b/NAMESPACE
index 7d71034..79672de 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -19,7 +19,6 @@ import(SummarizedExperiment)
import(ggplot2)
import(knitr)
import(methods)
-import(pcaExplorer)
import(rmarkdown)
import(shiny)
import(shinydashboard)
@@ -47,11 +46,26 @@ importFrom(goseq,goseq)
importFrom(goseq,nullp)
importFrom(gplots,venn)
importFrom(grDevices,axisTicks)
+importFrom(grDevices,colorRamp)
importFrom(grDevices,dev.off)
importFrom(grDevices,pdf)
+importFrom(grDevices,rgb)
+importFrom(graphics,pairs)
+importFrom(graphics,par)
+importFrom(graphics,strwidth)
+importFrom(graphics,text)
importFrom(heatmaply,heatmaply)
importFrom(limma,goana)
importFrom(limma,topGO)
+importFrom(mosdef,create_link_ENSEMBL)
+importFrom(mosdef,create_link_GO)
+importFrom(mosdef,create_link_NCBI)
+importFrom(mosdef,deresult_to_df)
+importFrom(mosdef,gene_plot)
+importFrom(mosdef,get_annotation_orgdb)
+importFrom(mosdef,pair_corr)
+importFrom(mosdef,run_goseq)
+importFrom(mosdef,run_topGO)
importFrom(pheatmap,pheatmap)
importFrom(plotly,plotlyOutput)
importFrom(plotly,renderPlotly)
@@ -68,6 +82,23 @@ importFrom(shinyAce,updateAceEditor)
importFrom(shinyBS,bsCollapse)
importFrom(shinyBS,bsCollapsePanel)
importFrom(shinyBS,bsTooltip)
+importFrom(stats,as.formula)
+importFrom(stats,cor)
+importFrom(stats,quantile)
+importFrom(stats,sd)
+importFrom(stats,terms.formula)
+importFrom(stats,var)
importFrom(stringr,str_count)
+importFrom(utils,count.fields)
+importFrom(utils,data)
+importFrom(utils,head)
+importFrom(utils,installed.packages)
+importFrom(utils,packageDescription)
+importFrom(utils,packageVersion)
+importFrom(utils,read.delim)
+importFrom(utils,sessionInfo)
+importFrom(utils,str)
+importFrom(utils,tail)
+importFrom(utils,write.csv)
importMethodsFrom(GOstats,hyperGTest)
importMethodsFrom(GOstats,summary)
diff --git a/NEWS.md b/NEWS.md
index 12e9f02..80c36b9 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,3 +1,14 @@
+# ideal 1.99.0
+
+## Other notes
+
+* The transition to the functions available in the `mosdef` Bioconductor is complete, with the original functions now being deprecated. This applies to `goseqTable()` (now replaced by `mosdef::run_goseq()`), which has now been made faster and more robust in its functionality and in the ways it can be executed
+* The gene plot widgets now also use the `gene_plot()` function from `mosdef`, instead of the previous `ggplotCounts()` function - `gene_plot()` is more flexible and has more options to control the behavior of the final plot object
+* The `deseqresult2tbl()` and `deseqresult2DEgenes()` are now replaced by the more flexible `mosdef::deresult_to_df()`
+* The internally defined `createLinkENS()`, `createLinkGeneSymbol()`, and `createLinkGO()` are now replaced by the equivalent functions in `mosdef`
+* The Roxygen-based documentation now supports markdown. No visible changes should appear to the user, as the content should have stayed fairly the same
+* Although no visible changes for the end user are expected, the incoming major version bump will reflect the change in the dependency graph, ensuring that this is noticed at least at the version numbering level
+
# ideal 1.18.0
## Bug fixes
diff --git a/R/deprecated.R b/R/deprecated.R
new file mode 100644
index 0000000..5e33335
--- /dev/null
+++ b/R/deprecated.R
@@ -0,0 +1,45 @@
+#' Deprecated functions in ideal
+#'
+#' Functions that are on their way to the function afterlife.
+#' Their successors are also listed.
+#'
+#' The successors of these functions are likely coming after the rework that
+#' led to the creation of the `mosdef` package. See more into its
+#' documentation for more details.
+#'
+#' @param ... Ignored arguments.
+#'
+#' @return All functions throw a warning, with a deprecation message pointing
+#' towards its descendent (if available).
+#'
+#' @name deprecated
+#'
+#' @section Transitioning to the mosdef framework:
+#'
+#' - [goseqTable()] is now being replaced by the more flexible
+#' [mosdef::run_goseq()] function (which is even faster)
+#' - [ggplotCounts()] is now being replaced by the more flexible, better
+#' designed, and actually even more good looking [mosdef::gene_plot()]
+#' function, with better default behavior and all.
+#' - [deseqresult2tbl()] and [deseqresult2DEgenes()] are now replaced by the
+#' more flexible [mosdef::deresult_to_df()]
+#' - The internally defined functions `createLinkENS()`, `createLinkGeneSymbol()`,
+#' and `createLinkGO()` are now replaced by the equivalent functions in `mosdef`:
+#' [mosdef::create_link_ENSEMBL()], [mosdef::create_link_NCBI()] and
+#' [mosdef::create_link_GO()]. Notably, the `mosdef` package expanded on the
+#' concept of automatically generated buttons, taking this to the extreme of
+#' efficiency with the [mosdef::buttonifier()] function
+#'
+#' @author Federico Marini
+#'
+#' @examples
+#' # try(goseqtable())
+#'
+NULL
+
+
+## #' @export
+## #' @rdname defunct
+## trendVar <- function(...) {
+## .Defunct("fitTrendVar")
+## }
diff --git a/R/genesignatures.R b/R/genesignatures.R
index 0fbaa38..360f242 100644
--- a/R/genesignatures.R
+++ b/R/genesignatures.R
@@ -12,7 +12,7 @@
#' # this example reads in the freely available pathways from wikipathways
#' \dontrun{
#' mysigs <- read_gmt(
-#' "http://data.wikipathways.org/20180910/gmt/wikipathways-20180910-gmt-Homo_sapiens.gmt"
+#' "http://data.wikipathways.org/20240910/gmt/wikipathways-20240910-gmt-Homo_sapiens.gmt"
#' )
#' head(mysigs)
#' # see how the gene identifiers are encoded as ENTREZ id
@@ -34,11 +34,11 @@ read_gmt <- function(gmtfile) {
#' Plot a heatmap for the selected gene signature on the provided data, with the
#' possibility to compactly display also DE only genes
#'
-#' @param vst_data A \code{\link{DESeqTransform}} object - usually the variance
+#' @param vst_data A [DESeqTransform()] object - usually the variance
#' stabilized transformed data, which will be used to extract the expression values
#' @param my_signature A character vector, usually named, containing the genes
#' which compose the gene signature
-#' @param res_data A \code{\link{DESeqResults}} object. If not provided, it can
+#' @param res_data A [DESeqResults()] object. If not provided, it can
#' be computed during the execution of the application
#' @param FDR Numeric value between 0 and 1, the False Discovery Rate
#' @param de_only Logical, whether to display only DE genes belonging to the pathway -
@@ -57,13 +57,13 @@ read_gmt <- function(gmtfile) {
#' @param scale_row Logical, whether to perform row-based standardization of the
#' expression values
#'
-#' @return A plot based on the \code{pheatmap} function
+#' @return A plot based on the `pheatmap` function
#' @export
#'
#' @examples
#' # with the well known airway package...
-#' library(airway)
-#' data(airway)
+#' library("airway")
+#' data("airway", package = "airway")
#' airway
#' dds_airway <- DESeq2::DESeqDataSetFromMatrix(assay(airway),
#' colData = colData(airway),
@@ -117,7 +117,7 @@ sig_heatmap <- function(vst_data, my_signature,
}
if (de_only) {
- de_res <- deseqresult2DEgenes(res_data, FDR)
+ de_res <- mosdef::deresult_to_df(res_data, FDR)
de_genes <- de_res$id
de_to_keep <- rownames(mydata_sig) %in% de_genes
mydata_sig <- mydata_sig[de_to_keep, ]
diff --git a/R/ggplotCounts.R b/R/ggplotCounts.R
index abb8539..001fc71 100644
--- a/R/ggplotCounts.R
+++ b/R/ggplotCounts.R
@@ -3,27 +3,30 @@
#' Plot for normalized counts of a single gene, with jittered points superimposed
#' on the boxplot
#'
-#' Note: this function relies on the \code{\link{plotCounts}} function of DESeq2,
+#' Note: this function relies on the [plotCounts()] function of DESeq2,
#' therefore pseudocounts of 0.5 are added to each point
#'
-#' @param dds A \code{\link{DESeqDataSet}} object.
+#' @param dds A [DESeqDataSet()] object.
#' @param gene A character, specifying the name of the gene to plot
#' @param intgroup Interesting groups: a character vector of
-#' names in \code{colData(dds)} to use for grouping
-#' @param annotation_obj A \code{data.frame} object, with \code{row.names} as gene
-#' identifiers (e.g. ENSEMBL ids) and a column, \code{gene_name}, containing
+#' names in `colData(dds)` to use for grouping
+#' @param annotation_obj A `data.frame` object, with `row.names` as gene
+#' identifiers (e.g. ENSEMBL ids) and a column, `gene_name`, containing
#' e.g. HGNC-based gene symbols. Optional.
#' @param transform Logical value, corresponding whether to have log scale y-axis
#' or not. Defaults to TRUE.
-#' @param labels_repel Logical value. Whether to use \code{ggrepel}'s functions to
+#' @param labels_repel Logical value. Whether to use `ggrepel`'s functions to
#' place labels; defaults to TRUE.
#'
-#' @return An object created by \code{ggplot}
+#' @return An object created by `ggplot`
+#'
+#' @importFrom mosdef gene_plot
+#'
#' @export
#'
#' @examples
-#' library(airway)
-#' data(airway)
+#' library("airway")
+#' data("airway", package = "airway")
#' airway
#' dds_airway <- DESeq2::DESeqDataSetFromMatrix(assay(airway),
#' colData = colData(airway),
@@ -35,59 +38,21 @@
#' )
ggplotCounts <- function(dds, gene, intgroup = "condition", annotation_obj = NULL,
transform = TRUE, labels_repel = TRUE) {
- df <- plotCounts(dds, gene, intgroup, returnData = TRUE)
- df$sampleID <- rownames(df)
-
- if (!is.null(annotation_obj)) {
- genesymbol <- annotation_obj$gene_name[match(gene, annotation_obj$gene_id)]
- } else {
- genesymbol <- ""
- }
-
- jittered_df <- df
- # jittered_df$conditionj <- jitter(as.numeric(factor(jittered_df$condition)))
- jittered_df$countj <- jitter(jittered_df$count)
-
- onlyfactors <- df[, match(intgroup, colnames(df))]
- df$plotby <- interaction(onlyfactors)
-
- # base_breaks <- function(n = 10){
- # function(x) {
- # axisTicks(log10(range(x, na.rm = TRUE)), log = TRUE, nint = n)
- # }
- # }
-
- p <-
- ggplot(df, aes_string(x = "plotby", y = "count", col = "plotby")) +
- geom_boxplot(outlier.shape = NA) +
- # geom_text(data = jittered_df,aes(x=conditionj,y=countj,label=sampleID)) +
- scale_x_discrete(name = "") +
- geom_jitter(aes_string(x = "plotby", y = "count"),
- position = position_jitter(width = 0.1)
- ) +
- scale_color_discrete(name = "Experimental\nconditions")
-
- if (labels_repel) {
- p <- p + ggrepel::geom_text_repel(aes_string(label = "sampleID"))
- } else {
- p <- p + geom_text(aes_string(label = "sampleID"), hjust = -.1, vjust = 0)
- }
-
- if (transform) {
- p <- p + scale_y_log10(name = "Normalized counts (log10 scale)")
- } else {
- p <- p + scale_y_continuous(name = "Normalized counts")
- }
-
- # scale_y_log10(name="Normalized counts - log10 scale") +
- # coord_cartesian(ylim = c())# ,limits=c(0.1,NA)) +
- p <- p + theme_bw()
-
- if (!is.null(annotation_obj)) {
- p <- p + labs(title = paste0("Normalized counts for ", genesymbol, " - ", gene))
- } else {
- p <- p + labs(title = paste0("Normalized counts for ", gene))
- }
-
- p
+ .Deprecated(old = "ggplotCounts", new = "mosdef::gene_plot",
+ msg = paste0(
+ "Please use `mosdef::gene_plot()` in replacement of the `ggplotCounts()` function, ",
+ "originally located in the ideal package. \nCheck the manual page for ",
+ "`?mosdef::gene_plot()` to see the details on how to use it, e.g. ",
+ "refer to the new parameter definition and naming"))
+
+ p <- mosdef::gene_plot(
+ de_container = dds,
+ gene = gene,
+ intgroup = intgroup,
+ annotation_obj = annotation_obj,
+ transform = transform,
+ labels_repel = labels_repel
+ )
+
+ return(p)
}
diff --git a/R/goseqTable.R b/R/goseqTable.R
index 5301d7e..2f69c54 100644
--- a/R/goseqTable.R
+++ b/R/goseqTable.R
@@ -3,32 +3,35 @@
#' A wrapper for extracting functional GO terms enriched in a list of (DE) genes,
#' based on the algorithm and the implementation in the goseq package
#'
-#' Note: the feature length retrieval is based on the \code{\link{goseq}} function,
+#' Note: the feature length retrieval is based on the [goseq()] function,
#' and requires that the corresponding TxDb packages are installed and available
#'
#' @param de.genes A vector of (differentially expressed) genes
#' @param assayed.genes A vector of background genes, e.g. all (expressed) genes
#' in the assays
#' @param genome A string identifying the genome that genes refer to, as in the
-#' \code{\link{goseq}} function
+#' [goseq()] function
#' @param id A string identifying the gene identifier used by genes, as in the
-#' \code{\link{goseq}} function
+#' [goseq()] function
#' @param testCats A vector specifying which categories to test for over representation amongst DE genes - can be any combination of "GO:CC", "GO:BP", "GO:MF" & "KEGG"
#' @param FDR_GO_cutoff Numeric value for subsetting the results
#' @param nTop Number of categories to extract, and optionally process for adding
#' genes to the respective terms
-#' @param orgDbPkg Character string, named as the \code{org.XX.eg.db}
+#' @param orgDbPkg Character string, named as the `org.XX.eg.db`
#' package which should be available in Bioconductor
#' @param addGeneToTerms Logical, whether to add a column with all genes annotated
#' to each GO term
#'
#' @return A table containing the computed GO Terms and related enrichment scores
+#'
#' @export
+#'
+#' @importFrom mosdef run_goseq
#'
#' @examples
#'
-#' library(airway)
-#' data(airway)
+#' library("airway")
+#' data("airway", package = "airway")
#' airway
#' dds_airway <- DESeq2::DESeqDataSetFromMatrix(assay(airway),
#' colData = colData(airway),
@@ -37,7 +40,7 @@
#' dds_airway <- DESeq2::DESeq(dds_airway)
#' res_airway <- DESeq2::results(dds_airway)
#'
-#' res_subset <- deseqresult2DEgenes(res_airway)[1:100, ]
+#' res_subset <- mosdef::deresult_to_df(res_airway)[1:100, ]
#' myde <- res_subset$id
#' myassayed <- rownames(res_airway)
#' \dontrun{
@@ -68,47 +71,23 @@ goseqTable <- function(de.genes, # Differentially expressed genes
## do it by default only for bp?
## tests at the beginning to see if the whole thing is feasible?
) {
- # library(goseq)
- # library(GO.db)
- gene.vector <- as.integer(assayed.genes %in% de.genes)
- names(gene.vector) <- assayed.genes
- fdr <- FDR_GO_cutoff
-
- pwf <- nullp(DEgenes = gene.vector, genome = genome, id = id, plot.fit = FALSE)
-
- goseq_out <- goseq(pwf, genome = genome, id = id, test.cats = testCats)
-
-
-
- goseq_out$p.adj <- p.adjust(goseq_out$over_represented_pvalue, method = "BH")
-
- # to reduce the load for adding the genes
- goseq_out <- goseq_out[seq_len(nTop), ]
-
- if (addGeneToTerms) {
- # for adding the gene ids/names...
- gene2cat <- getgo(de.genes, genome = genome, id = id, fetch.cats = testCats)
- names(gene2cat) <- de.genes
-
- reversemap <- function(map) # as in goseq
- {
- tmp <- unlist(map, use.names = FALSE)
- names(tmp) <- rep(names(map), times = as.numeric(summary(map)[, 1]))
- return(split(names(tmp), as.vector(tmp)))
- }
-
- cat2gene <- reversemap(gene2cat)
- # one list per GO term
- goseq_out$genes <- sapply(goseq_out$category, function(x) cat2gene[[x]])
-
- # TODO: replace identifiers/annotaions!!!
- ## and also TODO: do this only if genes are not already symbols
- goseq_out$genesymbols <- sapply(goseq_out$genes, function(x) sort(AnnotationDbi::mapIds(get(orgDbPkg), keys = x, keytype = "ENSEMBL", column = "SYMBOL", multiVals = "first")))
- # coerce to char
- goseq_out$genes <- unlist(lapply(goseq_out$genes, function(arg) paste(arg, collapse = ",")))
- # coerce to char
- goseq_out$genesymbols <- unlist(lapply(goseq_out$genesymbols, function(arg) paste(arg, collapse = ",")))
- }
-
- return(goseq_out)
+
+ .Deprecated(old = "goseqTable", new = "mosdef::run_goseq",
+ msg = paste0(
+ "Please use `mosdef::run_goseq()` in replacement of the `goseqTable()` function, ",
+ "originally located in the ideal package. \nCheck the manual page for ",
+ "`?mosdef::run_goseq()` to see the details on how to use it, e.g. ",
+ "refer to the new parameter definition and naming"))
+
+ res_enrich <- mosdef::run_goseq(
+ de_genes = de.genes,
+ bg_genes = assayed.genes,
+ genome = genome,
+ id = id,
+ testCats = testCats,
+ mapping = orgDbPkg,
+ add_gene_to_terms = addGeneToTerms
+ )
+
+ return(res_enrich)
}
diff --git a/R/helpers.R b/R/helpers.R
index c1e35e1..fcb36c5 100644
--- a/R/helpers.R
+++ b/R/helpers.R
@@ -38,7 +38,7 @@ footer <- function() {
#'
#' @param file The name of the file which the data are to be read from
#' @param sep_list A vector containing the candidates for being identified as
-#' separators. Defaults to \code{c(",", "\t", ";"," ")}
+#' separators. Defaults to `c(",", "\t", ";"," ")`
#'
#' @return A character value, corresponding to the guessed separator. One of ","
#' (comma), "\\t" (tab), ";" (semicolon)," " (whitespace)
@@ -80,7 +80,7 @@ shake_topGOtableResult <- function(obj,
if(!all(c("GO.ID", "Term", "Annotated", "Significant", "Expected", "p.value_classic") %in%
colnames(obj))) {
- stop("The provided object must be of in the format specified by the `pcaExplorer::topGOtable` function")
+ stop("The provided object must be of in the format specified by the `mosdef::run_topGO` function")
}
if(!p_value_column %in% colnames(obj)) {
@@ -90,7 +90,7 @@ shake_topGOtableResult <- function(obj,
if(!"genes" %in% colnames(obj)) {
stop("The column `genes` is not present in the provided object and is required for properly running GeneTonic.",
- "\nMaybe you did set `addGeneToTerms` to FALSE in the call to `pcaExplorer::topGOtable`?")
+ "\nMaybe you did set `add_gene_to_terms` to FALSE in the call to `mosdef::run_topGO`?")
}
# Thought: store somewhere the ontology if possible - in an extra column?
diff --git a/R/iSEE_plug.R b/R/iSEE_plug.R
index fb4b7e2..7b803f1 100644
--- a/R/iSEE_plug.R
+++ b/R/iSEE_plug.R
@@ -9,8 +9,8 @@
#' one of the workflows which include this package, e.g. in the context of the
#' ideal package.
#'
-#' @param dds A \code{\link{DESeqDataSet}} object.
-#' @param res A \code{\link{DESeqResults}} object.
+#' @param dds A [DESeqDataSet()] object.
+#' @param res A [DESeqResults()] object.
#'
#' @return A SummarizedExperiment object, with raw counts, normalized counts, and
#' variance-stabilizing transformed counts in the assay slots; and with colData
@@ -29,8 +29,8 @@
#' # iSEE(se)
#' \dontrun{
#' # or with the well known airway package...
-#' library(airway)
-#' data(airway)
+#' library("airway")
+#' data("airway", package = "airway")
#' airway
#' dds_airway <- DESeq2::DESeqDataSetFromMatrix(assay(airway),
#' colData = colData(airway),
diff --git a/R/ideal-pkg.R b/R/ideal-pkg.R
index ae188a4..652a079 100644
--- a/R/ideal-pkg.R
+++ b/R/ideal-pkg.R
@@ -33,7 +33,6 @@
#' @import GO.db
#' @importFrom UpSetR upset fromList
#' @importFrom goseq getgo goseq nullp
-#' @import pcaExplorer
#' @importFrom gplots venn
#' @importFrom IHW ihw
#' @importFrom rentrez entrez_summary
@@ -48,8 +47,12 @@
#' @importFrom shinyBS bsTooltip bsCollapse bsCollapsePanel
#' @importFrom ggrepel geom_text_repel
#' @importFrom base64enc dataURI
-#' @importFrom grDevices dev.off pdf axisTicks
+#' @importFrom grDevices dev.off pdf axisTicks colorRamp rgb
+#' @importFrom graphics pairs par strwidth text
#' @import methods
+#' @importFrom utils count.fields data head installed.packages
+#' packageDescription packageVersion read.delim sessionInfo str tail write.csv
+#' @importFrom stats as.formula cor quantile sd terms.formula var
#'
#' @author
#' Federico Marini \email{marinif@@uni-mainz.de}, 2016-2017
diff --git a/R/ideal.R b/R/ideal.R
index 08abfe2..2eb3d0b 100644
--- a/R/ideal.R
+++ b/R/ideal.R
@@ -5,41 +5,44 @@
#' ideal makes differential expression analysis interactive, easy and reproducible.
#' This function launches the main application included in the package.
#'
-#' @param dds_obj A \code{\link{DESeqDataSet}} object. If not provided, then a
-#' \code{countmatrix} and a \code{expdesign} need to be provided. If none of
+#' @param dds_obj A [DESeqDataSet()] object. If not provided, then a
+#' `countmatrix` and a `expdesign` need to be provided. If none of
#' the above is provided, it is possible to upload the data during the
#' execution of the Shiny App
-#' @param res_obj A \code{\link{DESeqResults}} object. If not provided, it can
+#' @param res_obj A [DESeqResults()] object. If not provided, it can
#' be computed during the execution of the application
-#' @param annotation_obj A \code{data.frame} object, with row.names as gene
-#' identifiers (e.g. ENSEMBL ids) and a column, \code{gene_name}, containing
+#' @param annotation_obj A `data.frame` object, with row.names as gene
+#' identifiers (e.g. ENSEMBL ids) and a column, `gene_name`, containing
#' e.g. HGNC-based gene symbols. If not provided, it can be constructed during
#' the execution via the org.eg.XX.db packages - these need to be installed
#' @param countmatrix A count matrix, with genes as rows and samples as columns.
#' If not provided, it is possible to upload the data during the execution of
#' the Shiny App
-#' @param expdesign A \code{data.frame} containing the info on the covariates
+#' @param expdesign A `data.frame` containing the info on the covariates
#' of each sample. If not provided, it is possible to upload the data during the
#' execution of the Shiny App
#' @param gene_signatures A list of vectors, one for each pathway/signature. This
-#' is for example the output of the \code{\link{read_gmt}} function. The provided
+#' is for example the output of the [read_gmt()] function. The provided
#' object can also be replaced during runtime in the dedicated upload widget.
#'
#' @return A Shiny App is launched for interactive data exploration and
#' differential expression analysis
+#'
+#' @importFrom mosdef run_topGO run_goseq gene_plot create_link_ENSEMBL
+#' create_link_NCBI create_link_GO get_annotation_orgdb pair_corr
#'
#' @export
#'
#' @examples
#' # with simulated data...
-#' library(DESeq2)
+#' library("DESeq2")
#' dds <- DESeq2::makeExampleDESeqDataSet(n = 100, m = 8)
#' cm <- counts(dds)
#' cd <- colData(dds)
#'
#' # with the well known airway package...
-#' library(airway)
-#' data(airway)
+#' library("airway")
+#' data("airway", package = "airway")
#' airway
#' dds_airway <- DESeq2::DESeqDataSetFromMatrix(assay(airway),
#' colData = colData(airway),
@@ -1485,8 +1488,10 @@ ideal <- function(dds_obj = NULL,
aw <- requireNamespace("airway", quietly = TRUE)
incProgress(0.2, detail = "`airway` package loaded")
if (aw) {
- data(airway, package = "airway", envir = environment())
-
+ data_env <- new.env(parent = emptyenv())
+ data("airway", envir = data_env, package = "airway")
+ airway <- data_env[["airway"]]
+
cm_airway <- assay(airway)
incProgress(0.7, detail = "Count matrix loaded")
ed_airway <- as.data.frame(colData(airway))
@@ -2029,7 +2034,8 @@ ideal <- function(dds_obj = NULL,
output$corrplot <- renderPlot({
if (input$compute_pairwisecorr) {
withProgress(
- pair_corr(current_countmat(),
+ mosdef::pair_corr(
+ current_countmat(),
method = input$corr_method,
log = input$corr_uselogs,
use_subset = input$corr_usesubset
@@ -2169,7 +2175,7 @@ ideal <- function(dds_obj = NULL,
# DE genes lists ----------------------------------------------------------
values$genelistUP <- reactive({
- res_tbl <- deseqresult2DEgenes(values$res_obj, FDR = input$FDR)
+ res_tbl <- mosdef::deresult_to_df(values$res_obj, FDR = input$FDR)
res_tbl_UP <- res_tbl[res_tbl$log2FoldChange > 0 & !is.na(res_tbl$padj), ]
# res_tbl_DOWN <- res_tbl[res_tbl$log2FoldChange < 0 & !is.na(res_tbl$padj),]
@@ -2192,7 +2198,7 @@ ideal <- function(dds_obj = NULL,
})
values$genelistDOWN <- reactive({
- res_tbl <- deseqresult2DEgenes(values$res_obj, FDR = input$FDR)
+ res_tbl <- mosdef::deresult_to_df(values$res_obj, FDR = input$FDR)
# res_tbl_UP <- res_tbl[res_tbl$log2FoldChange > 0 & !is.na(res_tbl$padj),]
res_tbl_DOWN <- res_tbl[res_tbl$log2FoldChange < 0 & !is.na(res_tbl$padj), ]
@@ -2215,7 +2221,7 @@ ideal <- function(dds_obj = NULL,
})
values$genelistUPDOWN <- reactive({
- res_tbl <- deseqresult2DEgenes(values$res_obj, FDR = input$FDR)
+ res_tbl <- mosdef::deresult_to_df(values$res_obj, FDR = input$FDR)
if ("symbol" %in% colnames(values$res_obj)) {
if (!is.null(values$annotation_obj)) {
@@ -2296,7 +2302,11 @@ ideal <- function(dds_obj = NULL,
incProgress(0.1, detail = "Matching identifiers")
tryCatch(
{
- annotation_obj <- get_annotation_orgdb(values$dds_obj, orgdb_species = annopkg, idtype = input$idtype)
+ annotation_obj <- mosdef::get_annotation_orgdb(
+ de_container = values$dds_obj,
+ orgdb_package = annopkg,
+ id_type = input$idtype)
+
values$annotation_obj <- annotation_obj
# and also, set the species in the reactiveValues
values$cur_species <- input$speciesSelect
@@ -2428,15 +2438,14 @@ ideal <- function(dds_obj = NULL,
)
incProgress(0.1, detail = "IDs mapped")
- values$gse_up_goseq <- goseqTable(de.genes.ids,
- assayed.genes.ids,
+ values$gse_up_goseq <- mosdef::run_goseq(
+ de_genes = de.genes.ids,
+ bg_genes = assayed.genes.ids,
genome = annoSpecies_df[values$cur_species, ]$goseq_short,
id = "ensGene",
testCats = paste0("GO:", input$go_cats),
- FDR_GO_cutoff = 1,
- nTop = 200,
- addGeneToTerms = TRUE,
- orgDbPkg = annoSpecies_df[values$cur_species, ]$pkg # ,
+ add_gene_to_terms = TRUE,
+ mapping = annoSpecies_df[values$cur_species, ]$pkg
)
incProgress(0.89)
@@ -2467,10 +2476,11 @@ ideal <- function(dds_obj = NULL,
incProgress(0.1, detail = "IDs mapped")
# library(topGO)
# requireNamespace("topGO")
- values$topgo_up <- pcaExplorer::topGOtable(de_symbols, bg_symbols,
+ values$topgo_up <- mosdef::run_topGO(
+ de_genes = de_symbols, bg_genes = bg_symbols,
ontology = input$go_cats[1],
mapping = annoSpecies_df[values$cur_species, ]$pkg,
- geneID = "symbol", addGeneToTerms = TRUE
+ gene_id = "symbol", add_gene_to_terms = TRUE
)
incProgress(0.89)
}
@@ -2552,15 +2562,14 @@ ideal <- function(dds_obj = NULL,
)
incProgress(0.1, detail = "IDs mapped")
- values$gse_down_goseq <- goseqTable(de.genes.ids,
- assayed.genes.ids,
+ values$gse_down_goseq <- mosdef::run_goseq(
+ de_genes = de.genes.ids,
+ bg_genes = assayed.genes.ids,
genome = annoSpecies_df[values$cur_species, ]$goseq_short,
id = "ensGene",
testCats = paste0("GO:", input$go_cats),
- FDR_GO_cutoff = 1,
- nTop = 200,
- addGeneToTerms = TRUE,
- orgDbPkg = annoSpecies_df[values$cur_species, ]$pkg # ,
+ add_gene_to_terms = TRUE,
+ mapping = annoSpecies_df[values$cur_species, ]$pkg
)
incProgress(0.89)
@@ -2591,10 +2600,11 @@ ideal <- function(dds_obj = NULL,
incProgress(0.1, detail = "IDs mapped")
# library(topGO)
# requireNamespace("topGO")
- values$topgo_down <- pcaExplorer::topGOtable(de_symbols, bg_symbols,
+ values$topgo_down <- mosdef::run_topGO(
+ de_genes = de_symbols, bg_genes = bg_symbols,
ontology = input$go_cats[1], # will take the first ontology
mapping = annoSpecies_df[values$cur_species, ]$pkg,
- geneID = "symbol", addGeneToTerms = TRUE
+ gene_id = "symbol", add_gene_to_terms = TRUE
)
incProgress(0.89)
}
@@ -2678,15 +2688,14 @@ ideal <- function(dds_obj = NULL,
)
incProgress(0.1, detail = "IDs mapped")
- values$gse_updown_goseq <- goseqTable(de.genes.ids,
- assayed.genes.ids,
+ values$gse_updown_goseq <- mosdef::run_goseq(
+ de_genes = de.genes.ids,
+ bg_genes = assayed.genes.ids,
genome = annoSpecies_df[values$cur_species, ]$goseq_short,
id = "ensGene",
testCats = paste0("GO:", input$go_cats),
- FDR_GO_cutoff = 1,
- nTop = 200,
- addGeneToTerms = TRUE,
- orgDbPkg = annoSpecies_df[values$cur_species, ]$pkg # ,
+ add_gene_to_terms = TRUE,
+ mapping = annoSpecies_df[values$cur_species, ]$pkg
)
incProgress(0.89)
@@ -2717,10 +2726,11 @@ ideal <- function(dds_obj = NULL,
incProgress(0.1, detail = "IDs mapped")
# library(topGO)
# requireNamespace("topGO")
- values$topgo_updown <- pcaExplorer::topGOtable(de_symbols, bg_symbols,
+ values$topgo_updown <- mosdef::run_topGO(
+ de_genes = de_symbols, bg_genes = bg_symbols,
ontology = input$go_cats[1],
mapping = annoSpecies_df[values$cur_species, ]$pkg,
- geneID = "symbol", addGeneToTerms = TRUE
+ gene_id = "symbol", add_gene_to_terms = TRUE
)
incProgress(0.89)
}
@@ -2797,15 +2807,14 @@ ideal <- function(dds_obj = NULL,
)
incProgress(0.1, detail = "IDs mapped")
- values$gse_list1_goseq <- goseqTable(de.genes.ids,
- assayed.genes.ids,
+ values$gse_list1_goseq <- mosdef::run_goseq(
+ de_genes = de.genes.ids,
+ bg_genes = assayed.genes.ids,
genome = annoSpecies_df[values$cur_species, ]$goseq_short,
id = "ensGene",
testCats = paste0("GO:", input$go_cats),
- FDR_GO_cutoff = 1,
- nTop = 200,
- addGeneToTerms = TRUE,
- orgDbPkg = annoSpecies_df[values$cur_species, ]$pkg # ,
+ add_gene_to_terms = TRUE,
+ mapping = annoSpecies_df[values$cur_species, ]$pkg
)
incProgress(0.89)
@@ -2833,10 +2842,11 @@ ideal <- function(dds_obj = NULL,
incProgress(0.1, detail = "IDs mapped")
# library(topGO)
# requireNamespace("topGO")
- values$topgo_list1 <- pcaExplorer::topGOtable(de_symbols, bg_symbols,
+ values$topgo_list1 <- mosdef::run_topGO(
+ de_genes = de_symbols, bg_genes = bg_symbols,
ontology = input$go_cats[1],
mapping = annoSpecies_df[values$cur_species, ]$pkg,
- geneID = "symbol", addGeneToTerms = TRUE
+ gene_id = "symbol", add_gene_to_terms = TRUE
)
incProgress(0.89)
}
@@ -2910,15 +2920,14 @@ ideal <- function(dds_obj = NULL,
)
incProgress(0.1, detail = "IDs mapped")
- values$gse_list2_goseq <- goseqTable(de.genes.ids,
- assayed.genes.ids,
+ values$gse_list2_goseq <- mosdef::run_goseq(
+ de_genes = de.genes.ids,
+ bg_genes = assayed.genes.ids,
genome = annoSpecies_df[values$cur_species, ]$goseq_short,
id = "ensGene",
testCats = paste0("GO:", input$go_cats),
- FDR_GO_cutoff = 1,
- nTop = 200,
- addGeneToTerms = TRUE,
- orgDbPkg = annoSpecies_df[values$cur_species, ]$pkg # ,
+ add_gene_to_terms = TRUE,
+ mapping = annoSpecies_df[values$cur_species, ]$pkg # ,
)
incProgress(0.89)
@@ -2946,10 +2955,11 @@ ideal <- function(dds_obj = NULL,
incProgress(0.1, detail = "IDs mapped")
# library(topGO)
# requireNamespace("topGO")
- values$topgo_list2 <- pcaExplorer::topGOtable(de_symbols, bg_symbols,
+ values$topgo_list2 <- mosdef::run_topGO(
+ de_genes = de_symbols, bg_genes = bg_symbols,
ontology = input$go_cats[1],
mapping = annoSpecies_df[values$cur_species, ]$pkg,
- geneID = "symbol", addGeneToTerms = TRUE
+ gene_id = "symbol", add_gene_to_terms = TRUE
)
incProgress(0.89)
}
@@ -3136,7 +3146,7 @@ ideal <- function(dds_obj = NULL,
return(NULL)
}
mytbl <- values$gse_up
- rownames(mytbl) <- createLinkGO(rownames(mytbl))
+ rownames(mytbl) <- mosdef::create_link_GO(rownames(mytbl))
datatable(mytbl, escape = FALSE)
})
output$DT_gse_down <- DT::renderDataTable({
@@ -3145,7 +3155,7 @@ ideal <- function(dds_obj = NULL,
return(NULL)
}
mytbl <- values$gse_down
- rownames(mytbl) <- createLinkGO(rownames(mytbl))
+ rownames(mytbl) <- mosdef::create_link_GO(rownames(mytbl))
datatable(mytbl, escape = FALSE)
})
output$DT_gse_updown <- DT::renderDataTable({
@@ -3154,7 +3164,7 @@ ideal <- function(dds_obj = NULL,
return(NULL)
}
mytbl <- values$gse_updown
- rownames(mytbl) <- createLinkGO(rownames(mytbl))
+ rownames(mytbl) <- mosdef::create_link_GO(rownames(mytbl))
datatable(mytbl, escape = FALSE)
})
output$DT_gse_list1 <- DT::renderDataTable({
@@ -3164,7 +3174,7 @@ ideal <- function(dds_obj = NULL,
}
mytbl <- values$gse_list1
# mytbl$GOid <- rownames(mytbl)
- rownames(mytbl) <- createLinkGO(rownames(mytbl))
+ rownames(mytbl) <- mosdef::create_link_GO(rownames(mytbl))
datatable(mytbl, escape = FALSE)
})
output$DT_gse_list2 <- DT::renderDataTable({
@@ -3173,7 +3183,7 @@ ideal <- function(dds_obj = NULL,
return(NULL)
}
mytbl <- values$gse_list2
- rownames(mytbl) <- createLinkGO(rownames(mytbl))
+ rownames(mytbl) <- mosdef::create_link_GO(rownames(mytbl))
datatable(mytbl, escape = FALSE)
})
@@ -3184,7 +3194,7 @@ ideal <- function(dds_obj = NULL,
return(NULL)
}
mytbl <- values$topgo_up
- mytbl$GO.ID <- createLinkGO(mytbl$GO.ID)
+ mytbl$GO.ID <- mosdef::create_link_GO(mytbl$GO.ID)
DT::datatable(mytbl, escape = FALSE, selection = list(mode = "single"))
})
output$DT_gse_down_topgo <- DT::renderDataTable({
@@ -3193,7 +3203,7 @@ ideal <- function(dds_obj = NULL,
return(NULL)
}
mytbl <- values$topgo_down
- mytbl$GO.ID <- createLinkGO(mytbl$GO.ID)
+ mytbl$GO.ID <- mosdef::create_link_GO(mytbl$GO.ID)
DT::datatable(mytbl, escape = FALSE, selection = list(mode = "single"))
})
output$DT_gse_updown_topgo <- DT::renderDataTable({
@@ -3202,7 +3212,7 @@ ideal <- function(dds_obj = NULL,
return(NULL)
}
mytbl <- values$topgo_updown
- mytbl$GO.ID <- createLinkGO(mytbl$GO.ID)
+ mytbl$GO.ID <- mosdef::create_link_GO(mytbl$GO.ID)
DT::datatable(mytbl, escape = FALSE, selection = list(mode = "single"))
})
output$DT_gse_list1_topgo <- DT::renderDataTable({
@@ -3212,7 +3222,7 @@ ideal <- function(dds_obj = NULL,
}
mytbl <- values$topgo_list1
# mytbl$GOid <- rownames(mytbl)
- mytbl$GO.ID <- createLinkGO(mytbl$GO.ID)
+ mytbl$GO.ID <- mosdef::create_link_GO(mytbl$GO.ID)
DT::datatable(mytbl, escape = FALSE, selection = list(mode = "single"))
})
output$DT_gse_list2_topgo <- DT::renderDataTable({
@@ -3222,7 +3232,7 @@ ideal <- function(dds_obj = NULL,
}
mytbl <- values$topgo_list2
# mytbl$GOid <- rownames(mytbl)
- mytbl$GO.ID <- createLinkGO(mytbl$GO.ID)
+ mytbl$GO.ID <- mosdef::create_link_GO(mytbl$GO.ID)
DT::datatable(mytbl, escape = FALSE, selection = list(mode = "single"))
})
@@ -3233,7 +3243,7 @@ ideal <- function(dds_obj = NULL,
return(NULL)
}
mytbl <- values$gse_up_goseq
- mytbl$category <- createLinkGO(mytbl$category)
+ mytbl$category <- mosdef::create_link_GO(mytbl$category)
datatable(mytbl, escape = FALSE, rownames = FALSE)
})
output$DT_gse_down_goseq <- DT::renderDataTable({
@@ -3242,7 +3252,7 @@ ideal <- function(dds_obj = NULL,
return(NULL)
}
mytbl <- values$gse_down_goseq
- mytbl$category <- createLinkGO(mytbl$category)
+ mytbl$category <- mosdef::create_link_GO(mytbl$category)
datatable(mytbl, escape = FALSE, rownames = FALSE)
})
output$DT_gse_updown_goseq <- DT::renderDataTable({
@@ -3251,7 +3261,7 @@ ideal <- function(dds_obj = NULL,
return(NULL)
}
mytbl <- values$gse_updown_goseq
- mytbl$category <- createLinkGO(mytbl$category)
+ mytbl$category <- mosdef::create_link_GO(mytbl$category)
datatable(mytbl, escape = FALSE, rownames = FALSE)
})
output$DT_gse_list1_goseq <- DT::renderDataTable({
@@ -3261,7 +3271,7 @@ ideal <- function(dds_obj = NULL,
}
mytbl <- values$gse_list1_goseq
# mytbl$GOid <- rownames(mytbl)
- mytbl$category <- createLinkGO(mytbl$category)
+ mytbl$category <- mosdef::create_link_GO(mytbl$category)
datatable(mytbl, escape = FALSE, rownames = FALSE)
})
output$DT_gse_list2_goseq <- DT::renderDataTable({
@@ -3271,7 +3281,7 @@ ideal <- function(dds_obj = NULL,
}
mytbl <- values$gse_list2_goseq
# mytbl$GOid <- rownames(mytbl)
- mytbl$category <- createLinkGO(mytbl$category)
+ mytbl$category <- mosdef::create_link_GO(mytbl$category)
datatable(mytbl, escape = FALSE, rownames = FALSE)
})
@@ -4042,9 +4052,9 @@ ideal <- function(dds_obj = NULL,
return(NULL)
}
mydf <- as.data.frame(values$res_obj[order(values$res_obj$padj), ]) # [1:500,]
- rownames(mydf) <- createLinkENS(rownames(mydf), species = annoSpecies_df$ensembl_db[match(input$speciesSelect, annoSpecies_df$species)]) ## TODO: check what are the species from ensembl and
+ rownames(mydf) <- mosdef::create_link_ENSEMBL(rownames(mydf), species = annoSpecies_df$ensembl_db[match(input$speciesSelect, annoSpecies_df$species)]) ## TODO: check what are the species from ensembl and
## TODO: add a check to see if wanted?
- mydf$symbol <- createLinkGeneSymbol(mydf$symbol)
+ mydf$symbol <- mosdef::create_link_NCBI(mydf$symbol)
datatable(mydf, escape = FALSE)
})
@@ -4354,7 +4364,10 @@ ideal <- function(dds_obj = NULL,
selectedGene <- as.character(curDataClick()$ID)
selectedGeneSymbol <- values$annotation_obj$gene_name[match(selectedGene, values$annotation_obj$gene_id)]
- p <- ggplotCounts(values$dds_obj, selectedGene, intgroup = input$color_by, annotation_obj = values$annotation_obj)
+ p <- mosdef::gene_plot(de_container = values$dds_obj,
+ gene = selectedGene,
+ intgroup = input$color_by,
+ annotation_obj = values$annotation_obj)
if (input$ylimZero_genes) {
p <- p + ylim(0.1, NA)
@@ -4417,7 +4430,7 @@ ideal <- function(dds_obj = NULL,
normCounts <- as.data.frame(counts(estimateSizeFactors(values$dds_obj), normalized = TRUE))
normCounts$id <- rownames(normCounts)
- res_df <- deseqresult2tbl(values$res_obj)
+ res_df <- mosdef::deresult_to_df(values$res_obj)
combi_obj <- dplyr::inner_join(res_df, normCounts, by = "id")
combi_obj$symbol <- values$annotation_obj$gene_name[match(combi_obj$id, values$annotation_obj$gene_id)]
@@ -4448,7 +4461,7 @@ ideal <- function(dds_obj = NULL,
normCounts <- as.data.frame(counts(estimateSizeFactors(values$dds_obj), normalized = TRUE))
normCounts$id <- rownames(normCounts)
- res_df <- deseqresult2tbl(values$res_obj)
+ res_df <- mosdef::deresult_to_df(values$res_obj)
combi_obj <- dplyr::inner_join(res_df, normCounts, by = "id")
combi_obj$symbol <- values$annotation_obj$gene_name[match(combi_obj$id, values$annotation_obj$gene_id)]
@@ -4501,7 +4514,10 @@ ideal <- function(dds_obj = NULL,
mysim <- ""
}
}
- p <- ggplotCounts(values$dds_obj, myid, intgroup = input$color_by, annotation_obj = values$annotation_obj)
+ p <- mosdef::gene_plot(de_container = values$dds_obj,
+ gene = myid,
+ intgroup = input$color_by,
+ annotation_obj = values$annotation_obj)
if (input$ylimZero_genefinder) {
p <- p + ylim(0.1, NA)
}
@@ -4535,7 +4551,10 @@ ideal <- function(dds_obj = NULL,
mysim <- ""
}
}
- p <- ggplotCounts(values$dds_obj, myid, intgroup = input$color_by, annotation_obj = values$annotation_obj)
+ p <- mosdef::gene_plot(de_container = values$dds_obj,
+ gene = myid,
+ intgroup = input$color_by,
+ annotation_obj = values$annotation_obj)
if (input$ylimZero_genefinder) {
p <- p + ylim(0.1, NA)
}
@@ -4569,7 +4588,10 @@ ideal <- function(dds_obj = NULL,
mysim <- ""
}
}
- p <- ggplotCounts(values$dds_obj, myid, intgroup = input$color_by, annotation_obj = values$annotation_obj)
+ p <- mosdef::gene_plot(de_container = values$dds_obj,
+ gene = myid,
+ intgroup = input$color_by,
+ annotation_obj = values$annotation_obj)
if (input$ylimZero_genefinder) {
p <- p + ylim(0.1, NA)
}
@@ -4603,7 +4625,10 @@ ideal <- function(dds_obj = NULL,
mysim <- ""
}
}
- p <- ggplotCounts(values$dds_obj, myid, intgroup = input$color_by, annotation_obj = values$annotation_obj)
+ p <- mosdef::gene_plot(de_container = values$dds_obj,
+ gene = myid,
+ intgroup = input$color_by,
+ annotation_obj = values$annotation_obj)
if (input$ylimZero_genefinder) {
p <- p + ylim(0.1, NA)
}
diff --git a/R/plot_ma.R b/R/plot_ma.R
index 229935e..afd7b47 100644
--- a/R/plot_ma.R
+++ b/R/plot_ma.R
@@ -3,16 +3,16 @@
#' MA-plot from base means and log fold changes, in the ggplot2 framework, with
#' additional support to annotate genes if provided.
#'
-#' The genes of interest are to be provided as gene symbols if a \code{symbol}
-#' column is provided in \code{res_obj}, or else by using the identifiers specified
+#' The genes of interest are to be provided as gene symbols if a `symbol`
+#' column is provided in `res_obj`, or else by using the identifiers specified
#' in the row names
#'
-#' @param res_obj A \code{\link{DESeqResults}} object
+#' @param res_obj A [DESeqResults()] object
#' @param FDR Numeric value, the significance level for thresholding adjusted p-values
#' @param point_alpha Alpha transparency value for the points (0 = transparent, 1 = opaque)
#' @param sig_color Color to use to mark differentially expressed genes. Defaults to red
-#' @param annotation_obj A \code{data.frame} object, with row.names as gene
-#' identifiers (e.g. ENSEMBL ids) and a column, \code{gene_name}, containing
+#' @param annotation_obj A `data.frame` object, with row.names as gene
+#' identifiers (e.g. ENSEMBL ids) and a column, `gene_name`, containing
#' e.g. HGNC-based gene symbols. Optional
#' @param draw_y0 Logical, whether to draw the horizontal line at y=0. Defaults to
#' TRUE.
@@ -22,21 +22,21 @@
#' @param xlab X axis label, defaults to "mean of normalized counts - log10 scale"
#' @param ylim Vector of two numeric values, Y axis limits to restrict the view
#' @param add_rug Logical, whether to add rug plots in the margins
-#' @param intgenes Vector of genes of interest. Gene symbols if a \code{symbol}
-#' column is provided in \code{res_obj}, or else the identifiers specified in the
+#' @param intgenes Vector of genes of interest. Gene symbols if a `symbol`
+#' column is provided in `res_obj`, or else the identifiers specified in the
#' row names
#' @param intgenes_color The color to use to mark the genes on the main plot.
#' @param labels_intgenes Logical, whether to add the gene identifiers/names close
#' to the marked plots
-#' @param labels_repel Logical, whether to use \code{geom_text_repel} for placing the
+#' @param labels_repel Logical, whether to use `geom_text_repel` for placing the
#' labels on the features to mark
#'
-#' @return An object created by \code{ggplot}
+#' @return An object created by `ggplot`
#' @export
#'
#' @examples
-#' library(airway)
-#' data(airway)
+#' library("airway")
+#' data("airway", package = "airway")
#' airway
#' dds_airway <- DESeq2::DESeqDataSetFromMatrix(assay(airway),
#' colData = colData(airway),
diff --git a/R/plot_volcano.R b/R/plot_volcano.R
index 1bb2b74..73dc77b 100644
--- a/R/plot_volcano.R
+++ b/R/plot_volcano.R
@@ -3,31 +3,31 @@
#' Volcano plot for log fold changes and log p-values in the ggplot2 framework, with
#' additional support to annotate genes if provided.
#'
-#' The genes of interest are to be provided as gene symbols if a \code{symbol}
-#' column is provided in \code{res_obj}, or else b< using the identifiers specified
+#' The genes of interest are to be provided as gene symbols if a `symbol`
+#' column is provided in `res_obj`, or else b< using the identifiers specified
#' in the row names
#'
-#' @param res_obj A \code{\link{DESeqResults}} object
+#' @param res_obj A [DESeqResults()] object
#' @param FDR Numeric value, the significance level for thresholding adjusted p-values
#' @param ylim_up Numeric value, Y axis upper limits to restrict the view
#' @param vlines The x coordinate (in absolute value) where to draw vertical lines,
#' optional
#' @param title A title for the plot, optional
-#' @param intgenes Vector of genes of interest. Gene symbols if a \code{symbol}
-#' column is provided in \code{res_obj}, or else the identifiers specified in the
+#' @param intgenes Vector of genes of interest. Gene symbols if a `symbol`
+#' column is provided in `res_obj`, or else the identifiers specified in the
#' row names
#' @param intgenes_color The color to use to mark the genes on the main plot.
#' @param labels_intgenes Logical, whether to add the gene identifiers/names close
#' to the marked plots
-#' @param labels_repel Logical, whether to use \code{geom_text_repel} for placing the
+#' @param labels_repel Logical, whether to use `geom_text_repel` for placing the
#' labels on the features to mark
#'
-#' @return An object created by \code{ggplot}
+#' @return An object created by `ggplot`
#' @export
#'
#' @examples
-#' library(airway)
-#' data(airway)
+#' library("airway")
+#' data("airway", package = "airway")
#' airway
#' dds_airway <- DESeq2::DESeqDataSetFromMatrix(assay(airway),
#' colData = colData(airway),
diff --git a/R/res2tbl.R b/R/res2tbl.R
index 0274cd5..95e12ee 100644
--- a/R/res2tbl.R
+++ b/R/res2tbl.R
@@ -2,10 +2,12 @@
#'
#' Generate a tidy table with the results of DESeq
#'
-#' @param deseqresult A \code{\link{DESeqResults}} object
+#' @param deseqresult A [DESeqResults()] object
#'
#' @return A "tidy" data.frame with all genes
#' @export
+#'
+#' @importFrom mosdef deresult_to_df
#'
#' @examples
#'
@@ -16,15 +18,16 @@
#' res <- DESeq2::results(dds)
#' deseqresult2tbl(res)
deseqresult2tbl <- function(deseqresult) {
- # library("dplyr")
- if (!is(deseqresult, "DESeqResults")) stop("Not a DESeqResults object.")
- deseqresult <- as.data.frame(deseqresult)
-
- deseqresult <- cbind(rownames(deseqresult), deseqresult)
- names(deseqresult)[1] <- "id"
- deseqresult$id <- as.character(deseqresult$id)
-
- dplyr::arrange(deseqresult, .data$padj)
+ .Deprecated(old = "deseqresult2tbl", new = "mosdef::deresult_to_df",
+ msg = paste0(
+ "Please use `mosdef::deresult_to_df()` in replacement of the `deseqresult2tbl()` function, ",
+ "originally located in the ideal package. \nCheck the manual page for ",
+ "`?mosdef::deresult_to_df()` to see the details on how to use it, e.g. ",
+ "refer to the new parameter definition and naming"))
+
+ res_de <- mosdef::deresult_to_df(deseqresult)
+
+ return(res_de)
}
@@ -34,11 +37,13 @@ deseqresult2tbl <- function(deseqresult) {
#'
#' Generate a tidy table with the DE genes from the results of DESeq
#'
-#' @param deseqresult A \code{\link{DESeqResults}} object
+#' @param deseqresult A [DESeqResults()] object
#' @param FDR Numeric value, the significance level for thresholding adjusted p-values
#'
#' @return A "tidy" data.frame with only genes marked as differentially expressed
#' @export
+#'
+#' @importFrom mosdef deresult_to_df
#'
#' @examples
#'
@@ -50,22 +55,14 @@ deseqresult2tbl <- function(deseqresult) {
#' deseqresult2DEgenes(res)
deseqresult2DEgenes <- function(deseqresult,
FDR = 0.05) {
- # library("dplyr")
- if (!is(deseqresult, "DESeqResults")) stop("Not a DESeqResults object.")
- deseqresult <- as.data.frame(deseqresult)
-
- deseqresult <- cbind(rownames(deseqresult), deseqresult)
- names(deseqresult)[1] <- "id"
- deseqresult$id <- as.character(deseqresult$id)
-
- # deseqresult$id <- rownames(deseqresult)
- # rownames(deseqresult) <- NULL
- # deseqresult <- dplyr::tbl_df(deseqresult)
- # if("symbol" %in% names(deseqresult))
- # deseqresult <- dplyr::select(deseqresult, id, baseMean, log2FoldChange:symbol)
- # else
- # deseqresult <- dplyr::select(deseqresult, id, baseMean, log2FoldChange:padj)
- tmp <- dplyr::arrange(deseqresult, .data$padj)
- res <- tmp[!(is.na(tmp$padj)) & tmp$padj <= FDR, ]
- res
+ .Deprecated(old = "deseqresult2DEgenes", new = "mosdef::deresult_to_df",
+ msg = paste0(
+ "Please use `mosdef::deresult_to_df()` in replacement of the `deseqresult2DEgenes()` function, ",
+ "originally located in the ideal package. \nCheck the manual page for ",
+ "`?mosdef::deresult_to_df()` to see the details on how to use it, e.g. ",
+ "refer to the new parameter definition and naming"))
+
+ res_de <- mosdef::deresult_to_df(deseqresult, FDR = FDR)
+
+ return(res_de)
}
diff --git a/R/table-enhancers.R b/R/table-enhancers.R
index 49c2bb0..ded1cce 100644
--- a/R/table-enhancers.R
+++ b/R/table-enhancers.R
@@ -3,22 +3,24 @@
createLinkGO <- function(val) {
- sprintf('%s', val, val)
+ .Deprecated(old = "createLinkGO", new = "mosdef::create_link_GO")
+
+ mosdef::create_link_GO(val = val)
}
createLinkENS <- function(val, species = "Mus_musculus") {
- paste0('', val, "")
+ .Deprecated(old = "createLinkENS", new = "mosdef::create_link_ENSEMBL")
+
+ mosdef::create_link_ENSEMBL(val = val, species = species)
}
createLinkGeneSymbol <- function(val) {
- # possibilities:
- # ncbi
- # genecards
- paste0('', val, "")
+ .Deprecated(old = "createLinkGeneSymbol", new = "mosdef::create_link_NCBI")
+
+ mosdef::create_link_NCBI(val = val)
}
-
geneinfo <- function(gene_id) {
# the gene id has to be entrez_id
diff --git a/inst/extdata/instructions.md b/inst/extdata/instructions.md
index dfec399..a57d2a7 100644
--- a/inst/extdata/instructions.md
+++ b/inst/extdata/instructions.md
@@ -277,10 +277,10 @@ To run *[ideal](http://bioconductor.org/packages/ideal)* on this dataset, the fo
```r
-library(airway)
-library(DESeq2)
+library("airway")
+library("DESeq2")
-data(airway)
+data("airway", package = "airway")
dds_airway <- DESeqDataSet(airway,design= ~ cell + dex)
dds_airway
@@ -521,6 +521,8 @@ ggplotCounts(dds = dds_airway,
When used in the context of the app, it is possible to seamless search for genes also by their gene name, making exploration even more immediate.
+From version 1.30.0 onwards, the `ggplotCounts()` function has been deprecated, in favor of the equivalent `mosdef::gene_plot()` function, which is more robust and flexible in its usage.
+
### `goseqTable`
`goseqTable` is a wrapper to extract the functional GO terms enriched in in a list of (DE) genes, based on the algorithm and the implementation in the *[goseq](http://bioconductor.org/packages/goseq)* package.
@@ -625,7 +627,7 @@ mygo_enhanced$category <- ideal:::createLinkGO(mygo_enhanced$category)
DT::datatable(mygo_enhanced,escape=FALSE)
```
-
+From version 1.30.0 onwards, the `goseqTable()` function has been deprecated, in favor of the equivalent `mosdef::run_goseq()` function, which is faster, more robust and flexible in its usage.
### `plot_ma`
diff --git a/inst/extdata/irt.Rmd b/inst/extdata/irt.Rmd
index 7fed9f3..b95cf0c 100644
--- a/inst/extdata/irt.Rmd
+++ b/inst/extdata/irt.Rmd
@@ -184,9 +184,9 @@ if(!is.null(values$res_obj)) {
print(p4)
mydf <- as.data.frame(values$res_obj[order(values$res_obj$padj),])#[1:500,]
- rownames(mydf) <- createLinkENS(rownames(mydf),species = annoSpecies_df$ensembl_db[match(input$speciesSelect,annoSpecies_df$species)]) ## TODO: check what are the species from ensembl and
+ rownames(mydf) <- mosdef::create_link_ENSEMBL(rownames(mydf),species = annoSpecies_df$ensembl_db[match(input$speciesSelect,annoSpecies_df$species)]) ## TODO: check what are the species from ensembl and
## TODO: add a check to see if wanted?
- mydf$symbol <- createLinkGeneSymbol(mydf$symbol)
+ mydf$symbol <- mosdef::create_link_NCBI(mydf$symbol)
datatable(mydf, escape = FALSE)
}
```
@@ -266,7 +266,10 @@ if(length(input$color_by) > 0 &
print(length(myids))
for(myid in myids) {
- p <- ggplotCounts(values$dds_obj, myid, intgroup = input$color_by,annotation_obj=values$annotation_obj)
+ p <- mosdef::gene_plot(de_container = values$dds_obj,
+ gene = myid,
+ intgroup = input$color_by,
+ annotation_obj=values$annotation_obj)
if(input$ylimZero_genefinder)
p <- p + ylim(0.1, NA)
print(p)
@@ -312,61 +315,61 @@ if(!is.null(values$res_obj)) {
# here only for goana
if(!is.null(values$gse_up)) {
mytbl <- values$gse_up
- rownames(mytbl) <- createLinkGO(rownames(mytbl))
+ rownames(mytbl) <- mosdef::create_link_GO(rownames(mytbl))
datatable(mytbl,escape=FALSE)
}
if(!is.null(values$gse_down)) {
mytbl <- values$gse_down
- rownames(mytbl) <- createLinkGO(rownames(mytbl))
+ rownames(mytbl) <- mosdef::create_link_GO(rownames(mytbl))
datatable(mytbl,escape=FALSE)
}
if(!is.null(values$gse_updown)) {
mytbl <- values$gse_updown
- rownames(mytbl) <- createLinkGO(rownames(mytbl))
+ rownames(mytbl) <- mosdef::create_link_GO(rownames(mytbl))
datatable(mytbl,escape=FALSE)
}
if(!is.null(values$gse_list1)) {
mytbl <- values$gse_list1
- rownames(mytbl) <- createLinkGO(rownames(mytbl))
+ rownames(mytbl) <- mosdef::create_link_GO(rownames(mytbl))
datatable(mytbl,escape=FALSE)
}
if(!is.null(values$gse_list2)) {
mytbl <- values$gse_list2
- rownames(mytbl) <- createLinkGO(rownames(mytbl))
+ rownames(mytbl) <- mosdef::create_link_GO(rownames(mytbl))
datatable(mytbl,escape=FALSE)
}
# here only for topgo
if(!is.null(values$topgo_up)) {
mytbl <- values$topgo_up
- mytbl$GO.ID <- createLinkGO(mytbl$GO.ID)
+ mytbl$GO.ID <- mosdef::create_link_GO(mytbl$GO.ID)
datatable(mytbl,escape=FALSE)
}
if(!is.null(values$topgo_down)) {
mytbl <- values$topgo_down
- mytbl$GO.ID <- createLinkGO(mytbl$GO.ID)
+ mytbl$GO.ID <- mosdef::create_link_GO(mytbl$GO.ID)
datatable(mytbl,escape=FALSE)
}
if(!is.null(values$topgo_updown)) {
mytbl <- values$topgo_updown
- mytbl$GO.ID <- createLinkGO(mytbl$GO.ID)
+ mytbl$GO.ID <- mosdef::create_link_GO(mytbl$GO.ID)
datatable(mytbl,escape=FALSE)
}
if(!is.null(values$topgo_list1)) {
mytbl <- values$topgo_list1
- mytbl$GO.ID <- createLinkGO(mytbl$GO.ID)
+ mytbl$GO.ID <- mosdef::create_link_GO(mytbl$GO.ID)
datatable(mytbl,escape=FALSE)
}
if(!is.null(values$topgo_list2)) {
mytbl <- values$topgo_list2
- mytbl$GO.ID <- createLinkGO(mytbl$GO.ID)
+ mytbl$GO.ID <- mosdef::create_link_GO(mytbl$GO.ID)
datatable(mytbl,escape=FALSE)
}
# similarly for goseq...
if(!is.null(values$gse_updown_goseq)) {
mytbl <- values$gse_updown_goseq
- mytbl$category <- createLinkGO(mytbl$category)
+ mytbl$category <- mosdef::create_link_GO(mytbl$category)
datatable(mytbl,escape=FALSE)
}
@@ -461,7 +464,7 @@ footertemplate <- function(){
tags$a(href="https://github.com/federicomarini/ideal", "ideal"), br(),
"ideal is a project developed by Federico Marini in the Bioinformatics division of the ",
tags$a(href="http://www.unimedizin-mainz.de/imbei","IMBEI"),br(),
- "Development of the pcaExplorer package is on ",
+ "Development of the ideal package is on ",
tags$a(href="https://github.com/federicomarini/ideal", "GitHub")
)
)
diff --git a/inst/www/help_dataformats.png b/inst/www/help_dataformats.png
new file mode 100644
index 0000000..5c01aa3
Binary files /dev/null and b/inst/www/help_dataformats.png differ
diff --git a/man/deprecated.Rd b/man/deprecated.Rd
new file mode 100644
index 0000000..d0f3faa
--- /dev/null
+++ b/man/deprecated.Rd
@@ -0,0 +1,47 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/deprecated.R
+\name{deprecated}
+\alias{deprecated}
+\title{Deprecated functions in ideal}
+\arguments{
+\item{...}{Ignored arguments.}
+}
+\value{
+All functions throw a warning, with a deprecation message pointing
+towards its descendent (if available).
+}
+\description{
+Functions that are on their way to the function afterlife.
+Their successors are also listed.
+}
+\details{
+The successors of these functions are likely coming after the rework that
+led to the creation of the \code{mosdef} package. See more into its
+documentation for more details.
+}
+\section{Transitioning to the mosdef framework}{
+
+\itemize{
+\item \code{\link[=goseqTable]{goseqTable()}} is now being replaced by the more flexible
+\code{\link[mosdef:run_goseq]{mosdef::run_goseq()}} function (which is even faster)
+\item \code{\link[=ggplotCounts]{ggplotCounts()}} is now being replaced by the more flexible, better
+designed, and actually even more good looking \code{\link[mosdef:gene_plot]{mosdef::gene_plot()}}
+function, with better default behavior and all.
+\item \code{\link[=deseqresult2tbl]{deseqresult2tbl()}} and \code{\link[=deseqresult2DEgenes]{deseqresult2DEgenes()}} are now replaced by the
+more flexible \code{\link[mosdef:deresult_to_df]{mosdef::deresult_to_df()}}
+\item The internally defined functions \code{createLinkENS()}, \code{createLinkGeneSymbol()},
+and \code{createLinkGO()} are now replaced by the equivalent functions in \code{mosdef}:
+\code{\link[mosdef:create_link_ENSEMBL]{mosdef::create_link_ENSEMBL()}}, \code{\link[mosdef:create_link_NCBI]{mosdef::create_link_NCBI()}} and
+\code{\link[mosdef:create_link_GO]{mosdef::create_link_GO()}}. Notably, the \code{mosdef} package expanded on the
+concept of automatically generated buttons, taking this to the extreme of
+efficiency with the \code{\link[mosdef:buttonifier]{mosdef::buttonifier()}} function
+}
+}
+
+\examples{
+# try(goseqtable())
+
+}
+\author{
+Federico Marini
+}
diff --git a/man/deseqresult2DEgenes.Rd b/man/deseqresult2DEgenes.Rd
index 096ea5b..6da64c6 100644
--- a/man/deseqresult2DEgenes.Rd
+++ b/man/deseqresult2DEgenes.Rd
@@ -7,7 +7,7 @@
deseqresult2DEgenes(deseqresult, FDR = 0.05)
}
\arguments{
-\item{deseqresult}{A \code{\link{DESeqResults}} object}
+\item{deseqresult}{A \code{\link[=DESeqResults]{DESeqResults()}} object}
\item{FDR}{Numeric value, the significance level for thresholding adjusted p-values}
}
diff --git a/man/deseqresult2tbl.Rd b/man/deseqresult2tbl.Rd
index 3b7818c..b7dd4a5 100644
--- a/man/deseqresult2tbl.Rd
+++ b/man/deseqresult2tbl.Rd
@@ -7,7 +7,7 @@
deseqresult2tbl(deseqresult)
}
\arguments{
-\item{deseqresult}{A \code{\link{DESeqResults}} object}
+\item{deseqresult}{A \code{\link[=DESeqResults]{DESeqResults()}} object}
}
\value{
A "tidy" data.frame with all genes
diff --git a/man/ggplotCounts.Rd b/man/ggplotCounts.Rd
index 9f6c791..50e2f54 100644
--- a/man/ggplotCounts.Rd
+++ b/man/ggplotCounts.Rd
@@ -14,7 +14,7 @@ ggplotCounts(
)
}
\arguments{
-\item{dds}{A \code{\link{DESeqDataSet}} object.}
+\item{dds}{A \code{\link[=DESeqDataSet]{DESeqDataSet()}} object.}
\item{gene}{A character, specifying the name of the gene to plot}
@@ -39,12 +39,12 @@ Plot for normalized counts of a single gene, with jittered points superimposed
on the boxplot
}
\details{
-Note: this function relies on the \code{\link{plotCounts}} function of DESeq2,
+Note: this function relies on the \code{\link[=plotCounts]{plotCounts()}} function of DESeq2,
therefore pseudocounts of 0.5 are added to each point
}
\examples{
-library(airway)
-data(airway)
+library("airway")
+data("airway", package = "airway")
airway
dds_airway <- DESeq2::DESeqDataSetFromMatrix(assay(airway),
colData = colData(airway),
diff --git a/man/goseqTable.Rd b/man/goseqTable.Rd
index 6f2b44c..83328d7 100644
--- a/man/goseqTable.Rd
+++ b/man/goseqTable.Rd
@@ -23,10 +23,10 @@ goseqTable(
in the assays}
\item{genome}{A string identifying the genome that genes refer to, as in the
-\code{\link{goseq}} function}
+\code{\link[=goseq]{goseq()}} function}
\item{id}{A string identifying the gene identifier used by genes, as in the
-\code{\link{goseq}} function}
+\code{\link[=goseq]{goseq()}} function}
\item{testCats}{A vector specifying which categories to test for over representation amongst DE genes - can be any combination of "GO:CC", "GO:BP", "GO:MF" & "KEGG"}
@@ -49,13 +49,13 @@ A wrapper for extracting functional GO terms enriched in a list of (DE) genes,
based on the algorithm and the implementation in the goseq package
}
\details{
-Note: the feature length retrieval is based on the \code{\link{goseq}} function,
+Note: the feature length retrieval is based on the \code{\link[=goseq]{goseq()}} function,
and requires that the corresponding TxDb packages are installed and available
}
\examples{
-library(airway)
-data(airway)
+library("airway")
+data("airway", package = "airway")
airway
dds_airway <- DESeq2::DESeqDataSetFromMatrix(assay(airway),
colData = colData(airway),
@@ -64,7 +64,7 @@ dds_airway <- DESeq2::DESeqDataSetFromMatrix(assay(airway),
dds_airway <- DESeq2::DESeq(dds_airway)
res_airway <- DESeq2::results(dds_airway)
-res_subset <- deseqresult2DEgenes(res_airway)[1:100, ]
+res_subset <- mosdef::deresult_to_df(res_airway)[1:100, ]
myde <- res_subset$id
myassayed <- rownames(res_airway)
\dontrun{
diff --git a/man/ideal.Rd b/man/ideal.Rd
index e0376fd..02cfc24 100644
--- a/man/ideal.Rd
+++ b/man/ideal.Rd
@@ -14,12 +14,12 @@ ideal(
)
}
\arguments{
-\item{dds_obj}{A \code{\link{DESeqDataSet}} object. If not provided, then a
+\item{dds_obj}{A \code{\link[=DESeqDataSet]{DESeqDataSet()}} object. If not provided, then a
\code{countmatrix} and a \code{expdesign} need to be provided. If none of
the above is provided, it is possible to upload the data during the
execution of the Shiny App}
-\item{res_obj}{A \code{\link{DESeqResults}} object. If not provided, it can
+\item{res_obj}{A \code{\link[=DESeqResults]{DESeqResults()}} object. If not provided, it can
be computed during the execution of the application}
\item{annotation_obj}{A \code{data.frame} object, with row.names as gene
@@ -36,7 +36,7 @@ of each sample. If not provided, it is possible to upload the data during the
execution of the Shiny App}
\item{gene_signatures}{A list of vectors, one for each pathway/signature. This
-is for example the output of the \code{\link{read_gmt}} function. The provided
+is for example the output of the \code{\link[=read_gmt]{read_gmt()}} function. The provided
object can also be replaced during runtime in the dedicated upload widget.}
}
\value{
@@ -49,14 +49,14 @@ This function launches the main application included in the package.
}
\examples{
# with simulated data...
-library(DESeq2)
+library("DESeq2")
dds <- DESeq2::makeExampleDESeqDataSet(n = 100, m = 8)
cm <- counts(dds)
cd <- colData(dds)
# with the well known airway package...
-library(airway)
-data(airway)
+library("airway")
+data("airway", package = "airway")
airway
dds_airway <- DESeq2::DESeqDataSetFromMatrix(assay(airway),
colData = colData(airway),
diff --git a/man/plot_ma.Rd b/man/plot_ma.Rd
index ce458d9..a2630b2 100644
--- a/man/plot_ma.Rd
+++ b/man/plot_ma.Rd
@@ -23,7 +23,7 @@ plot_ma(
)
}
\arguments{
-\item{res_obj}{A \code{\link{DESeqResults}} object}
+\item{res_obj}{A \code{\link[=DESeqResults]{DESeqResults()}} object}
\item{FDR}{Numeric value, the significance level for thresholding adjusted p-values}
@@ -74,8 +74,8 @@ column is provided in \code{res_obj}, or else by using the identifiers specifie
in the row names
}
\examples{
-library(airway)
-data(airway)
+library("airway")
+data("airway", package = "airway")
airway
dds_airway <- DESeq2::DESeqDataSetFromMatrix(assay(airway),
colData = colData(airway),
diff --git a/man/plot_volcano.Rd b/man/plot_volcano.Rd
index 1171b45..af4a8cd 100644
--- a/man/plot_volcano.Rd
+++ b/man/plot_volcano.Rd
@@ -17,7 +17,7 @@ plot_volcano(
)
}
\arguments{
-\item{res_obj}{A \code{\link{DESeqResults}} object}
+\item{res_obj}{A \code{\link[=DESeqResults]{DESeqResults()}} object}
\item{FDR}{Numeric value, the significance level for thresholding adjusted p-values}
@@ -53,8 +53,8 @@ column is provided in \code{res_obj}, or else b< using the identifiers specifie
in the row names
}
\examples{
-library(airway)
-data(airway)
+library("airway")
+data("airway", package = "airway")
airway
dds_airway <- DESeq2::DESeqDataSetFromMatrix(assay(airway),
colData = colData(airway),
diff --git a/man/read_gmt.Rd b/man/read_gmt.Rd
index bf29e5e..20c8836 100644
--- a/man/read_gmt.Rd
+++ b/man/read_gmt.Rd
@@ -20,7 +20,7 @@ Returns a list of pathways from a GMT file.
# this example reads in the freely available pathways from wikipathways
\dontrun{
mysigs <- read_gmt(
- "http://data.wikipathways.org/20180910/gmt/wikipathways-20180910-gmt-Homo_sapiens.gmt"
+ "http://data.wikipathways.org/20240910/gmt/wikipathways-20240910-gmt-Homo_sapiens.gmt"
)
head(mysigs)
# see how the gene identifiers are encoded as ENTREZ id
diff --git a/man/sepguesser.Rd b/man/sepguesser.Rd
index 355189a..7a71e07 100644
--- a/man/sepguesser.Rd
+++ b/man/sepguesser.Rd
@@ -10,7 +10,7 @@ sepguesser(file, sep_list = c(",", "\\t", ";", " "))
\item{file}{The name of the file which the data are to be read from}
\item{sep_list}{A vector containing the candidates for being identified as
-separators. Defaults to \code{c(",", "\t", ";"," ")}}
+separators. Defaults to \code{c(",", "\\t", ";"," ")}}
}
\value{
A character value, corresponding to the guessed separator. One of ","
diff --git a/man/sig_heatmap.Rd b/man/sig_heatmap.Rd
index db3475b..a3fe6d4 100644
--- a/man/sig_heatmap.Rd
+++ b/man/sig_heatmap.Rd
@@ -20,13 +20,13 @@ sig_heatmap(
)
}
\arguments{
-\item{vst_data}{A \code{\link{DESeqTransform}} object - usually the variance
+\item{vst_data}{A \code{\link[=DESeqTransform]{DESeqTransform()}} object - usually the variance
stabilized transformed data, which will be used to extract the expression values}
\item{my_signature}{A character vector, usually named, containing the genes
which compose the gene signature}
-\item{res_data}{A \code{\link{DESeqResults}} object. If not provided, it can
+\item{res_data}{A \code{\link[=DESeqResults]{DESeqResults()}} object. If not provided, it can
be computed during the execution of the application}
\item{FDR}{Numeric value between 0 and 1, the False Discovery Rate}
@@ -63,8 +63,8 @@ possibility to compactly display also DE only genes
}
\examples{
# with the well known airway package...
-library(airway)
-data(airway)
+library("airway")
+data("airway", package = "airway")
airway
dds_airway <- DESeq2::DESeqDataSetFromMatrix(assay(airway),
colData = colData(airway),
diff --git a/man/wrapup_for_iSEE.Rd b/man/wrapup_for_iSEE.Rd
index fa2d0eb..a436235 100644
--- a/man/wrapup_for_iSEE.Rd
+++ b/man/wrapup_for_iSEE.Rd
@@ -7,9 +7,9 @@
wrapup_for_iSEE(dds, res)
}
\arguments{
-\item{dds}{A \code{\link{DESeqDataSet}} object.}
+\item{dds}{A \code{\link[=DESeqDataSet]{DESeqDataSet()}} object.}
-\item{res}{A \code{\link{DESeqResults}} object.}
+\item{res}{A \code{\link[=DESeqResults]{DESeqResults()}} object.}
}
\value{
A SummarizedExperiment object, with raw counts, normalized counts, and
@@ -38,8 +38,8 @@ se <- wrapup_for_iSEE(dds, res)
# iSEE(se)
\dontrun{
# or with the well known airway package...
-library(airway)
-data(airway)
+library("airway")
+data("airway", package = "airway")
airway
dds_airway <- DESeq2::DESeqDataSetFromMatrix(assay(airway),
colData = colData(airway),
diff --git a/vignettes/ideal-usersguide.Rmd b/vignettes/ideal-usersguide.Rmd
index 005b400..9718ab2 100644
--- a/vignettes/ideal-usersguide.Rmd
+++ b/vignettes/ideal-usersguide.Rmd
@@ -29,33 +29,33 @@ vignette: >
---
-
-
-
-
-
-
-**Compiled date**: `r Sys.Date()`
-
-**Last edited**: 2019-02-06
-
-**License**: `r packageDescription("ideal")[["License"]]`
+**Package**: `r Rpackage("ideal")`
+**Authors**: `r packageDescription("ideal")[["Author"]]`
+**Version**: `r packageDescription("ideal")$Version`
+**Compiled date**: `r Sys.Date()`
+**Last edited**: 2019-02-06
+**License**: `r packageDescription("ideal")[["License"]]`
```{r setup, echo=FALSE, warning=FALSE}
+library("knitr")
set.seed(42)
-# knitr::opts_chunk$set(comment=NA,
-# fig.align="center",
-# fig.width = 7,
-# fig.height = 7,
-# warning=FALSE)
+opts_chunk$set(comment = "#>",
+ fig.align = "center",
+ warning = FALSE)
+stopifnot(requireNamespace("htmltools"))
+htmltools::tagList(rmarkdown::html_dependency_font_awesome())
+```
+
+```{r, out.width="50%", echo=FALSE}
+knitr::include_graphics(system.file("www", "ideal.png", package = "ideal"))
```
# Getting started
-
- -
+ + + `r Biocpkg("ideal")` is an R package distributed as part of the [Bioconductor](http://bioconductor.org) project. To install the package, start R and enter: @@ -134,7 +134,7 @@ You can obtain more information on the formats that are expected and required to For the sake of completeness, you can see an overview reported in the image below. ```{r, out.width="100%", echo=FALSE} -knitr::include_graphics(system.file("www", "help_dataformats.png", package = "pcaExplorer")) +knitr::include_graphics(system.file("www", "help_dataformats.png", package = "ideal")) ``` The value to specify for the experimental design is best selected live in Step 2 of the Data Setup panel (see more in Section \@ref(datasetup)) - or if passing directly the `dds` object in the call to `ideal`, is already contained in the `dds` itself. @@ -349,10 +349,10 @@ This package provides a `RangedSummarizedExperiment` object of read counts in ge To run `r Biocpkg("ideal")` on this dataset, the following commands are required. First, prepare the objects to be passed as parameters of `r Biocpkg("ideal")`. ```{r loadairway, message=FALSE} -library(airway) -library(DESeq2) +library("airway") +library("DESeq2") -data(airway) +data("airway", package = "airway") dds_airway <- DESeqDataSet(airway, design = ~ cell + dex) dds_airway @@ -498,34 +498,38 @@ Where possible, for each function a code snippet will be provided for its typica `deseqresult2DEgenes` and `deseqresult2tbl` generate a tidy table with the results of DESeq2, sorted by the values in the `padj` column. +From version 1.30.0 onwards, the `deseqresult2tbl()` and `deseqresult2DEgenes()` functions have been deprecated, in favor of the equivalent `mosdef::deresult_to_df()` function, which is more robust and flexible in its usage. + ```{r res2tbl} summary(res_airway) res_airway -head(deseqresult2tbl(res_airway)) +head(mosdef::deresult_to_df(res_airway)) ``` -In particular, `deseqresult2DEgenes` only includes genes detected as DE. +In particular, `deseqresult2DEgenes` only includes genes detected as DE - this is also covered by `mosdef::deresult_to_df()` in the newer versions. ```{r res2de} -head(deseqresult2DEgenes(res_airway, FDR = 0.05)) +head(mosdef::deresult_to_df(res_airway, FDR = 0.05)) # the output in the first lines is the same, but dim(res_airway) -dim(deseqresult2DEgenes(res_airway)) +dim(mosdef::deresult_to_df(res_airway)) ``` This tables can be enhanced with clickable links to the ENSEMBL and NCBI gene databases by the following commands: ```{r res-enhance} -myde <- deseqresult2DEgenes(res_airway, FDR = 0.05) +myde <- mosdef::deresult_to_df(res_airway, FDR = 0.05) myde$symbol <- mapIds(org.Hs.eg.db, keys = as.character(myde$id), column = "SYMBOL", keytype = "ENSEMBL") myde_enhanced <- myde -myde_enhanced$id <- ideal:::createLinkENS(myde_enhanced$id, species = "Homo_sapiens") -myde_enhanced$symbol <- ideal:::createLinkGeneSymbol(myde_enhanced$symbol) +myde_enhanced$id <- mosdef::create_link_ENSEMBL(myde_enhanced$id, species = "Homo_sapiens") +myde_enhanced$symbol <- mosdef::create_link_NCBI(myde_enhanced$symbol) + DT::datatable(myde_enhanced[1:100, ], escape = FALSE) ``` + ## `ggplotCounts` `ggplotCounts` extends the functionality of the `plotCounts` function of `r Biocpkg("DESeq2")`, and plots the normalized counts of a single gene as a boxplot, with jittered points superimposed. @@ -551,6 +555,8 @@ ggplotCounts( When used in the context of the app, it is possible to seamless search for genes also by their gene name, making exploration even more immediate. +From version 1.30.0 onwards, the `ggplotCounts()` function has been deprecated, in favor of the equivalent `mosdef::gene_plot()` function, which is more robust and flexible in its usage. + ## `goseqTable` `goseqTable` is a wrapper to extract the functional GO terms enriched in in a list of (DE) genes, based on the algorithm and the implementation in the `r Biocpkg("goseq")` package. @@ -562,7 +568,7 @@ Its counterpart, based on the `r Biocpkg("topGO")` package, can be found in the ```{r goseq, eval=FALSE} -res_subset <- deseqresult2DEgenes(res_airway)[1:100, ] # taking only a subset of the DE genes +res_subset <- mosdef::deresult_to_df(res_airway)[1:100, ] # taking only a subset of the DE genes myde <- res_subset$id myassayed <- rownames(res_airway) mygo <- goseqTable( @@ -583,10 +589,11 @@ As for the results, this table can be enhanced by adding the links for each cate ```{r go-enhance, eval=FALSE} mygo_enhanced <- mygo # using the unexported function to link the GO term to the entry in the AmiGO db -mygo_enhanced$category <- ideal:::createLinkGO(mygo_enhanced$category) +mygo_enhanced$category <- mosdef::create_link_GO(mygo_enhanced$category) DT::datatable(mygo_enhanced, escape = FALSE) ``` +From version 1.30.0 onwards, the `goseqTable()` function has been deprecated, in favor of the equivalent `mosdef::run_goseq()` function, which is faster, more robust and flexible in its usage. ## `plot_ma`