From 8f4df5cf8237060280519623c9017c1ff6aada17 Mon Sep 17 00:00:00 2001 From: Noah Dove Date: Mon, 28 Nov 2022 16:22:22 -0800 Subject: [PATCH] [r] Fix: AnVIL indexer doesn't follow downstream links from files to files (#4761) --- src/azul/plugins/repository/tdr_anvil/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/azul/plugins/repository/tdr_anvil/__init__.py b/src/azul/plugins/repository/tdr_anvil/__init__.py index 11259eac0..e72dec777 100644 --- a/src/azul/plugins/repository/tdr_anvil/__init__.py +++ b/src/azul/plugins/repository/tdr_anvil/__init__.py @@ -229,7 +229,7 @@ def _bundle_entity(self, bundle_fqid: SourcedBundleFQID) -> KeyReference: return bundle_entity def _consolidate_by_type(self, entities: Keys) -> MutableKeysByType: - result = defaultdict(set) + result = {entity_type: set() for entity_type in self.indexed_columns_by_entity_type} for e in entities: result[e.entity_type].add(e.key) return result @@ -259,7 +259,7 @@ def _follow_downstream(self, ) -> Links: return set.union( self._downstream_from_biosamples(source, entities['biosample']), - self._downstream_from_files(source, entities['files']) + self._downstream_from_files(source, entities['file']) ) def _upstream_from_biosamples(self, @@ -446,6 +446,8 @@ def _retrieve_entities(self, entity_type: EntityType, keys: AbstractSet[Key], ) -> MutableJSONs: + if not keys: + return [] table_name = self._full_table_name(source, entity_type) columns = set.union( self.common_indexed_columns,