Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hej @gaddamshreya,
this PR contains a few suggestions of minor changes:
faster cosine distance computing
I'd suggest using faster way to compute cosine distances in
map_cells_to_space
. Currently the code is:My proposal is to replace this with a function
mat_cosine_similarity
(I placed this in theutils
module). This function uses broadcasting andnjit
fromnumba
. This gives you a fairly big increase in speed. This is not a pivotal part of the code, but if the function is run many times (like in LOOV) it's kinda nice. The functionmat_cosine_similarity
is defined as:See the attached image for a comparison of time and also assertion that the two implementations produce the same results.
plotting utilities
plot_genes_sc
- if thegenes
argument is a single gene (string) this no longer throws an error (i.e., you can provide either a list of multiple genes or a single gene as a string) - this makes it more convenient to plot.plot_genes_sc
- I added the option to "lowercase" the genes provided viagenes
(to make them match the indices, which are lowercased).spatial_key
in some spatial plot functions, similar to the standard thatscanpy
/squidpy
are using.Image: