diff --git a/R/DEG_marker.R b/R/DEG_marker.R index 28ae659..fe3cb48 100644 --- a/R/DEG_marker.R +++ b/R/DEG_marker.R @@ -1011,9 +1011,8 @@ computePval <- function(ustat, ties, N, n1n2) { #' @param groupSize Maximum number of cells in each group to be downsampled for #' plotting. Default \code{50}. #' @param column_title Title on the column. Default \code{NULL}. -#' @param ... Parameter passed to wrapped functions in the inheritance order: -#' \code{\link{plotGeneHeatmap}}, \code{\link{.plotHeatmap}}, -#' \code{ComplexHeatmap::\link[ComplexHeatmap]{Heatmap}} +#' @inheritDotParams plotGeneHeatmap cellAnnotation +#' @inheritDotParams .plotHeatmap transpose showCellLabel showCellLegend showFeatureLabel cellAnnColList featureAnnColList scale trim baseSize cellTextSize featureTextSize cellTitleSize featureTitleSize legendTextSize legendTitleSize viridisOption viridisDirection RColorBrewerOption #' @return A \linkS4class{HeatmapList} object. #' @examples #' defaultCluster(pbmc) <- pbmcPlot$leiden_cluster @@ -1116,9 +1115,7 @@ plotMarkerHeatmap <- function( #' \code{NULL} includes dataset source and the default cluster. #' @param column_title Title on the column. Default \code{NULL}. #' @param seed Random seed for reproducibility. Default \code{1}. -#' @param ... Parameter passed to wrapped functions in the inheritance order: -#' \code{\link{plotGeneHeatmap}}, \code{\link{.plotHeatmap}}, -#' \code{ComplexHeatmap::\link[ComplexHeatmap]{Heatmap}} +#' @inheritDotParams .plotHeatmap transpose showCellLabel showCellLegend showFeatureLabel cellAnnColList featureAnnColList scale trim baseSize cellTextSize featureTextSize cellTitleSize featureTitleSize legendTextSize legendTitleSize viridisOption viridisDirection RColorBrewerOption #' @return A \linkS4class{HeatmapList} object. #' @examples #' defaultCluster(pbmc) <- pbmcPlot$leiden_cluster diff --git a/R/classes.R b/R/classes.R index ba7b304..4ee7d0b 100644 --- a/R/classes.R +++ b/R/classes.R @@ -26,21 +26,29 @@ NULL #' higher level \linkS4class{liger} object #' @docType class #' @rdname ligerDataset-class -#' @slot rawData Raw data. -#' @slot normData Normalized data -#' @slot scaleData Scaled data, usually with subset variable features -#' @slot scaleUnsharedData Scaled data of features not shared with other -#' datasets -#' @slot varUnsharedFeatures Variable features not shared with other datasets -#' @slot V matrix -#' @slot A matrix -#' @slot B matrix -#' @slot H matrix -#' @slot U matrix -#' @slot h5fileInfo list -#' @slot featureMeta Feature metadata, DataFrame -#' @slot colnames character -#' @slot rownames character +#' @slot rawData Raw data. Feature by cell matrix. Most of the time, sparse +#' matrix of integer numbers for RNA and ATAC data. +#' @slot normData Normalized data. Feature by cell matrix. Sparse if the +#' \code{rawData} it is normalized from is sparse. +#' @slot scaleData Scaled data, usually with subset shared variable features, by +#' cells. Most of the time sparse matrix of float numbers. This is the data used +#' for iNMF factorization. +#' @slot scaleUnsharedData Scaled data of variable features not shared with +#' other datasets. This is the data used for UINMF factorization. +#' @slot varUnsharedFeatures Variable features not shared with other datasets. +#' @slot V iNMF output matrix holding the dataset specific gene loading of each +#' factor. Feature by factor matrix. +#' @slot A Online iNMF intermediate product matrix. +#' @slot B Online iNMF intermediate product matrix. +#' @slot H iNMF output matrix holding the factor loading of each cell. Factor by +#' cell matrix. +#' @slot U UINMF output matrix holding the unshared variable gene loading of +#' each factor. Feature by factor matrix. +#' @slot h5fileInfo list of meta information of HDF5 file used for constructing +#' the object. +#' @slot featureMeta Feature metadata, DataFrame object. +#' @slot colnames Character vector of unique cell identifiers. +#' @slot rownames Character vector of unique feature names. #' @importClassesFrom S4Vectors DataFrame #' @exportClass ligerDataset ligerDataset <- setClass( @@ -147,7 +155,7 @@ setValidity("ligerDataset", .valid.ligerDataset) #' be a \linkS4class{ligerDataset} object containing dataset specific #' information, such as the expression matrices. The other parts of liger object #' stores information that can be shared across the analysis, such as the cell -#' metadata and factorization result matrices. +#' metadata. #' #' This manual provides explanation to the \code{liger} object structure as well #' as usage of class-specific methods. Please see detail sections for more @@ -160,14 +168,13 @@ setValidity("ligerDataset", .valid.ligerDataset) #' \code{dataset}, \code{dataset<-}, \code{datasets} or \code{datasets<-} to #' interact with. See detailed section accordingly. #' @slot cellMeta \linkS4class{DFrame} object for cell metadata. Pre-existing -#' metadata, QC metrics, cluster labeling, low-dimensional embedding and etc. -#' are all stored here. Use generic \code{cellMeta}, \code{cellMeta<-}, -#' \code{$}, \code{[[]]} or \code{[[]]<-} to interact with. See detailed section -#' accordingly. -#' @slot varFeatures Character vector of feature names. Use generic +#' metadata, QC metrics, cluster labeling and etc. are all stored here. Use +#' generic \code{cellMeta}, \code{cellMeta<-}, \code{$}, \code{[[]]} or +#' \code{[[]]<-} to interact with. See detailed section accordingly. +#' @slot varFeatures Character vector of names of variable features. Use generic #' \code{varFeatures} or \code{varFeatures<-} to interact with. See detailed #' section accordingly. -#' @slot W Matrix of gene loading for each factor. See +#' @slot W iNMF output matrix of shared gene loadings for each factor. See #' \code{\link{runIntegration}}. #' @slot H.norm Matrix of aligned factor loading for each cell. See #' \code{\link{quantileNorm}} and \code{\link{runIntegration}}. diff --git a/R/heatmap.R b/R/heatmap.R index d87a496..0a4eb55 100644 --- a/R/heatmap.R +++ b/R/heatmap.R @@ -29,8 +29,7 @@ #' @param viridisOption See \code{option} argument of #' \code{\link[viridisLite]{viridis}}. Default \code{"C"} (plasma) for #' \code{plotGeneHeatmap} and \code{"D"} (viridis) for \code{plotFactorHeatmap}. -#' @param ... Additional arguments passed to general function -#' \code{\link{.plotHeatmap}} and \code{\link[ComplexHeatmap]{Heatmap}}. +#' @inheritDotParams .plotHeatmap transpose showCellLabel showCellLegend showFeatureLabel showFeatureLegend cellAnnColList featureAnnColList scale baseSize cellTextSize featureTextSize cellTitleSize featureTitleSize legendTextSize legendTitleSize viridisDirection RColorBrewerOption #' @return \code{\link[ComplexHeatmap]{HeatmapList-class}} object #' @export #' @rdname plotHeatmap diff --git a/R/import.R b/R/import.R index d1ab8d4..e2caa37 100644 --- a/R/import.R +++ b/R/import.R @@ -457,7 +457,7 @@ createH5LigerDataset <- function( #' tempPath <- tempfile(fileext = ".rds") #' saveRDS(lig, tempPath) #' -#' lig <- readLiger(tempPath, h5FilePath = c(ctrl = h5tempPath)) +#' lig <- readLiger(tempPath, h5FilePath = list(ctrl = h5tempPath)) #' #' \dontrun{ #' # Read a old liger object <= 1.0.1 diff --git a/man/liger-class.Rd b/man/liger-class.Rd index 8c14288..bb7efc3 100644 --- a/man/liger-class.Rd +++ b/man/liger-class.Rd @@ -382,7 +382,7 @@ analysis in R. The slot \code{datasets} is a list where each element should be a \linkS4class{ligerDataset} object containing dataset specific information, such as the expression matrices. The other parts of liger object stores information that can be shared across the analysis, such as the cell -metadata and factorization result matrices. +metadata. This manual provides explanation to the \code{liger} object structure as well as usage of class-specific methods. Please see detail sections for more @@ -400,16 +400,15 @@ please try updating the objects individually with interact with. See detailed section accordingly.} \item{\code{cellMeta}}{\linkS4class{DFrame} object for cell metadata. Pre-existing -metadata, QC metrics, cluster labeling, low-dimensional embedding and etc. -are all stored here. Use generic \code{cellMeta}, \code{cellMeta<-}, -\code{$}, \code{[[]]} or \code{[[]]<-} to interact with. See detailed section -accordingly.} +metadata, QC metrics, cluster labeling and etc. are all stored here. Use +generic \code{cellMeta}, \code{cellMeta<-}, \code{$}, \code{[[]]} or +\code{[[]]<-} to interact with. See detailed section accordingly.} -\item{\code{varFeatures}}{Character vector of feature names. Use generic +\item{\code{varFeatures}}{Character vector of names of variable features. Use generic \code{varFeatures} or \code{varFeatures<-} to interact with. See detailed section accordingly.} -\item{\code{W}}{Matrix of gene loading for each factor. See +\item{\code{W}}{iNMF output matrix of shared gene loadings for each factor. See \code{\link{runIntegration}}.} \item{\code{H.norm}}{Matrix of aligned factor loading for each cell. See diff --git a/man/ligerDataset-class.Rd b/man/ligerDataset-class.Rd index 7c10002..392ef4b 100644 --- a/man/ligerDataset-class.Rd +++ b/man/ligerDataset-class.Rd @@ -155,34 +155,42 @@ higher level \linkS4class{liger} object \section{Slots}{ \describe{ -\item{\code{rawData}}{Raw data.} +\item{\code{rawData}}{Raw data. Feature by cell matrix. Most of the time, sparse +matrix of integer numbers for RNA and ATAC data.} -\item{\code{normData}}{Normalized data} +\item{\code{normData}}{Normalized data. Feature by cell matrix. Sparse if the +\code{rawData} it is normalized from is sparse.} -\item{\code{scaleData}}{Scaled data, usually with subset variable features} +\item{\code{scaleData}}{Scaled data, usually with subset shared variable features, by +cells. Most of the time sparse matrix of float numbers. This is the data used +for iNMF factorization.} -\item{\code{scaleUnsharedData}}{Scaled data of features not shared with other -datasets} +\item{\code{scaleUnsharedData}}{Scaled data of variable features not shared with +other datasets. This is the data used for UINMF factorization.} -\item{\code{varUnsharedFeatures}}{Variable features not shared with other datasets} +\item{\code{varUnsharedFeatures}}{Variable features not shared with other datasets.} -\item{\code{V}}{matrix} +\item{\code{V}}{iNMF output matrix holding the dataset specific gene loading of each +factor. Feature by factor matrix.} -\item{\code{A}}{matrix} +\item{\code{A}}{Online iNMF intermediate product matrix.} -\item{\code{B}}{matrix} +\item{\code{B}}{Online iNMF intermediate product matrix.} -\item{\code{H}}{matrix} +\item{\code{H}}{iNMF output matrix holding the factor loading of each cell. Factor by +cell matrix.} -\item{\code{U}}{matrix} +\item{\code{U}}{UINMF output matrix holding the unshared variable gene loading of +each factor. Feature by factor matrix.} -\item{\code{h5fileInfo}}{list} +\item{\code{h5fileInfo}}{list of meta information of HDF5 file used for constructing +the object.} -\item{\code{featureMeta}}{Feature metadata, DataFrame} +\item{\code{featureMeta}}{Feature metadata, DataFrame object.} -\item{\code{colnames}}{character} +\item{\code{colnames}}{Character vector of unique cell identifiers.} -\item{\code{rownames}}{character} +\item{\code{rownames}}{Character vector of unique feature names.} }} \section{Matrix access}{ diff --git a/man/plotHeatmap.Rd b/man/plotHeatmap.Rd index 2743b44..b486aea 100644 --- a/man/plotHeatmap.Rd +++ b/man/plotHeatmap.Rd @@ -73,8 +73,35 @@ heatmap by specified variables. Default \code{NULL}.} \code{\link[viridisLite]{viridis}}. Default \code{"C"} (plasma) for \code{plotGeneHeatmap} and \code{"D"} (viridis) for \code{plotFactorHeatmap}.} -\item{...}{Additional arguments passed to general function -\code{\link{.plotHeatmap}} and \code{\link[ComplexHeatmap]{Heatmap}}.} +\item{...}{ + Arguments passed on to \code{\link[=.plotHeatmap]{.plotHeatmap}} + \describe{ + \item{\code{transpose}}{Logical, whether to "rotate" the heatmap by 90 degrees so +that cell information is displayed by row. Default \code{FALSE}.} + \item{\code{showCellLabel,showFeatureLabel}}{Logical, whether to show cell barcodes, +gene symbols or factor names. Default \code{TRUE} for gene/factors but +\code{FALSE} for cells.} + \item{\code{showCellLegend,showFeatureLegend}}{Logical, whether to show cell or +feature legends. Default \code{TRUE}. Can be a scalar for overall control +or a vector matching with each given annotation variable.} + \item{\code{cellAnnColList,featureAnnColList}}{List object, with each element a +named vector of R-interpretable color code. The names of the list elements +are used for matching the annotation variable names. The names of the colors +in the vectors are used for matching the levels of a variable (factor object, +categorical). Default \code{NULL} generates ggplot-flavor categorical colors.} + \item{\code{scale}}{Logical, whether to take z-score to scale and center gene +expression. Applied after \code{dataScaleFunc}. Default \code{FALSE}.} + \item{\code{baseSize}}{One-parameter control of all text sizes. Individual text +element sizes can be controlled by other size arguments. "Title" sizes are +2 points larger than "text" sizes when being controlled by this.} + \item{\code{cellTextSize,featureTextSize,legendTextSize}}{Size of cell barcode +labels, gene/factor labels, or legend values. Default \code{NULL}.} + \item{\code{cellTitleSize,featureTitleSize,legendTitleSize}}{Size of titles of the +cell slices, gene/factor slices, or the legends. Default \code{NULL}.} + \item{\code{RColorBrewerOption}}{When \code{scale = TRUE}, heatmap color will be +mapped with \code{\link[RColorBrewer]{brewer.pal}}. This is passed to +\code{name}. Default \code{"RdBu"}.} + }} \item{trim}{Numeric vector of two numbers. Higher value limits the maximum value and lower value limits the minimum value. Default \code{c(0, 0.03)}.} diff --git a/man/plotMarkerHeatmap.Rd b/man/plotMarkerHeatmap.Rd index cc702c6..71e599d 100644 --- a/man/plotMarkerHeatmap.Rd +++ b/man/plotMarkerHeatmap.Rd @@ -52,9 +52,41 @@ plotting. Default \code{50}.} \item{column_title}{Title on the column. Default \code{NULL}.} -\item{...}{Parameter passed to wrapped functions in the inheritance order: -\code{\link{plotGeneHeatmap}}, \code{\link{.plotHeatmap}}, -\code{ComplexHeatmap::\link[ComplexHeatmap]{Heatmap}}} +\item{...}{ + Arguments passed on to \code{\link[=plotGeneHeatmap]{plotGeneHeatmap}}, \code{\link[=.plotHeatmap]{.plotHeatmap}} + \describe{ + \item{\code{cellAnnotation}}{data.frame object for using external annotation, with +each column a variable and each row is a cell. Row names of this data.frame +will be used for matching cells involved in heatmap. For cells not found in +this data.frame, \code{NA}s will be added with warning. Default \code{NULL}.} + \item{\code{transpose}}{Logical, whether to "rotate" the heatmap by 90 degrees so +that cell information is displayed by row. Default \code{FALSE}.} + \item{\code{showCellLabel,showFeatureLabel}}{Logical, whether to show cell barcodes, +gene symbols or factor names. Default \code{TRUE} for gene/factors but +\code{FALSE} for cells.} + \item{\code{cellAnnColList,featureAnnColList}}{List object, with each element a +named vector of R-interpretable color code. The names of the list elements +are used for matching the annotation variable names. The names of the colors +in the vectors are used for matching the levels of a variable (factor object, +categorical). Default \code{NULL} generates ggplot-flavor categorical colors.} + \item{\code{scale}}{Logical, whether to take z-score to scale and center gene +expression. Applied after \code{dataScaleFunc}. Default \code{FALSE}.} + \item{\code{trim}}{Numeric vector of two values. Limit the z-score value into this +range when \code{scale = TRUE}. Default \code{c(-2, 2)}.} + \item{\code{baseSize}}{One-parameter control of all text sizes. Individual text +element sizes can be controlled by other size arguments. "Title" sizes are +2 points larger than "text" sizes when being controlled by this.} + \item{\code{cellTextSize,featureTextSize,legendTextSize}}{Size of cell barcode +labels, gene/factor labels, or legend values. Default \code{NULL}.} + \item{\code{cellTitleSize,featureTitleSize,legendTitleSize}}{Size of titles of the +cell slices, gene/factor slices, or the legends. Default \code{NULL}.} + \item{\code{viridisOption,viridisDirection}}{See argument \code{option} and +\code{direction} of \code{\link[viridisLite]{viridis}}. Default \code{"A"} +and \code{-1}.} + \item{\code{RColorBrewerOption}}{When \code{scale = TRUE}, heatmap color will be +mapped with \code{\link[RColorBrewer]{brewer.pal}}. This is passed to +\code{name}. Default \code{"RdBu"}.} + }} } \value{ A \linkS4class{HeatmapList} object. diff --git a/man/plotPairwiseDEGHeatmap.Rd b/man/plotPairwiseDEGHeatmap.Rd index 621d916..194971e 100644 --- a/man/plotPairwiseDEGHeatmap.Rd +++ b/man/plotPairwiseDEGHeatmap.Rd @@ -55,9 +55,37 @@ specified. Default \code{200}.} \item{seed}{Random seed for reproducibility. Default \code{1}.} -\item{...}{Parameter passed to wrapped functions in the inheritance order: -\code{\link{plotGeneHeatmap}}, \code{\link{.plotHeatmap}}, -\code{ComplexHeatmap::\link[ComplexHeatmap]{Heatmap}}} +\item{...}{ + Arguments passed on to \code{\link[=.plotHeatmap]{.plotHeatmap}} + \describe{ + \item{\code{transpose}}{Logical, whether to "rotate" the heatmap by 90 degrees so +that cell information is displayed by row. Default \code{FALSE}.} + \item{\code{showCellLabel,showFeatureLabel}}{Logical, whether to show cell barcodes, +gene symbols or factor names. Default \code{TRUE} for gene/factors but +\code{FALSE} for cells.} + \item{\code{cellAnnColList,featureAnnColList}}{List object, with each element a +named vector of R-interpretable color code. The names of the list elements +are used for matching the annotation variable names. The names of the colors +in the vectors are used for matching the levels of a variable (factor object, +categorical). Default \code{NULL} generates ggplot-flavor categorical colors.} + \item{\code{scale}}{Logical, whether to take z-score to scale and center gene +expression. Applied after \code{dataScaleFunc}. Default \code{FALSE}.} + \item{\code{trim}}{Numeric vector of two values. Limit the z-score value into this +range when \code{scale = TRUE}. Default \code{c(-2, 2)}.} + \item{\code{baseSize}}{One-parameter control of all text sizes. Individual text +element sizes can be controlled by other size arguments. "Title" sizes are +2 points larger than "text" sizes when being controlled by this.} + \item{\code{cellTextSize,featureTextSize,legendTextSize}}{Size of cell barcode +labels, gene/factor labels, or legend values. Default \code{NULL}.} + \item{\code{cellTitleSize,featureTitleSize,legendTitleSize}}{Size of titles of the +cell slices, gene/factor slices, or the legends. Default \code{NULL}.} + \item{\code{viridisOption,viridisDirection}}{See argument \code{option} and +\code{direction} of \code{\link[viridisLite]{viridis}}. Default \code{"A"} +and \code{-1}.} + \item{\code{RColorBrewerOption}}{When \code{scale = TRUE}, heatmap color will be +mapped with \code{\link[RColorBrewer]{brewer.pal}}. This is passed to +\code{name}. Default \code{"RdBu"}.} + }} } \value{ A \linkS4class{HeatmapList} object. diff --git a/man/readLiger.Rd b/man/readLiger.Rd index f257d05..1bfe6f4 100644 --- a/man/readLiger.Rd +++ b/man/readLiger.Rd @@ -57,7 +57,7 @@ lig <- createLiger(list(ctrl = h5tempPath)) tempPath <- tempfile(fileext = ".rds") saveRDS(lig, tempPath) -lig <- readLiger(tempPath, h5FilePath = c(ctrl = h5tempPath)) +lig <- readLiger(tempPath, h5FilePath = list(ctrl = h5tempPath)) \dontrun{ # Read a old liger object <= 1.0.1