diff --git a/ChangeLog.md b/ChangeLog.md index afc3d0f3..18a55b7a 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,6 +1,13 @@ BIOM-Format ChangeLog ===================== +biom 2.1.11-dev +----------- + +Bug fixes: + +* `Table.from_json` now respects the creation date [issue #770](https://github.com/biocore/biom-format/issues/770) in Python 3.7 and higher + biom 2.1.10 ----------- @@ -84,6 +91,7 @@ Bug fixes: * Tables of shape `(0, n)` or `(n, 0)` were raising exceptions when being written out. See [issue #619](https://github.com/biocore/biom-format/issues/619). * Tables loaded with a `list` of empty `dict`s will have their metadata attributes set to None. See [issue #594](https://github.com/biocore/biom-format/issues/594). + biom 2.1.6 ---------- diff --git a/biom/table.py b/biom/table.py index 33a4d787..a70846de 100644 --- a/biom/table.py +++ b/biom/table.py @@ -4562,21 +4562,23 @@ def from_json(self, json_table, data_pump=None, type_ = json_table['type'] if data_pump is None: - table_obj = Table(json_table['data'], obs_ids, sample_ids, - obs_metadata, sample_metadata, - shape=json_table['shape'], - dtype=dtype, - type=type_, - generated_by=json_table['generated_by'], - input_is_dense=input_is_dense) + data = json_table['data'] else: - table_obj = Table(data_pump, obs_ids, sample_ids, - obs_metadata, sample_metadata, - shape=json_table['shape'], - dtype=dtype, - type=type_, - generated_by=json_table['generated_by'], - input_is_dense=input_is_dense) + data = data_pump + create_date = None + if hasattr(datetime, "fromisoformat"): + try: + create_date = datetime.fromisoformat(json_table['date']) + except (TypeError, ValueError): + pass + table_obj = Table(data, obs_ids, sample_ids, + obs_metadata, sample_metadata, + shape=json_table['shape'], + dtype=dtype, + type=type_, + create_date=create_date, + generated_by=json_table['generated_by'], + input_is_dense=input_is_dense) return table_obj def to_json(self, generated_by, direct_io=None):