Skip to content

Commit

Permalink
LOOM_SPEC_VERSION
Browse files Browse the repository at this point in the history
  • Loading branch information
slinnarsson committed Feb 27, 2018
1 parent dd2014a commit 515af64
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
12 changes: 12 additions & 0 deletions doc/format/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
Loom file format specs
======================

Versions
--------

This specification defines the Loom file format version ``2.0.1``.


.. _formatinfo:

Introduction
Expand Down Expand Up @@ -89,6 +95,12 @@ Global attributes
attribute <https://www.hdfgroup.org/HDF5/Tutor/crtatt.html>`__ on the
root ``/`` group, which can be any valid scalar or multidimensional datatype and should be
interpreted as attributes of the whole ``.loom`` file.
- There can OPTIONALLY be an `HDF5
attribute <https://www.hdfgroup.org/HDF5/Tutor/crtatt.html>`__ on the
root ``/`` group named ``LOOM_SPEC_VERSION``, a string value giving the
loom file spec version that was followed in creating the file. See top of this
document for the current version of the spec.


Row and column attributes
^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
3 changes: 2 additions & 1 deletion loompy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
from .to_html import to_html
from .view_manager import ViewManager
from .loompy import connect, create, create_append, combine, create_from_cellranger, LoomConnection
from ._version import __version__
from ._version import __version__, loom_spec_version

1 change: 1 addition & 0 deletions loompy/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
__version__ = '2.0.7'
loom_spec_version = '2.0.1'
3 changes: 3 additions & 0 deletions loompy/loompy.py
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,8 @@ def create(filename: str, layers: Union[np.ndarray, Dict[str, np.ndarray], loomp
f.create_group('/layers')
f.create_group('/row_attrs')
f.create_group('/col_attrs')
f.create_group('/row_graphs')
f.create_group('/col_graphs')
f.flush()
f.close()

Expand All @@ -864,6 +866,7 @@ def create(filename: str, layers: Union[np.ndarray, Dict[str, np.ndarray], loomp
# store creation date
currentTime = time.localtime(time.time())
ds.attrs['CreationDate'] = timestamp()
ds.attrs["LOOM_SPEC_VERSION"] = loompy.loom_spec_version

except ValueError as ve:
ds.close(suppress_warning=True)
Expand Down

0 comments on commit 515af64

Please sign in to comment.