Contents

1 ABSTRACT

Differential Expression (DE) analysis serves as a key downstream analysis for scRNA-seq data. It is necessary for generating informative gene sets, which can be subsequently utilized as input for various other analyses, including pathway or gene set analysis, gene regulation modeling, and gene network analysis. Additionally, numerous methods and tools exist in the literature for conducting DE analysis of scRNA-seq data, which vary significantly based on their statistical approaches, input data, and other factors. Many of the current methods often overlook cell-level auxiliary information such as cell clusters, cell cycles, and molecular capturing procedures and are restricted to comparing only two cellular populations in their model development.

For example, DEsingle, a widely used method, fails to account for factors such as the molecular capturing process, cellular process, cellular clusters, cell cycle stages, and cell phages in differential expression (DE) analysis and is restricted to comparisons between only two cell groups. Consequently, the SwarnSeq approach and the R package are designed to conduct various analyses, including DE analysis, differential zero inflation analysis, and gene classification into subtypes, utilizing the RNA capturing process and cell-level auxiliary data (i.e., cell clusters and other cell-level information) in the development of statistical models for scRNA-seq data.

2 Introduction

This R package performs differential expression and differential zero inflation analysis of single-cell RNA-seq (scRNA-seq) UMI counts data through adjusting cell capture efficiency.

3 Installation

SwarnSeq package can be installed from Bioconductor using the following command:

if (!require("BiocManager", quietly = TRUE))
    install.packages("BiocManager")

BiocManager::install("SwarnSeq")

4 Some Details about the functions

There are actually two major functions to get the result and these two functions depend on some other functions for internal processing. Those functions are ‘swarnUnadjLrt’ and ‘swarnAdjLrt’ depend on dzinb and ZINBEM functions. Its recommended that users avoid these dependent functions to save time and get the desired results by running the major functions.

swarnUnadjLrt: This function performs differential gene expression (DEG) analysis on a single-cell RNA-sequencing (scRNA-seq) raw read counts matrix data without capture efficiency correction after normalizing the counts.

swarnAdjLrt: This function performs differential gene expression (DEG) analysis on a single-cell RNA-sequencing (scRNA-seq) raw read counts matrix after normalizing the reads.

5 Further Processing of Obtained Results

After obtaining the results, a user can further use the functions swarnClassDe and swarnTopTags.

swarnClassDe: This function is used to clasify the influential genes of single-cell RNA-seq (scRNA-seq) data.

swarnTopTags: This function selects the most statistically significant genes in your scRNA-seq data.

6 Other Functions

The remaining functions, named ‘CapEff’ and ‘ExtAdjNormData,’ are used for the following purposes.

capEff: This function estimates the capture efficiencies of cells from single-cell RNA-seq studies. This function takes ERCC spike-in transcript and molecular concentration data, if available.

extAdjNormData: This function returns a list of two distinct capture efficiency adjusted normalized counts matrices, based on the number of factors in the group vector for the scRNA-seq data.

Here’s a simple and quick example of the declared functions. To keep the runtime managable for this demonstration, we’have utilized a subsample from the example dataset instead of the full dataset.

library(SingleCellExperiment)
#> Loading required package: SummarizedExperiment
#> Loading required package: MatrixGenerics
#> Loading required package: matrixStats
#> 
#> Attaching package: 'MatrixGenerics'
#> The following objects are masked from 'package:matrixStats':
#> 
#>     colAlls, colAnyNAs, colAnys, colAvgsPerRowSet, colCollapse,
#>     colCounts, colCummaxs, colCummins, colCumprods, colCumsums,
#>     colDiffs, colIQRDiffs, colIQRs, colLogSumExps, colMadDiffs,
#>     colMads, colMaxs, colMeans2, colMedians, colMins, colOrderStats,
#>     colProds, colQuantiles, colRanges, colRanks, colSdDiffs, colSds,
#>     colSums2, colTabulates, colVarDiffs, colVars, colWeightedMads,
#>     colWeightedMeans, colWeightedMedians, colWeightedSds,
#>     colWeightedVars, rowAlls, rowAnyNAs, rowAnys, rowAvgsPerColSet,
#>     rowCollapse, rowCounts, rowCummaxs, rowCummins, rowCumprods,
#>     rowCumsums, rowDiffs, rowIQRDiffs, rowIQRs, rowLogSumExps,
#>     rowMadDiffs, rowMads, rowMaxs, rowMeans2, rowMedians, rowMins,
#>     rowOrderStats, rowProds, rowQuantiles, rowRanges, rowRanks,
#>     rowSdDiffs, rowSds, rowSums2, rowTabulates, rowVarDiffs, rowVars,
#>     rowWeightedMads, rowWeightedMeans, rowWeightedMedians,
#>     rowWeightedSds, rowWeightedVars
#> Loading required package: GenomicRanges
#> Loading required package: stats4
#> Loading required package: BiocGenerics
#> Loading required package: generics
#> 
#> Attaching package: 'generics'
#> The following objects are masked from 'package:base':
#> 
#>     as.difftime, as.factor, as.ordered, intersect, is.element, setdiff,
#>     setequal, union
#> 
#> Attaching package: 'BiocGenerics'
#> The following objects are masked from 'package:stats':
#> 
#>     IQR, mad, sd, var, xtabs
#> The following object is masked from 'package:utils':
#> 
#>     data
#> The following objects are masked from 'package:base':
#> 
#>     Filter, Find, Map, Position, Reduce, anyDuplicated, aperm, append,
#>     as.data.frame, basename, cbind, colnames, dirname, do.call,
#>     duplicated, eval, evalq, get, grep, grepl, is.unsorted, lapply,
#>     mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int,
#>     rank, rbind, rownames, sapply, saveRDS, scale, sequence, table,
#>     tapply, transform, unique, unsplit, which.max, which.min
#> Loading required package: S4Vectors
#> 
#> Attaching package: 'S4Vectors'
#> The following object is masked from 'package:utils':
#> 
#>     findMatches
#> The following objects are masked from 'package:base':
#> 
#>     I, expand.grid, unname
#> Loading required package: IRanges
#> Loading required package: Seqinfo
#> Loading required package: Biobase
#> Welcome to Bioconductor
#> 
#>     Vignettes contain introductory material; view with
#>     'browseVignettes()'. To cite Bioconductor, see
#>     'citation("Biobase")', and for packages 'citation("pkgname")'.
#> 
#> Attaching package: 'Biobase'
#> The following object is masked from 'package:MatrixGenerics':
#> 
#>     rowMedians
#> The following objects are masked from 'package:matrixStats':
#> 
#>     anyMissing, rowMedians
# Load the test data.
data(SwarnSeqToyData); data(SpikeInData)
data <- assays(SwarnSeqToyData)[[1]][1:20, c(1:50, 350:399)]
groups <- SwarnSeqToyData$groups[c(1:50, 350:399)]
clusters <- SwarnSeqToyData$clusters[c(1:50, 350:399)]
# Make the spike-in single cell experiment object like the following examples.
testData <- SingleCellExperiment(assays = list(counts = data), colData = data.frame(clusters = clusters, groups = groups))
SwarnAdjLRT_Results <- swarnAdjLrt(sce = testData,norm.method = "DEseq.norm", RNAspike.use = TRUE, spike_in_sce = SpikeInData)
#> SwarnSeq is analyzing the gene at index 1.
#> SwarnSeq is analyzing the gene at index 2.
#> SwarnSeq is analyzing the gene at index 3.
#> SwarnSeq is analyzing the gene at index 4.
#> SwarnSeq is analyzing the gene at index 5.
#> SwarnSeq is analyzing the gene at index 6.
#> SwarnSeq is analyzing the gene at index 7.
#> SwarnSeq is analyzing the gene at index 8.
#> SwarnSeq is analyzing the gene at index 9.
#> SwarnSeq is analyzing the gene at index 10.
#> SwarnSeq is analyzing the gene at index 11.
#> SwarnSeq is analyzing the gene at index 12.
#> SwarnSeq is analyzing the gene at index 13.
#> SwarnSeq is analyzing the gene at index 14.
#> SwarnSeq is analyzing the gene at index 15.
#> SwarnSeq is analyzing the gene at index 16.
#> SwarnSeq is analyzing the gene at index 17.
#> SwarnSeq is analyzing the gene at index 18.
#> 
#> 
#> This process has been completed successfully.
#> 
#> Correction for multiple hypothesis testing.

7 Information about the functions

Please visit the documentation page to know more about the functionality of each function in detail.

SwarnClass <- swarnClassDe(results = SwarnAdjLRT_Results, alpha = 0.01)
swarnClass_result <- SwarnClass$SwarnClassDE
# Consider Top.DEG item from the following output list.
top_genes <- swarnTopTags(results = SwarnAdjLRT_Results, m = 10)
top_genes_result <- top_genes$Top.DEG
capeff <- capEff(sce = testData,CE.range = c(0.01, 0.05),RNAspike.use = TRUE, spike_in_sce = SpikeInData,method = "")
extractedAdjNormData <- extAdjNormData(sce=testData,norm.method = "log1p",CE.range = c(0.01,0.5))

7.1 Session Information

utils::sessionInfo()
#> R version 4.6.1 (2026-06-24)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Ubuntu 24.04.4 LTS
#> 
#> Matrix products: default
#> BLAS:   /home/biocbuild/bbs-3.24-bioc/R/lib/libRblas.so 
#> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.12.0  LAPACK version 3.12.0
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_GB              LC_COLLATE=C              
#>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
#>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
#> 
#> time zone: America/New_York
#> tzcode source: system (glibc)
#> 
#> attached base packages:
#> [1] stats4    stats     graphics  grDevices utils     datasets  methods  
#> [8] base     
#> 
#> other attached packages:
#>  [1] SingleCellExperiment_1.35.2 SummarizedExperiment_1.43.0
#>  [3] Biobase_2.73.2              GenomicRanges_1.65.3       
#>  [5] Seqinfo_1.3.2               IRanges_2.47.5             
#>  [7] S4Vectors_0.51.9            BiocGenerics_0.59.12       
#>  [9] generics_0.1.4              MatrixGenerics_1.25.0      
#> [11] matrixStats_1.5.0           SwarnSeq_0.99.5            
#> [13] BiocStyle_2.41.0           
#> 
#> loaded via a namespace (and not attached):
#>  [1] Matrix_1.7-6        limma_3.99.0        jsonlite_2.0.0     
#>  [4] compiler_4.6.1      BiocManager_1.30.27 jquerylib_0.1.4    
#>  [7] statmod_1.5.2       yaml_2.3.12         fastmap_1.2.0      
#> [10] lattice_0.23-1      XVector_0.53.0      R6_2.6.1           
#> [13] S4Arrays_1.13.0     knitr_1.51          MASS_7.3-66        
#> [16] DelayedArray_0.39.6 bookdown_0.48       bslib_0.12.0       
#> [19] rlang_1.3.0         cachem_1.1.0        xfun_0.60          
#> [22] sass_0.4.10         otel_0.2.0          SparseArray_1.13.2 
#> [25] cli_3.6.6           locfit_1.5-9.12     digest_0.6.39      
#> [28] grid_4.6.1          edgeR_4.99.1        lifecycle_1.0.5    
#> [31] evaluate_1.0.5      abind_1.4-8         rmarkdown_2.31     
#> [34] tools_4.6.1         htmltools_0.5.9

Reference to methods

Das, S., & Rai, S. N. (2021). SwarnSeq: An improved statistical approach for differential expression analysis of single-cell RNA-seq data. Genomics, 113(3), 1308–1324. https://doi.org/10.1016/j.ygeno.2021.02.014

We hope this package helps you get the best Differential Expression Analysis results for your scRNA-seq data and assist you in making the best decisions based on those results.