From e63fe6d6a1e4113c84af3a19a542062285fbe159 Mon Sep 17 00:00:00 2001 From: Federico Marini Date: Thu, 12 Sep 2024 15:07:22 +0200 Subject: [PATCH] markdownified roxygen blocks --- R/correlatePCs.R | 12 +- R/deprecated.R | 2 +- R/distro_expr.R | 6 +- R/genespca.R | 16 +- R/get_annotation.R | 18 +- R/hi_loadings.R | 10 +- R/makeds.R | 10 +- R/pair_corr.R | 4 +- R/pca2go.R | 272 ++++++++++++------------ R/pcaExplorer.R | 16 +- R/pcaplot.R | 22 +- R/profile_explore.R | 8 +- man/deprecated.Rd | 11 +- man/distro_expr.Rd | 2 +- man/geneprofiler.Rd | 4 +- man/genespca.Rd | 8 +- man/get_annotation.Rd | 4 +- man/get_annotation_orgdb.Rd | 10 +- man/hi_loadings.Rd | 2 +- man/limmaquickpca2go.Rd | 8 +- man/makeExampleDESeqDataSet_multifac.Rd | 6 +- man/pca2go.Rd | 10 +- man/pcaExplorer.Rd | 6 +- man/pcaplot.Rd | 6 +- man/pcaplot3d.Rd | 6 +- man/topGOtable.Rd | 6 +- 26 files changed, 244 insertions(+), 241 deletions(-) diff --git a/R/correlatePCs.R b/R/correlatePCs.R index e8ec30e..a2a3393 100644 --- a/R/correlatePCs.R +++ b/R/correlatePCs.R @@ -2,15 +2,15 @@ #' #' Computes the significance of (cor)relations between PCA scores and the sample #' experimental covariates, using Kruskal-Wallis test for categorial variables -#' and the \code{cor.test} based on Spearman's correlation for continuous +#' and the `cor.test` based on Spearman's correlation for continuous #' variables #' -#' @param pcaobj A \code{prcomp} object -#' @param coldata A \code{data.frame} object containing the experimental +#' @param pcaobj A `prcomp` object +#' @param coldata A `data.frame` object containing the experimental #' covariates #' @param pcs A numeric vector, containing the corresponding PC number #' -#' @return A \code{data.frame} object with computed p values for each covariate +#' @return A `data.frame` object with computed p values for each covariate #' and for each principal component #' #' @examples @@ -53,10 +53,10 @@ correlatePCs <- function(pcaobj, coldata, pcs = 1:4) { #' #' Plots the significance of the (cor)relation of each covariate vs a principal component #' -#' @param pccorrs A \code{data.frame} object generated by \link{correlatePCs} +#' @param pccorrs A `data.frame` object generated by [correlatePCs] #' @param pc An integer number, corresponding to the principal component of #' interest -#' @param logp Logical, defaults to \code{TRUE}, displays the -\code{log10} of +#' @param logp Logical, defaults to `TRUE`, displays the -`log10` of #' the pvalue instead of the p value itself #' #' @return A base plot object diff --git a/R/deprecated.R b/R/deprecated.R index 91cf472..ab0f49e 100644 --- a/R/deprecated.R +++ b/R/deprecated.R @@ -16,7 +16,7 @@ #' #' @section Transitioning to the mosdef framework: #' -#' * [topGOtable()] is now being replaced by the more flexible +#' - [topGOtable()] is now being replaced by the more flexible #' [mosdef::run_topGO()] function #' #' @author Federico Marini diff --git a/R/distro_expr.R b/R/distro_expr.R index 54f6616..32132c3 100644 --- a/R/distro_expr.R +++ b/R/distro_expr.R @@ -1,8 +1,8 @@ #' Plot distribution of expression values #' -#' @param rld A \code{\link{DESeqTransform}} object. -#' @param plot_type Character, choose one of \code{boxplot}, \code{violin} or -#' \code{density}. Defaults to \code{density} +#' @param rld A [DESeqTransform()] object. +#' @param plot_type Character, choose one of `boxplot`, `violin` or +#' `density`. Defaults to `density` #' #' @return A plot with the distribution of the expression values #' @export diff --git a/R/genespca.R b/R/genespca.R index a8c8f10..b31f77f 100644 --- a/R/genespca.R +++ b/R/genespca.R @@ -3,14 +3,14 @@ #' Computes and plots the principal components of the genes, eventually displaying #' the samples as in a typical biplot visualization. #' -#' The implementation of this function is based on the beautiful \code{ggbiplot} +#' The implementation of this function is based on the beautiful `ggbiplot` #' package developed by Vince Vu, available at https://github.com/vqv/ggbiplot. #' The adaptation and additional parameters are tailored to display typical genomics data #' such as the transformed counts of RNA-seq experiments #' -#' @param x A \code{\link{DESeqTransform}} object, with data in \code{assay(x)}, -#' produced for example by either \code{\link{rlog}} or -#' \code{\link{varianceStabilizingTransformation}} +#' @param x A [DESeqTransform()] object, with data in `assay(x)`, +#' produced for example by either [rlog()] or +#' [varianceStabilizingTransformation()] #' @param ntop Number of top genes to use for principal components, #' selected by highest row variance #' @param choices Vector of two numeric values, to select on which principal components to plot @@ -37,7 +37,7 @@ #' @param circle.prob Size of the correlation circle in Normal probability #' @param varname.size Size of the text for variable names #' @param varname.adjust Adjustment factor the placement of the variable names, -#' >= 1 means farther from the arrow +#' '>= 1' means farther from the arrow #' @param varname.abbrev Logical, whether or not to abbreviate the variable names #' @param returnData Logical, if TRUE returns a data.frame for further use, containing the #' selected principal components for custom plotting @@ -47,10 +47,10 @@ #' to allow for distinguishing where the variables are plotted #' @param useRownamesAsLabels Logical, if TRUE uses the row names as labels for plotting #' @param point_size Size of the points to be plotted for the observations (genes) -#' @param annotation A \code{data.frame} object, with row.names as gene identifiers (e.g. ENSEMBL ids) -#' and a column, \code{gene_name}, containing e.g. HGNC-based gene symbols +#' @param annotation 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 #' -#' @return An object created by \code{ggplot}, which can be assigned and further customized. +#' @return An object created by `ggplot`, which can be assigned and further customized. #' #' @examples #' diff --git a/R/get_annotation.R b/R/get_annotation.R index 8991b8f..850941e 100644 --- a/R/get_annotation.R +++ b/R/get_annotation.R @@ -1,12 +1,12 @@ #' Get an annotation data frame from biomaRt #' -#' @param dds A \code{\link{DESeqDataSet}} object +#' @param dds A [DESeqDataSet()] object #' @param biomart_dataset A biomaRt dataset to use. To see the list, type -#' \code{mart = useMart('ensembl')}, followed by \code{listDatasets(mart)}. +#' `mart = useMart('ensembl')`, followed by `listDatasets(mart)`. #' @param idtype Character, the ID type of the genes as in the row names of -#' \code{dds}, to be used for the call to \code{\link{getBM}} +#' `dds`, to be used for the call to [getBM()] #' -#' @return A data frame for ready use in \code{pcaExplorer}, retrieved from biomaRt. +#' @return A data frame for ready use in `pcaExplorer`, retrieved from biomaRt. #' @export #' #' @examples @@ -44,18 +44,18 @@ To obtain a list, type mart = useMart('ensembl'), followed by listDatasets(mart) #' Get an annotation data frame from org db packages #' -#' @param dds A \code{\link{DESeqDataSet}} object -#' @param orgdb_species Character string, named as the \code{org.XX.eg.db} +#' @param dds A [DESeqDataSet()] object +#' @param orgdb_species Character string, named as the `org.XX.eg.db` #' package which should be available in Bioconductor #' @param idtype Character, the ID type of the genes as in the row names of -#' \code{dds}, to be used for the call to \code{\link{mapIds}} +#' `dds`, to be used for the call to [mapIds()] #' @param key_for_genenames Character, corresponding to the column name for the #' key in the orgDb package containing the official gene name (often called #' gene symbol). #' This parameter defaults to "SYMBOL", but can be adjusted in case the key is not -#' found in the annotation package (e.g. for \code{org.Sc.sgd.db}). +#' found in the annotation package (e.g. for `org.Sc.sgd.db`). #' -#' @return A data frame for ready use in \code{pcaExplorer}, retrieved from the +#' @return A data frame for ready use in `pcaExplorer`, retrieved from the #' org db packages #' @export #' diff --git a/R/hi_loadings.R b/R/hi_loadings.R index a253615..766b823 100644 --- a/R/hi_loadings.R +++ b/R/hi_loadings.R @@ -1,16 +1,16 @@ #' Extract genes with highest loadings #' -#' @param pcaobj A \code{prcomp} object +#' @param pcaobj A `prcomp` object #' @param whichpc An integer number, corresponding to the principal component of #' interest #' @param topN Integer, number of genes with top and bottom loadings -#' @param exprTable A \code{matrix} object, e.g. the counts of a \code{\link{DESeqDataSet}}. +#' @param exprTable A `matrix` object, e.g. the counts of a [DESeqDataSet()]. #' If not NULL, returns the counts matrix for the selected genes -#' @param annotation A \code{data.frame} object, with row.names as gene identifiers (e.g. ENSEMBL ids) -#' and a column, \code{gene_name}, containing e.g. HGNC-based gene symbols +#' @param annotation 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 #' @param title The title of the plot #' -#' @return A ggplot2 object, or a \code{matrix}, if \code{exprTable} is not null +#' @return A ggplot2 object, or a `matrix`, if `exprTable` is not null #' #' @examples #' dds <- makeExampleDESeqDataSet_multifac(betaSD = 3, betaSD_tissue = 1) diff --git a/R/makeds.R b/R/makeds.R index e242ded..0ee4120 100644 --- a/R/makeds.R +++ b/R/makeds.R @@ -1,11 +1,11 @@ #' Make a simulated DESeqDataSet for two or more experimental factors #' #' Constructs a simulated dataset of Negative Binomial data from different conditions. -#' The fold changes between the conditions can be adjusted with the \code{betaSD_condition} -#' and the \code{betaSD_tissue} arguments. +#' The fold changes between the conditions can be adjusted with the `betaSD_condition` +#' and the `betaSD_tissue` arguments. #' #' This function is designed and inspired following the proposal of -#' \code{\link{makeExampleDESeqDataSet}} from the \code{DESeq2} package. Credits are given +#' [makeExampleDESeqDataSet()] from the `DESeq2` package. Credits are given #' to Mike Love for the nice initial implementation #' #' @param n number of rows (genes) @@ -15,10 +15,10 @@ #' @param interceptMean the mean of the intercept betas (log2 scale) #' @param interceptSD the standard deviation of the intercept betas (log2 scale) #' @param dispMeanRel a function specifying the relationship of the dispersions on -#' \code{2^trueIntercept} +#' `2^trueIntercept` #' @param sizeFactors multiplicative factors for each sample #' -#' @return a \code{\link{DESeqDataSet}} with true dispersion, +#' @return a [DESeqDataSet()] with true dispersion, #' intercept for two factors (condition and tissue) and beta values in the #' metadata columns. Note that the true betas are provided on the log2 scale. #' diff --git a/R/pair_corr.R b/R/pair_corr.R index 91549c1..ee553de 100644 --- a/R/pair_corr.R +++ b/R/pair_corr.R @@ -3,8 +3,8 @@ #' @param df A data frame, containing the (raw/normalized/transformed) counts #' @param log Logical, whether to convert the input values to log2 (with addition #' of a pseudocount). Defaults to FALSE. -#' @param method Character string, one of \code{pearson} (default), \code{kendall}, or -#' \code{spearman} as in \code{cor} +#' @param method Character string, one of `pearson` (default), `kendall`, or +#' `spearman` as in `cor` #' @param use_subset Logical value. If TRUE, only 1000 values per sample will be used #' to speed up the plotting operations. #' diff --git a/R/pca2go.R b/R/pca2go.R index a661288..5ae211f 100644 --- a/R/pca2go.R +++ b/R/pca2go.R @@ -1,32 +1,148 @@ +#' Extract functional terms enriched in the DE genes, based on topGO +#' +#' A wrapper for extracting functional GO terms enriched in the DE genes, based on +#' the algorithm and the implementation in the topGO package +#' +#' Allowed values assumed by the `topGO_method2` parameter are one of the +#' following: `elim`, `weight`, `weight01`, `lea`, +#' `parentchild`. For more details on this, please refer to the original +#' documentation of the `topGO` package itself +#' +#' @param DEgenes A vector of (differentially expressed) genes +#' @param BGgenes A vector of background genes, e.g. all (expressed) genes in the assays +#' @param ontology Which Gene Ontology domain to analyze: `BP` (Biological Process), `MF` (Molecular Function), or `CC` (Cellular Component) +#' @param annot Which function to use for annotating genes to GO terms. Defaults to `annFUN.org` +#' @param mapping Which `org.XX.eg.db` to use for annotation - select according to the species +#' @param geneID Which format the genes are provided. Defaults to `symbol`, could also be +#' `entrez` or `ENSEMBL` +#' @param topTablerows How many rows to report before any filtering +#' @param fullNamesInRows Logical, whether to display or not the full names for the GO terms +#' @param addGeneToTerms Logical, whether to add a column with all genes annotated to each GO term +#' @param plotGraph Logical, if TRUE additionally plots a graph on the identified GO terms +#' @param plotNodes Number of nodes to plot +#' @param writeOutput Logical, if TRUE additionally writes out the result to a file +#' @param outputFile Name of the file the result should be written into +#' @param topGO_method2 Character, specifying which of the methods implemented by `topGO` should be used, in addition to the `classic` algorithm. Defaults to `elim` +#' @param do_padj Logical, whether to perform the adjustment on the p-values from the specific +#' topGO method, based on the FDR correction. Defaults to FALSE, since the assumption of +#' independent hypotheses is somewhat violated by the intrinsic DAG-structure of the Gene +#' Ontology Terms +#' +#' @import topGO +#' +#' @return A table containing the computed GO Terms and related enrichment scores +#' +#' @examples +#' library(airway) +#' library(DESeq2) +#' data(airway) +#' airway +#' dds_airway <- DESeqDataSet(airway, design= ~ cell + dex) +#' # Example, performing extraction of enriched functional categories in +#' # detected significantly expressed genes +#' \dontrun{ +#' dds_airway <- DESeq(dds_airway) +#' res_airway <- results(dds_airway) +#' library("AnnotationDbi") +#' library("org.Hs.eg.db") +#' res_airway$symbol <- mapIds(org.Hs.eg.db, +#' keys = row.names(res_airway), +#' column = "SYMBOL", +#' keytype = "ENSEMBL", +#' multiVals = "first") +#' res_airway$entrez <- mapIds(org.Hs.eg.db, +#' keys = row.names(res_airway), +#' column = "ENTREZID", +#' keytype = "ENSEMBL", +#' multiVals = "first") +#' resOrdered <- as.data.frame(res_airway[order(res_airway$padj),]) +#' de_df <- resOrdered[resOrdered$padj < .05 & !is.na(resOrdered$padj),] +#' de_symbols <- de_df$symbol +#' bg_ids <- rownames(dds_airway)[rowSums(counts(dds_airway)) > 0] +#' bg_symbols <- mapIds(org.Hs.eg.db, +#' keys = bg_ids, +#' column = "SYMBOL", +#' keytype = "ENSEMBL", +#' multiVals = "first") +#' library(topGO) +#' topgoDE_airway <- topGOtable(de_symbols, bg_symbols, +#' ontology = "BP", +#' mapping = "org.Hs.eg.db", +#' geneID = "symbol") +#' } +#' +#' @importFrom mosdef run_topGO +#' +#' @export +topGOtable <- function(DEgenes, # Differentially expressed genes + BGgenes, # background genes + ontology = "BP", # could use also "MF" + annot = annFUN.org, # parameters for creating topGO object + mapping = "org.Mm.eg.db", + geneID = "symbol", # could also beID = "entrez" + topTablerows = 200, + fullNamesInRows = TRUE, + addGeneToTerms = TRUE, + plotGraph = FALSE, + plotNodes = 10, + writeOutput = FALSE, + outputFile = "", + topGO_method2 = "elim", + do_padj = FALSE) { + + .Deprecated(old = "topGOtable", new = "mosdef::run_topGO", + msg = paste0( + "Please use `mosdef::run_topGO()` in replacement of the `topGOtable()` function, ", + "originally located in the pcaExplorer package. \nCheck the manual page for ", + "`?mosdef::run_topGO()` to see the details on how to use it, e.g. ", + "refer to the new parameter definition and naming")) + + res_enrich <- mosdef::run_topGO( + de_genes = DEgenes, + bg_genes = BGgenes, + annot = annot, + ontology = ontology, + mapping = mapping, + gene_id = geneID, + full_names_in_rows = fullNamesInRows, + add_gene_to_terms = addGeneToTerms, + topGO_method2 = topGO_method2, + do_padj = do_padj, + verbose = TRUE + ) + + return(res_enrich) +} + #' Functional interpretation of the principal components #' #' Extracts the genes with the highest loadings for each principal component, and #' performs functional enrichment analysis on them using routines and algorithms from -#' the \code{topGO} package +#' the `topGO` package #' -#' @param se A \code{\link{DESeqTransform}} object, with data in \code{assay(se)}, -#' produced for example by either \code{\link{rlog}} or -#' \code{\link{varianceStabilizingTransformation}} +#' @param se A [DESeqTransform()] object, with data in `assay(se)`, +#' produced for example by either [rlog()] or +#' [varianceStabilizingTransformation()] #' @param pca_ngenes Number of genes to use for the PCA -#' @param annotation A \code{data.frame} object, with row.names as gene identifiers (e.g. ENSEMBL ids) -#' and a column, \code{gene_name}, containing e.g. HGNC-based gene symbols -#' @param inputType Input format type of the gene identifiers. Will be used by the routines of \code{topGO} -#' @param organism Character abbreviation for the species, using \code{org.XX.eg.db} for annotation +#' @param annotation 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 +#' @param inputType Input format type of the gene identifiers. Will be used by the routines of `topGO` +#' @param organism Character abbreviation for the species, using `org.XX.eg.db` for annotation #' @param ensToGeneSymbol Logical, whether to expect ENSEMBL gene identifiers, to convert to gene symbols -#' with the \code{annotation} provided +#' with the `annotation` provided #' @param loadings_ngenes Number of genes to extract the loadings (in each direction) #' @param background_genes Which genes to consider as background. #' @param scale Logical, defaults to FALSE, scale values for the PCA #' @param return_ranked_gene_loadings Logical, defaults to FALSE. If TRUE, simply returns #' a list containing the top ranked genes with hi loadings in each PC and in each direction #' @param annopkg String containing the name of the organism annotation package. Can be used to -#' override the \code{organism} parameter, e.g. in case of alternative identifiers used +#' override the `organism` parameter, e.g. in case of alternative identifiers used #' in the annotation package (Arabidopsis with TAIR) #' @param ... Further parameters to be passed to the topGO routine #' #' @return A nested list object containing for each principal component the terms enriched #' in each direction. This object is to be thought in combination with the displaying feature -#' of the main \code{\link{pcaExplorer}} function +#' of the main [pcaExplorer()] function #' #' @examples #' library(airway) @@ -167,137 +283,23 @@ rankedGeneLoadings <- function(x, pc = 1, decreasing = TRUE) { } -#' Extract functional terms enriched in the DE genes, based on topGO -#' -#' A wrapper for extracting functional GO terms enriched in the DE genes, based on -#' the algorithm and the implementation in the topGO package -#' -#' Allowed values assumed by the \code{topGO_method2} parameter are one of the -#' following: \code{elim}, \code{weight}, \code{weight01}, \code{lea}, -#' \code{parentchild}. For more details on this, please refer to the original -#' documentation of the \code{topGO} package itself -#' -#' @param DEgenes A vector of (differentially expressed) genes -#' @param BGgenes A vector of background genes, e.g. all (expressed) genes in the assays -#' @param ontology Which Gene Ontology domain to analyze: \code{BP} (Biological Process), \code{MF} (Molecular Function), or \code{CC} (Cellular Component) -#' @param annot Which function to use for annotating genes to GO terms. Defaults to \code{annFUN.org} -#' @param mapping Which \code{org.XX.eg.db} to use for annotation - select according to the species -#' @param geneID Which format the genes are provided. Defaults to \code{symbol}, could also be -#' \code{entrez} or \code{ENSEMBL} -#' @param topTablerows How many rows to report before any filtering -#' @param fullNamesInRows Logical, whether to display or not the full names for the GO terms -#' @param addGeneToTerms Logical, whether to add a column with all genes annotated to each GO term -#' @param plotGraph Logical, if TRUE additionally plots a graph on the identified GO terms -#' @param plotNodes Number of nodes to plot -#' @param writeOutput Logical, if TRUE additionally writes out the result to a file -#' @param outputFile Name of the file the result should be written into -#' @param topGO_method2 Character, specifying which of the methods implemented by \code{topGO} should be used, in addition to the \code{classic} algorithm. Defaults to \code{elim} -#' @param do_padj Logical, whether to perform the adjustment on the p-values from the specific -#' topGO method, based on the FDR correction. Defaults to FALSE, since the assumption of -#' independent hypotheses is somewhat violated by the intrinsic DAG-structure of the Gene -#' Ontology Terms -#' -#' @import topGO -#' -#' @return A table containing the computed GO Terms and related enrichment scores -#' -#' @examples -#' library(airway) -#' library(DESeq2) -#' data(airway) -#' airway -#' dds_airway <- DESeqDataSet(airway, design= ~ cell + dex) -#' # Example, performing extraction of enriched functional categories in -#' # detected significantly expressed genes -#' \dontrun{ -#' dds_airway <- DESeq(dds_airway) -#' res_airway <- results(dds_airway) -#' library("AnnotationDbi") -#' library("org.Hs.eg.db") -#' res_airway$symbol <- mapIds(org.Hs.eg.db, -#' keys = row.names(res_airway), -#' column = "SYMBOL", -#' keytype = "ENSEMBL", -#' multiVals = "first") -#' res_airway$entrez <- mapIds(org.Hs.eg.db, -#' keys = row.names(res_airway), -#' column = "ENTREZID", -#' keytype = "ENSEMBL", -#' multiVals = "first") -#' resOrdered <- as.data.frame(res_airway[order(res_airway$padj),]) -#' de_df <- resOrdered[resOrdered$padj < .05 & !is.na(resOrdered$padj),] -#' de_symbols <- de_df$symbol -#' bg_ids <- rownames(dds_airway)[rowSums(counts(dds_airway)) > 0] -#' bg_symbols <- mapIds(org.Hs.eg.db, -#' keys = bg_ids, -#' column = "SYMBOL", -#' keytype = "ENSEMBL", -#' multiVals = "first") -#' library(topGO) -#' topgoDE_airway <- topGOtable(de_symbols, bg_symbols, -#' ontology = "BP", -#' mapping = "org.Hs.eg.db", -#' geneID = "symbol") -#' } -#' -#' @importFrom mosdef run_topGO -#' -#' @export -topGOtable <- function(DEgenes, # Differentially expressed genes - BGgenes, # background genes - ontology = "BP", # could use also "MF" - annot = annFUN.org, # parameters for creating topGO object - mapping = "org.Mm.eg.db", - geneID = "symbol", # could also beID = "entrez" - topTablerows = 200, - fullNamesInRows = TRUE, - addGeneToTerms = TRUE, - plotGraph = FALSE, - plotNodes = 10, - writeOutput = FALSE, - outputFile = "", - topGO_method2 = "elim", - do_padj = FALSE) { - - .Deprecated(old = "topGOtable", new = "mosdef::run_topGO", - msg = paste0( - "Please use `mosdef::run_topGO()` in replacement of the `topGOtable()` function, ", - "originally located in the pcaExplorer package. \nCheck the manual page for ", - "`?mosdef::run_topGO()` to see the details on how to use it, e.g. ", - "refer to the new parameter definition and naming")) - - res_enrich <- mosdef::run_topGO( - de_genes = DEgenes, - bg_genes = BGgenes, - annot = annot, - ontology = ontology, - mapping = mapping, - gene_id = geneID, - full_names_in_rows = fullNamesInRows, - add_gene_to_terms = addGeneToTerms, - topGO_method2 = topGO_method2, - do_padj = do_padj, - verbose = TRUE - ) - - return(res_enrich) -} + #' Functional interpretation of the principal components, based on simple #' overrepresentation analysis #' #' Extracts the genes with the highest loadings for each principal component, and #' performs functional enrichment analysis on them using the simple and quick routine -#' provided by the \code{limma} package +#' provided by the `limma` package #' -#' @param se A \code{\link{DESeqTransform}} object, with data in \code{assay(se)}, -#' produced for example by either \code{\link{rlog}} or -#' \code{\link{varianceStabilizingTransformation}} +#' @param se A [DESeqTransform()] object, with data in `assay(se)`, +#' produced for example by either [rlog()] or +#' [varianceStabilizingTransformation()] #' @param pca_ngenes Number of genes to use for the PCA -#' @param inputType Input format type of the gene identifiers. Deafults to \code{ENSEMBL}, that then will -#' be converted to ENTREZ ids. Can assume values such as \code{ENTREZID},\code{GENENAME} or \code{SYMBOL}, -#' like it is normally used with the \code{select} function of \code{AnnotationDbi} -#' @param organism Character abbreviation for the species, using \code{org.XX.eg.db} for annotation +#' @param inputType Input format type of the gene identifiers. Deafults to `ENSEMBL`, that then will +#' be converted to ENTREZ ids. Can assume values such as `ENTREZID`,`GENENAME` or `SYMBOL`, +#' like it is normally used with the `select` function of `AnnotationDbi` +#' @param organism Character abbreviation for the species, using `org.XX.eg.db` for annotation #' @param loadings_ngenes Number of genes to extract the loadings (in each direction) #' @param background_genes Which genes to consider as background. #' @param scale Logical, defaults to FALSE, scale values for the PCA @@ -305,7 +307,7 @@ topGOtable <- function(DEgenes, # Differentially expressed gene #' #' @return A nested list object containing for each principal component the terms enriched #' in each direction. This object is to be thought in combination with the displaying feature -#' of the main \code{\link{pcaExplorer}} function +#' of the main [pcaExplorer()] function #' #' @examples #' library(airway) diff --git a/R/pcaExplorer.R b/R/pcaExplorer.R index 2bda2bc..07059c9 100644 --- a/R/pcaExplorer.R +++ b/R/pcaExplorer.R @@ -3,23 +3,23 @@ #' Launch a Shiny App for interactive exploration of a dataset from the perspective #' of Principal Components Analysis #' -#' @param dds A \code{\link{DESeqDataSet}} object. If not provided, then a \code{countmatrix} -#' and a \code{coldata} need to be provided. If none of the above is provided, it is possible +#' @param dds A [DESeqDataSet()] object. If not provided, then a `countmatrix` +#' and a `coldata` 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 dst A \code{\link{DESeqTransform}} object. Can be computed from the \code{dds} object -#' if left NULL. If none is provided, then a \code{countmatrix} -#' and a \code{coldata} need to be provided. If none of the above is provided, it is possible +#' @param dst A [DESeqTransform()] object. Can be computed from the `dds` object +#' if left NULL. If none is provided, then a `countmatrix` +#' and a `coldata` 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 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 coldata 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 pca2go An object generated by the \code{\link{pca2go}} function, which contains +#' @param pca2go An object generated by the [pca2go()] function, which contains #' the information on enriched functional categories in the genes that show the top or bottom loadings #' in each principal component of interest. If not provided, it is possible #' to compute live during the execution of the Shiny App -#' @param annotation A \code{data.frame} object, with row.names as gene identifiers (e.g. ENSEMBL ids) -#' and a column, \code{gene_name}, containing e.g. HGNC-based gene symbols +#' @param annotation 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 #' @param runLocal A logical indicating whether the app is to be run locally or remotely on a server, which determines how documentation will be accessed. #' #' @return A Shiny App is launched for interactive data exploration diff --git a/R/pcaplot.R b/R/pcaplot.R index 26d87b7..ec22558 100644 --- a/R/pcaplot.R +++ b/R/pcaplot.R @@ -2,11 +2,11 @@ #' #' Plots the results of PCA on a 2-dimensional space #' -#' @param x A \code{\link{DESeqTransform}} object, with data in \code{assay(x)}, -#' produced for example by either \code{\link{rlog}} or -#' \code{\link{varianceStabilizingTransformation}} +#' @param x A [DESeqTransform()] object, with data in `assay(x)`, +#' produced for example by either [rlog()] or +#' [varianceStabilizingTransformation()] #' @param intgroup Interesting groups: a character vector of -#' names in \code{colData(x)} to use for grouping +#' names in `colData(x)` to use for grouping #' @param ntop Number of top genes to use for principal components, #' selected by highest row variance #' @param returnData logical, if TRUE returns a data.frame for further use, containing the @@ -19,7 +19,7 @@ #' @param ellipse Logical, whether to display the confidence ellipse for the selected groups #' @param ellipse.prob Numeric, a value in the interval [0;1) #' -#' @return An object created by \code{ggplot}, which can be assigned and further customized. +#' @return An object created by `ggplot`, which can be assigned and further customized. #' #' @examples #' dds <- makeExampleDESeqDataSet_multifac(betaSD_condition = 3, betaSD_tissue = 1) @@ -105,13 +105,13 @@ pcaplot <- function (x, intgroup = "condition", ntop = 500, returnData = FALSE,t #' Produces a scree plot for investigating the proportion of explained variance, or #' alternatively the cumulative value #' -#' @param obj A \code{prcomp} object +#' @param obj A `prcomp` object #' @param type Display absolute proportions or cumulative proportion. Possible values: #' "pev" or "cev" #' @param pc_nr How many principal components to display max #' @param title Title of the plot #' -#' @return An object created by \code{ggplot}, which can be assigned and further customized. +#' @return An object created by `ggplot`, which can be assigned and further customized. #' #' @examples #' dds <- makeExampleDESeqDataSet_multifac(betaSD_condition = 3, betaSD_tissue = 1) @@ -161,11 +161,11 @@ pcascree <- function(obj, type = c("pev", "cev"),pc_nr=NULL,title=NULL) #' #' Plots the results of PCA on a 3-dimensional space, interactively #' -#' @param x A \code{\link{DESeqTransform}} object, with data in \code{assay(x)}, -#' produced for example by either \code{\link{rlog}} or -#' \code{\link{varianceStabilizingTransformation}} +#' @param x A [DESeqTransform()] object, with data in `assay(x)`, +#' produced for example by either [rlog()] or +#' [varianceStabilizingTransformation()] #' @param intgroup Interesting groups: a character vector of -#' names in \code{colData(x)} to use for grouping +#' names in `colData(x)` to use for grouping #' @param ntop Number of top genes to use for principal components, #' selected by highest row variance #' @param returnData logical, if TRUE returns a data.frame for further use, containing the diff --git a/R/profile_explore.R b/R/profile_explore.R index d15e1a2..298c395 100644 --- a/R/profile_explore.R +++ b/R/profile_explore.R @@ -1,12 +1,12 @@ #' Extract and plot the expression profile of genes #' -#' @param se A \code{\link{DESeqDataSet}} object, or a -#' \code{\link{DESeqTransform}} object. +#' @param se A [DESeqDataSet()] object, or a +#' [DESeqTransform()] object. #' @param genelist An array of characters, including the names of the genes of #' interest of which the profile is to be plotted -#' @param intgroup A factor, needs to be in the \code{colnames} of \code{colData(se)} +#' @param intgroup A factor, needs to be in the `colnames` of `colData(se)` #' @param plotZ Logical, whether to plot the scaled expression values. Defaults to -#' \code{FALSE} +#' `FALSE` #' #' @return A plot of the expression profile for the genes #' @export diff --git a/man/deprecated.Rd b/man/deprecated.Rd index 18898b3..81e14e1 100644 --- a/man/deprecated.Rd +++ b/man/deprecated.Rd @@ -7,7 +7,7 @@ \item{...}{Ignored arguments.} } \value{ -All functions throw a warning, with a deprecation message pointing +All functions throw a warning, with a deprecation message pointing towards its descendent (if available). } \description{ @@ -16,14 +16,15 @@ Their successors are also listed. } \details{ The successors of these functions are likely coming after the rework that -led to the creation of the `mosdef` package. See more into its +led to the creation of the \code{mosdef} package. See more into its documentation for more details. } \section{Transitioning to the mosdef framework}{ - -* [topGOtable()] is now being replaced by the more flexible -[mosdef::run_topGO()] function +\itemize{ +\item \code{\link[=topGOtable]{topGOtable()}} is now being replaced by the more flexible +\code{\link[mosdef:run_topGO]{mosdef::run_topGO()}} function +} } \examples{ diff --git a/man/distro_expr.Rd b/man/distro_expr.Rd index 1d41115..08c5b7d 100644 --- a/man/distro_expr.Rd +++ b/man/distro_expr.Rd @@ -7,7 +7,7 @@ distro_expr(rld, plot_type = "density") } \arguments{ -\item{rld}{A \code{\link{DESeqTransform}} object.} +\item{rld}{A \code{\link[=DESeqTransform]{DESeqTransform()}} object.} \item{plot_type}{Character, choose one of \code{boxplot}, \code{violin} or \code{density}. Defaults to \code{density}} diff --git a/man/geneprofiler.Rd b/man/geneprofiler.Rd index a53a900..633bf0c 100644 --- a/man/geneprofiler.Rd +++ b/man/geneprofiler.Rd @@ -7,8 +7,8 @@ geneprofiler(se, genelist = NULL, intgroup = "condition", plotZ = FALSE) } \arguments{ -\item{se}{A \code{\link{DESeqDataSet}} object, or a -\code{\link{DESeqTransform}} object.} +\item{se}{A \code{\link[=DESeqDataSet]{DESeqDataSet()}} object, or a +\code{\link[=DESeqTransform]{DESeqTransform()}} object.} \item{genelist}{An array of characters, including the names of the genes of interest of which the profile is to be plotted} diff --git a/man/genespca.Rd b/man/genespca.Rd index 2ec45ef..6281129 100644 --- a/man/genespca.Rd +++ b/man/genespca.Rd @@ -36,9 +36,9 @@ genespca( ) } \arguments{ -\item{x}{A \code{\link{DESeqTransform}} object, with data in \code{assay(x)}, -produced for example by either \code{\link{rlog}} or -\code{\link{varianceStabilizingTransformation}}} +\item{x}{A \code{\link[=DESeqTransform]{DESeqTransform()}} object, with data in \code{assay(x)}, +produced for example by either \code{\link[=rlog]{rlog()}} or +\code{\link[=varianceStabilizingTransformation]{varianceStabilizingTransformation()}}} \item{ntop}{Number of top genes to use for principal components, selected by highest row variance} @@ -85,7 +85,7 @@ was called with scale = TRUE and when var.scale = 1)} \item{varname.size}{Size of the text for variable names} \item{varname.adjust}{Adjustment factor the placement of the variable names, ->= 1 means farther from the arrow} +'>= 1' means farther from the arrow} \item{varname.abbrev}{Logical, whether or not to abbreviate the variable names} diff --git a/man/get_annotation.Rd b/man/get_annotation.Rd index 15c4957..fb78a90 100644 --- a/man/get_annotation.Rd +++ b/man/get_annotation.Rd @@ -7,13 +7,13 @@ get_annotation(dds, biomart_dataset, idtype) } \arguments{ -\item{dds}{A \code{\link{DESeqDataSet}} object} +\item{dds}{A \code{\link[=DESeqDataSet]{DESeqDataSet()}} object} \item{biomart_dataset}{A biomaRt dataset to use. To see the list, type \code{mart = useMart('ensembl')}, followed by \code{listDatasets(mart)}.} \item{idtype}{Character, the ID type of the genes as in the row names of -\code{dds}, to be used for the call to \code{\link{getBM}}} +\code{dds}, to be used for the call to \code{\link[=getBM]{getBM()}}} } \value{ A data frame for ready use in \code{pcaExplorer}, retrieved from biomaRt. diff --git a/man/get_annotation_orgdb.Rd b/man/get_annotation_orgdb.Rd index 3a8c8ea..f94be3b 100644 --- a/man/get_annotation_orgdb.Rd +++ b/man/get_annotation_orgdb.Rd @@ -7,17 +7,17 @@ get_annotation_orgdb(dds, orgdb_species, idtype, key_for_genenames = "SYMBOL") } \arguments{ -\item{dds}{A \code{\link{DESeqDataSet}} object} +\item{dds}{A \code{\link[=DESeqDataSet]{DESeqDataSet()}} object} \item{orgdb_species}{Character string, named as the \code{org.XX.eg.db} package which should be available in Bioconductor} \item{idtype}{Character, the ID type of the genes as in the row names of -\code{dds}, to be used for the call to \code{\link{mapIds}}} +\code{dds}, to be used for the call to \code{\link[=mapIds]{mapIds()}}} -\item{key_for_genenames}{Character, corresponding to the column name for the -key in the orgDb package containing the official gene name (often called -gene symbol). +\item{key_for_genenames}{Character, corresponding to the column name for the +key in the orgDb package containing the official gene name (often called +gene symbol). This parameter defaults to "SYMBOL", but can be adjusted in case the key is not found in the annotation package (e.g. for \code{org.Sc.sgd.db}).} } diff --git a/man/hi_loadings.Rd b/man/hi_loadings.Rd index 22c3181..eecf397 100644 --- a/man/hi_loadings.Rd +++ b/man/hi_loadings.Rd @@ -21,7 +21,7 @@ interest} \item{topN}{Integer, number of genes with top and bottom loadings} -\item{exprTable}{A \code{matrix} object, e.g. the counts of a \code{\link{DESeqDataSet}}. +\item{exprTable}{A \code{matrix} object, e.g. the counts of a \code{\link[=DESeqDataSet]{DESeqDataSet()}}. If not NULL, returns the counts matrix for the selected genes} \item{annotation}{A \code{data.frame} object, with row.names as gene identifiers (e.g. ENSEMBL ids) diff --git a/man/limmaquickpca2go.Rd b/man/limmaquickpca2go.Rd index d54fb16..05b2782 100644 --- a/man/limmaquickpca2go.Rd +++ b/man/limmaquickpca2go.Rd @@ -17,9 +17,9 @@ limmaquickpca2go( ) } \arguments{ -\item{se}{A \code{\link{DESeqTransform}} object, with data in \code{assay(se)}, -produced for example by either \code{\link{rlog}} or -\code{\link{varianceStabilizingTransformation}}} +\item{se}{A \code{\link[=DESeqTransform]{DESeqTransform()}} object, with data in \code{assay(se)}, +produced for example by either \code{\link[=rlog]{rlog()}} or +\code{\link[=varianceStabilizingTransformation]{varianceStabilizingTransformation()}}} \item{pca_ngenes}{Number of genes to use for the PCA} @@ -40,7 +40,7 @@ like it is normally used with the \code{select} function of \code{AnnotationDbi} \value{ A nested list object containing for each principal component the terms enriched in each direction. This object is to be thought in combination with the displaying feature -of the main \code{\link{pcaExplorer}} function +of the main \code{\link[=pcaExplorer]{pcaExplorer()}} function } \description{ Extracts the genes with the highest loadings for each principal component, and diff --git a/man/makeExampleDESeqDataSet_multifac.Rd b/man/makeExampleDESeqDataSet_multifac.Rd index 599502f..b28974e 100644 --- a/man/makeExampleDESeqDataSet_multifac.Rd +++ b/man/makeExampleDESeqDataSet_multifac.Rd @@ -34,9 +34,9 @@ makeExampleDESeqDataSet_multifac( \item{sizeFactors}{multiplicative factors for each sample} } \value{ -a \code{\link{DESeqDataSet}} with true dispersion, +a \code{\link[=DESeqDataSet]{DESeqDataSet()}} with true dispersion, intercept for two factors (condition and tissue) and beta values in the - metadata columns. Note that the true betas are provided on the log2 scale. +metadata columns. Note that the true betas are provided on the log2 scale. } \description{ Constructs a simulated dataset of Negative Binomial data from different conditions. @@ -45,7 +45,7 @@ and the \code{betaSD_tissue} arguments. } \details{ This function is designed and inspired following the proposal of -\code{\link{makeExampleDESeqDataSet}} from the \code{DESeq2} package. Credits are given +\code{\link[=makeExampleDESeqDataSet]{makeExampleDESeqDataSet()}} from the \code{DESeq2} package. Credits are given to Mike Love for the nice initial implementation } \examples{ diff --git a/man/pca2go.Rd b/man/pca2go.Rd index 0d61b38..601ab7c 100644 --- a/man/pca2go.Rd +++ b/man/pca2go.Rd @@ -20,9 +20,9 @@ pca2go( ) } \arguments{ -\item{se}{A \code{\link{DESeqTransform}} object, with data in \code{assay(se)}, -produced for example by either \code{\link{rlog}} or -\code{\link{varianceStabilizingTransformation}}} +\item{se}{A \code{\link[=DESeqTransform]{DESeqTransform()}} object, with data in \code{assay(se)}, +produced for example by either \code{\link[=rlog]{rlog()}} or +\code{\link[=varianceStabilizingTransformation]{varianceStabilizingTransformation()}}} \item{pca_ngenes}{Number of genes to use for the PCA} @@ -45,7 +45,7 @@ with the \code{annotation} provided} \item{return_ranked_gene_loadings}{Logical, defaults to FALSE. If TRUE, simply returns a list containing the top ranked genes with hi loadings in each PC and in each direction} -\item{annopkg}{String containing the name of the organism annotation package. Can be used to +\item{annopkg}{String containing the name of the organism annotation package. Can be used to override the \code{organism} parameter, e.g. in case of alternative identifiers used in the annotation package (Arabidopsis with TAIR)} @@ -54,7 +54,7 @@ in the annotation package (Arabidopsis with TAIR)} \value{ A nested list object containing for each principal component the terms enriched in each direction. This object is to be thought in combination with the displaying feature -of the main \code{\link{pcaExplorer}} function +of the main \code{\link[=pcaExplorer]{pcaExplorer()}} function } \description{ Extracts the genes with the highest loadings for each principal component, and diff --git a/man/pcaExplorer.Rd b/man/pcaExplorer.Rd index c9ff2b8..ccc2a28 100644 --- a/man/pcaExplorer.Rd +++ b/man/pcaExplorer.Rd @@ -15,11 +15,11 @@ pcaExplorer( ) } \arguments{ -\item{dds}{A \code{\link{DESeqDataSet}} object. If not provided, then a \code{countmatrix} +\item{dds}{A \code{\link[=DESeqDataSet]{DESeqDataSet()}} object. If not provided, then a \code{countmatrix} and a \code{coldata} 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{dst}{A \code{\link{DESeqTransform}} object. Can be computed from the \code{dds} object +\item{dst}{A \code{\link[=DESeqTransform]{DESeqTransform()}} object. Can be computed from the \code{dds} object if left NULL. If none is provided, then a \code{countmatrix} and a \code{coldata} 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} @@ -30,7 +30,7 @@ to upload the data during the execution of the Shiny App} \item{coldata}{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} -\item{pca2go}{An object generated by the \code{\link{pca2go}} function, which contains +\item{pca2go}{An object generated by the \code{\link[=pca2go]{pca2go()}} function, which contains the information on enriched functional categories in the genes that show the top or bottom loadings in each principal component of interest. If not provided, it is possible to compute live during the execution of the Shiny App} diff --git a/man/pcaplot.Rd b/man/pcaplot.Rd index dae0f0d..3a733fb 100644 --- a/man/pcaplot.Rd +++ b/man/pcaplot.Rd @@ -19,9 +19,9 @@ pcaplot( ) } \arguments{ -\item{x}{A \code{\link{DESeqTransform}} object, with data in \code{assay(x)}, -produced for example by either \code{\link{rlog}} or -\code{\link{varianceStabilizingTransformation}}} +\item{x}{A \code{\link[=DESeqTransform]{DESeqTransform()}} object, with data in \code{assay(x)}, +produced for example by either \code{\link[=rlog]{rlog()}} or +\code{\link[=varianceStabilizingTransformation]{varianceStabilizingTransformation()}}} \item{intgroup}{Interesting groups: a character vector of names in \code{colData(x)} to use for grouping} diff --git a/man/pcaplot3d.Rd b/man/pcaplot3d.Rd index 05e21e7..f825142 100644 --- a/man/pcaplot3d.Rd +++ b/man/pcaplot3d.Rd @@ -18,9 +18,9 @@ pcaplot3d( ) } \arguments{ -\item{x}{A \code{\link{DESeqTransform}} object, with data in \code{assay(x)}, -produced for example by either \code{\link{rlog}} or -\code{\link{varianceStabilizingTransformation}}} +\item{x}{A \code{\link[=DESeqTransform]{DESeqTransform()}} object, with data in \code{assay(x)}, +produced for example by either \code{\link[=rlog]{rlog()}} or +\code{\link[=varianceStabilizingTransformation]{varianceStabilizingTransformation()}}} \item{intgroup}{Interesting groups: a character vector of names in \code{colData(x)} to use for grouping} diff --git a/man/topGOtable.Rd b/man/topGOtable.Rd index 13e83e8..4388e52 100644 --- a/man/topGOtable.Rd +++ b/man/topGOtable.Rd @@ -53,7 +53,7 @@ topGOtable( \item{topGO_method2}{Character, specifying which of the methods implemented by \code{topGO} should be used, in addition to the \code{classic} algorithm. Defaults to \code{elim}} \item{do_padj}{Logical, whether to perform the adjustment on the p-values from the specific -topGO method, based on the FDR correction. Defaults to FALSE, since the assumption of +topGO method, based on the FDR correction. Defaults to FALSE, since the assumption of independent hypotheses is somewhat violated by the intrinsic DAG-structure of the Gene Ontology Terms} } @@ -66,8 +66,8 @@ the algorithm and the implementation in the topGO package } \details{ Allowed values assumed by the \code{topGO_method2} parameter are one of the -following: \code{elim}, \code{weight}, \code{weight01}, \code{lea}, -\code{parentchild}. For more details on this, please refer to the original +following: \code{elim}, \code{weight}, \code{weight01}, \code{lea}, +\code{parentchild}. For more details on this, please refer to the original documentation of the \code{topGO} package itself } \examples{