Visualize detected doublets
VizSeuratDoublets.Rd
Visualize detected doublets
Usage
VizSeuratDoublets(
object,
plot_type = c("dim", "pie", "pk", "pK"),
palette = "Set2",
...
)
Arguments
- object
A Seurat object with detected doublets
- plot_type
Type of plot to generate One of 'dim', 'pie', 'pk', 'pK'. dim/pie show the distribution of doublets by droplet type. pk/pK show the relationship between BC metric and pK when using DoubletFinder.
- palette
Color palette to use
- ...
Additional arguments to pass to the plot function
For 'dim', additional arguments to pass to scplotter::CellDimPlot
For 'pie', additional arguments to pass to plotthis::PieChart
For 'pk' or 'pK', additional arguments to pass to plotthis::LinePlot
Examples
# \donttest{
datadir <- system.file("extdata", "scrna", package = "biopipen.utils")
meta <- data.frame(
Sample = c("Sample1", "Sample2"),
RNAData = c(
file.path(datadir, "Sample1"),
file.path(datadir, "Sample2")
)
)
obj <- LoadSeuratAndPerformQC(meta, cache = FALSE, gene_qc = list(min_cells = 3),
cell_qc = "nFeature_RNA > 500")
#> INFO [2025-01-03 21:08:00] Loading each sample ...
#> INFO [2025-01-03 21:08:00] - Loading sample Sample1 ...
#> INFO [2025-01-03 21:08:00] - Loading sample Sample2 ...
#> INFO [2025-01-03 21:08:00] Merging samples ...
#> INFO [2025-01-03 21:08:01] Performing cell QC ...
#> INFO [2025-01-03 21:08:02] Performing gene QC ...
VizSeuratCellQC(obj)
VizSeuratCellQC(obj, plot_type = "scatter")
VizSeuratCellQC(obj, plot_type = "ridge")
#> Picking joint bandwidth of 177
#> Picking joint bandwidth of 61.9
#> Picking joint bandwidth of 0.341
#> Picking joint bandwidth of 0.341
#> Picking joint bandwidth of 0.341
#> Picking joint bandwidth of 0.341
#> Picking joint bandwidth of 177
#> Picking joint bandwidth of 61.9
#> Picking joint bandwidth of 0.341
#> Picking joint bandwidth of 0.341
#> Picking joint bandwidth of 0.341
#> Picking joint bandwidth of 0.341
VizSeuratGeneQC(obj)
obj <- RunSeuratTransformation(obj)
#> INFO [2025-01-03 21:08:04] Performing data transformation and scaling ...
#> INFO [2025-01-03 21:08:04] - Running NormalizeData ...
#> Normalizing layer: counts.Sample1
#> Normalizing layer: counts.Sample2
#> INFO [2025-01-03 21:08:06] - Running FindVariableFeatures ...
#> Finding variable features for layer counts.Sample1
#> Finding variable features for layer counts.Sample2
#> INFO [2025-01-03 21:08:08] - Running ScaleData ...
#> Centering and scaling data matrix
#> INFO [2025-01-03 21:08:09] - Running RunPCA ...
#> PC_ 1
#> Positive: ENSG00000172005, ENSG00000230885, ENSG00000013297, ENSG00000123560, ENSG00000168314, ENSG00000173786, ENSG00000174607, ENSG00000167641, ENSG00000105695, ENSG00000091513
#> ENSG00000136541, ENSG00000103089, ENSG00000184221, ENSG00000197971, ENSG00000197430, ENSG00000115290, ENSG00000134198, ENSG00000159176, ENSG00000139433, ENSG00000188643
#> ENSG00000104267, ENSG00000205116, ENSG00000171766, ENSG00000148180, ENSG00000120913, ENSG00000102934, ENSG00000127920, ENSG00000169562, ENSG00000189058, ENSG00000105894
#> Negative: ENSG00000128683, ENSG00000143153, ENSG00000102804, ENSG00000197457, ENSG00000132639, ENSG00000139970, ENSG00000133169, ENSG00000125869, ENSG00000213190, ENSG00000101489
#> ENSG00000213760, ENSG00000122952, ENSG00000182698, ENSG00000151778, ENSG00000152954, ENSG00000105649, ENSG00000168081, ENSG00000104490, ENSG00000170004, ENSG00000170091
#> ENSG00000162188, ENSG00000148908, ENSG00000115738, ENSG00000250479, ENSG00000100092, ENSG00000273079, ENSG00000157152, ENSG00000152932, ENSG00000276734, ENSG00000119900
#> PC_ 2
#> Positive: ENSG00000143947, ENSG00000088986, ENSG00000126267, ENSG00000138326, ENSG00000109846, ENSG00000171858, ENSG00000145592, ENSG00000197756, ENSG00000108518, ENSG00000169567
#> ENSG00000134419, ENSG00000142534, ENSG00000175130, ENSG00000088832, ENSG00000116030, ENSG00000147604, ENSG00000196531, ENSG00000240972, ENSG00000110700, ENSG00000233954
#> ENSG00000100442, ENSG00000173915, ENSG00000177600, ENSG00000137154, ENSG00000114391, ENSG00000272835, ENSG00000177432, ENSG00000178449, ENSG00000156976, ENSG00000131495
#> Negative: ENSG00000139182, ENSG00000172247, ENSG00000197106, ENSG00000092096, ENSG00000111897, ENSG00000101438, ENSG00000181790, ENSG00000071553, ENSG00000101180, ENSG00000187730
#> ENSG00000143153, ENSG00000174437, ENSG00000179222, ENSG00000187957, ENSG00000171951, ENSG00000063015, ENSG00000163536, ENSG00000185818, ENSG00000163399, ENSG00000135472
#> ENSG00000152583, ENSG00000105409, ENSG00000179218, ENSG00000182636, ENSG00000157087, ENSG00000180155, ENSG00000135916, ENSG00000069667, ENSG00000058404, ENSG00000144283
#> PC_ 3
#> Positive: ENSG00000087258, ENSG00000172809, ENSG00000213741, ENSG00000170027, ENSG00000142541, ENSG00000161016, ENSG00000161970, ENSG00000145592, ENSG00000233927, ENSG00000197756
#> ENSG00000132535, ENSG00000146676, ENSG00000110076, ENSG00000071082, ENSG00000106244, ENSG00000198918, ENSG00000182899, ENSG00000048740, ENSG00000073969, ENSG00000173376
#> ENSG00000175352, ENSG00000122026, ENSG00000161681, ENSG00000118473, ENSG00000189056, ENSG00000089169, ENSG00000118432, ENSG00000138326, ENSG00000136854, ENSG00000198300
#> Negative: ENSG00000136156, ENSG00000166922, ENSG00000099797, ENSG00000110651, ENSG00000117410, ENSG00000101439, ENSG00000116459, ENSG00000143198, ENSG00000182698, ENSG00000111716
#> ENSG00000184277, ENSG00000128463, ENSG00000102471, ENSG00000014641, ENSG00000005022, ENSG00000134333, ENSG00000144746, ENSG00000133872, ENSG00000182636, ENSG00000151729
#> ENSG00000062716, ENSG00000123395, ENSG00000151366, ENSG00000140740, ENSG00000075415, ENSG00000109472, ENSG00000044574, ENSG00000080824, ENSG00000166736, ENSG00000277791
#> PC_ 4
#> Positive: ENSG00000113387, ENSG00000161970, ENSG00000100442, ENSG00000178531, ENSG00000233927, ENSG00000213741, ENSG00000182899, ENSG00000109270, ENSG00000196262, ENSG00000145592
#> ENSG00000134809, ENSG00000173372, ENSG00000261857, ENSG00000119979, ENSG00000166441, ENSG00000172809, ENSG00000244694, ENSG00000135070, ENSG00000214736, ENSG00000131495
#> ENSG00000156482, ENSG00000122026, ENSG00000213190, ENSG00000197756, ENSG00000240972, ENSG00000155849, ENSG00000197584, ENSG00000182698, ENSG00000137154, ENSG00000143727
#> Negative: ENSG00000179218, ENSG00000128564, ENSG00000179292, ENSG00000105290, ENSG00000166963, ENSG00000174437, ENSG00000110025, ENSG00000167552, ENSG00000092096, ENSG00000176884
#> ENSG00000156261, ENSG00000110955, ENSG00000054523, ENSG00000117691, ENSG00000166736, ENSG00000006451, ENSG00000143740, ENSG00000154917, ENSG00000167614, ENSG00000139182
#> ENSG00000182636, ENSG00000166165, ENSG00000134121, ENSG00000273761, ENSG00000088367, ENSG00000152583, ENSG00000240849, ENSG00000006118, ENSG00000169925, ENSG00000188517
#> PC_ 5
#> Positive: ENSG00000173376, ENSG00000189056, ENSG00000118432, ENSG00000198785, ENSG00000137726, ENSG00000143195, ENSG00000162545, ENSG00000178568, ENSG00000145242, ENSG00000196090
#> ENSG00000134121, ENSG00000138650, ENSG00000120833, ENSG00000035862, ENSG00000155052, ENSG00000166006, ENSG00000182220, ENSG00000118971, ENSG00000122584, ENSG00000249992
#> ENSG00000170419, ENSG00000092421, ENSG00000174460, ENSG00000115252, ENSG00000139970, ENSG00000153956, ENSG00000170540, ENSG00000145681, ENSG00000173805, ENSG00000134419
#> Negative: ENSG00000155849, ENSG00000105048, ENSG00000188730, ENSG00000115738, ENSG00000089220, ENSG00000130066, ENSG00000171119, ENSG00000183166, ENSG00000119900, ENSG00000198739
#> ENSG00000130592, ENSG00000278588, ENSG00000105516, ENSG00000174871, ENSG00000151276, ENSG00000157193, ENSG00000154229, ENSG00000076356, ENSG00000198363, ENSG00000168993
#> ENSG00000130226, ENSG00000167549, ENSG00000240891, ENSG00000185630, ENSG00000119421, ENSG00000111674, ENSG00000120963, ENSG00000105364, ENSG00000135824, ENSG00000196353
obj <- RunSeuratIntegration(obj)
#> INFO [2025-01-03 21:08:10] Performing data integration ...
#> INFO [2025-01-03 21:08:10] - Running IntegrateLayers (method = rpca) ...
#> Computing within dataset neighborhoods
#> Finding all pairwise anchors
#> Projecting new data onto SVD
#> Projecting new data onto SVD
#> Finding neighborhoods
#> Finding anchors
#> Found 233 anchors
#> Merging dataset 2 into 1
#> Extracting anchors for merged samples
#> Finding integration vectors
#> Finding integration vector weights
#> Integrating data
#> INFO [2025-01-03 21:08:14] - Joining layers ...
obj <- RunSeuratDoubletDetection(obj, tool = "scDblFinder", filter = FALSE)
#> INFO [2025-01-03 21:08:15] Running doublet detection using scDblFinder ...
#> Assuming the input to be a matrix of counts or expected counts.
#> Creating ~1500 artificial doublets...
#> Dimensional reduction
#> Evaluating kNN...
#> Training model...
#> iter=0, 23 cells excluded from training.
#> iter=1, 21 cells excluded from training.
#> iter=2, 21 cells excluded from training.
#> Threshold found:0.725
#> 17 (4.2%) doublets called
VizSeuratDoublets(obj)
VizSeuratDoublets(obj, plot_type = "pie")
# }