Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
MillenniumFalconMechanic committed Nov 29, 2023
1 parent 6fd6191 commit 66868b1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 6 additions & 4 deletions backend/portal/api/enrichment.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,16 @@ def enrich_dataset_with_ancestors(dataset, key, ontology_mapping):
if unique_ancestors:
dataset[f"{key}_ancestors"] = unique_ancestors


def generate_tagged_ontology_id(tissue):
"""
Generate ontology ID tagged with tissue_type for the given tissue. For
example, UBERON:1234567 (organoid).
"""
tissue_id = tissue["ontology_term_id"]
tissue_type = tissue["tissue_type"]
# TODO(cc) revisit None here, is this possible during migration only?
if ( tissue_type is None or tissue_type == "tissue" ):
# Handle possible None for tissue_type (possible during migration): default
# to "tissue".
tissue_type = tissue["tissue_type"] or "tissue"
if tissue_type == "tissue":
return tissue_id
return f"{tissue_id} ({tissue_type})"
return f"{tissue_id} ({tissue_type})"
4 changes: 1 addition & 3 deletions tests/unit/backend/layers/api/test_portal_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1840,9 +1840,7 @@ def convert_ontology(ontologies):
# TODO update with fix for #6192.
self.assertCountEqual(
actual_dataset["tissue_ancestors"],
[
"UBERON:0000995 (organoid)"
],
["UBERON:0000995 (organoid)"],
)

self.assertEqual(actual_dataset["cell_type"], convert_ontology(modified_metadata.cell_type))
Expand Down

0 comments on commit 66868b1

Please sign in to comment.