Skip to content

Commit

Permalink
Addition of ER EntityKeyTable and bug fixes (#872)
Browse files Browse the repository at this point in the history
  • Loading branch information
mavaylon1 committed Jun 22, 2023
1 parent f81537c commit 2f9ec56
Show file tree
Hide file tree
Showing 6 changed files with 458 additions and 269 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# HDMF Changelog

## HMDF 3.6.2 (Upcoming)

### New features and minor improvements
- Updated `ExternalResources` to have EntityKeyTable with updated tests/documentation and minor bug fix to ObjectKeyTable. @mavaylon1 [#872](https://github.com/hdmf-dev/hdmf/pull/872)

## HMDF 3.6.1 (May 18, 2023)

### Bug fixes
Expand Down
16 changes: 8 additions & 8 deletions docs/gallery/plot_external_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@
from hdmf.common import DynamicTable, VectorData
from hdmf import Container, ExternalResourcesManager
from hdmf import Data
from hdmf.testing import remove_test_file
import numpy as np
import os
# Ignore experimental feature warnings in the tutorial to improve rendering
import warnings
warnings.filterwarnings("ignore", category=UserWarning, message="ExternalResources is experimental*")
Expand Down Expand Up @@ -306,17 +306,17 @@ def __init__(self, **kwargs):
###############################################################################
# Write ExternalResources
# ------------------------------------------------------
# :py:class:`~hdmf.common.resources.ExternalResources` is written as a flattened tsv file.
# The user provides the path, which contains the name of the file, to where the tsv
# file will be written.
# :py:class:`~hdmf.common.resources.ExternalResources` is written as a zip file of
# the individual tables written to tsv.
# The user provides the path, which contains the name of the directory.

er.to_flat_tsv(path='./er_example.tsv')
er.to_norm_tsv(path='./')

###############################################################################
# Read ExternalResources
# ------------------------------------------------------
# Users can read :py:class:`~hdmf.common.resources.ExternalResources` from the tsv format
# by providing the path to the file.
# by providing the path to the directory.

er_read = ExternalResources.from_flat_tsv(path='./er_example.tsv')
remove_test_file('./er_example.tsv')
er_read = ExternalResources.from_norm_tsv(path='./')
os.remove('./er.zip')
2 changes: 1 addition & 1 deletion src/hdmf/common/hdmf-common-schema
6 changes: 5 additions & 1 deletion src/hdmf/common/io/resources.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .. import register_map
from ..resources import ExternalResources, KeyTable, FileTable, ObjectTable, ObjectKeyTable, EntityTable
from ..resources import ExternalResources, KeyTable, FileTable, ObjectTable, ObjectKeyTable, EntityTable, EntityKeyTable
from ...build import ObjectMapper


Expand Down Expand Up @@ -38,3 +38,7 @@ def objects(self, builder, manager):
@ObjectMapper.constructor_arg('object_keys')
def object_keys(self, builder, manager):
return self.construct_helper('object_keys', builder, ObjectKeyTable, manager)

@ObjectMapper.constructor_arg('entity_keys')
def entity_keys(self, builder, manager):
return self.construct_helper('entity_keys', builder, EntityKeyTable, manager)

0 comments on commit 2f9ec56

Please sign in to comment.