Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from yaml import safe_load as load_yaml
import jsonschema

from hubmap_translation.addl_index_transformations.portal.add_is_integrated import add_is_integrated
from hubmap_translation.addl_index_transformations.portal.translate import (
translate, TranslationException
)
Expand Down Expand Up @@ -76,6 +77,7 @@ def transform(doc, transformation_resources, batch_id='unspecified'):
return None
sort_files(doc_copy)
add_counts(doc_copy)
add_is_integrated(doc_copy)
add_partonomy(doc_copy, organ_map)
reset_entity_type(doc_copy)
if len(doc_copy['transformation_errors']) == 0:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from hubmap_translation.addl_index_transformations.portal.add_assay_details import (
CreationAction,
)


# Determines whether to display the raw dataset-focused UI or the processed outline-focused UI
# Must be run after add_counts transformation, since it relies on ancestor_counts
def add_is_integrated(doc):
# only datasets can be integrated
if doc.get("entity_type") != "Dataset":
return

# EPIC datasets are always considered integrated (including segmentation masks):
# - they can be derived from multiple datasets
# - they are always processed
# - they always have visualization support
# - they have their own list of contributors that may differ from the base dataset's contributors
if doc.get("creation_action") == CreationAction.EPIC:
doc["is_integrated"] = True
return

# If a dataset is immediately descended from multiple datasets, it is considered integrated
# This covers Snare-Seq2 experiments
if doc.get("ancestor_counts"):
if doc["ancestor_counts"].get("entity_type", {}).get("Dataset", 0) > 1:
doc["is_integrated"] = True
return

doc["is_integrated"] = False
Loading