Extract the primary count matrix from an AnnData object
Source:R/extract_anndata_X.R
extract_anndata_X.RdSelects a layer from `adata$layers` if `layer` is supplied and present; otherwise falls back to `adata$X`. The returned matrix is in AnnData orientation (cells x features) and converted to CsparseMatrix. Row and column names are set from `obs_names` / `var_names` when provided.