diff --git a/DESCRIPTION b/DESCRIPTION index b774d6c..c4b7bc9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -28,7 +28,8 @@ Imports: sva, GSEABase, xCell, - MCPcounter + MCPcounter, + utils Suggests: testthat, knitr, @@ -47,4 +48,4 @@ Roxygen: list(markdown = TRUE) LazyData: true URL: https://icbi-lab.github.io/immunedeconv, https://github.com/icbi-lab/immunedeconv BugReports: https://github.com/icbi-lab/immunedeconv/issues -RoxygenNote: 6.1.1 +RoxygenNote: 7.1.0 diff --git a/NAMESPACE b/NAMESPACE index 7a0ab12..267b3e2 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,5 +1,8 @@ # Generated by roxygen2: do not edit by hand +export(available_datasets) +export(cell_type_map) +export(cell_type_tree) export(deconvolute) export(deconvolute_cibersort) export(deconvolute_epic) @@ -35,3 +38,4 @@ importFrom(stats,na.omit) importFrom(testit,assert) importFrom(tibble,as_tibble) importFrom(tibble,rowid_to_column) +importFrom(utils,assignInMyNamespace) diff --git a/R/cell_type_mapping.R b/R/cell_type_mapping.R index 5d2a8c4..ca87604 100644 --- a/R/cell_type_mapping.R +++ b/R/cell_type_mapping.R @@ -6,19 +6,18 @@ #' @importFrom dplyr select #' @importFrom stats na.omit #' @import magrittr -#' +#' #' @name cell_type_mapping NULL - #' Table mapping the cell types from methods/datasets to a single, controlled vocabulary. #' #' Columns: `method_dataset`, `method_cell_type`, `cell_type`. #' #' See `inst/extdata/cell_type_mapping.xlsx` for more details. #' -#' @name cell_type_map -NULL +#' @export +cell_type_map = NULL # gets attached on .onLoad, see zzz.R .get_cell_type_map = function() { readxl::read_xlsx(system.file("extdata", "cell_type_mapping.xlsx", @@ -34,14 +33,16 @@ NULL #' A list of all methods (e.g. `cibersort`) and datasets (e.g. `schelker_ovarian`) for #' that the cell types are mapped to the controlled vocabulary. #' -#' @name available_datasets -NULL +#' @export +available_datasets = NULL # gets attached on .onLoad, see zzz.R .get_available_datasets = function() { cell_type_map %>% pull(method_dataset) %>% unique() } +#' List with controlled cell-type vocabulary +cell_type_list = NULL .get_cell_type_list = function() { tmp_list = readxl::read_excel(system.file("extdata", "cell_type_mapping.xlsx", package="immunedeconv", mustWork=TRUE), @@ -57,14 +58,19 @@ NULL #' #' @details a `data.tree` object #' @name cell_type_tree -NULL +#' @export +cell_type_tree = NULL # gets attached on .onLoad, see zzz.R .get_cell_type_tree = function() { cell_type_list %>% as.data.frame() %>% data.tree::FromDataFrameNetwork() } -# Access nodes by name in O(1). Node names are unique in our tree. +#' Lookup dictionary for cell-type nodes +#' +#' Access nodes by name in O(1). Node names are unique in our tree. +#' gets attached on .onLoad, see zzz.R +node_by_name=NULL # gets attached on .onLoad, see zzz.R .get_node_by_name = function() { cell_type_tree$Get(function(node){node}) diff --git a/R/immune_deconvolution_methods.R b/R/immune_deconvolution_methods.R index b74a78b..a4a6a68 100644 --- a/R/immune_deconvolution_methods.R +++ b/R/immune_deconvolution_methods.R @@ -1,5 +1,7 @@ #' Collection of immune cell deconvolution methods. -#' +#' +#' @description Immunedeconv is an an R package for unified access to computational methods for +#' estimating immune cell fractions from bulk RNA sequencing data. #' @docType package #' @name immunedeconv #' @import methods diff --git a/R/zzz.R b/R/zzz.R index 1528136..6393419 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -1,14 +1,17 @@ -# assign the following global variables -# .onLoad because of 'staged-install' -# -# See https://developer.r-project.org/Blog/public/2019/02/14/staged-install/index.html -# for more details. -# +#' assign the following global variables +#' .onLoad because of 'staged-install' +#' +#' See https://developer.r-project.org/Blog/public/2019/02/14/staged-install/index.html +#' for more details. +#' +#' @name fix_namespace +#' @importFrom utils assignInMyNamespace +NULL .onLoad = function(libname, pkgname) { - assign('cell_type_map', .get_cell_type_map(), envir=.GlobalEnv) - assign('available_datasets', .get_available_datasets(), envir=.GlobalEnv) - assign('cell_type_list', .get_cell_type_list(), envir=.GlobalEnv) - assign('cell_type_tree', .get_cell_type_tree(), envir=.GlobalEnv) - assign('node_by_name', .get_node_by_name(), envir=.GlobalEnv) + assignInMyNamespace('cell_type_map', .get_cell_type_map()) + assignInMyNamespace('available_datasets', .get_available_datasets()) + assignInMyNamespace('cell_type_list', .get_cell_type_list()) + assignInMyNamespace('cell_type_tree', .get_cell_type_tree()) + assignInMyNamespace('node_by_name', .get_node_by_name()) } diff --git a/man/available_datasets.Rd b/man/available_datasets.Rd index 705125e..ec0ce03 100644 --- a/man/available_datasets.Rd +++ b/man/available_datasets.Rd @@ -1,9 +1,17 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/cell_type_mapping.R +\docType{data} \name{available_datasets} \alias{available_datasets} \title{Available methods and datasets.} +\format{ +An object of class \code{character} of length 13. +} +\usage{ +available_datasets +} \description{ A list of all methods (e.g. \code{cibersort}) and datasets (e.g. \code{schelker_ovarian}) for that the cell types are mapped to the controlled vocabulary. } +\keyword{datasets} diff --git a/man/cell_type_list.Rd b/man/cell_type_list.Rd new file mode 100644 index 0000000..a359328 --- /dev/null +++ b/man/cell_type_list.Rd @@ -0,0 +1,16 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/cell_type_mapping.R +\docType{data} +\name{cell_type_list} +\alias{cell_type_list} +\title{List with controlled cell-type vocabulary} +\format{ +An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 65 rows and 3 columns. +} +\usage{ +cell_type_list +} +\description{ +List with controlled cell-type vocabulary +} +\keyword{datasets} diff --git a/man/cell_type_map.Rd b/man/cell_type_map.Rd index e3e02e9..100be6d 100644 --- a/man/cell_type_map.Rd +++ b/man/cell_type_map.Rd @@ -1,11 +1,19 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/cell_type_mapping.R +\docType{data} \name{cell_type_map} \alias{cell_type_map} \title{Table mapping the cell types from methods/datasets to a single, controlled vocabulary.} +\format{ +An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 159 rows and 3 columns. +} +\usage{ +cell_type_map +} \description{ Columns: \code{method_dataset}, \code{method_cell_type}, \code{cell_type}. } \details{ See \code{inst/extdata/cell_type_mapping.xlsx} for more details. } +\keyword{datasets} diff --git a/man/cell_type_tree.Rd b/man/cell_type_tree.Rd index 9507c04..221cbc1 100644 --- a/man/cell_type_tree.Rd +++ b/man/cell_type_tree.Rd @@ -1,11 +1,19 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/cell_type_mapping.R +\docType{data} \name{cell_type_tree} \alias{cell_type_tree} \title{Available cell types in the controlled vocabulary organized as a lineage tree.} +\format{ +An object of class \code{Node} (inherits from \code{R6}) of length 41. +} +\usage{ +cell_type_tree +} \description{ Available cell types in the controlled vocabulary organized as a lineage tree. } \details{ a \code{data.tree} object } +\keyword{datasets} diff --git a/man/dataset_racle.Rd b/man/dataset_racle.Rd index b8eed15..545b3f0 100644 --- a/man/dataset_racle.Rd +++ b/man/dataset_racle.Rd @@ -4,9 +4,11 @@ \name{dataset_racle} \alias{dataset_racle} \title{Example RNA-seq dataset from the EPIC publication.} -\format{an environment with two objects: +\format{ +an environment with two objects: (1) \code{expr_mat}: gene expression matrix with gene_symbols as rownames and sample identifiers as colnames. -(2) \code{ref}: FACS measurements in a data.frame with three columns: sample, cell_type, true_fraction} +(2) \code{ref}: FACS measurements in a data.frame with three columns: sample, cell_type, true_fraction +} \source{ Racle et al. (2017), eLIFE, https://doi.org/10.7554/eLife.26476.029 } diff --git a/man/deconvolute.Rd b/man/deconvolute.Rd index 6982120..b6b7b32 100644 --- a/man/deconvolute.Rd +++ b/man/deconvolute.Rd @@ -4,10 +4,18 @@ \alias{deconvolute} \title{Perform an immune cell deconvolution on a dataset.} \usage{ -deconvolute(gene_expression, method = deconvolution_methods, - indications = NULL, tumor = TRUE, arrays = FALSE, - column = "gene_symbol", rmgenes = NULL, scale_mrna = TRUE, - expected_cell_types = NULL, ...) +deconvolute( + gene_expression, + method = deconvolution_methods, + indications = NULL, + tumor = TRUE, + arrays = FALSE, + column = "gene_symbol", + rmgenes = NULL, + scale_mrna = TRUE, + expected_cell_types = NULL, + ... +) } \arguments{ \item{gene_expression}{A gene expression matrix or a Biobase ExpressionSet. diff --git a/man/deconvolute_cibersort.Rd b/man/deconvolute_cibersort.Rd index c0d3d52..ba51169 100644 --- a/man/deconvolute_cibersort.Rd +++ b/man/deconvolute_cibersort.Rd @@ -4,8 +4,13 @@ \alias{deconvolute_cibersort} \title{Deconvolute using CIBERSORT or CIBERSORT abs.} \usage{ -deconvolute_cibersort(gene_expression_matrix, arrays, absolute = FALSE, - abs_method = "sig.score", ...) +deconvolute_cibersort( + gene_expression_matrix, + arrays, + absolute = FALSE, + abs_method = "sig.score", + ... +) } \arguments{ \item{gene_expression_matrix}{a m x n matrix with m genes and n samples} diff --git a/man/deconvolute_mcp_counter.Rd b/man/deconvolute_mcp_counter.Rd index 212d489..8ecda2b 100644 --- a/man/deconvolute_mcp_counter.Rd +++ b/man/deconvolute_mcp_counter.Rd @@ -4,14 +4,17 @@ \alias{deconvolute_mcp_counter} \title{Deconvolute using MCP-counter} \usage{ -deconvolute_mcp_counter(gene_expression_matrix, - feature_types = "HUGO_symbols", ...) +deconvolute_mcp_counter( + gene_expression_matrix, + feature_types = "HUGO_symbols", + ... +) } \arguments{ \item{gene_expression_matrix}{a m x n matrix with m genes and n samples} \item{feature_types}{type of identifiers used for expression features. May be -one of \code{"affy133P2_probesets","HUGO_symbols","ENTREZ_ID"}} +one of \verb{"affy133P2_probesets","HUGO_symbols","ENTREZ_ID"}} \item{...}{pased through to original MCP-counter function. A native argument takes precedence over an immunedeconv argument (e.g. \code{featureType} takes precedence over \code{feature_types}) diff --git a/man/deconvolute_quantiseq.Rd b/man/deconvolute_quantiseq.Rd index e08d530..f0a9136 100644 --- a/man/deconvolute_quantiseq.Rd +++ b/man/deconvolute_quantiseq.Rd @@ -4,8 +4,7 @@ \alias{deconvolute_quantiseq} \title{Deconvolute using quanTIseq} \usage{ -deconvolute_quantiseq(gene_expression_matrix, tumor, arrays, scale_mrna, - ...) +deconvolute_quantiseq(gene_expression_matrix, tumor, arrays, scale_mrna, ...) } \arguments{ \item{gene_expression_matrix}{a m x n matrix with m genes and n samples} diff --git a/man/deconvolute_quantiseq.default.Rd b/man/deconvolute_quantiseq.default.Rd index ed1b6d8..77f88ed 100644 --- a/man/deconvolute_quantiseq.default.Rd +++ b/man/deconvolute_quantiseq.default.Rd @@ -4,9 +4,16 @@ \alias{deconvolute_quantiseq.default} \title{Use quanTIseq to deconvolute a gene expression matrix.} \usage{ -deconvolute_quantiseq.default(mix.mat, arrays = FALSE, - signame = "TIL10", tumor = FALSE, mRNAscale = TRUE, - method = "lsei", btotalcells = FALSE, rmgenes = "unassigned") +deconvolute_quantiseq.default( + mix.mat, + arrays = FALSE, + signame = "TIL10", + tumor = FALSE, + mRNAscale = TRUE, + method = "lsei", + btotalcells = FALSE, + rmgenes = "unassigned" +) } \arguments{ \item{mix.mat}{table with the gene TPM (or microarray expression values) for all samples to be deconvoluted diff --git a/man/deconvolute_xcell.Rd b/man/deconvolute_xcell.Rd index 72bb195..08dbbaa 100644 --- a/man/deconvolute_xcell.Rd +++ b/man/deconvolute_xcell.Rd @@ -4,8 +4,12 @@ \alias{deconvolute_xcell} \title{Deconvolute using xCell} \usage{ -deconvolute_xcell(gene_expression_matrix, arrays, - expected_cell_types = NULL, ...) +deconvolute_xcell( + gene_expression_matrix, + arrays, + expected_cell_types = NULL, + ... +) } \arguments{ \item{gene_expression_matrix}{a m x n matrix with m genes and n samples} diff --git a/man/deconvolution_methods.Rd b/man/deconvolution_methods.Rd index 873ac67..d0a7777 100644 --- a/man/deconvolution_methods.Rd +++ b/man/deconvolution_methods.Rd @@ -4,7 +4,9 @@ \name{deconvolution_methods} \alias{deconvolution_methods} \title{List of supported immune deconvolution methods} -\format{An object of class \code{character} of length 7.} +\format{ +An object of class \code{character} of length 7. +} \usage{ deconvolution_methods } diff --git a/man/fix_namespace.Rd b/man/fix_namespace.Rd new file mode 100644 index 0000000..0c58c47 --- /dev/null +++ b/man/fix_namespace.Rd @@ -0,0 +1,10 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/zzz.R +\name{fix_namespace} +\alias{fix_namespace} +\title{assign the following global variables +.onLoad because of 'staged-install'} +\description{ +See https://developer.r-project.org/Blog/public/2019/02/14/staged-install/index.html +for more details. +} diff --git a/man/immunedeconv.Rd b/man/immunedeconv.Rd index 6bc04e8..81887f8 100644 --- a/man/immunedeconv.Rd +++ b/man/immunedeconv.Rd @@ -3,8 +3,8 @@ \docType{package} \name{immunedeconv} \alias{immunedeconv} -\alias{immunedeconv-package} \title{Collection of immune cell deconvolution methods.} \description{ -Collection of immune cell deconvolution methods. +Immunedeconv is an an R package for unified access to computational methods for +estimating immune cell fractions from bulk RNA sequencing data. } diff --git a/man/node_by_name.Rd b/man/node_by_name.Rd new file mode 100644 index 0000000..7ee4df9 --- /dev/null +++ b/man/node_by_name.Rd @@ -0,0 +1,17 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/cell_type_mapping.R +\docType{data} +\name{node_by_name} +\alias{node_by_name} +\title{Lookup dictionary for cell-type nodes} +\format{ +An object of class \code{list} of length 66. +} +\usage{ +node_by_name +} +\description{ +Access nodes by name in O(1). Node names are unique in our tree. +gets attached on .onLoad, see zzz.R +} +\keyword{datasets} diff --git a/man/timer_available_cancers.Rd b/man/timer_available_cancers.Rd index 875a865..b892445 100644 --- a/man/timer_available_cancers.Rd +++ b/man/timer_available_cancers.Rd @@ -4,7 +4,9 @@ \name{timer_available_cancers} \alias{timer_available_cancers} \title{TIMER signatures are cancer specific. This is the list of available cancer types.} -\format{An object of class \code{character} of length 32.} +\format{ +An object of class \code{character} of length 32. +} \usage{ timer_available_cancers } diff --git a/man/xCell.data.Rd b/man/xCell.data.Rd index 92406cf..ece30fc 100644 --- a/man/xCell.data.Rd +++ b/man/xCell.data.Rd @@ -4,7 +4,9 @@ \name{xCell.data} \alias{xCell.data} \title{Data object from xCell.} -\format{An object of class \code{list} of length 4.} +\format{ +An object of class \code{list} of length 4. +} \usage{ xCell.data }