From 982db8f4c1bf1495deddc41475e89fd8c6c88a9b Mon Sep 17 00:00:00 2001 From: Givanna Putri Date: Sat, 23 Aug 2025 10:05:11 +1000 Subject: [PATCH 1/3] changed paste to sprintf --- R/runSuperCellCyto.R | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/R/runSuperCellCyto.R b/R/runSuperCellCyto.R index f2b2b7f..80f5d1a 100644 --- a/R/runSuperCellCyto.R +++ b/R/runSuperCellCyto.R @@ -256,10 +256,9 @@ runSuperCellCyto <- function( .adjust_n_pc <- function(n_pc, markers) { if (n_pc > length(markers)) { warning( - paste0( - "Requested n_pc (", n_pc, - ") is greater than the number of markers (", length(markers), - "). Setting n_pc to ", length(markers), "." + sprintf( + "n_pc (%d) > number of markers (%d). Setting n_pc to %d.", + n_pc, length(markers), length(markers) ) ) n_pc <- length(markers) From 73fa665f032d7461347e8cb76b8280c8efc07510 Mon Sep 17 00:00:00 2001 From: Givanna Putri Date: Sat, 23 Aug 2025 11:58:52 +1000 Subject: [PATCH 2/3] move data to inst and add chunk labels --- .../Data23_Panel3_base_NR4_Patient9.fcs | Bin .../Data23_Panel3_base_R5_Patient15.fcs | Bin .../extdata}/Levine_32dim_H1_sub.csv | 0 .../extdata}/Levine_32dim_H2_sub.csv | 0 .../extdata}/Levine_32dim_sce_sub.qs | Bin .../extdata}/Levine_32dim_seurat_sub.qs | Bin vignettes/how_to_create_supercells.Rmd | 48 +++++++++--------- vignettes/how_to_prepare_data.Rmd | 36 ++++++++----- vignettes/interoperability_with_sce.Rmd | 30 ++++++----- vignettes/interoperability_with_seurat.Rmd | 30 ++++++----- ...percellcyto_for_stratified_summarising.Rmd | 14 ++--- 11 files changed, 86 insertions(+), 72 deletions(-) rename {vignettes/data => inst/extdata}/Data23_Panel3_base_NR4_Patient9.fcs (100%) rename {vignettes/data => inst/extdata}/Data23_Panel3_base_R5_Patient15.fcs (100%) rename {vignettes/data => inst/extdata}/Levine_32dim_H1_sub.csv (100%) rename {vignettes/data => inst/extdata}/Levine_32dim_H2_sub.csv (100%) rename {vignettes/data => inst/extdata}/Levine_32dim_sce_sub.qs (100%) rename {vignettes/data => inst/extdata}/Levine_32dim_seurat_sub.qs (100%) diff --git a/vignettes/data/Data23_Panel3_base_NR4_Patient9.fcs b/inst/extdata/Data23_Panel3_base_NR4_Patient9.fcs similarity index 100% rename from vignettes/data/Data23_Panel3_base_NR4_Patient9.fcs rename to inst/extdata/Data23_Panel3_base_NR4_Patient9.fcs diff --git a/vignettes/data/Data23_Panel3_base_R5_Patient15.fcs b/inst/extdata/Data23_Panel3_base_R5_Patient15.fcs similarity index 100% rename from vignettes/data/Data23_Panel3_base_R5_Patient15.fcs rename to inst/extdata/Data23_Panel3_base_R5_Patient15.fcs diff --git a/vignettes/data/Levine_32dim_H1_sub.csv b/inst/extdata/Levine_32dim_H1_sub.csv similarity index 100% rename from vignettes/data/Levine_32dim_H1_sub.csv rename to inst/extdata/Levine_32dim_H1_sub.csv diff --git a/vignettes/data/Levine_32dim_H2_sub.csv b/inst/extdata/Levine_32dim_H2_sub.csv similarity index 100% rename from vignettes/data/Levine_32dim_H2_sub.csv rename to inst/extdata/Levine_32dim_H2_sub.csv diff --git a/vignettes/data/Levine_32dim_sce_sub.qs b/inst/extdata/Levine_32dim_sce_sub.qs similarity index 100% rename from vignettes/data/Levine_32dim_sce_sub.qs rename to inst/extdata/Levine_32dim_sce_sub.qs diff --git a/vignettes/data/Levine_32dim_seurat_sub.qs b/inst/extdata/Levine_32dim_seurat_sub.qs similarity index 100% rename from vignettes/data/Levine_32dim_seurat_sub.qs rename to inst/extdata/Levine_32dim_seurat_sub.qs diff --git a/vignettes/how_to_create_supercells.Rmd b/vignettes/how_to_create_supercells.Rmd index 5e2b129..b37cc47 100644 --- a/vignettes/how_to_create_supercells.Rmd +++ b/vignettes/how_to_create_supercells.Rmd @@ -16,7 +16,7 @@ knitr::opts_chunk$set( ) ``` -```{r setup, echo=FALSE, message=FALSE} +```{r load_packages, echo=FALSE, message=FALSE} library(SuperCellCyto) library(parallel) library(BiocParallel) @@ -61,7 +61,7 @@ with each sample containing 10,000 cells. Hence in total, we will have a toy dataset containing 15 markers and 30,000 cells. -```{r} +```{r simulate_data} n_markers <- 15 n_samples <- 3 dat <- simCytoData(nmarkers = n_markers, ncells = rep(10000, n_samples)) @@ -71,7 +71,7 @@ head(dat) For our toy dataset, we will transform our data using arcsinh transformation. We will use the base R `asinh` function to do this: -```{r} +```{r arcsinh_transformation} # Specify which columns are the markers to transform marker_cols <- paste0("Marker_", seq_len(n_markers)) # The co-factor for arc-sinh @@ -94,7 +94,7 @@ We will also create a column *Cell_id_dummy* which uniquely identify each cell. It will have values such as `Cell_1, Cell_2,` all the way until `Cell_x` where x is the number of cells in the dataset. -```{r} +```{r create_cell_id} dat$Cell_id_dummy <- paste0("Cell_", seq_len(nrow(dat))) head(dat$Cell_id_dummy, n = 10) ``` @@ -103,13 +103,13 @@ By default, the `simCytoData` function will generate cells for multiple samples, and that the resulting `data.table` object will already have a column called *Sample* that denotes the sample the cells come from. -```{r} +```{r check_sample_col} unique(dat$Sample) ``` Let's take note of the sample and cell id column for later. -```{r} +```{r set_colnames} sample_col <- "Sample" cell_id_col <- "Cell_id_dummy" ``` @@ -131,7 +131,7 @@ your data, then make sure you specify them in a vector that you later pass to For this tutorial, we will use all the arcsinh transformed markers in the toy data. -```{r} +```{r run_supercellcyto} supercells <- runSuperCellCyto( dt = dat, markers = marker_cols_asinh, @@ -142,13 +142,13 @@ supercells <- runSuperCellCyto( Let's dig deeper into the object it created: -```{r} +```{r check_supercells_class} class(supercells) ``` It is a list containing 3 elements: -```{r} +```{r check_supercells_names} names(supercells) ``` @@ -171,7 +171,7 @@ supercell. These are calculated by taking the average of the marker expression of all the cells contained within a supercell. -```{r} +```{r show_supercell_expr_matrix} head(supercells$supercell_expression_matrix) ``` @@ -188,7 +188,7 @@ variable). Let's have a look at `SuperCellId`: -```{r} +```{r show_supercell_ids} head(unique(supercells$supercell_expression_matrix$SuperCellId)) ``` @@ -198,7 +198,7 @@ a sample) used to uniquely identify each supercell in a sample. Notably, you may encounter this (`SuperCell_1`, `SuperCell_2`) being repeated across different samples, e.g., -```{r} +```{r show_supercell_1_ids} supercell_ids <- unique(supercells$supercell_expression_matrix$SuperCellId) supercell_ids[grep("SuperCell_1_", supercell_ids)] ``` @@ -217,7 +217,7 @@ This aids in differentiating the supercells in different samples. `supercell_cell_map` maps each cell in our dataset to the supercell it belongs to. -```{r} +```{r show_supercell_cell_map} head(supercells$supercell_cell_map) ``` @@ -244,7 +244,7 @@ As each sample will be processed by a parallel job, we don't want a job that processs large sample to also be assigned other smaller samples if possible. If you want to know more how this feature works, please refer to our manuscript. -```{r} +```{r run_supercellcyto_parallel} supercell_par <- runSuperCellCyto( dt = dat, markers = marker_cols_asinh, @@ -307,7 +307,7 @@ toy dataset, we will regenerate the supercells using gamma of 10 and 50. The function to do this is `recomputeSupercells`. We will store the output in a list, one element per gamma value. -```{r} +```{r recompute_supercells} addt_gamma_vals <- c(10, 50) supercells_addt_gamma <- lapply(addt_gamma_vals, function(gam) { recomputeSupercells( @@ -325,7 +325,7 @@ We should end up with a list containing 2 elements. The 1st element contains supercells generated using gamma = 10, and the 2nd contains supercells generated using gamma = 50. -```{r} +```{r show_supercells_gamma10} supercells_addt_gamma[[1]] ``` @@ -341,7 +341,7 @@ Compared to the previous run where gamma was set to 20, we should get more supercells for gamma = 10, and less for gamma = 50. Let's see if that's the case. -```{r} +```{r count_supercells} n_supercells_gamma20 <- nrow(supercells$supercell_expression_matrix) n_supercells_gamma10 <- nrow( supercells_addt_gamma[[1]]$supercell_expression_matrix @@ -351,11 +351,11 @@ n_supercells_gamma50 <- nrow( ) ``` -```{r} +```{r gamma10_gt_gamma20} n_supercells_gamma10 > n_supercells_gamma20 ``` -```{r} +```{r gamma50_lt_gamma20} n_supercells_gamma50 < n_supercells_gamma20 ``` @@ -369,7 +369,7 @@ and run `runSuperCellCyto` function on each of them with different `gam` parameter value. Something like the following: -```{r} +```{r diff_gamma_per_sample} n_markers <- 10 dat <- simCytoData(nmarkers = n_markers) markers_col <- paste0("Marker_", seq_len(n_markers)) @@ -397,7 +397,7 @@ supercells_diff_gam <- lapply(seq_len(length(samples)), function(i) { Subsequently, to extract and combine the `supercell_expression_matrix` and `supercell_cell_map`, we will need to use `rbind`: -```{r} +```{r combine_supercell_results} supercell_expression_matrix <- do.call( "rbind", lapply( supercells_diff_gam, function(x) x[["supercell_expression_matrix"]] @@ -411,14 +411,14 @@ supercell_cell_map <- do.call( ) ``` -```{r} +```{r show_combined_expr_matrix} rbind( head(supercell_expression_matrix, n = 3), tail(supercell_expression_matrix, n = 3) ) ``` -```{r} +```{r show_combined_cell_map} rbind(head(supercell_cell_map, n = 3), tail(supercell_cell_map, n = 3)) ``` @@ -463,6 +463,6 @@ load the relevant output saved using the qs package and the relevant data `recomputeSupercells` function. ## Session information -```{r} +```{r session_info} sessionInfo() ``` diff --git a/vignettes/how_to_prepare_data.Rmd b/vignettes/how_to_prepare_data.Rmd index 193d8e0..8697c01 100644 --- a/vignettes/how_to_prepare_data.Rmd +++ b/vignettes/how_to_prepare_data.Rmd @@ -9,7 +9,7 @@ vignette: > %\VignetteEncoding{UTF-8} --- -```{r, include = FALSE} +```{r setup, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>" @@ -59,7 +59,7 @@ For Oetjen_bcell data, we used the following gating strategy post compensation: The following is the resulting single live cells manually gated for the `Oetjen_bcell` data. -```{r} +```{r add_fig} knitr::include_graphics( "figures/oetjen_bcell_single_live_cells.png", error = FALSE @@ -131,7 +131,7 @@ We can use the `fread` function from the `data.table` package. Here's how to install it: -```{r eval=FALSE} +```{r install_datatable, eval=FALSE} install.packages("data.table") ``` @@ -140,10 +140,18 @@ For this example, let's load two CSV files containing subsampled data from the Each file represents a sample (H1 and H2), with the sample name appended to the file name: -```{r} +```{r load_csv_data} library(data.table) -csv_files <- c("data/Levine_32dim_H1_sub.csv", "data/Levine_32dim_H2_sub.csv") +csv_files <- c( + system.file( + "extdata", "Levine_32dim_H1_sub.csv", package = "SuperCellCyto" + ), + system.file( + "extdata", "Levine_32dim_H2_sub.csv", package = "SuperCellCyto" + ) +) + samples <- c("H1", "H2") dat <- lapply(seq_len(length(samples)), function(i) { @@ -166,8 +174,8 @@ Let's break down what we have done. We specify the location of the csv files in `csv_files` vector and their corresponding sample names in `samples` vector. -`data/Levine_32dim_H1_sub.csv` belongs to sample H1 while -`data/Levine_32dim_H2_sub.csv` belongs to sample H2. +`Levine_32dim_H1_sub.csv` belongs to sample H1 while +`Levine_32dim_H2_sub.csv` belongs to sample H2. We use `lapply` to simultaneously iterate over each element in the `csv_files` and `samples` vector. @@ -193,12 +201,14 @@ Let's load two small FCS files for the Anti-PD1 data from [FlowRepository]( http://flowrepository.org/public_experiment_representations/1124). -```{r} +```{r load_fcs_data} library(flowCore) library(data.table) fs <- read.flowSet( - path = "data", + path = system.file( + "extdata", package = "SuperCellCyto" + ), pattern = "\\.fcs$" ) @@ -236,7 +246,7 @@ them into our `data.table` object. We will also to create a new column `cell_id` which gives each cell a unique id such as `Cell_1`, `Cell_2`, etc. -```{r} +```{r add_sample_and_cellid} sample_info <- data.table( sample = c("patient9", "patient15"), file_name = c( @@ -276,7 +286,7 @@ First, we need to select the markers to be transformed. Usually, all markers should be transformed for SuperCellCyto. However, you can choose to exclude specific markers if needed: -```{r} +```{r define_markers} markers <- c( "209Bi_CD11b", "162Dy_CD11c", "163Dy_CD7", "166Er_CD209", "167Er_CD38", "151Eu_CD123", "153Eu_CD62L", "152Gd_CD66b", "154Gd_ICAM-1", "155Gd_CD1c", @@ -290,7 +300,7 @@ markers <- c( For transformation, we'll use a cofactor of 5 and apply the arcsinh transformation. -```{r} +```{r arcsinh_transformation} new_cols <- paste0(markers, "_asinh") cf <- 5 dat[, (new_cols) := lapply(.SD, function(x) asinh(x / cf)), .SDcols = markers] @@ -306,7 +316,7 @@ Please refer to for detailed instructions. ## Session information -```{r} +```{r session_info} sessionInfo() ``` diff --git a/vignettes/interoperability_with_sce.Rmd b/vignettes/interoperability_with_sce.Rmd index 4de1811..a419404 100644 --- a/vignettes/interoperability_with_sce.Rmd +++ b/vignettes/interoperability_with_sce.Rmd @@ -8,7 +8,7 @@ vignette: > %\VignetteEncoding{UTF-8} --- -```{r, include = FALSE} +```{r global_options, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>" @@ -41,8 +41,10 @@ We first load the subsampled Levine_32dim data, stored as a [qs](https://cran.r-project.org/web/packages/qs/index.html) using the `qread` function. -```{r} -sce <- qread("data/Levine_32dim_sce_sub.qs") +```{r load_sce_object} +sce <- qread(system.file( + "extdata", "Levine_32dim_sce_sub.qs", package = "SuperCellCyto" +)) sce ``` The data is stored in the `counts` assay. @@ -50,7 +52,7 @@ We will subset it to include only markers we need to perform downstream analysis, transform it using arcsinh transformation, and store the transformed data in the `logcounts` assay. -```{r} +```{r subset_and_transform} markers <- c( "CD45RA", "CD133", "CD19", "CD22", "CD11b", "CD4", "CD8", "CD34", "Flt3", "CD20", "CXCR4", "CD235ab", "CD45", "CD123", "CD321", @@ -81,7 +83,7 @@ than features. Hence, we will transpose the extracted data accordingly when creating the `data.table` object. -```{r} +```{r extract_dt_and_run_supercellcyto} dt <- data.table(t(exprs(sce))) dt$sample <- colData(sce)$sample dt$cell_id <- colnames(sce) @@ -99,7 +101,7 @@ head(supercells$supercell_expression_matrix) We can now embed the supercell ID in the `colData` of our SCE object. -```{r} +```{r add_supercell_id_to_coldata} colData(sce)$supercell_id <- factor(supercells$supercell_cell_map$SuperCellID) head(colData(sce)) ``` @@ -110,7 +112,7 @@ As the number of supercells is less than the number of cells in our SCE object, we store the supercell expression matrix as a separate SCE object. This then allows us to use Bioconductor packages to analyse our supercells. -```{r} +```{r create_supercell_sce} supercell_sce <- SingleCellExperiment( list(logcounts = t( supercells$supercell_expression_matrix[, markers, with = FALSE] @@ -134,7 +136,7 @@ With the supercell expression matrix now in an SCE format, we can perform downstream analyses such as clustering and and drawing UMAP plots using Bioconductor packages. -```{r} +```{r cluster_and_umap_supercells} set.seed(42) supercell_sce <- fixedPCA( @@ -162,7 +164,7 @@ create violin plots of the markers against clusters. Note, the y-axis says "logcounts", but the data is actually arcsinh transformed, not log transformed. -```{r} +```{r plot_marker_expression_supercells} plotExpression( supercell_sce, c("CD4", "CD8", "CD19", "CD34", "CD11b"), x = "label", colour_by = "sample" @@ -185,7 +187,7 @@ of your single cell SCE object. This ensures that the order of the resulting `data.table` aligns with the order of the `colData` of our single-cell SCE object. -```{r} +```{r transfer_cluster_to_singlecell} cell_id_sce <- data.table(as.data.frame(colData(sce))) supercell_cluster <- data.table(as.data.frame(colData(supercell_sce))) cell_id_sce_with_clusters <- merge.data.table( @@ -200,13 +202,13 @@ cell_id_sce_with_clusters <- merge.data.table( Finally, we can then add the cluster assignment as a column in the `colData` of our single-cell SCE object. -```{r} +```{r add_cluster_to_coldata} colData(sce)$cluster <- cell_id_sce_with_clusters$label ``` Visualise them as UMAP plot. -```{r} +```{r umap_singlecell_colored_by_cluster} sce <- fixedPCA(sce, rank = 10, subset.row = NULL, BSPARAM = RandomParam()) sce <- runUMAP(sce, dimred = "PCA") @@ -218,7 +220,7 @@ Or violin plot to see the distribution of their marker expressions. Note, the y-axis says "logcounts", but the data is actually arcsinh transformed, not log transformed. -```{r} +```{r plot_marker_expression_singlecell} plotExpression( sce, c("CD4", "CD8", "CD19", "CD34", "CD11b"), x = "cluster", colour_by = "sample" @@ -228,7 +230,7 @@ plotExpression( ## Session information -```{r} +```{r session_info} sessionInfo() ``` diff --git a/vignettes/interoperability_with_seurat.Rmd b/vignettes/interoperability_with_seurat.Rmd index 728c422..96db94b 100644 --- a/vignettes/interoperability_with_seurat.Rmd +++ b/vignettes/interoperability_with_seurat.Rmd @@ -8,7 +8,7 @@ vignette: > %\VignetteEncoding{UTF-8} --- -```{r, include = FALSE} +```{r global_options, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>" @@ -44,8 +44,10 @@ The subsampled Levine_32dim data is stored as a We begin by loading this data using the `qread` function from the qs package. -```{r} -seurat_obj <- qread("data/Levine_32dim_seurat_sub.qs") +```{r load_seurat_obj} +seurat_obj <- qread(system.file( + "extdata", "Levine_32dim_seurat_sub.qs", package = "SuperCellCyto" +)) seurat_obj ``` The data is stored in the `originalexp` assay, with both counts and data @@ -58,7 +60,7 @@ downstream analysis. 2. Perform arcsinh transformation, and store the transformed data in the `data` slot of the `originalexp` assay. -```{r} +```{r subset_and_transform} markers <- c( "CD45RA", "CD133", "CD19", "CD22", "CD11b", "CD4", "CD8", "CD34", "Flt3", "CD20", "CXCR4", "CD235ab", "CD45", "CD123", "CD321", "CD14", @@ -92,7 +94,7 @@ After transposing and preparing the `data table`, we run `runSuperCellCyto` function, passing the required parameters including the markers, sample column name, cell ID column name, and gamma value. -```{r} +```{r extract_dt_and_run_supercellcyto} # check.names set to FALSE so HLA-DR is not replaced with HLA.DR dt <- data.table( t(data.frame(seurat_obj[["originalexp"]]$data, check.names = FALSE)) @@ -113,7 +115,7 @@ head(supercells$supercell_expression_matrix) We can now embed the supercell ID in the metadata of our Seurat object. -```{r} +```{r add_supercell_id_to_metadata} seurat_obj$supercell_id <- factor(supercells$supercell_cell_map$SuperCellID) head(seurat_obj[[]]) ``` @@ -130,7 +132,7 @@ the default `RNA` assay. The `data` and `counts` slots of the RNA assay are then set to contain the marker expression. -```{r} +```{r create_supercell_seurat_obj} supercell_mat <- t( supercells$supercell_expression_matrix[, markers, with = FALSE] ) @@ -144,7 +146,7 @@ With the supercell marker expression stored as a Seurat object, we can proceed with performing downstream analysis such as clustering and creating UMAP plots. -```{r message=FALSE} +```{r cluster_and_umap_supercells, message=FALSE} # Have to do this, otherwise Seurat will complain supercell_seurat_obj <- ScaleData(supercell_seurat_obj) @@ -164,7 +166,7 @@ supercell_seurat_obj <- RunUMAP(supercell_seurat_obj, dims = 1:10) DimPlot(supercell_seurat_obj, reduction = "umap") ``` -```{r height=10, width=10} +```{r featureplot_supercells, height=10, width=10} FeaturePlot( supercell_seurat_obj, features = c("CD4", "CD8", "CD19", "CD34", "CD11b"), ncol = 3 @@ -188,7 +190,7 @@ the single-cell Seurat object. These ensure the result is in the order of the metadata from our single-cell Seurat object. -```{r} +```{r merge_clusters_to_metadata} clusters <- data.table( supercell_id = colnames(supercell_seurat_obj), cluster = as.vector(Idents(supercell_seurat_obj)) @@ -206,7 +208,7 @@ cell_metadata <- merge.data.table( After merging, we can add the cluster assignment to the metadata of the single-cell Seurat object. -```{r} +```{r add_cluster_to_metadata} seurat_obj$cluster <- cell_metadata$cluster Idents(seurat_obj) <- "cluster" ``` @@ -214,7 +216,7 @@ Idents(seurat_obj) <- "cluster" Then visualise the cluster assignments and marker expressions of our clustered single cell data. -```{r message=FALSE} +```{r cluster_and_umap_singlecell, message=FALSE} seurat_obj <- ScaleData(seurat_obj) seurat_obj <- RunPCA( object = seurat_obj, @@ -233,7 +235,7 @@ DimPlot(seurat_obj, reduction = "umap") ``` -```{r} +```{r featureplot_singlecell} FeaturePlot( seurat_obj, features = c("CD4", "CD8", "CD19", "CD34", "CD11b"), ncol = 3 @@ -243,6 +245,6 @@ FeaturePlot( ## Session information -```{r} +```{r session_info} sessionInfo() ``` \ No newline at end of file diff --git a/vignettes/using_supercellcyto_for_stratified_summarising.Rmd b/vignettes/using_supercellcyto_for_stratified_summarising.Rmd index d1c7bd8..5fcb530 100644 --- a/vignettes/using_supercellcyto_for_stratified_summarising.Rmd +++ b/vignettes/using_supercellcyto_for_stratified_summarising.Rmd @@ -8,7 +8,7 @@ vignette: > %\VignetteEncoding{UTF-8} --- -```{r, include = FALSE} +```{r global_options, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>" @@ -35,7 +35,7 @@ each cell belong to as the `sample_colname` parameter! Let's illustrate this using a clustered (using k-means) toy data. -```{r} +```{r simulate_and_cluster} library(SuperCellCyto) set.seed(42) @@ -59,7 +59,7 @@ To perform stratified summarising, we supply the cluster column (`kmeans_clusters` in the example above), as `runSuperCellCyto`'s `sample_colname` parameter. -```{r} +```{r run_supercellcyto_stratified} supercells <- runSuperCellCyto( dt = dat, markers = markers_col, @@ -72,7 +72,7 @@ Now, if we look at the `supercell_expression_matrix`, each row (each supercell) will be denoted with the cluster it belongs to, and *not the biological sample it came from*: -```{r} +```{r inspect_supercell_matrix} # Inspect the top 3 and bottom 3 of the expression matrix and some columns. rbind( head(supercells$supercell_expression_matrix, n = 3), @@ -85,17 +85,17 @@ there were in each cluster, we will find that, for each cluster, we get approximately `n_cells_in_the_cluster/20` where 20 is the `gam` parameter value we used for `runSuperCellCyto` (this is the default). -```{r} +```{r cells_per_cluster} # Compute how many cells per cluster, and divide by 20, the gamma value. table(dat$kmeans_clusters) / 20 ``` -```{r} +```{r supercells_per_cluster} table(supercells$supercell_expression_matrix$kmeans_clusters) ``` ## Session information -```{r} +```{r session_info} sessionInfo() ``` From b9c2ef3f81c5cfb42b424718b24611838de6db15 Mon Sep 17 00:00:00 2001 From: Givanna Putri Date: Sat, 23 Aug 2025 12:01:54 +1000 Subject: [PATCH 3/3] bump version --- DESCRIPTION | 2 +- NEWS.md | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 7454d94..acd110d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: SuperCellCyto Title: SuperCell For Cytometry Data -Version: 0.99.0 +Version: 0.99.1 Authors@R: c( person("Givanna", "Putri", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-7399-8014"), email = "givanna.h@gmail.com"), person("George", "Howitt", role = "aut"), diff --git a/NEWS.md b/NEWS.md index f5f0f06..5d551ac 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,9 @@ +# SuperCellCyto 0.99.1 + +* Changed `paste` to `sprintf` for warning messages. +* Moved example data to `inst/extdata` and update vignettes. +* Add chunk labels to vignettes. + # SuperCellCyto 0.99.0 ## Major changes