diff --git a/DESCRIPTION b/DESCRIPTION index 8d20e8e..0710463 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -23,6 +23,7 @@ RoxygenNote: 7.1.1 Depends: R(>= 3.4.0), Rcpp LazyData: true LinkingTo: Rcpp, RcppArmadillo, RcppProgress +biocViews: Imports: dplyr, cowplot, diff --git a/NAMESPACE b/NAMESPACE index c44f465..b24766b 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -14,4 +14,5 @@ importFrom(methods,as) importFrom(methods,is) importFrom(methods,new) importFrom(rlang,.data) +importFrom(rlang,`%||%`) useDynLib(harmony) diff --git a/R/RunHarmony.R b/R/RunHarmony.R index 14f23b9..ec65ad0 100644 --- a/R/RunHarmony.R +++ b/R/RunHarmony.R @@ -44,6 +44,7 @@ #' #' #' @rdname RunHarmony +#' @importFrom rlang `%||%` #' @export RunHarmony <- function(object, group.by.vars, ...) { UseMethod("RunHarmony") @@ -57,6 +58,7 @@ RunHarmony <- function(object, group.by.vars, ...) { #' @return Seurat (version 3) object. Harmony dimensions placed into #' dimensional reduction object harmony. For downstream Seurat analyses, #' use reduction='harmony'. +#' @importFrom rlang `%||%` #' @export RunHarmony.Seurat <- function( object, @@ -81,7 +83,7 @@ RunHarmony.Seurat <- function( project.dim = TRUE, ... ) { - assay.use <- assay.use %||% DefaultAssay(object) + assay.use <- assay.use %||% Seurat::DefaultAssay(object) if (reduction == "pca") { tryCatch( embedding <- Seurat::Embeddings(object, reduction = "pca"), diff --git a/man/RunHarmony.Rd b/man/RunHarmony.Rd index 3fb774c..63d1ab0 100644 --- a/man/RunHarmony.Rd +++ b/man/RunHarmony.Rd @@ -27,7 +27,7 @@ RunHarmony(object, group.by.vars, ...) verbose = TRUE, reference_values = NULL, reduction.save = "harmony", - assay.use = "RNA", + assay.use = NULL, project.dim = TRUE, ... ) @@ -64,17 +64,17 @@ RunHarmony(object, group.by.vars, ...) \item{dims.use}{Which PCA dimensions to use for Harmony. By default, use all} -\item{theta}{Diversity clustering penalty parameter. Specify for each +\item{theta}{Diversity clustering penalty parameter. Specify for each variable in group.by.vars. Default theta=2. theta=0 does not encourage any diversity. Larger values of theta result in more diverse clusters.} -\item{lambda}{Ridge regression penalty parameter. Specify for each variable -in group.by.vars. Default lambda=1. Lambda must be strictly positive. +\item{lambda}{Ridge regression penalty parameter. Specify for each variable +in group.by.vars. Default lambda=1. Lambda must be strictly positive. Smaller values result in more aggressive correction.} -\item{sigma}{Width of soft kmeans clusters. Default sigma=0.1. Sigma scales +\item{sigma}{Width of soft kmeans clusters. Default sigma=0.1. Sigma scales the distance from a cell to cluster centroids. Larger values of sigma result - in cells assigned to more clusters. Smaller values of sigma make soft + in cells assigned to more clusters. Smaller values of sigma make soft kmeans cluster approach hard clustering.} \item{nclust}{Number of clusters in model. nclust=1 equivalent to simple @@ -89,7 +89,7 @@ Between 0 to 1, default 0.05. Larger values may be faster but less accurate} \item{max.iter.harmony}{Maximum number of rounds to run Harmony. One round of Harmony involves one clustering and one correction step.} -\item{max.iter.cluster}{Maximum number of rounds to run clustering at each +\item{max.iter.cluster}{Maximum number of rounds to run clustering at each round of Harmony.} \item{epsilon.cluster}{Convergence tolerance for clustering round of Harmony @@ -98,7 +98,7 @@ Set to -Inf to never stop early.} \item{epsilon.harmony}{Convergence tolerance for Harmony. Set to -Inf to never stop early.} -\item{plot_convergence}{Whether to print the convergence plot of the +\item{plot_convergence}{Whether to print the convergence plot of the clustering objective function. TRUE to plot, FALSE to suppress. This can be useful for debugging.} @@ -109,11 +109,10 @@ suppress.} that have batch variables values matching reference_values will not be moved} \item{reduction.save}{Keyword to save Harmony reduction. Useful if you want -to try Harmony with multiple parameters and save them as e.g. +to try Harmony with multiple parameters and save them as e.g. 'harmony_theta0', 'harmony_theta1', 'harmony_theta2'} -\item{assay.use}{(Seurat V3 only) Which assay to Harmonize with (RNA -by default).} +\item{assay.use}{(Seurat V3 only) Which assay to Harmonize with (Default Assay as default).} \item{project.dim}{Project dimension reduction loadings. Default TRUE.} } diff --git a/man/harmony.Rd b/man/harmony.Rd index 5624d64..7e46a7a 100644 --- a/man/harmony.Rd +++ b/man/harmony.Rd @@ -8,10 +8,10 @@ Algorithm for single cell integration. } \section{Usage}{ - + \enumerate{ -\item ?HarmonyMatrix to run Harmony on gene expression or PCA +\item ?HarmonyMatrix to run Harmony on gene expression or PCA embeddings matrix. \item ?RunHarmony to run Harmony on Seurat or SingleCellExperiment objects. } diff --git a/src/RcppExports.cpp b/src/RcppExports.cpp index 1e28b05..ca5cab7 100644 --- a/src/RcppExports.cpp +++ b/src/RcppExports.cpp @@ -7,6 +7,11 @@ using namespace Rcpp; +#ifdef RCPP_USE_GLOBAL_ROSTREAM +Rcpp::Rostream& Rcpp::Rcout = Rcpp::Rcpp_cout_get(); +Rcpp::Rostream& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get(); +#endif + // compute_Y MATTYPE compute_Y(const MATTYPE& Z_cos, const MATTYPE& R); RcppExport SEXP _harmony_compute_Y(SEXP Z_cosSEXP, SEXP RSEXP) {