From 9d3328bb602f91306263acc96928d44049a887a2 Mon Sep 17 00:00:00 2001 From: Konstantin Pelz <35631987+PelzKo@users.noreply.github.com> Date: Mon, 19 Jul 2021 15:14:49 +0200 Subject: [PATCH 1/8] Update RunHarmony.R --- R/RunHarmony.R | 2 ++ 1 file changed, 2 insertions(+) diff --git a/R/RunHarmony.R b/R/RunHarmony.R index 14f23b9..3c8bd19 100644 --- a/R/RunHarmony.R +++ b/R/RunHarmony.R @@ -58,6 +58,8 @@ RunHarmony <- function(object, group.by.vars, ...) { #' dimensional reduction object harmony. For downstream Seurat analyses, #' use reduction='harmony'. #' @export +#' @importFrom rlang `%||%` +#' @importFrom Seurat DefaultAssay RunHarmony.Seurat <- function( object, group.by.vars, From 1d3ad6242dd9683acd2d1b21e861336d02455196 Mon Sep 17 00:00:00 2001 From: Konstantin Pelz <35631987+PelzKo@users.noreply.github.com> Date: Mon, 19 Jul 2021 15:35:41 +0200 Subject: [PATCH 2/8] Update RunHarmony.R --- R/RunHarmony.R | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/R/RunHarmony.R b/R/RunHarmony.R index 3c8bd19..9591afc 100644 --- a/R/RunHarmony.R +++ b/R/RunHarmony.R @@ -44,6 +44,8 @@ #' #' #' @rdname RunHarmony +#' @importFrom rlang `%||%` +#' @importFrom Seurat DefaultAssay #' @export RunHarmony <- function(object, group.by.vars, ...) { UseMethod("RunHarmony") @@ -57,9 +59,9 @@ 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'. -#' @export #' @importFrom rlang `%||%` #' @importFrom Seurat DefaultAssay +#' @export RunHarmony.Seurat <- function( object, group.by.vars, From 1c8d6688a027c03e533fbdd947cad78488aab4b1 Mon Sep 17 00:00:00 2001 From: Konstantin Pelz <35631987+PelzKo@users.noreply.github.com> Date: Tue, 20 Jul 2021 10:31:20 +0200 Subject: [PATCH 3/8] Update RunHarmony.R --- R/RunHarmony.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/RunHarmony.R b/R/RunHarmony.R index 9591afc..4a86188 100644 --- a/R/RunHarmony.R +++ b/R/RunHarmony.R @@ -85,7 +85,7 @@ RunHarmony.Seurat <- function( project.dim = TRUE, ... ) { - assay.use <- assay.use %||% DefaultAssay(object) + assay.use <- assay.use rlang::'%||%' Seurat::DefaultAssay(object) if (reduction == "pca") { tryCatch( embedding <- Seurat::Embeddings(object, reduction = "pca"), From 44882149b507e92fb4c9c678fd0617c061d27a66 Mon Sep 17 00:00:00 2001 From: Konstantin Pelz <35631987+PelzKo@users.noreply.github.com> Date: Tue, 20 Jul 2021 10:35:16 +0200 Subject: [PATCH 4/8] Update RunHarmony.R --- R/RunHarmony.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/RunHarmony.R b/R/RunHarmony.R index 4a86188..02dcf49 100644 --- a/R/RunHarmony.R +++ b/R/RunHarmony.R @@ -85,7 +85,7 @@ RunHarmony.Seurat <- function( project.dim = TRUE, ... ) { - assay.use <- assay.use rlang::'%||%' Seurat::DefaultAssay(object) + assay.use <- assay.use %||% Seurat::DefaultAssay(object) if (reduction == "pca") { tryCatch( embedding <- Seurat::Embeddings(object, reduction = "pca"), From 5ca2f1f711c832c54de33057e1aa1dcb03b7d9bc Mon Sep 17 00:00:00 2001 From: Konstantin Pelz Date: Thu, 22 Jul 2021 13:57:01 +0200 Subject: [PATCH 5/8] ran roxigenize() --- NAMESPACE | 2 ++ man/RunHarmony.Rd | 21 ++++++++++----------- man/harmony.Rd | 4 ++-- src/RcppExports.cpp | 5 +++++ 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index c44f465..46b8b89 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -8,10 +8,12 @@ export(RunHarmony) export(moe_ridge_get_betas) importFrom(Rcpp,loadModule) importFrom(Rcpp,sourceCpp) +importFrom(Seurat,DefaultAssay) importFrom(cowplot,plot_grid) importFrom(dplyr,"%>%") importFrom(methods,as) importFrom(methods,is) importFrom(methods,new) importFrom(rlang,.data) +importFrom(rlang,`%||%`) useDynLib(harmony) 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) { From 1d1a2a1b6a87a35879895b540cd892b6ddf1b9eb Mon Sep 17 00:00:00 2001 From: Konstantin Pelz Date: Thu, 22 Jul 2021 14:31:07 +0200 Subject: [PATCH 6/8] resolve checking failure --- .Rhistory | 2 ++ NAMESPACE | 1 - R/RunHarmony.R | 2 -- 3 files changed, 2 insertions(+), 3 deletions(-) create mode 100644 .Rhistory diff --git a/.Rhistory b/.Rhistory new file mode 100644 index 0000000..63bbe78 --- /dev/null +++ b/.Rhistory @@ -0,0 +1,2 @@ +setwd("C:/Users/Konstantin/Programmierung/harmony") +roxygen2::roxygenise() diff --git a/NAMESPACE b/NAMESPACE index 46b8b89..b24766b 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -8,7 +8,6 @@ export(RunHarmony) export(moe_ridge_get_betas) importFrom(Rcpp,loadModule) importFrom(Rcpp,sourceCpp) -importFrom(Seurat,DefaultAssay) importFrom(cowplot,plot_grid) importFrom(dplyr,"%>%") importFrom(methods,as) diff --git a/R/RunHarmony.R b/R/RunHarmony.R index 02dcf49..ec65ad0 100644 --- a/R/RunHarmony.R +++ b/R/RunHarmony.R @@ -45,7 +45,6 @@ #' #' @rdname RunHarmony #' @importFrom rlang `%||%` -#' @importFrom Seurat DefaultAssay #' @export RunHarmony <- function(object, group.by.vars, ...) { UseMethod("RunHarmony") @@ -60,7 +59,6 @@ RunHarmony <- function(object, group.by.vars, ...) { #' dimensional reduction object harmony. For downstream Seurat analyses, #' use reduction='harmony'. #' @importFrom rlang `%||%` -#' @importFrom Seurat DefaultAssay #' @export RunHarmony.Seurat <- function( object, From 7cdd17506a6ac3fd5d3061a8f5487fa37eb50e31 Mon Sep 17 00:00:00 2001 From: Konstantin Pelz <35631987+PelzKo@users.noreply.github.com> Date: Mon, 6 Sep 2021 14:30:45 +0200 Subject: [PATCH 7/8] Delete .Rhistory --- .Rhistory | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 .Rhistory diff --git a/.Rhistory b/.Rhistory deleted file mode 100644 index 63bbe78..0000000 --- a/.Rhistory +++ /dev/null @@ -1,2 +0,0 @@ -setwd("C:/Users/Konstantin/Programmierung/harmony") -roxygen2::roxygenise() From 6d8737c7f99b5838bff683be5170d366a4bceec2 Mon Sep 17 00:00:00 2001 From: Gregor Sturm Date: Mon, 6 Sep 2021 15:20:57 +0200 Subject: [PATCH 8/8] Update DESCRIPTION --- DESCRIPTION | 1 + 1 file changed, 1 insertion(+) 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,