Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The "date" keyword is ignored by the from_json parser #770

Closed
schferbe opened this issue Mar 27, 2018 · 1 comment
Closed

The "date" keyword is ignored by the from_json parser #770

schferbe opened this issue Mar 27, 2018 · 1 comment

Comments

@schferbe
Copy link
Contributor

schferbe commented Mar 27, 2018

The BIOME format has a keyword "date" in the top level. The Table has an attribute create_date which is None after loading a .biom file though. Could this field be parsed into the Table?

To reproduce:

from json import loads
from pathlib import Path
import numpy as np
from biom import load_table
from biom.table import Table
data = np.arange(40).reshape(10, 4)
sample_ids = ['S%d' % i for i in range(4)]
observ_ids = ['O%d' % i for i in range(10)]
sample_metadata = [{'environment': 'A'}, {'environment': 'B'},
                   {'environment': 'A'}, {'environment': 'B'}]
observ_metadata = [{'taxonomy': ['Bacteria', 'Firmicutes']},
                   {'taxonomy': ['Bacteria', 'Firmicutes']},
                   {'taxonomy': ['Bacteria', 'Proteobacteria']},
                   {'taxonomy': ['Bacteria', 'Proteobacteria']},
                   {'taxonomy': ['Bacteria', 'Proteobacteria']},
                   {'taxonomy': ['Bacteria', 'Bacteroidetes']},
                   {'taxonomy': ['Bacteria', 'Bacteroidetes']},
                   {'taxonomy': ['Bacteria', 'Firmicutes']},
                   {'taxonomy': ['Bacteria', 'Firmicutes']},
                   {'taxonomy': ['Bacteria', 'Firmicutes']}]
table = Table(data, observ_ids, sample_ids, observ_metadata,
              sample_metadata, table_id='Example Table')
file = Path('~/test.biom').expanduser()
table.to_json('me', file.open('w'))
loaded = load_table(file.as_posix())
print(loaded.create_date)  # is None
loaded_2 = Table.from_json(loads(table.to_json('me')))
print(loaded_2.create_date)  # is None

This is quite similar to #697. (I don't know why it was closed...)
Edit: It was closed because of commit b1fff87.

schferbe added a commit to schferbe/biom-format that referenced this issue Mar 27, 2018
@schferbe
Copy link
Contributor Author

schferbe commented Mar 27, 2018

I added pull request #771 resolving this issue...

schferbe added a commit to schferbe/biom-format that referenced this issue Mar 27, 2018
schferbe added a commit to schferbe/biom-format that referenced this issue May 4, 2021
@wasade wasade closed this as completed in caf2c7d May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant