Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

downsampling in scBarplot.CellFractions works unexpectedly: if the 5% thr is used, it does not "upsample" smaller categories #73

Open
vertesy opened this issue Apr 23, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@vertesy
Copy link
Owner

vertesy commented Apr 23, 2024

  • 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 
@vertesy vertesy added the bug Something isn't working label Apr 23, 2024
@vertesy
Copy link
Owner Author

vertesy commented Apr 23, 2024

I used a function that nevere supposed to do this kinda calculation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant