Bioconductor / LoomExperiment

A package to read, write, and manipulate loom files using LoomExperiments. Uses the loom file format from the Linnarson Lab. https://linnarssonlab.org/loompy/
https://www.bioconductor.org/packages/LoomExperiment
6 stars 5 forks source link

`col_graphs` and `row_graphs` are mandatory #7

Closed nsoranzo closed 5 years ago

nsoranzo commented 5 years ago

When exporting an object, the col_graphs and row_graphs attributes are not always added:

https://github.com/Bioconductor/LoomExperiment/blob/master/R/export-method.R#L248-L252

while the Loom file format specification says they must be present: http://linnarssonlab.org/loompy/format/index.html?highlight=h5py#row-and-column-sparse-graphs

dvantwisk commented 5 years ago

Good catch! The 1.3.2 version should now write empty col_graphs and row_graphs groups if there are no ColGraphs or RowGraphs present in the LoomExperiment object.

> u <- matrix(rpois(20000, 5), ncol=100)
> v <- log2(u + 1)
> scle <- SingleCellLoomExperiment(assays=list(counts=u, logcounts=v))
> export(scle, 'test.loom')
> rhdf5::h5ls('test.loom')
       group        name       otype  dclass       dim
0          /   col_attrs   H5I_GROUP
1 /col_attrs    colnames H5I_DATASET  STRING       100
2 /col_attrs reducedDims   H5I_GROUP
3          /  col_graphs   H5I_GROUP
4          /      layers   H5I_GROUP
5    /layers   logcounts H5I_DATASET   FLOAT 100 x 200
6          /      matrix H5I_DATASET INTEGER 100 x 200
7          /   row_attrs   H5I_GROUP
8 /row_attrs    rownames H5I_DATASET  STRING       200
9          /  row_graphs   H5I_GROUP
nsoranzo commented 5 years ago

And thanks for this one too!