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

Speed improvements #206

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Speed improvements #206

wants to merge 10 commits into from

Conversation

jpromeror
Copy link

This PR includes a series of commits intended to reduce the computational time when running the algorithm in doublet mode. Mostly intended for high definition assays (big number of spots), but usable with all other methods.

SpaceXR_SpeedUp

Main changes:

1. Change parallelization approach

  • Use foreach + DoParallel for the multicore implementation. This prevents launching multiple R sessions and we also included a progress bar for a cleaner UI.

2. Speed up gather_results

  • Bottle neck in the algorithm. Fully vectorized the function to remove unnecessary loops. Added progress bar as well

3. General speed up

  • Modified existing functions to improve overall performance.

4. Add MIN_OBS as parameter to create.RCTD

  • Adds MIN_OBS as a variable to allow running in specific scenarios. Allows more control and customized running, but user should be aware of the drawbacks (i.e. sampling noise). Kept the original default value.

To do list:

  • Adapt new parallelization approach to other modes (full & multi)
  • Improve screen messages for easier progress tracking


results_df <- data.frame(spot_class = factor(sapply(results,function(X){return(X$spot_class)}),levels=spot_levels),
first_type = sapply(results,function(X){return(X$first_type)}),
scond_type = sapply(results,function(X){return(X$second_type)}),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is a typo of 'second_type' here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants