Description Usage Arguments Value Examples
Quantify cell population diversity between two single cell RNA-seq datasets
1 2 3 |
data1 |
matrix; the data matrix of the first dataset, row is the gene symbol, the column is the cell id |
sampleName1 |
a character string giving the name of the first dataset; (default: "S1") |
data2 |
matrix; the data matrix of the second dataset, row is the gene symbol, the column is the cell id; data1 and data1 should have the same gene symbols |
sampleName2 |
a character string giving the name of the second dataset; (default: "S2") |
ref.expr |
matrix; the data matrix of the reference cell atlas; the ref.expr is used to predict the cell types of single cell from data1 and data2 (default: NULL) |
genenum |
integer; Number of highly variable genes to build the cell population structure (default: 500) |
ncluster |
integer; Number of clusters to divide cells (default: 10) |
nDim |
integer; Number of PCA dimensions to build the cell population structure (default: 4) |
normalize |
logical; Indicate whether normalize data1 and data2 (default: TRUE, normalize to the total count and log2 transform) |
report |
logical; Indicate whether to generate a report (default: TRUE); if set to FALSE, scUnifrac will not generate the report but calculate the distance and the pvalue; set to FALSE, when users have more than two samples to compare and only want to calculate the pairwise distance |
outputFile |
a character string giving the name of the report;(default: "scUnifrac_report.html") |
List with the following elements:
distance |
The distance of cell population diversity between two single-cell RNA-seq datasets |
pvalue |
The statistical signficance of the distance |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | library(scUnifrac)
##load the two example datasets
load(system.file("extdata", "colon1.Rdata", package = "scUnifrac"))
load(system.file("extdata", "pan1.Rdata", package = "scUnifrac"))
##Calculate the distance and pvalue between data1 and data2 and generate a report summarizing the result in the work directory
result<-scUnifrac( data1=colon1, data2=pan1)
result
##load the mouse cell altas from Han et al., 2018, Cell 172, 1091–1107. The atlas is used as a reference to predict cell types of data1 and data2
load(system.file("extdata", "ref.expr.Rdata", package = "scUnifrac"))
##Generate a report which also includes the predicted cell types by mapping each cell to the reference
result<-scUnifrac( data1=colon1, data2=pan1,ref.expr=ref.expr, outputFile="scUnifrac_report.html")
##test two samples with similar populations
ind<-sample(c(1:ncol(colon1)), ncol(colon1)/2)
result<-scUnifrac(data1=colon1[,ind], data2=colon1[,-ind],ref.expr=ref.expr, outputFile="scUnifrac_report.html")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.