-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add functionality for linked DynamicTables (#645)
Smplify interacting with DynamicTables that reference other tables via DynamicTableRegion, creating a collection of linked tables. In the ICEphys case this is a "simple" linear hierarchy of tables, but in principle a table may contain any number of DynamicTableRegion columns. This PR adds several functions to simplify introspection of linked DynamicTables and conversion to pandas DataFrames. - [X] Fix #646 by adding ``AlignedDynamicTable.get`` - [X] Fix #651 by updating ``AlignedDynamicTable.get`` to support slicing with ``[int, (str, str)]``, ``[int, str, str]``, and ``[int, str]`` to select a single cell or row of a category table, repectively - [X] Add ``AlignedDynamicTable.get_colnames(...)`` functions to allow us to keep compliance of the ``colnames`` property with ``DynamicTable`` while providing an easy way to get the full list of column names. - [X] Set name of DataFrame in ``DynamicTable.to_dataframe()`` and ``DynamicTable.get`` - [X] Add helper functions to ``DynamicTable`` to deal with foreign columns: - [X] ``DynamicTable.get_foreign_columns`` to identify if the table contains ``DynamicTableRegion`` columns - [X] ``DynamicTable.has_foreign_columns`` to identify which columns are``DynamicTableRegion`` columns - [X] ``DynamicTable.get_linked_tables`` to retrieve all tables linked to either directly or indirectly from the current table via ``DynamicTableRegion`` - [x] Implement the same helper functions also for ``AlignedDynamicTable`` - [x] ``DynamicTable.get_foreign_columns`` to identify if the table contains ``DynamicTableRegion`` columns - [X] ``DynamicTable.has_foreign_columns`` to identify which columns are``DynamicTableRegion`` columns - [x] ``DynamicTable.get_linked_tables`` to retrieve all tables linked to either directly or indirectly from the current table via ``DynamicTableRegion`` - [X] Add new module ``hdmf.common.hierarchicaltable`` with helper functions to facilitate conversion of linked tables to a single Pandas dataframe. - [X] ``to_hierarchical_dataframe`` to merge linked tables into a single consolidated pandas DataFrame. - [X] ``drop_id_columns`` to remove "id" columns from a DataFrame. - [X] ``flatten_column_index`` to replace a ``pandas.MultiIndex`` with a regular ``pandas.Index`` - [x] Add test for DyanmicTableRegion pointing to AlignedDynamicTable to check that the all columns are used - [x] Add tests for hierarchicaltable.py for - [X] to_hierarchical_dataframe - [x] drop_id_columns - [x] flatten_column_index functions - [X] File issue tickets for open TODO items for future PRs - [X] ``to_hierarchical_dataframe`` should be updated to support resolution of more than one DynamicTableRegion column. See #649 - [x] Add tutorial for DynamicTableRegion and how to use for linking to tables and for creating linked tables. See #648
- Loading branch information
Showing
9 changed files
with
1,336 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.