Open GreenGilad opened 2 years ago
Hey Gilad!
Could you provide me with a small reproducible example?
I'll think about whether I can find a "nice" solution to your problem while still being compatible with the standard anndata interface.
Robrecht
Hi there,
When storing a matrix with row names and column names in the
uns
slot, these are removed. I assume that is to align with the pythonnumpy
implementation where these are not supported.To try and work around this problem of loosing the row and column names I can convert the R matrix to a R dataframe. However, when doing so, the anndata object stores these as a pandas DataFrame. I wanted to ask why does the R
anndata
object stores Rdataframe
as a pandasDataFrame
instead in the R format? Couldn't this be kept transparent to the user only for reading and writing the h5ad object to file but then once loaded to have the class of R dataframe? Currently, every time I wish to use such a dataframe I must usereticulate::py_to_r
and I still loose row and column names when doing so.Couldn't it be the same as
anndata$X
?Related to this issue is the case that the matrix contains character values. In this case I am not able to nicely obtain the matrix with the names and in a proper matrix shape. I get it as a flat matrix even if I try to reshape it.
The scenario I am working on is of a square symmetric correlation matrix with the p-values, multiple hypothesis testing corrections matrix and the asterisks matrix.
To keep it simple I am showing the above using
data$X
but in reality I am using a matrix of different shape thanX
and therefore usinguns
and notvarp
.Thanks!