Skip to content

Commit 3973745

Browse files
authored
Merge pull request #142 from samuel-marsh/release/2.0.1
Release/2.0.1
2 parents eb17b70 + 41c7dbc commit 3973745

10 files changed

+83
-35
lines changed

CRAN-SUBMISSION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
Version: 2.0.0
2-
Date: 2023-11-14 01:30:08 UTC
3-
SHA: 8987da5397b33ac79a5a3a08da9f7eccfac71a03
1+
Version: 2.0.1
2+
Date: 2023-11-17 15:28:31 UTC
3+
SHA: 2bf5f1166ee097878adef4e10d1a3923db44557b

DESCRIPTION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Package: scCustomize
22
Type: Package
33
Title: Custom Visualizations & Functions for Streamlined Analyses of Single Cell Sequencing
4-
Description: Collection of functions created and/or curated to aid in the visualization and analysis of single-cell data using 'R'. 'scCustomize' aims to provide 1) Customized visualizations for aid in ease of use and to create more aesthetic and functional visuals. 2) Improve speed/reproducibility of common tasks/pieces of code in scRNA-seq analysis with a single or group of functions. For citation please use: Marsh SE (2021) "Custom Visualizations & Functions for Streamlined Analyses of Single Cell Sequencing" <doi:10.5281/zenodo.5706430>.
5-
Version: 2.0.0
6-
Date: 2023-11-13
4+
Description: Collection of functions created and/or curated to aid in the visualization and analysis of single-cell data using 'R'. 'scCustomize' aims to provide 1) Customized visualizations for aid in ease of use and to create more aesthetic and functional visuals. 2) Improve speed/reproducibility of common tasks/pieces of code in scRNA-seq analysis with a single or group of functions. For citation please use: Marsh SE (2021) "Custom Visualizations & Functions for Streamlined Analyses of Single Cell Sequencing" <doi:10.5281/zenodo.5706430> RRID:SCR_024675.
5+
Version: 2.0.1
6+
Date: 2023-11-17
77
Authors@R: c(
88
person(given = "Samuel", family = "Marsh", email = "samuel.marsh@childrens.harvard.edu", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-3012-6945")),
99
person(given = "Ming", family = "Tang", role = c("ctb"), email = "tangming2005@gmail.com"),

NEWS.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# scCustomize 2.0.1 (2023-11-17)
2+
## Added
3+
- None.
4+
5+
6+
## Changed
7+
- Removed warning in `VariableFeaturePlot_scCustom` now fixed in Seurat release.
8+
9+
10+
## Fixes
11+
- Fixed error in `Add_Mito_Ribo_Seurat` causing failure due to error message when `overwrite = TRUE`.
12+
- Fixed error in `Add_Top_Gene_Pct_Seurat` to avoid issue that accidentally could call function on normalized data.
13+
- Fixed error in `Add_Top_Gene_Pct_Seurat` that caused error if more than one counts layer was present.
14+
- Fixed error in `QC_Histogram` that prevented plotting or titling of plots.
15+
16+
17+
118
# scCustomize 2.0.0 (2023-11-13)
219
## Added
320
- Added support for metrics produced by Cell Ranger `multi` pipeline to `Read10X_Metrics` via new parameter `cellranger_multi`.

R/Internal_Utilities.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ Retrieve_Ensembl_Ribo <- function(
654654
)
655655
}
656656
cli_inform(message = c("Columns with {.val {oxphos_name}} and/or {.val {apop_name}} already present in meta.data slot.",
657-
"i" = "Overwriting those columns as .code {overwrite = TRUE.}")
657+
"i" = "Overwriting those columns as {.code overwrite = TRUE.}")
658658
)
659659
}
660660

@@ -739,7 +739,7 @@ Retrieve_Ensembl_Ribo <- function(
739739
)
740740
}
741741
cli_inform(message = c("Column with {.val {ieg_name}} already present in meta.data slot.",
742-
"i" = "Overwriting those column as .code {overwrite = TRUE.}")
742+
"i" = "Overwriting those column as {.code overwrite = TRUE.}")
743743
)
744744
}
745745

R/Object_Utilities.R

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ Add_Mito_Ribo_Seurat <- function(
183183
)
184184
}
185185
cli_inform(message = c("Columns with {.val {mito_name}} and/or {.val {ribo_name}} already present in meta.data slot.",
186-
"i" = "Overwriting those columns as .code {overwrite = TRUE.}")
186+
"i" = "Overwriting those columns as {.code overwrite = TRUE.}")
187187
)
188188
}
189189

@@ -391,9 +391,10 @@ Add_Cell_Complexity_Seurat <- function(
391391
#' storing corrected and uncorrected assays in same object (e.g. outputs of both Cell Ranger and Cell Bender).
392392
#' @param overwrite Logical. Whether to overwrite existing an meta.data column. Default is FALSE meaning that
393393
#' function will abort if column with name provided to `meta_col_name` is present in meta.data slot.
394+
#' @param verbose logical, whether to print messages with status updates, default is TRUE.
394395
#'
395396
#' @import cli
396-
#' @importFrom dplyr select all_of
397+
#' @importFrom dplyr select all_of bind_rows
397398
#' @importFrom magrittr "%>%"
398399
#' @importFrom rlang is_installed
399400
#' @importFrom SeuratObject LayerData
@@ -425,7 +426,8 @@ Add_Top_Gene_Pct_Seurat <- function(
425426
num_top_genes = 50,
426427
meta_col_name = NULL,
427428
assay = "RNA",
428-
overwrite = FALSE
429+
overwrite = FALSE,
430+
verbose = TRUE
429431
){
430432
# Check for scuttle first
431433
scuttle_check <- is_installed(pkg = "scuttle")
@@ -468,15 +470,47 @@ Add_Top_Gene_Pct_Seurat <- function(
468470
)
469471
}
470472

473+
count_layers_present <- Layers(object = seurat_object, search = "counts")
474+
471475
# Extract matrix
472-
count_mat <- LayerData(object = seurat_object, assay = assay)
476+
if (length(x = count_layers_present) == 1) {
477+
if (isTRUE(x = verbose)) {
478+
cli_inform(message = "Calculating percent expressing top {num_top_genes} for layer: {.field {count_layers_present}}")
479+
}
480+
481+
count_mat <- LayerData(object = seurat_object, assay = assay, layer = "counts")
482+
483+
# calculate
484+
res <- as.data.frame(scuttle::perCellQCMetrics(x = count_mat, percent.top = num_top_genes))
485+
486+
# select percent column
487+
res <- res %>%
488+
select(all_of(scuttle_colname))
489+
}
490+
491+
492+
if (length(x = count_layers_present) > 1) {
493+
res_list <- lapply(1:length(x = count_layers_present), function(x) {
494+
if (isTRUE(x = verbose)) {
495+
cli_inform(message = "Calculating percent expressing top {num_top_genes} for layer: {.field {count_layers_present[x]}}")
496+
}
473497

474-
# calculate
475-
res <- as.data.frame(scuttle::perCellQCMetrics(x = count_mat, percent.top = num_top_genes))
498+
# Get layer data
499+
layer_count <- LayerData(object = seurat_object, assay = assay, layer = count_layers_present[x])
476500

477-
# select percent column
478-
res <- res %>%
479-
select(all_of(scuttle_colname))
501+
# run scuttle
502+
layer_res <- as.data.frame(scuttle::perCellQCMetrics(x = layer_count, percent.top = num_top_genes))
503+
# select results column
504+
layer_res <- layer_res %>%
505+
select(all_of(scuttle_colname))
506+
})
507+
508+
# combine results
509+
if (isTRUE(x = verbose)) {
510+
cli_inform(message = "Combining data from: {.field {count_layers_present}}")
511+
}
512+
res <- bind_rows(res_list)
513+
}
480514

481515
# Add to object and return
482516
seurat_object <- AddMetaData(object = seurat_object, metadata = res, col.name = meta_col_name)

R/QC_Plotting_Seurat.R

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -632,12 +632,14 @@ QC_Histogram <- function(
632632
}
633633

634634
# Check and set titles
635-
if (is.null(x = plot_title) && is.null(x = split.by)) {
636-
plot_titles <- all_found_features
635+
if (!is.null(x = plot_title) && length(x = plot_title) != length(x = features)) {
636+
cli_abort(message = "The number of {.code plot_title} (.field {length(x = plot_title)}}) does not equal number of features ({.field {length(x = all_found_features)}})")
637+
} else {
638+
plot_titles <- plot_title
637639
}
638640

639-
if (!is.null(x = plot_title) && length(x = plot_title) != features) {
640-
cli_abort(message = "The number of {.code plot_title} (.field {length(x = plot_title)}}) does not equal number of features ({.field {length(x = all_found_features)}})")
641+
if (is.null(x = plot_title) && is.null(x = split.by)) {
642+
plot_titles <- all_found_features
641643
}
642644

643645
# Plot

R/Seurat_Plotting.R

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2582,12 +2582,6 @@ VariableFeaturePlot_scCustom <- function(
25822582
# set assay (if null set to active assay)
25832583
assay <- assay %||% DefaultAssay(object = seurat_object)
25842584

2585-
if (isTRUE(x = Assay5_Check(seurat_object = seurat_object, assay = assay))) {
2586-
cli_inform(message = c("!" = "Currently labeling top variable genes from Assay5 object will not correctly label top variable features due to changes in Seurat5.",
2587-
"i" = "This feature will be updated when more information comes from Seurat Dev team.",
2588-
"i" = "For now the top variable features can be manually extracted and provided to {.code custom_features} parameter."))
2589-
}
2590-
25912585
# Extract num of desired features
25922586
top_features <- head(x = VariableFeatures(object = seurat_object, assay = assay, selection.method = selection.method), num_features)
25932587

cran-comments.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
## Minor Version Update
2-
This is a major version update to v2.0.0. In this version I have:
2+
This is a hotfix update with bug fixes now v2.0.1; apologies for not catching these in v2.0.0 submission last week. In this version I have:
33

4-
- Added a number of new functions, added new function parameters, and fixed bugs (see News.md).
5-
- Ensured compatibility with major version of Seurat package.
6-
- Fixed in example code causing current CRAN check errors with current package version (v1.1.3).
4+
- Fixed 5 minor bugs presented in v2.0.0 release.
75

86

97
## R CMD check results
@@ -29,5 +27,5 @@ This is a major version update to v2.0.0. In this version I have:
2927
- The errors are from failures running package examples. This includes functions that have been part of prior CRAN releases.
3028
NO errors are found when checking locally on macos platform using R 4.3.2 and none are found in GitHub Actions check on linux
3129
or windows platforms. I believe to be error in GitHub Actions workflow and I have therefore refrained from adding `dontrun`
32-
to examples that run fine on other platforms. If error occurs during CRAN check during submission I will re-evaluate changes
33-
required.
30+
to examples that run fine on other platforms. This was also the case with v2.0.0 which passed macos checks on CRAN,
31+
furthering it is likely a GitHub Actions issue.

man/Add_Top_Gene_Pct_Seurat.Rd

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

man/scCustomize-package.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)