loomR icon indicating copy to clipboard operation
loomR copied to clipboard

row_attrs from create loom vs add.row.attribute

Open combiz opened this issue 6 years ago • 1 comments

I've attached row and column attributes at loom file creation as follows: -

>create(paste(LOOMDIR, "test.loom", sep = ""),
       data = counts(sce),
       layers = list(logcounts = logcounts(sce)),
       gene.attrs = as.list(rowData(sce)), 
       cell.attrs = as.list(colData(sce)))

This works successfully for the col_attrs, however the row_attrs are absent: -

>lfile[['row_attrs']]
Class: H5Group
Filename: /home/ckhozoie/Documents/ms-sc/data/raw/loom/test.loom
Group: /row_attrs
Attributes: last_modified
Listing:
 name    obj_type dataset.dims dataset.type_class
 Gene H5I_DATASET        64914         H5T_STRING

After adding manually after file creation: -

> lfile$add.row.attribute(as.list(rowData(sce)), overwrite = TRUE)
> lfile[['row_attrs']]
Class: H5Group
Filename: /home/ckhozoie/Documents/ms-sc/data/raw/loom/test.loom
Group: /row_attrs
Attributes: last_modified
Listing:
                  name    obj_type dataset.dims dataset.type_class
                  Gene H5I_DATASET        64914         H5T_STRING
       ensembl_gene_id H5I_DATASET        64914         H5T_STRING
                  gene H5I_DATASET        64914         H5T_STRING
    is_feature_control H5I_DATASET        64914           H5T_ENUM
                  keep H5I_DATASET        64914           H5T_ENUM
     log10_mean_counts H5I_DATASET        64914          H5T_FLOAT
    log10_total_counts H5I_DATASET        64914          H5T_FLOAT
           mean_counts H5I_DATASET        64914          H5T_FLOAT
     n_cells_by_counts H5I_DATASET        64914        H5T_INTEGER
 pct_dropout_by_counts H5I_DATASET        64914          H5T_FLOAT
< Printed 10, out of 11>

Using the add.row.attribute() approach with the same attribute data as.list(rowData(sce)) seems to work correctly. Possible bug?

combiz avatar Apr 12 '19 11:04 combiz

Hi Combiz,

Could you update to the latest development version of loomR and try again? If it's still not working, then it's likely a bug that I haven't caught yet.

mojaveazure avatar Apr 26 '19 20:04 mojaveazure