| Title: | Differential Expression and Differential Zero Inflation analysis |
|---|---|
| Description: | 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. |
| Authors: | Samarendra Das [aut, cre] (ORCID: <https://orcid.org/0000-0002-0263-7027>), Satyajit Chhatoi [aut], Indian Council of Agricultural Research [fnd], Science and Engineering Research Board [fnd] (Core Research Grant (CRG004960)) |
| Maintainer: | Samarendra Das <[email protected]> |
| License: | GPL-3 |
| Version: | 0.99.5 |
| Built: | 2026-10-10 17:56:14 UTC |
| Source: | https://github.com/bioc/SwarnSeq |
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. If spike-ins are not available, it uses count expression data.
capEff(sce, CE.range, RNAspike.use = FALSE, spike_in_sce, method = "ML")capEff(sce, CE.range, RNAspike.use = FALSE, spike_in_sce, method = "ML")
sce |
This is a gene-by-cell raw count matrix single cell experiment object with colData contains 'clusters', 'groups' and 'auxil' as a data frame object. |
CE.range |
This is a two-element vector that sets the lower and upper limits for the estimated range of capture efficiencies. |
RNAspike.use |
This is a logical parameter. If this parameter is set to TRUE, then it requires you to provide spike counts (spike) and spike concentration (spike.conc) information. |
spike_in_sce |
This is a single cell experiment object which contains the spike-in counts data as the main assay and spike concentrations as its row data. # spike-in counts: This is the observed count matrix for spike-in transcripts, where each row is a spike-in and each column is a cell. It's only required if you set RNAspike.use to TRUE. # spike concentrations: This is a vector of theoretical counts for each spike-in transcript in a single cell, and it's only required if you set RNAspike.use to TRUE. |
method |
A string that specifies the method for computing capture efficiencies. ("ML" or "") |
This function returns the capture efficiencies of all the cells as a vector.
library(SingleCellExperiment) # 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)] X <- data.frame(clusters = clusters, groups = groups) testData <- SingleCellExperiment(assays = list(counts = data), colData = X) capeff <- capEff(sce = testData,CE.range = c(0.01, 0.05),RNAspike.use = FALSE)library(SingleCellExperiment) # 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)] X <- data.frame(clusters = clusters, groups = groups) testData <- SingleCellExperiment(assays = list(counts = data), colData = X) capeff <- capEff(sce = testData,CE.range = c(0.01, 0.05),RNAspike.use = FALSE)
This function adjusts the scRNA-seq data by capture efficiency for each cell, then normalizes the adjusted matrix, and finally splits the matrix into two distinct matrices based on the number of factors in the group vector.
extAdjNormData( sce, norm.method = c("DEseq.norm", "TMM", "log1p"), method = "ML", RNAspike.use = FALSE, spike_in_sce, CE.range = c(0.01, 0.5) )extAdjNormData( sce, norm.method = c("DEseq.norm", "TMM", "log1p"), method = "ML", RNAspike.use = FALSE, spike_in_sce, CE.range = c(0.01, 0.5) )
sce |
This is a gene-by-cell raw count matrix single cell experiment object with colData contains 'clusters', 'groups' and 'auxil' as a data frame object. # groups: This is a vector of factors with 2 levels that serves as a grouping variable that assigns each column (cell) of the count matrix to one of two predefined experimental conditions. |
norm.method |
There are three distinct statistical normalization methods for scRNA-seq count data:DESeq2, a maximum likelihood approach described by Ye et al. (2027); TMM, a trimmed mean method introduced by Robinson et al. (2010), both designed to correct for library size and compositional biases; and a third method, which is the log1p standard normalization method for scRNA-seq data. |
method |
A string that specifies the method for computing capture efficiencies. ("ML" or "") |
RNAspike.use |
This is a logical parameter. If this parameter is set to TRUE, then it requires you to provide spike counts (spike) and spike concentration (spike.conc) information. |
spike_in_sce |
This is a single cell experiment object which contains the spike-in counts data as the main assay and spike concentrations as its row data. # spike-in counts: This is the observed count matrix for spike-in transcripts, where each row is a spike-in and each column is a cell. It's only required if you set RNAspike.use to TRUE. # spike concentrations: This is a vector of theoretical counts for each spike-in transcript in a single cell, and it's only required if you set RNAspike.use to TRUE. |
CE.range |
This is a two-element vector that sets the lower and upper limits for the estimated range of capture efficiencies. |
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.
library(SingleCellExperiment) # 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)] X <- data.frame(clusters = clusters, groups=groups) testData <- SingleCellExperiment(assays=list(counts = data),colData=X) ExtData <- extAdjNormData(sce=testData,norm.method="log1p",CE.range=c(0.01,0.5))library(SingleCellExperiment) # 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)] X <- data.frame(clusters = clusters, groups=groups) testData <- SingleCellExperiment(assays=list(counts = data),colData=X) ExtData <- extAdjNormData(sce=testData,norm.method="log1p",CE.range=c(0.01,0.5))
A SingleCellExperiment object containing the spike-in counts and spike concentrations.
SingleCellExperiment Calss.
This is a gene-by-cell raw count matrix.
SingleCellExperiment spike-in counts data for SwarnSeqToyData.
Petropoulos, S., Edsgård, D., Reinius, B., Deng, Q., Panula, S. P., Codeluppi, S., Plaza Reyes, A., Linnarsson, S., Sandberg, R., & Lanner, F. (2016). Single-Cell RNA-Seq Reveals Lineage and X Chromosome Dynamics in Human Preimplantation Embryos. Cell, 165(4), 1012–1026. https://doi.org/10.1016/j.cell.2016.03.023
This function performs differential gene expression (DEG) analysis on a single-cell RNA-sequencing (scRNA-seq) raw read counts matrix. The input is a non-negative integer matrix, where rows correspond to genes and columns to individual cells. The primary objective is to identify genes with statistically significant changes in expression levels between teo predefined groups of cells. This analysis is a downstream step following the initial read mapping and gene counting, which generates the input matrix. By contrasting the expression profiles of the two groups, the function identifies biomarkers or genes that characterize the biological differences between them.
swarnAdjLrt( sce, norm.method = c("DEseq.norm", "TMM", "log1p"), maxit = 100, eps = 1e-04, muoffset = NULL, phioffset = NULL, weights = NULL, method = "ML", p.value.adj.method = "BH", RNAspike.use = FALSE, spike_in_sce, CE.range = c(0.01, 0.5) )swarnAdjLrt( sce, norm.method = c("DEseq.norm", "TMM", "log1p"), maxit = 100, eps = 1e-04, muoffset = NULL, phioffset = NULL, weights = NULL, method = "ML", p.value.adj.method = "BH", RNAspike.use = FALSE, spike_in_sce, CE.range = c(0.01, 0.5) )
sce |
This is a gene-by-cell raw count matrix single cell experiment object with colData contains 'clusters', 'groups' and 'auxil' as a data frame object. # clusters: This is a vector of factors with the optimal number of cluster levels, with each entry assigning a cell from the count matrix's columns to its computationally inferred cluster identity. # groups: This is a vector of factors with 2 levels that serves as a grouping variable that assigns each column (cell) of the count matrix to one of two predefined experimental conditions. # 'auxil' is for CellAuxil: This is a vector of factors of cell-level metadata that provides additional information about each cell, such as its batch, donor, or quality control metrics, with each entry aligning to a column in the count matrix. |
norm.method |
There are three distinct statistical normalization methods for scRNA-seq count data:DESeq2, a maximum likelihood approach described by Ye et al. (2027); TMM, a trimmed mean method introduced by Robinson et al. (2010), both designed to correct for library size and compositional biases; and a third method, which is the log1p standard normalization method for scRNA-seq data. |
maxit |
This is the maximum number of iterations for the Expected-Maximization (EM) algorithm. |
eps |
This is the convergence criteria for the Expected-Maximization (EM) algorithm. |
muoffset |
This is the offset parameter for mean (mu), with a default value of NULL. |
phioffset |
This is the offset parameter for the zero inflation (phi) parameter, with a default value of NULL. |
weights |
This is the observation-wise weight for the cells, with a default value of NULL. |
method |
A string that specifies the method for computing capture efficiencies. ("ML" or "") |
p.value.adj.method |
A string that specifies the method for multiple hypothesis correction, which can be any of the following values: "holm," "hochberg," "hommel," "bonferroni," "BH," "BY," "fdr," or "none"). |
RNAspike.use |
This is a logical parameter. If this parameter is set to TRUE, then it requires you to provide spike counts (spike) and spike concentration (spike.conc) information. |
spike_in_sce |
This is a single cell experiment object which contains the spike-in counts data as the main assay and spike concentrations as its row data. # spike-in counts: This is the observed count matrix for spike-in transcripts, where each row is a spike-in and each column is a cell. It's only required if you set RNAspike.use to TRUE. # spike concentrations: This is a vector of theoretical counts for each spike-in transcript in a single cell, and it's only required if you set RNAspike.use to TRUE. |
CE.range |
This is a two-element vector that sets the lower and upper limits for the estimated range of capture efficiencies. |
This function analyzes single-cell RNA-sequencing adjusted normalized data to find differentially expressed genes and returns a list of the results.
library(SingleCellExperiment) # 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)] X <- data.frame(clusters = clusters, groups = groups) testData <- SingleCellExperiment(assays = list(counts = data), colData = X) # SpikeInData <- SingleCellExperiment(assays = list(SpikeCounts),rowData=SpikeConc) # Make the spike-in single cell experiment object like this. res <- swarnAdjLrt(sce=testData,norm.method="log1p",RNAspike.use=FALSE)library(SingleCellExperiment) # 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)] X <- data.frame(clusters = clusters, groups = groups) testData <- SingleCellExperiment(assays = list(counts = data), colData = X) # SpikeInData <- SingleCellExperiment(assays = list(SpikeCounts),rowData=SpikeConc) # Make the spike-in single cell experiment object like this. res <- swarnAdjLrt(sce=testData,norm.method="log1p",RNAspike.use=FALSE)
This function is used to clasify the influential genes of single-cell RNA-seq (scRNA-seq) data.
swarnClassDe(results, alpha)swarnClassDe(results, alpha)
results |
This is obtained from 'SwarnUnadjLRT' or 'SwarnAdjLRT' function. |
alpha |
Level of Significance |
It returns the list with one more element, SwarnClassDE, that represents the SwarnClass.
library(SingleCellExperiment) # 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)] X <- data.frame(clusters = clusters, groups = groups) testData <- SingleCellExperiment(assays = list(counts = data), colData = X) # SpikeInData <- SingleCellExperiment(assays=list(SpikeCounts),rowData=SpikeConc) # Make the spike-in single cell experiment object like this. res <- swarnAdjLrt(sce=testData,norm.method="log1p",RNAspike.use=TRUE,spike_in_sce=SpikeInData) SwarnClass <- swarnClassDe(results = res, alpha = 0.01)library(SingleCellExperiment) # 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)] X <- data.frame(clusters = clusters, groups = groups) testData <- SingleCellExperiment(assays = list(counts = data), colData = X) # SpikeInData <- SingleCellExperiment(assays=list(SpikeCounts),rowData=SpikeConc) # Make the spike-in single cell experiment object like this. res <- swarnAdjLrt(sce=testData,norm.method="log1p",RNAspike.use=TRUE,spike_in_sce=SpikeInData) SwarnClass <- swarnClassDe(results = res, alpha = 0.01)
A test dataset containing a single-cell RNA-seq (scRNA-seq) read counts matrix and column metadata.
SingleCellExperiment Calss.
This is a gene-by-cell raw count matrix.
SingleCellExperiment object of raw scRNA-seq data.
Petropoulos, S., Edsgård, D., Reinius, B., Deng, Q., Panula, S. P., Codeluppi, S., Plaza Reyes, A., Linnarsson, S., Sandberg, R., & Lanner, F. (2016). Single-Cell RNA-Seq Reveals Lineage and X Chromosome Dynamics in Human Preimplantation Embryos. Cell, 165(4), 1012–1026. https://doi.org/10.1016/j.cell.2016.03.023
This function selects the most statistically significant genes in your scRNA-seq data.
swarnTopTags(results, m)swarnTopTags(results, m)
results |
This is obtained from 'SwarnUnadjLRT' or 'SwarnAdjLRT' function. |
m |
This is an integer that represents the number of statistically significant genes to be selected from the downstream analysis. |
A list of the top genes along with their statistics.
library(SingleCellExperiment) # 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)] X <- data.frame(clusters = clusters, groups = groups) testData <- SingleCellExperiment(assays = list(counts = data), colData = X) # SpikeInData <- SingleCellExperiment(assays = list(SpikeCounts), rowData = SpikeConc) # Make the spike-in single cell experiment object like this. res <- swarnAdjLrt(sce=testData,norm.method="DEseq.norm", RNAspike.use = FALSE) top_genes <- swarnTopTags(results = res, m = 50)library(SingleCellExperiment) # 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)] X <- data.frame(clusters = clusters, groups = groups) testData <- SingleCellExperiment(assays = list(counts = data), colData = X) # SpikeInData <- SingleCellExperiment(assays = list(SpikeCounts), rowData = SpikeConc) # Make the spike-in single cell experiment object like this. res <- swarnAdjLrt(sce=testData,norm.method="DEseq.norm", RNAspike.use = FALSE) top_genes <- swarnTopTags(results = res, m = 50)
This function performs differential gene expression (DEG) analysis on a single-cell RNA-sequencing (scRNA-seq) raw read counts matrix. The input is a non-negative integer matrix, where rows correspond to genes and columns to individual cells. The primary objective is to identify genes with statistically significant changes in expression levels between teo predefined groups of cells. This analysis is a downstream step following the initial read mapping and gene counting, which generates the input matrix. By contrasting the expression profiles of the two groups, the function identifies biomarkers or genes that characterize the biological differences between them.
swarnUnadjLrt( sce, norm.method = c("DEseq.norm", "TMM", "log1p"), maxit = 100, eps = 1e-04, muoffset = NULL, phioffset = NULL, weights = NULL, method = NA, p.value.adj.method = "BH" )swarnUnadjLrt( sce, norm.method = c("DEseq.norm", "TMM", "log1p"), maxit = 100, eps = 1e-04, muoffset = NULL, phioffset = NULL, weights = NULL, method = NA, p.value.adj.method = "BH" )
sce |
This is a gene-by-cell raw count matrix single cell experiment object with colData contains 'clusters', 'groups' and 'auxil' as a data frame object. # clusters: This is a vector of factors with the optimal number of cluster levels, with each entry assigning a cell from the count matrix's columns to its computationally inferred cluster identity. # groups: This is a vector of factors with 2 levels that serves as a grouping variable that assigns each column (cell) of the count matrix to one of two predefined experimental conditions. # 'auxil' is for CellAuxil: This is a vector of factors of cell-level metadata that provides additional information about each cell, such as its batch, donor, or quality control metrics, with each entry aligning to a column in the count matrix. |
norm.method |
There are three distinct statistical normalization methods for scRNA-seq count data:DESeq2, a maximum likelihood approach described by Ye et al. (2027); TMM, a trimmed mean method introduced by Robinson et al. (2010), both designed to correct for library size and compositional biases; and a third method, which is the log1p standard normalization method for scRNA-seq data. |
maxit |
This is the maximum number of iterations for the Expected-Maximization (EM) algorithm. |
eps |
This is the convergence criteria for the Expected-Maximization (EM) algorithm. |
muoffset |
This is the offset parameter for mean (mu), with a default value of NULL. |
phioffset |
This is the offset parameter for the zero inflation (phi) parameter, with a default value of NULL. |
weights |
This is the observation-wise weight for the cells, with a default value of NULL. |
method |
A string that specifies the method for computing capture efficiencies. ("ML" or "") |
p.value.adj.method |
A string that specifies the method for multiple hypothesis correction, which can be any of the following values: "holm," "hochberg," "hommel," "bonferroni," "BH," "BY," "fdr," or "none"). |
This function analyzes single-cell RNA-sequencing unadjusted normalized data to find differentially expressed genes and returns a list of the results.
library(SingleCellExperiment) # Load the test data. data(SwarnSeqToyData) 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)] X <- data.frame(clusters = clusters, groups = groups) testData <- SingleCellExperiment(assays = list(counts = data), colData = X) res <- swarnUnadjLrt(sce = testData, norm.method = "DEseq.norm")library(SingleCellExperiment) # Load the test data. data(SwarnSeqToyData) 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)] X <- data.frame(clusters = clusters, groups = groups) testData <- SingleCellExperiment(assays = list(counts = data), colData = X) res <- swarnUnadjLrt(sce = testData, norm.method = "DEseq.norm")