Seurat.utils
Seurat.utils copied to clipboard
downsampling in `scBarplot.CellFractions` works unexpectedly: if the 5% thr is used, it does not "upsample" smaller categories
- Therefore downsampling is a weird hybrid, atm, and misleading.
> scBarplot.CellFractions(fill.by = "Major_Celltypes", obj = combined.obj, group.by = "1", downsample = T)
The size of the smallest group is: 302 cells.
If smallest category is < 5% of total cells, than sampling with replacement to 5%.
[1] "Variable used: Major_Celltypes"
Sampling with replacement to: 5% of the data or 8131 of cells.
From 162615 reduced to 85332 cells.
Total cells sampled: 85332
data
Acyte EN, DL, RV, ABI3BP EN, L2/3 EN, L5/6 EN, maturing
4596 10768 34525 24668 14704
EN, mixed EN, UL, RV, C1QL3 Hindbrain IN, CGE IN, mixed
5776 19649 1208 4967 2833
IPC MSN Necropt. RG RG, Div.
10094 302 923 19792 3925
RG, Ventr.
3885
data
Acyte EN, DL, RV, ABI3BP EN, L2/3 EN, L5/6 EN, maturing
1.000 0.755 0.236 0.330 0.553
EN, mixed EN, UL, RV, C1QL3 Hindbrain IN, CGE IN, mixed
1.000 0.414 1.000 1.000 1.000
IPC MSN Necropt. RG RG, Div.
0.806 1.000 1.000 0.411 1.000
RG, Ventr.
1.000
Called from: scBarplot.CellFractions(fill.by = "Major_Celltypes", obj = combined.obj,
group.by = "1", downsample = T)
Browse[1]> # Update plot name and caption to reflect downsampling
Browse[1]> plotname <- kpp(plotname, "downsampled")
Browse[1]> table(obj$Major_Celltypes)
Acyte EN, DL, RV, ABI3BP EN, L2/3 EN, L5/6 EN, maturing
4596 8131 8131 8131 8131
EN, mixed EN, UL, RV, C1QL3 Hindbrain IN, CGE IN, mixed
5776 8131 1208 4967 2833
IPC MSN Necropt. RG RG, Div.
8131 302 923 8131 3925
RG, Ventr.
3885
I used a function that nevere supposed to do this kinda calculation!