You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 python numpy 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 R dataframe as a pandas DataFrame 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 use reticulate::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 than X and therefore using uns and not varp.
Thanks!
The text was updated successfully, but these errors were encountered:
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!
The text was updated successfully, but these errors were encountered: