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

tidySCE Speedup aggregate_cells #84

Closed
stemangiola opened this issue Aug 22, 2023 · 2 comments · Fixed by #86
Closed

tidySCE Speedup aggregate_cells #84

stemangiola opened this issue Aug 22, 2023 · 2 comments · Fixed by #86
Assignees
Labels
enhancement New feature or request

Comments

@stemangiola
Copy link
Owner

This has taken inspiration and motivation from

https://twitter.com/lcolladotor/status/1687475222687936512

@stemangiola stemangiola added the enhancement New feature or request label Aug 22, 2023
@stemangiola stemangiola self-assigned this Aug 23, 2023
@stemangiola
Copy link
Owner Author

stemangiola commented Aug 24, 2023

Some discussion is here

Bioconductor/SummarizedExperiment#45

A proposal for a function is here

drisso/SingleCellExperiment#55

@stemangiola
Copy link
Owner Author

stemangiola commented Aug 24, 2023

Data preparation

data(pbmc_small)
df <- pbmc_small
ids = df |> unite("id", factor, string) |> pull(id)

scuttle

microbenchmark(aggregateAcrossCells(df, ids), times = 10L, unit = "seconds")

Unit: seconds
                          expr       min        lq     mean    median        uq       max neval
 aggregateAcrossCells(df, ids) 0.1972021 0.2095963 0.214034 0.2129438 0.2222606 0.2374125    10

OLD tidySingleCellExperiment

microbenchmark(aggregate_cells(df, c(factor, string)), times = 10L)

Unit: seconds
                                   expr      min       lq    mean   median       uq     max neval
 aggregate_cells(df, c(factor, string)) 2.046285 2.106658 2.25975 2.129606 2.296099 2.88916    10

FIRST iteration 2x improvement b60f538

microbenchmark(aggregate_cells(df, c(factor, string)), times = 10L, unit = "second")
Unit: seconds
                                   expr       min        lq      mean    median        uq      max neval
 aggregate_cells(df, c(factor, string)) 0.9484644 0.9818873 0.9893115 0.9847042 0.9996955 1.063225    10

SECOND iteration 1/3x further improvement d302642

microbenchmark(aggregate_cells(df, c(factor, string)), times = 10L, unit = "second")
Unit: seconds
                                   expr       min        lq      mean    median        uq      max neval
 aggregate_cells(df, c(factor, string)) 0.6526753 0.6631348 0.7401931 0.6699366 0.6837512 1.064324    10

THIRD iteration 2x further improvement 4195aa8

microbenchmark(aggregate_cells(df, c(factor, string)), times = 10L, unit = "second")
Unit: seconds
                                   expr       min        lq      mean    median        uq      max neval
 aggregate_cells(df, c(factor, string)) 0.3838859 0.3932368 0.4351129 0.4167958 0.4408787 0.633195    10

FOURTH iteration 1.5x further improvement 5fb88fa

microbenchmark(aggregate_cells(df, c(factor, string)), times = 10L, unit = "second")
Unit: seconds
                                   expr       min        lq      mean    median        uq       max neval
 aggregate_cells(df, c(factor, string)) 0.2763835 0.2814492 0.2886746 0.2838345 0.2929347 0.3170838    10

@stemangiola stemangiola linked a pull request Aug 24, 2023 that will close this issue
@stemangiola stemangiola moved this from Todo to In Progress in tidyomics open challenges Aug 24, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in tidyomics open challenges Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant