Browse code

Updated Harmony documentation

irzamsarfraz authored on 29/10/2023 20:00:42
Showing 1 changed files
... ...
@@ -6,7 +6,7 @@
6 6
 \usage{
7 7
 runHarmony(
8 8
   inSCE,
9
-  useAssay = "logcounts",
9
+  useAssay = NULL,
10 10
   useReducedDim = NULL,
11 11
   batch = "batch",
12 12
   reducedDimName = "HARMONY",
... ...
@@ -24,10 +24,13 @@ runHarmony(
24 24
 \item{inSCE}{Input \linkS4class{SingleCellExperiment} object}
25 25
 
26 26
 \item{useAssay}{A single character indicating the name of the assay requiring
27
-batch correction. Default \code{"logcounts"}.}
27
+batch correction. Default \code{NULL}. It is recommended to use a reducedDim
28
+such as PCA through the `useReducedDim` parameter of this function.}
28 29
 
29 30
 \item{useReducedDim}{A single character indicating the name of the reducedDim
30
-used to be corrected. Specifying this will ignore \code{useAssay}. Default
31
+to be used. It is recommended to use a reducedDim instead of a full assay as 
32
+using an assay might cause the algorithm to not converge and throw error.
33
+Specifying this will ignore \code{useAssay}. Default
31 34
 \code{NULL}.}
32 35
 
33 36
 \item{batch}{A single character indicating a field in \code{colData} that
Browse code

Minor fix

irzamsarfraz authored on 08/10/2023 13:16:19
Showing 1 changed files
... ...
@@ -56,12 +56,12 @@ make soft kmeans cluster approach hard clustering. Default \code{0.1}.}
56 56
 \item{nIter}{An integer. The max number of iterations to perform. Default
57 57
 \code{10L}.}
58 58
 
59
+\item{seed}{Set seed for reproducibility. Default is \code{12345}.}
60
+
59 61
 \item{verbose}{Whether to print progress messages. Default \code{TRUE}.}
60 62
 
61 63
 \item{...}{Other arguments passed to \code{\link[harmony]{HarmonyMatrix}}.
62 64
 See details.}
63
-
64
-\item{Set}{seed for reproducibility. Default is \code{12345}.}
65 65
 }
66 66
 \value{
67 67
 The input \linkS4class{SingleCellExperiment} object with
Browse code

More fixes for reproducibility

irzamsarfraz authored on 08/10/2023 03:15:16
Showing 1 changed files
... ...
@@ -15,6 +15,7 @@ runHarmony(
15 15
   theta = 5,
16 16
   sigma = 0.1,
17 17
   nIter = 10,
18
+  seed = 12345,
18 19
   verbose = TRUE,
19 20
   ...
20 21
 )
... ...
@@ -59,6 +60,8 @@ make soft kmeans cluster approach hard clustering. Default \code{0.1}.}
59 60
 
60 61
 \item{...}{Other arguments passed to \code{\link[harmony]{HarmonyMatrix}}.
61 62
 See details.}
63
+
64
+\item{Set}{seed for reproducibility. Default is \code{12345}.}
62 65
 }
63 66
 \value{
64 67
 The input \linkS4class{SingleCellExperiment} object with
Browse code

Fix check error

Yichen Wang authored on 18/10/2022 07:29:41
Showing 1 changed files
... ...
@@ -79,9 +79,11 @@ work with only include: \code{nclust}, \code{tau}, \code{block.size},
79 79
 \examples{
80 80
 data('sceBatches', package = 'singleCellTK')
81 81
 logcounts(sceBatches) <- log1p(counts(sceBatches))
82
+\dontrun{
82 83
 if (require("harmony"))
83 84
     sceCorr <- runHarmony(sceBatches)
84 85
 }
86
+}
85 87
 \references{
86 88
 Ilya Korsunsky, et al., 2019
87 89
 }
Browse code

Fix CHECK issues

Yichen Wang authored on 23/09/2022 04:25:14
Showing 1 changed files
... ...
@@ -79,7 +79,8 @@ work with only include: \code{nclust}, \code{tau}, \code{block.size},
79 79
 \examples{
80 80
 data('sceBatches', package = 'singleCellTK')
81 81
 logcounts(sceBatches) <- log1p(counts(sceBatches))
82
-sceCorr <- runHarmony(sceBatches)
82
+if (require("harmony"))
83
+    sceCorr <- runHarmony(sceBatches)
83 84
 }
84 85
 \references{
85 86
 Ilya Korsunsky, et al., 2019
Browse code

Add .selectSCEMatrix() and .manageCellVar; together with refining batch correction functions

Yichen Wang authored on 11/08/2022 16:49:05
Showing 1 changed files
... ...
@@ -20,7 +20,7 @@ runHarmony(
20 20
 )
21 21
 }
22 22
 \arguments{
23
-\item{inSCE}{Input \linkS4class{SingleCellExperiment} inherited object.}
23
+\item{inSCE}{Input \linkS4class{SingleCellExperiment} object}
24 24
 
25 25
 \item{useAssay}{A single character indicating the name of the assay requiring
26 26
 batch correction. Default \code{"logcounts"}.}
... ...
@@ -29,9 +29,9 @@ batch correction. Default \code{"logcounts"}.}
29 29
 used to be corrected. Specifying this will ignore \code{useAssay}. Default
30 30
 \code{NULL}.}
31 31
 
32
-\item{batch}{A single character indicating a field in
33
-\code{\link{colData}} that annotates the batches.
34
-Default \code{"batch"}.}
32
+\item{batch}{A single character indicating a field in \code{colData} that
33
+annotates the batches of each cell; or a vector/factor with the same length
34
+as the number of cells. Default \code{"batch"}.}
35 35
 
36 36
 \item{reducedDimName}{A single character. The name for the corrected
37 37
 low-dimensional representation. Will be saved to \code{reducedDim(inSCE)}.
... ...
@@ -78,7 +78,7 @@ work with only include: \code{nclust}, \code{tau}, \code{block.size},
78 78
 }
79 79
 \examples{
80 80
 data('sceBatches', package = 'singleCellTK')
81
-logcounts(sceBatches) <- log(counts(sceBatches) + 1)
81
+logcounts(sceBatches) <- log1p(counts(sceBatches))
82 82
 sceCorr <- runHarmony(sceBatches)
83 83
 }
84 84
 \references{
Browse code

Add harmony for batch correction

Yichen Wang authored on 16/07/2022 01:03:49
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,86 @@
1
+% Generated by roxygen2: do not edit by hand
2
+% Please edit documentation in R/runBatchCorrection.R
3
+\name{runHarmony}
4
+\alias{runHarmony}
5
+\title{Apply Harmony batch effect correction method to SingleCellExperiment object}
6
+\usage{
7
+runHarmony(
8
+  inSCE,
9
+  useAssay = "logcounts",
10
+  useReducedDim = NULL,
11
+  batch = "batch",
12
+  reducedDimName = "HARMONY",
13
+  nComponents = 50,
14
+  lambda = 0.1,
15
+  theta = 5,
16
+  sigma = 0.1,
17
+  nIter = 10,
18
+  verbose = TRUE,
19
+  ...
20
+)
21
+}
22
+\arguments{
23
+\item{inSCE}{Input \linkS4class{SingleCellExperiment} inherited object.}
24
+
25
+\item{useAssay}{A single character indicating the name of the assay requiring
26
+batch correction. Default \code{"logcounts"}.}
27
+
28
+\item{useReducedDim}{A single character indicating the name of the reducedDim
29
+used to be corrected. Specifying this will ignore \code{useAssay}. Default
30
+\code{NULL}.}
31
+
32
+\item{batch}{A single character indicating a field in
33
+\code{\link{colData}} that annotates the batches.
34
+Default \code{"batch"}.}
35
+
36
+\item{reducedDimName}{A single character. The name for the corrected
37
+low-dimensional representation. Will be saved to \code{reducedDim(inSCE)}.
38
+Default \code{"HARMONY"}.}
39
+
40
+\item{nComponents}{An integer. The number of PCs to use and generate.
41
+Default \code{50L}.}
42
+
43
+\item{lambda}{A Numeric scalar. Ridge regression penalty parameter. Must be
44
+strictly positive. Smaller values result in more aggressive correction.
45
+Default \code{0.1}.}
46
+
47
+\item{theta}{A Numeric scalar. Diversity clustering penalty parameter. Larger
48
+values of theta result in more diverse clusters. theta=0 does not encourage
49
+any diversity. Default \code{5}.}
50
+
51
+\item{sigma}{A Numeric scalar. Width of soft kmeans clusters. Larger values
52
+of sigma result in cells assigned to more clusters. Smaller values of sigma
53
+make soft kmeans cluster approach hard clustering. Default \code{0.1}.}
54
+
55
+\item{nIter}{An integer. The max number of iterations to perform. Default
56
+\code{10L}.}
57
+
58
+\item{verbose}{Whether to print progress messages. Default \code{TRUE}.}
59
+
60
+\item{...}{Other arguments passed to \code{\link[harmony]{HarmonyMatrix}}.
61
+See details.}
62
+}
63
+\value{
64
+The input \linkS4class{SingleCellExperiment} object with
65
+\code{reducedDim(inSCE, reducedDimName)} updated.
66
+}
67
+\description{
68
+Harmony is an algorithm that projects cells into a shared
69
+embedding in which cells group by cell type rather than dataset-specific
70
+conditions.
71
+}
72
+\details{
73
+Since some of the arguments of \code{\link[harmony]{HarmonyMatrix}}
74
+is controlled by this wrapper function. The additional arguments users can
75
+work with only include: \code{nclust}, \code{tau}, \code{block.size},
76
+\code{max.iter.cluster}, \code{epsilon.cluster}, \code{epsilon.harmony},
77
+\code{plot_convergence}, \code{reference_values} and \code{cluster_prior}.
78
+}
79
+\examples{
80
+data('sceBatches', package = 'singleCellTK')
81
+logcounts(sceBatches) <- log(counts(sceBatches) + 1)
82
+sceCorr <- runHarmony(sceBatches)
83
+}
84
+\references{
85
+Ilya Korsunsky, et al., 2019
86
+}
Browse code

temp removal of harmony and liger; fix zinbwave bug; add brief guidence to DE page

Yichen Wang authored on 21/10/2020 08:05:49
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,61 +0,0 @@
1
-% Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/runBatchCorrection.R
3
-\name{runHarmony}
4
-\alias{runHarmony}
5
-\title{Apply Harmony batch effect correction method to SingleCellExperiment object}
6
-\usage{
7
-runHarmony(
8
-  inSCE,
9
-  useAssay = "logcounts",
10
-  pcInput = FALSE,
11
-  batch = "batch",
12
-  reducedDimName = "HARMONY",
13
-  nComponents = 50L,
14
-  theta = 5,
15
-  nIter = 10L
16
-)
17
-}
18
-\arguments{
19
-\item{inSCE}{\linkS4class{SingleCellExperiment} inherited object. Required.}
20
-
21
-\item{useAssay}{A single character indicating the name of the assay requiring
22
-batch correction. Default \code{"logcounts"}.}
23
-
24
-\item{pcInput}{A logical scalar. Whether to use a low-dimension matrix for
25
-batch effect correction. If \code{TRUE}, \code{useAssay} will be searched
26
-from \code{reducedDimNames(inSCE)}. Default \code{FALSE}.}
27
-
28
-\item{batch}{A single character indicating a field in
29
-\code{\link[SummarizedExperiment]{colData}} that annotates the batches.
30
-Default \code{"batch"}.}
31
-
32
-\item{reducedDimName}{A single character. The name for the corrected
33
-low-dimensional representation. Will be saved to \code{reducedDim(inSCE)}.
34
-Default \code{"HARMONY"}.}
35
-
36
-\item{nComponents}{An integer. The number of principle components or
37
-dimensionality to generate in the resulting matrix. If \code{pcInput} is set
38
-to \code{TRUE}, the output dimension will follow the low-dimension matrix,
39
-so this argument will be ignored. Default \code{50L}.}
40
-
41
-\item{theta}{A Numeric scalar. Diversity clustering penalty parameter,
42
-Larger value results in more diverse clusters. Default \code{5}}
43
-
44
-\item{nIter}{An integer. The max number of iterations to perform. Default
45
-\code{10L}.}
46
-}
47
-\value{
48
-The input \linkS4class{SingleCellExperiment} object with
49
-\code{reducedDim(inSCE, reducedDimName)} updated.
50
-}
51
-\description{
52
-Harmony is an algorithm that projects cells into a shared embedding in which
53
-cells group by cell type rather than dataset-specific conditions.
54
-}
55
-\examples{
56
-data('sceBatches', package = 'singleCellTK')
57
-sceCorr <- runHarmony(sceBatches, nComponents = 10L)
58
-}
59
-\references{
60
-Ilya Korsunsky, et al., 2019
61
-}
Browse code

Fix 80character/line limit; merge missed devel commit; remove unused file; allow forced run in MAST when using counts

Yichen Wang authored on 15/10/2020 16:46:08
Showing 1 changed files
... ...
@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/runHarmony.R
2
+% Please edit documentation in R/runBatchCorrection.R
3 3
 \name{runHarmony}
4 4
 \alias{runHarmony}
5 5
 \title{Apply Harmony batch effect correction method to SingleCellExperiment object}
Browse code

merge upstream; fix conflicts; update part of batch correction docs

Yichen Wang authored on 27/06/2020 00:08:12
Showing 0 changed files
Browse code

dependency version control & bug fixes

Yichen Wang authored on 11/03/2020 20:16:13
Showing 1 changed files
... ...
@@ -6,9 +6,9 @@
6 6
 \usage{
7 7
 runHarmony(
8 8
   inSCE,
9
-  exprs = "logcounts",
9
+  useAssay = "logcounts",
10 10
   pcInput = FALSE,
11
-  batchKey = "batch",
11
+  batch = "batch",
12 12
   reducedDimName = "HARMONY",
13 13
   nComponents = 50,
14 14
   theta = 5,
... ...
@@ -19,14 +19,14 @@ runHarmony(
19 19
 \item{inSCE}{SingleCellExperiment object. An object that stores your dataset
20 20
 and analysis procedures.}
21 21
 
22
-\item{exprs}{character, default `"logcounts"`. A string indicating the name 
22
+\item{useAssay}{character, default `"logcounts"`. A string indicating the name 
23 23
 of the assay requiring batch correction in "inSCE", should exist in 
24 24
 `assayNames(inSCE)`.}
25 25
 
26 26
 \item{pcInput}{bool, default `FALSE`. Whether to do correction on a low-dim
27
-matrix. If `TRUE`, will look for `exprs` in `reducedDim(inSCE)`.}
27
+matrix. If `TRUE`, will look for `useAssay` in `reducedDim(inSCE)`.}
28 28
 
29
-\item{batchKey}{character, default `"batch"`. A string indicating the 
29
+\item{batch}{character, default `"batch"`. A string indicating the 
30 30
 field of `colData(inSCE)` that defines different batches.}
31 31
 
32 32
 \item{reducedDimName}{character, default `"HARMONY"`. The name for the 
... ...
@@ -52,17 +52,6 @@ cells group by cell type rather than dataset-specific conditions.
52 52
 \examples{
53 53
  
54 54
 data('sceBatches', package = 'singleCellTK')
55
-sceBatches
56
-## class: SingleCellExperiment 
57
-## dim: 27610 1820 
58
-## metadata(0):
59
-## assays(3): normcounts logcounts
60
-## rownames(27610): GCG MALAT1 ... LOC102724004 LOC102724238
61
-## rowData names(0):
62
-## colnames(1820): reads.12732 reads.12733 ... Sample_1598 Sample_1600
63
-## colData names(2): cell_type1 batch
64
-## reducedDimNames(5): PCA
65
-## spikeNames(0):
66 55
 sceCorr <- runHarmony(sceBatches, nComponents = 10)
67 56
 }
68 57
 \references{
Browse code

Updated LIGER function and put correct dependencies in DESCRIPTION. Updated docs

Joshua D. Campbell authored on 06/03/2020 05:15:13
Showing 1 changed files
... ...
@@ -4,9 +4,16 @@
4 4
 \alias{runHarmony}
5 5
 \title{Apply Harmony batch effect correction method to SingleCellExperiment object}
6 6
 \usage{
7
-runHarmony(inSCE, exprs = "logcounts", pcInput = FALSE,
8
-  batchKey = "batch", reducedDimName = "HARMONY", nComponents = 50,
9
-  theta = 5, nIter = 10)
7
+runHarmony(
8
+  inSCE,
9
+  exprs = "logcounts",
10
+  pcInput = FALSE,
11
+  batchKey = "batch",
12
+  reducedDimName = "HARMONY",
13
+  nComponents = 50,
14
+  theta = 5,
15
+  nIter = 10
16
+)
10 17
 }
11 18
 \arguments{
12 19
 \item{inSCE}{SingleCellExperiment object. An object that stores your dataset
Browse code

move to branch

Yichen Wang authored on 04/03/2020 20:32:17
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,63 @@
1
+% Generated by roxygen2: do not edit by hand
2
+% Please edit documentation in R/runHarmony.R
3
+\name{runHarmony}
4
+\alias{runHarmony}
5
+\title{Apply Harmony batch effect correction method to SingleCellExperiment object}
6
+\usage{
7
+runHarmony(inSCE, exprs = "logcounts", pcInput = FALSE,
8
+  batchKey = "batch", reducedDimName = "HARMONY", nComponents = 50,
9
+  theta = 5, nIter = 10)
10
+}
11
+\arguments{
12
+\item{inSCE}{SingleCellExperiment object. An object that stores your dataset
13
+and analysis procedures.}
14
+
15
+\item{exprs}{character, default `"logcounts"`. A string indicating the name 
16
+of the assay requiring batch correction in "inSCE", should exist in 
17
+`assayNames(inSCE)`.}
18
+
19
+\item{pcInput}{bool, default `FALSE`. Whether to do correction on a low-dim
20
+matrix. If `TRUE`, will look for `exprs` in `reducedDim(inSCE)`.}
21
+
22
+\item{batchKey}{character, default `"batch"`. A string indicating the 
23
+field of `colData(inSCE)` that defines different batches.}
24
+
25
+\item{reducedDimName}{character, default `"HARMONY"`. The name for the 
26
+corrected low-dimensional representation.}
27
+
28
+\item{nComponents}{integer, default `20`. Number of principle components or 
29
+dimensionality to generate in the resulting reducedDim. If `pcInput`, will
30
+directly follow the dimensionality of the specified reducedDim.}
31
+
32
+\item{theta}{Numeric, default 5. Diversity clustering penalty parameter, 
33
+Larger value results in more diverse clusters.}
34
+
35
+\item{nIter}{integer, default `10`. The max number of iterations to perform.}
36
+}
37
+\value{
38
+SingleCellExperiment object with `reducedDim(inSCE, reducedDimName)` 
39
+updated with corrected low-dimentional representation.
40
+}
41
+\description{
42
+Harmony is an algorithm that projects cells into a shared embedding in which 
43
+cells group by cell type rather than dataset-specific conditions.
44
+}
45
+\examples{
46
+ 
47
+data('sceBatches', package = 'singleCellTK')
48
+sceBatches
49
+## class: SingleCellExperiment 
50
+## dim: 27610 1820 
51
+## metadata(0):
52
+## assays(3): normcounts logcounts
53
+## rownames(27610): GCG MALAT1 ... LOC102724004 LOC102724238
54
+## rowData names(0):
55
+## colnames(1820): reads.12732 reads.12733 ... Sample_1598 Sample_1600
56
+## colData names(2): cell_type1 batch
57
+## reducedDimNames(5): PCA
58
+## spikeNames(0):
59
+sceCorr <- runHarmony(sceBatches, nComponents = 10)
60
+}
61
+\references{
62
+Ilya Korsunsky, et al., 2019
63
+}