Skip to content

Commit

Permalink
Merge pull request #304 from mvfki/newObj
Browse files Browse the repository at this point in the history
Back to "rliger"
  • Loading branch information
mvfki authored Mar 14, 2024
2 parents 530b137 + 4e70862 commit e23c66e
Show file tree
Hide file tree
Showing 72 changed files with 976 additions and 728 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Package: rliger2
Package: rliger
Version: 1.99.0
Date: 2023-11-09
Type: Package
Expand Down Expand Up @@ -37,7 +37,7 @@ LazyData: true
RoxygenNote: 7.3.1
VignetteBuilder: knitr
Encoding: UTF-8
LinkingTo: Rcpp, RcppArmadillo, RcppEigen, RcppProgress
LinkingTo: Rcpp, RcppArmadillo, RcppProgress
Depends:
methods,
stats,
Expand Down
15 changes: 9 additions & 6 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Generated by roxygen2: do not edit by hand

S3method("$",liger)
S3method("$<-",liger)
S3method("[",liger)
S3method("[",ligerDataset)
S3method("[[",liger)
S3method("[[<-",liger)
S3method("names<-",liger)
S3method(.DollarNames,liger)
S3method(as.liger,Seurat)
S3method(as.liger,SingleCellExperiment)
Expand All @@ -15,6 +19,9 @@ S3method(as.ligerDataset,matrix)
S3method(c,liger)
S3method(cbind,ligerDataset)
S3method(fortify,liger)
S3method(length,liger)
S3method(lengths,liger)
S3method(names,liger)
S3method(normalize,Seurat)
S3method(normalize,dgCMatrix)
S3method(normalize,liger)
Expand Down Expand Up @@ -85,6 +92,7 @@ export(importBMMC)
export(importCGE)
export(importPBMC)
export(imputeKNN)
export(is.newLiger)
export(isH5Liger)
export(ligerATACDataset)
export(ligerCommand)
Expand Down Expand Up @@ -191,8 +199,6 @@ exportClasses(ligerDataset)
exportClasses(ligerMethDataset)
exportClasses(ligerRNADataset)
exportClasses(ligerSpatialDataset)
exportMethods("$")
exportMethods("$<-")
exportMethods("cellMeta<-")
exportMethods("coordinate<-")
exportMethods("dataset<-")
Expand All @@ -203,7 +209,6 @@ exportMethods("dimRed<-")
exportMethods("dimnames<-")
exportMethods("featureMeta<-")
exportMethods("h5fileInfo<-")
exportMethods("names<-")
exportMethods("normData<-")
exportMethods("normPeak<-")
exportMethods("rawData<-")
Expand All @@ -226,8 +231,6 @@ exportMethods(featureMeta)
exportMethods(getH5File)
exportMethods(getMatrix)
exportMethods(h5fileInfo)
exportMethods(length)
exportMethods(names)
exportMethods(normData)
exportMethods(normPeak)
exportMethods(rawData)
Expand All @@ -253,4 +256,4 @@ importFrom(methods,show)
importFrom(rlang,"%||%")
importFrom(rlang,.data)
importFrom(utils,.DollarNames)
useDynLib(rliger2, .registration = TRUE)
useDynLib(rliger, .registration = TRUE)
4 changes: 2 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## rliger2 1.9.9
## rliger 1.9.9

- Added `ligerDataset` class for per-dataset information storage, with inheritance for specific modalities
- Added a number of plotting functions with clear function names and useful functionality
Expand All @@ -12,7 +12,7 @@
Now named by `runINMF()`, `runUINMF()` and `runOnlineINMF()` respectively, and wrapped in
`runIntegration()`.

## rliger2 1.0.1
## rliger 1.0.1

- Allow setting mito pattern in `getMitoProportion()` #271
- Fix efficiency issue when taking the log of norm.data (e.g. `runWilcoxon`)
Expand Down
18 changes: 9 additions & 9 deletions R/ATAC.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#' @param scale Logical. Whether to scale but not center the imputed data.
#' Default \code{TRUE}.
#' @param verbose Logical. Whether to show information of the progress. Default
#' \code{getOption("ligerVerbose")} which is \code{TRUE} if users have not set.
#' \code{getOption("ligerVerbose")} or \code{TRUE} if users have not set.
#' @param ... Optional arguments to be passed to \code{\link{normalize}} when
#' \code{norm = TRUE}.
#' @param knn_k \bold{Deprecated}. See Usage section for replacement.
Expand Down Expand Up @@ -44,7 +44,7 @@ imputeKNN <- function(
weight = TRUE,
norm = TRUE,
scale = FALSE,
verbose = getOption("ligerVerbose"),
verbose = getOption("ligerVerbose", TRUE),
...,
# Deprecated coding style,
knn_k = nNeighbors
Expand Down Expand Up @@ -152,7 +152,7 @@ imputeKNN <- function(
#' Peak-gene correlations with p-values below this threshold are considered
#' significant. Default \code{0.05}.
#' @param verbose Logical. Whether to show information of the progress. Default
#' \code{getOption("ligerVerbose")} which is \code{TRUE} if users have not set.
#' \code{getOption("ligerVerbose")} or \code{TRUE} if users have not set.
#' @param path_to_coords,genes.list,dist \bold{Deprecated}. See Usage section
#' for replacement.
#' @return A sparse matrix with peak names as rows and gene names as columns,
Expand All @@ -171,7 +171,7 @@ imputeKNN <- function(
#' bmmc <- imputeKNN(bmmc, reference = "atac", queries = "rna")
#' corr <- linkGenesAndPeaks(
#' bmmc, useDataset = "rna",
#' pathToCoords = system.file("extdata/hg19_genes.bed", package = "rliger2")
#' pathToCoords = system.file("extdata/hg19_genes.bed", package = "rliger")
#' )
#' }
linkGenesAndPeaks <- function(
Expand All @@ -181,7 +181,7 @@ linkGenesAndPeaks <- function(
useGenes = NULL,
method = c("spearman", "pearson", "kendall"),
alpha = 0.05,
verbose = getOption("ligerVerbose"),
verbose = getOption("ligerVerbose", TRUE),
# Deprecated coding style
path_to_coords = pathToCoords,
genes.list = useGenes,
Expand Down Expand Up @@ -359,12 +359,12 @@ linkGenesAndPeaks <- function(
#' bmmc <- imputeKNN(bmmc, reference = "atac", queries = "rna")
#' corr <- linkGenesAndPeaks(
#' bmmc, useDataset = "rna",
#' pathToCoords = system.file("extdata/hg19_genes.bed", package = "rliger2")
#' pathToCoords = system.file("extdata/hg19_genes.bed", package = "rliger")
#' )
#' resultPath <- tempfile()
#' exportInteractTrack(
#' corrMat = corr,
#' pathToCoords = system.file("extdata/hg19_genes.bed", package = "rliger2"),
#' pathToCoords = system.file("extdata/hg19_genes.bed", package = "rliger"),
#' outputPath = resultPath
#' )
#' head(read.table(resultPath, skip = 1))
Expand Down Expand Up @@ -478,10 +478,10 @@ exportInteractTrack <- function(
#' current working directory.
#' @return No return value. A file located at \code{outputPath} will be created.
#' @name makeInteractTrack-deprecated
#' @seealso \code{\link{rliger2-deprecated}}, \code{\link{exportInteractTrack}}
#' @seealso \code{\link{rliger-deprecated}}, \code{\link{exportInteractTrack}}
NULL

#' @rdname rliger2-deprecated
#' @rdname rliger-deprecated
#' @section \code{makeInteractTrack}:
#' For \code{makeInteractTrack}, use \code{\link{exportInteractTrack}}.
#' @export
Expand Down
10 changes: 5 additions & 5 deletions R/DEG_marker.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#' @param seed Random seed to use for pseudo-replicate generation. Default
#' \code{1}.
#' @param verbose Logical. Whether to show information of the progress. Default
#' \code{getOption("ligerVerbose")} which is \code{TRUE} if users have not set.
#' \code{getOption("ligerVerbose")} or \code{TRUE} if users have not set.
#' @return A data.frame with DEG information
#' @rdname liger-DEG
#' @export
Expand All @@ -65,7 +65,7 @@ runPairwiseDEG <- function(
nPsdRep = 5,
minCellPerRep = 10,
seed = 1,
verbose = getOption("ligerVerbose")
verbose = getOption("ligerVerbose", TRUE)
) {
method <- match.arg(method)
if (is.null(variable1) && is.null(variable2)) {
Expand Down Expand Up @@ -155,7 +155,7 @@ runMarkerDEG <- function(
nPsdRep = 5,
minCellPerRep = 10,
seed = 1,
verbose = getOption("ligerVerbose")
verbose = getOption("ligerVerbose", TRUE)
) {
useDatasets <- .checkUseDatasets(object, useDatasets)
allCellIdx <- seq(ncol(object))[object$dataset %in% useDatasets]
Expand Down Expand Up @@ -237,7 +237,7 @@ runWilcoxon <- function(
nPsdRep = 5,
minCellPerRep = 10,
seed = 1,
verbose = getOption("ligerVerbose")
verbose = getOption("ligerVerbose", TRUE)
) {
method <- match.arg(method)
allCellIdx <- unlist(groups)
Expand Down Expand Up @@ -381,7 +381,7 @@ makePseudoBulk <- function(mat, replicateAnn, minCellPerRep, verbose = TRUE) {
}

.callDESeq2 <- function(pseudoBulks, groups,
verbose = getOption("ligerVerbose")) {
verbose = getOption("ligerVerbose", TRUE)) {
# DESeq2 workflow
if (isTRUE(verbose)) cliID <- cli::cli_process_start("Calling DESeq2 Wald test")
## NOTE: DESeq2 wishes that the contrast/control group is the first level
Expand Down
4 changes: 2 additions & 2 deletions R/DoubletFinder.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#' @param nExp The total number of doublet predictions produced. Scalar for all
#' used datasets or vector for each. Default \code{NULL} sets a 0.15 proportion.
#' @param verbose Logical. Whether to show information of the progress. Default
#' \code{getOption("ligerVerbose")} which is \code{TRUE} if users have not set.
#' \code{getOption("ligerVerbose")} or \code{TRUE} if users have not set.
#' @param ... Additional arguments passed to
#' \code{DoubletFinder::doubletFinder}.
#' @return Updated \code{object} with variables \code{DoubletFinder_pANN} and
Expand All @@ -37,7 +37,7 @@ runDoubletFinder <- function(
PCs = 1:10,
nNeighbors = 20,
nExp = NULL,
verbose = getOption("ligerVerbose"),
verbose = getOption("ligerVerbose", TRUE),
...
) {
if (!requireNamespace("DoubletFinder", quietly = TRUE)) { # nocov start
Expand Down
50 changes: 25 additions & 25 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,55 @@
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

RunModularityClusteringCpp <- function(SNN, modularityFunction, resolution, algorithm, nRandomStarts, nIterations, randomSeed, printOutput, edgefilename) {
.Call(`_rliger2_RunModularityClusteringCpp`, SNN, modularityFunction, resolution, algorithm, nRandomStarts, nIterations, randomSeed, printOutput, edgefilename)
.Call(`_rliger_RunModularityClusteringCpp`, SNN, modularityFunction, resolution, algorithm, nRandomStarts, nIterations, randomSeed, printOutput, edgefilename)
}

colNormalize_dense_cpp <- function(x, L) {
.Call(`_rliger2_colNormalize_dense_cpp`, x, L)
.Call(`_rliger_colNormalize_dense_cpp`, x, L)
}

colAggregateMedian_dense_cpp <- function(x, group, n) {
.Call(`_rliger2_colAggregateMedian_dense_cpp`, x, group, n)
.Call(`_rliger_colAggregateMedian_dense_cpp`, x, group, n)
}

scaleNotCenter_byRow_rcpp <- function(x) {
.Call(`_rliger2_scaleNotCenter_byRow_rcpp`, x)
.Call(`_rliger_scaleNotCenter_byRow_rcpp`, x)
}

scaleNotCenter_byRow_perDataset_rcpp <- function(x, ann, n) {
.Call(`_rliger2_scaleNotCenter_byRow_perDataset_rcpp`, x, ann, n)
.Call(`_rliger_scaleNotCenter_byRow_perDataset_rcpp`, x, ann, n)
}

rowVars_sparse_rcpp <- function(x, means) {
.Call(`_rliger2_rowVars_sparse_rcpp`, x, means)
.Call(`_rliger_rowVars_sparse_rcpp`, x, means)
}

rowDivide_rcpp <- function(x, v) {
.Call(`_rliger2_rowDivide_rcpp`, x, v)
.Call(`_rliger_rowDivide_rcpp`, x, v)
}

sumSquaredDeviations <- function(x, means) {
.Call(`_rliger2_sumSquaredDeviations`, x, means)
.Call(`_rliger_sumSquaredDeviations`, x, means)
}

denseZScore <- function(x, m) {
.Call(`_rliger2_denseZScore`, x, m)
.Call(`_rliger_denseZScore`, x, m)
}

rowVarsDense <- function(x, m) {
.Call(`_rliger2_rowVarsDense`, x, m)
.Call(`_rliger_rowVarsDense`, x, m)
}

SparseRowVarStd <- function(x, mu, sd, vmax) {
.Call(`_rliger2_SparseRowVarStd`, x, mu, sd, vmax)
.Call(`_rliger_SparseRowVarStd`, x, mu, sd, vmax)
}

colAggregateSums_sparse <- function(x, group, ngroups) {
.Call(`_rliger2_colAggregateSums_sparse`, x, group, ngroups)
.Call(`_rliger_colAggregateSums_sparse`, x, group, ngroups)
}

sample_cpp <- function(x, size) {
.Call(`_rliger2_sample_cpp`, x, size)
.Call(`_rliger_sample_cpp`, x, size)
}

#' Fast calculation of feature count matrix
Expand All @@ -68,46 +68,46 @@ sample_cpp <- function(x, size) {
#' samnple <- gene.counts + promoter.counts
#' }
makeFeatureMatrix <- function(bedmat, barcodes) {
.Call(`_rliger2_makeFeatureMatrix`, bedmat, barcodes)
.Call(`_rliger_makeFeatureMatrix`, bedmat, barcodes)
}

cluster_vote_rcpp <- function(nn_ranked, clusts) {
.Call(`_rliger2_cluster_vote_rcpp`, nn_ranked, clusts)
.Call(`_rliger_cluster_vote_rcpp`, nn_ranked, clusts)
}

max_factor_rcpp <- function(H, dims_use, center = FALSE) {
.Call(`_rliger2_max_factor_rcpp`, H, dims_use, center)
.Call(`_rliger_max_factor_rcpp`, H, dims_use, center)
}

ComputeSNN <- function(nn_ranked, prune) {
.Call(`_rliger2_ComputeSNN`, nn_ranked, prune)
ComputeSNN <- function(nn_idx, prune) {
.Call(`_rliger_ComputeSNN`, nn_idx, prune)
}

WriteEdgeFile <- function(snn, filename, display_progress) {
invisible(.Call(`_rliger2_WriteEdgeFile`, snn, filename, display_progress))
invisible(.Call(`_rliger_WriteEdgeFile`, snn, filename, display_progress))
}

DirectSNNToFile <- function(nn_ranked, prune, display_progress, filename) {
.Call(`_rliger2_DirectSNNToFile`, nn_ranked, prune, display_progress, filename)
.Call(`_rliger_DirectSNNToFile`, nn_ranked, prune, display_progress, filename)
}

cpp_rank_matrix_dgc <- function(x, p, nrow, ncol) {
.Call(`_rliger2_cpp_rank_matrix_dgc`, x, p, nrow, ncol)
.Call(`_rliger_cpp_rank_matrix_dgc`, x, p, nrow, ncol)
}

rowAggregateSum_sparse <- function(X, groups, ngroups) {
.Call(`_rliger2_rowAggregateSum_sparse`, X, groups, ngroups)
.Call(`_rliger_rowAggregateSum_sparse`, X, groups, ngroups)
}

colAggregateSum_sparse <- function(X, groups, ngroups) {
.Call(`_rliger2_colAggregateSum_sparse`, X, groups, ngroups)
.Call(`_rliger_colAggregateSum_sparse`, X, groups, ngroups)
}

colNNZAggr_sparse <- function(X, groups, ngroups) {
.Call(`_rliger2_colNNZAggr_sparse`, X, groups, ngroups)
.Call(`_rliger_colNNZAggr_sparse`, X, groups, ngroups)
}

rowNNZAggr_sparse <- function(X, groups, ngroups) {
.Call(`_rliger2_rowNNZAggr_sparse`, X, groups, ngroups)
.Call(`_rliger_rowNNZAggr_sparse`, X, groups, ngroups)
}

4 changes: 2 additions & 2 deletions R/aaa.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#' @importFrom rlang .data %||%
#' @importFrom methods new show
#' @importFrom utils .DollarNames
#' @useDynLib rliger2, .registration = TRUE
#' @useDynLib rliger, .registration = TRUE
NULL

#' @importFrom magrittr %>%
Expand Down Expand Up @@ -75,6 +75,6 @@ scPalette <- c('#E41A1C', '#377EB8', '#4DAF4A', '#FFCF00', '#aa47b9', '#e67c14',
}

.onUnload <- function(libpath) {
library.dynam.unload("rliger2", libpath)
library.dynam.unload("rliger", libpath)
return(invisible(NULL))
}
Loading

0 comments on commit e23c66e

Please sign in to comment.