Skip to content

Commit 0f8f9fd

Browse files
authored
Merge pull request #254 from jr-leary7/dev
Dev
2 parents 2516d8a + 62b3803 commit 0f8f9fd

File tree

6 files changed

+21
-7
lines changed

6 files changed

+21
-7
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: scLANE
22
Type: Package
33
Title: Model Gene Expression Dynamics with Spline-Based NB GLMs, GEEs, & GLMMs
4-
Version: 0.8.4
4+
Version: 0.8.5
55
Authors@R: c(person(given = c("Jack", "R."), family = "Leary", email = "j.leary@ufl.edu", role = c("aut", "cre"), comment = c(ORCID = "0009-0004-8821-3269")),
66
person(given = "Rhonda", family = "Bacher", email = "rbacher@ufl.edu", role = c("ctb", "fnd"), comment = c(ORCID = "0000-0001-5787-476X")))
77
Description: Our scLANE model uses truncated power basis spline models to build flexible, interpretable models of single cell gene expression over pseudotime or latent time.

NEWS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# Changes in v0.8.5
2+
3+
+ Minor bug fixes.
4+
+ More improved matrix operations using `RcppEigen`.
5+
+ Improved support for `cell_data_set` objects from `monocle3`.
6+
17
# Changes in v0.8.4
28

39
+ Minor bug fixes.

R/getFittedValues.R

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#' @param size.factor.offset (Optional) An offset to be used to rescale the fitted values. Can be generated easily with \code{\link{createCellOffset}}. No need to provide if the GEE backend was used. Defaults to NULL.
1515
#' @param log1p.norm (Optional) Should log1p-normalized versions of expression & model predictions be returned as well? Defaults to TRUE.
1616
#' @param cell.meta.data (Optional) A data.frame of metadata values for each cell (celltype label, subject characteristics, tissue type, etc.) that will be included in the result table. Defaults to NULL.
17+
#' @param is.gee Was the GEE mode used to fit the models? Defaults to FALSE.
1718
#' @param id.vec (Optional) A vector of subject IDs used in fitting GEE or GLMM models. Defaults to NULL.
1819
#' @param ci.alpha (Optional) The pre-specified Type I Error rate used in generating (\eqn{1 - \alpha})\% CIs. Defaults to good old 0.05.
1920
#' @param filter.lineage (Optional) A character vector of lineages to filter out before generating the final plot. Should be letters, i.e. lineage "A" or "B". Defaults to NULL.
@@ -35,6 +36,7 @@ getFittedValues <- function(test.dyn.res = NULL,
3536
size.factor.offset = NULL,
3637
log1p.norm = TRUE,
3738
cell.meta.data = NULL,
39+
is.gee = FALSE,
3840
id.vec = NULL,
3941
ci.alpha = 0.05,
4042
filter.lineage = NULL) {
@@ -44,6 +46,9 @@ getFittedValues <- function(test.dyn.res = NULL,
4446
if (inherits(expr.mat, "SingleCellExperiment")) {
4547
expr.mat <- BiocGenerics::counts(expr.mat)[genes, , drop = FALSE]
4648
expr.mat <- as.matrix(expr.mat)
49+
} else if (inherits(expr.mat, "cell_data_set")) {
50+
expr.mat <- BiocGenerics::counts(expr.mat)[genes, , drop = FALSE]
51+
expr.mat <- as.matrix(expr.mat)
4752
} else if (inherits(expr.mat, "Seurat")) {
4853
expr.mat <- Seurat::GetAssayData(expr.mat,
4954
slot = "counts",
@@ -104,7 +109,7 @@ getFittedValues <- function(test.dyn.res = NULL,
104109
scLANE_pred = exp(scLANE_pred_link),
105110
scLANE_ci_ll = exp(scLANE_pred_link - Z * scLANE_se_link),
106111
scLANE_ci_ul = exp(scLANE_pred_link + Z * scLANE_se_link))
107-
if (!is.null(size.factor.offset)) {
112+
if (!is.null(size.factor.offset) & !is.gee) {
108113
gene_df <- dplyr::mutate(gene_df,
109114
dplyr::across(c(rna, scLANE_pred, scLANE_ci_ll, scLANE_ci_ul), \(m) m * size_factor))
110115
}

R/sortObservations.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
#' @author Jack R. Leary
55
#' @importFrom dplyr arrange
66
#' @description Since the GEE & GLMM modes require data to be sorted by sample ID and pseudotime, this function provides a simple way to do so for a range of inputs.
7-
#' @param expr.mat Either a \code{SingleCellExperiment} or \code{Seurat} object from which counts can be extracted, or a matrix of integer-valued counts with genes as rows & cells as columns. Defaults to NULL.
7+
#' @param expr.mat Either a \code{SingleCellExperiment}, \code{Seurat}, or \code{cell_data_set} object from which cell-level metadata can be extracted, or a matrix of integer-valued counts with genes as rows & cells as columns. Defaults to NULL.
88
#' @param pt.vec A vector of pseudotime values used to sort the observations. May contain NA values. Defaults to NULL.
99
#' @param id.vec A vector of subject IDs used to sort the observations. Defaults to NULL.
1010
#' @return An object of the same class as the input \code{expr.mat}, but sorted by sample ID & pseudotime.
1111
#' @details
1212
#' \itemize{
1313
#' \item If the input is a matrix, it is assumed that the columns are cells - and are named as such - and the rows are genes.
14-
#' \item If the input is a Seurat object, sorting requires converting to \code{SingleCellExperiment} object first, then ordering, then converting back toa \code{Seurat} object. Some information might be lost, so it is recommended not to overwrite your original \code{Seurat} object.
14+
#' \item If the input is a \code{Seurat} object, sorting requires converting to \code{SingleCellExperiment} object first, then ordering, then converting back to a \code{Seurat} object. Some information might be lost, so it is recommended not to overwrite your original \code{Seurat} object.
1515
#' }
1616
#' @export
1717
#' @examples
@@ -36,7 +36,7 @@ sortObservations <- function(expr.mat = NULL,
3636
ID,
3737
PT)
3838
# sort object by cells
39-
if (inherits(expr.mat, "SingleCellExperiment") || inherits(expr.mat, "matrix") || inherits(expr.mat, "dgCMatrix")) {
39+
if (inherits(expr.mat, "SingleCellExperiment") || inherits(expr.mat, "cell_data_set") || inherits(expr.mat, "matrix") || inherits(expr.mat, "dgCMatrix")) {
4040
expr.mat <- expr.mat[, subj_df$Cell]
4141
} else if (inherits(expr.mat, "Seurat")) {
4242
warning("Ordering a Seurat object requires conversion to SingleCellExperiment, and some information might be lost.")

man/getFittedValues.Rd

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/sortObservations.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)