Closed lazappi closed 3 months ago
Or maybe assume the hits are an unweighted graph and fill the matrix with 1s with a warning?
Seems reasonable to me. Also could create an lgCMatrix
.
Related, if there is more than one metadata column, then the first one is used. Maybe it would be good to give a warning in this case?
May or may not be reasonable. assay()
and other SE-related getters assume first argument without any noise. I guess we could have an argument to choose between metadata columns.
Can you put together a little PR for each of these suggestions?
Creating a PR for the first one. I'm not sure if there is a nice way to pass arguments for the second one, but maybe it's fine.
I'll take the PR since it's already been put together, but longer term, I am wondering whether it would be better to (i) deprecate the asSparse=
and (ii) export the .hits2mat
function (and its counterpart for converting a matrix to a Hits
object). This would simplify the interface; the SCE only cares about Hits
going in and out, and exactly how this is converted to/from a sparse matrix is up to the user/application outside of the SCE.
I don't ever use the colPairs
and rowPairs
functionality so I have no relevant experience/opinion on this matter, but happy to take thoughts from people who do use it.
I have only used them in the context of converting to/from AnnData
which has matching slots but I think SpatialExperiment
also uses them (or something similar) which is how the issue came up.
Alright, this should roll out in 1.25.1. Will leave the more general question of as.sparse=
deprecation for another time.
If
colPairs()
contains aSelfHits
object with no metadata columns thencolPairs(x, asSparse = TRUE)
fails with a cryptic error. Example based on the documentation:I suppose this makes sense as it is unclear what to fill the matrix with but it would be helpful to have a more informative error. Or maybe assume the hits are an unweighted graph and fill the matrix with 1s with a warning?
Related, if there is more than one metadata column, then the first one is used. Maybe it would be good to give a warning in this case?