Skip to content

Commit

Permalink
CRAN release 2.0.0; with final minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mvfki committed Mar 20, 2024
1 parent e939e11 commit 3739d1c
Show file tree
Hide file tree
Showing 17 changed files with 119 additions and 49 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ LICENSE
^vignettes/articles$
^doc$
^Meta$
cran-comments.md
8 changes: 3 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: rliger
Version: 2.0.0
Date: 2024-03-19
Date: 2024-03-20
Type: Package
Title: Linked Inference of Genomic Experimental Relationships
Description: Uses an extension of nonnegative matrix factorization to identify shared and dataset-specific factors. See Welch J, Kozareva V, et al (2019) <doi:10.1016/j.cell.2019.05.006>, and Liu J, Gao C, Sodicoff J, et al (2020) <doi:10.1038/s41596-020-0391-8> for more details.
Expand Down Expand Up @@ -30,13 +30,14 @@ Author: Joshua Welch [aut],
Andrew Robbins [ctb]
Maintainer: Yichen Wang <wayichen@umich.edu>
BugReports: https://github.com/welch-lab/liger/issues
URL: https://github.com/welch-lab/liger
URL: https://welch-lab.github.io/liger/
License: GPL-3
biocViews:
LazyData: true
RoxygenNote: 7.3.1
VignetteBuilder: knitr
Encoding: UTF-8
Additional_repositories: https:/welch-lab.r-universe.dev, https://blaserlab.r-universe.dev
LinkingTo: Rcpp, RcppArmadillo, RcppProgress
Depends:
methods,
Expand Down Expand Up @@ -89,6 +90,3 @@ Suggests:
SingleCellExperiment,
SummarizedExperiment,
testthat
Remotes:
chris-mcginnis-ucsf/DoubletFinder,
welch-lab/RcppPlanc
17 changes: 15 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## rliger Next

- Standardized H5 writing specification that can be shared with other platforms.
- Currently we allow analysis with 10X cellranger output H5 file and H5AD file from anndata>=0.8.0
- Writing to H5AD file should follow anndata specification otherwise the file cannot be read back to a Python seesion.
- Writing to 10X H5 file should be carefully investigated.
- Ability to reorganize datasets
- Allow doing something like `reorganize(ligerObj, variable = "somethingNotDataset")` and resulting in a new liger object with different ligerDataset grouping.
- Ability to do downstream analysis on H5 data
- Pseudo-bulk should be easy because we are just aggregating cells.
- Wilcoxon might be a bit harder because ranks are calculated per gene but the H5 sparse data is column majored. Might need to find a fast on-disk transposition method.

## rliger 2.0.0

- Added `ligerDataset` class for per-dataset information storage, with inheritance for specific modalities
Expand All @@ -8,10 +20,11 @@
- Added gene name pattern for expression percentage QC metric
- Added native Seurat object support for the core integration workflow
- Added a documentation website built with pkgdown
- Added new iNMF variant method, consensus iNMF (c-iNMF), in `runCINMF()`
- Added new iNMF variant method, consensus iNMF (c-iNMF), in `runCINMF()`. Not stable.
- Changed `liger` object class structure
- Changed iNMF (previously `optimizeALS()`), UINMF (previously `optimizeALS(unshared = TRUE)`) and online iNMF (previously `online_iNMF()`) implementation with vastly improved performance. Now named by `runINMF()`, `runUINMF()` and `runOnlineINMF()` respectively, and wrapped in `runIntegration()`.
- Moved iNMF (previously `optimizeALS()`), UINMF (previously `optimizeALS(unshared = TRUE)`) and online iNMF (previously `online_iNMF()`) implementation to new package *RcppPlanc* with vastly improved performance. Now wrapped in `runINMF()`, `runUINMF()` and `runOnlineINMF()` respectively, and all can be invoked with `runIntegration()`.
- Updated H5AD support to match up with Python anndata package 0.8.0 specs
- Renamed many function/argument names to follow camelCase style, original names are still available while deprecation warnings are issued

## rliger 1.0.1

Expand Down
2 changes: 2 additions & 0 deletions R/ATAC.R
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ imputeKNN <- function(
#' @seealso \code{\link{imputeKNN}}
#' @export
#' @examples
#' \donttest{
#' bmmc <- normalize(bmmc)
#' bmmc <- selectGenes(bmmc)
#' bmmc <- scaleNotCenter(bmmc)
Expand All @@ -181,6 +182,7 @@ imputeKNN <- function(
#' pathToCoords = system.file("extdata/hg19_genes.bed", package = "rliger")
#' )
#' }
#' }
linkGenesAndPeaks <- function(
object,
useDataset,
Expand Down
15 changes: 11 additions & 4 deletions R/clustering.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,18 @@
#' @param groupSingletons Whether to group single cells that make up their own
#' cluster in with the cluster they are most connected to. Default \code{TRUE},
#' if \code{FALSE}, assign all singletons to a \code{"singleton"} group.
#' @param saveSNN Logical, whether to store the SNN graph, as a dgCMatrix
#' object, in the object. Default \code{FALSE}.
#' @param clusterName Name of the variable that will store the clustering result
#' in \code{cellMeta} slot of \code{object}. Default \code{"leiden_cluster"} and
#' \code{"louvain_cluster"}.
#' @param seed Seed of the random number generator. Default \code{1}.
#' @param verbose Logical. Whether to show information of the progress. Default
#' \code{getOption("ligerVerbose")} or \code{TRUE} if users have not set.
#' @return \code{object} with refined cluster assignment updated in
#' \code{clusterName} variable in \code{cellMeta} slot. Can be fetched
#' with \code{object[[clusterName]]}
#' @return \code{object} with cluster assignment updated in \code{clusterName}
#' variable in \code{cellMeta} slot. Can be fetched with
#' \code{object[[clusterName]]}. If \code{saveSNN = TRUE}, the SNN graph will
#' be stored at \code{object@uns$snn}.
#' @rdname runCluster
#' @export
#' @examples
Expand All @@ -65,6 +68,7 @@ runCluster <- function(
useRaw = NULL,
useDims = NULL,
groupSingletons = TRUE,
saveSNN = FALSE,
clusterName = paste0(method, "_cluster"),
seed = 1,
verbose = getOption("ligerVerbose", TRUE)
Expand Down Expand Up @@ -121,8 +125,11 @@ runCluster <- function(
groupSingletons = groupSingletons,
verbose = verbose)
cellMeta(object, clusterName, check = FALSE) <- clusts
if (isTRUE(saveSNN)) object@uns$snn <- snn
if (isTRUE(verbose))
cli::cli_process_done(msg_done = "{method} clustering on {type} cell factor loadings ... Found {nlevels(clusts)} clusters.")
cli::cli_process_done(
msg_done = "{method} clustering on {type} cell factor loadings ... Found {nlevels(clusts)} cluster{?s}."
)
object@uns$defaultCluster <- object@uns$defaultCluster %||% clusterName
if (isTRUE(verbose))
cli::cli_alert_info("{.field cellMeta} variable {.val {clusterName}} is now set as default.")
Expand Down
3 changes: 1 addition & 2 deletions R/h5Utility.R
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,7 @@ closeAllH5.ligerDataset <- function(object) {
#' @return Nothing is returned. H5 file will be created on disk.
#' @examples
#' raw <- rawData(pbmc, "ctrl")
#' writeH5(raw, "ctrl.h5")
#' unlink("ctrl.h5")
#' writeH5(raw, tempfile(pattern = "ctrl_", fileext = ".h5"))
writeH5 <- function(x, file, ...) {
UseMethod("writeH5", x)
}
Expand Down
2 changes: 2 additions & 0 deletions R/heatmap.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#' @export
#' @rdname plotHeatmap
#' @examples
#' \donttest{
#' plotGeneHeatmap(pbmcPlot, varFeatures(pbmcPlot))
#' plotGeneHeatmap(pbmcPlot, varFeatures(pbmcPlot),
#' useCellMeta = c("leiden_cluster", "dataset"),
Expand All @@ -44,6 +45,7 @@
#' plotFactorHeatmap(pbmcPlot, cellIdx = pbmcPlot$leiden_cluster %in% 1:3,
#' useCellMeta = c("leiden_cluster", "dataset"),
#' cellSplitBy = "leiden_cluster")
#' }
plotGeneHeatmap <- function(
object,
features,
Expand Down
34 changes: 19 additions & 15 deletions R/integration.R
Original file line number Diff line number Diff line change
Expand Up @@ -1651,13 +1651,15 @@ quantile_norm <- function( # nocov start
#' \code{byDataset = FALSE} or each dataset a value otherwise.
#' @export
#' @examples
#' pbmc <- pbmc %>%
#' normalize %>%
#' selectGenes %>%
#' scaleNotCenter %>%
#' runINMF %>%
#' quantileNorm
#' calcAgreement(pbmc)
#' if (requireNamespace("RcppPlanc", quietly = TRUE)) {
#' pbmc <- pbmc %>%
#' normalize %>%
#' selectGenes %>%
#' scaleNotCenter %>%
#' runINMF %>%
#' quantileNorm
#' calcAgreement(pbmc)
#' }
calcAgreement <- function(
object,
ndims = 40,
Expand Down Expand Up @@ -1777,7 +1779,7 @@ calcAgreement <- function(
#' @param clusterVar The name of one variable in \code{cellMeta(object)}.
#' Default \code{NULL} uses default clusters.
#' @param nNeighbors Number of neighbors to use in calculating alignment.
#' Default \code{NULL} uses code{floor(0.01 * ncol(object))}, with a lower bound
#' Default \code{NULL} uses \code{floor(0.01*ncol(object))}, with a lower bound
#' of 10 in all cases except where the total number of sampled cells is less
#' than 10.
#' @param cellIdx,cellComp Character, logical or numeric index that can
Expand All @@ -1791,13 +1793,15 @@ calcAgreement <- function(
#' @return The alignment metric.
#' @export
#' @examples
#' pbmc <- pbmc %>%
#' normalize %>%
#' selectGenes %>%
#' scaleNotCenter %>%
#' runINMF %>%
#' quantileNorm
#' calcAlignment(pbmc)
#' if (requireNamespace("RcppPlanc", quietly = TRUE)) {
#' pbmc <- pbmc %>%
#' normalize %>%
#' selectGenes %>%
#' scaleNotCenter %>%
#' runINMF %>%
#' quantileNorm
#' calcAlignment(pbmc)
#' }
calcAlignment <- function(
object,
clustersUse = NULL,
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ Meanwhile, since version 2.0.0, LIGER is massively updated for usability and int
* [Introduction to new liger object and other related classes](https://welch-lab.github.io/liger/articles/liger_object.html)
* [Running Liger directly on Seurat objects](https://welch-lab.github.io/liger/articles/liger_with_seurat.html)

If you need to refer to the tutorials for the old version of rliger, please check the [GitHub archive v1.0.1](https://github.com/welch-lab/liger/tree/v1.0.1/vignettes), download the desired rendered HTML files and open them in your browser.

## Sample Datasets

The `rliger` package provides different types of small toy dataset for basic demos of the functions. After attaching the package in an R session, you can load them with:
Expand Down
28 changes: 28 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# rliger 2.0.0

## R CMD check results

There were no ERRORs or WARNINGs.

There were two NOTEs from winbuilder:

```
* checking CRAN incoming feasibility ... [86s] NOTE
Maintainer: 'Yichen Wang <wayichen@umich.edu>'
Suggests or Enhances not in mainstream repositories:
DoubletFinder, RcppPlanc
Availability using Additional_repositories specification:
DoubletFinder yes https://blaserlab.r-universe.dev
RcppPlanc yes https:/welch-lab.r-universe.dev
```

```
* checking package dependencies ... NOTE
Packages suggested but not available for checking:
'DoubletFinder', 'RcppPlanc'
```

*DoubletFinder* and *RcppPlanc* are hosted on R-universe and used conditionally in rliger.

Besides, we kindly request that CRAN team can approve our submission for *RcppPlanc* so we can move it to Imports.
16 changes: 9 additions & 7 deletions man/calcAgreement.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 10 additions & 8 deletions man/calcAlignment.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions man/linkGenesAndPeaks.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions man/plotHeatmap.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions man/runCluster.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions man/writeH5.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion tests/testthat/test_downstream.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,14 @@ test_that("clustering", {
pbmc <- runOnlineINMF(pbmc, k = 20, minibatchSize = 100)
expect_message(runCluster(pbmc, nRandomStarts = 1),
"leiden clustering on unnormalized")

expect_message(runCluster(pbmc, nRandomStarts = 1, method = "louvain"),
"louvain clustering on unnormalized")

pbmc <- quantileNorm(pbmc)
expect_message(runCluster(pbmc, nRandomStarts = 1),
expect_message(pbmc <- runCluster(pbmc, nRandomStarts = 1, saveSNN = TRUE),
"leiden clustering on quantile normalized")
expect_is(pbmc@uns$snn, "dgCMatrix")
expect_message(runCluster(pbmc, nRandomStarts = 1, method = "louvain"),
"louvain clustering on quantile normalized")

Expand Down

0 comments on commit 3739d1c

Please sign in to comment.