-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[builder] update uberon and tissue_general mapping to schema 4 standa…
…rd (#1018) * update uberon and tissue_general mapping to schema 4 standard * incorporate fixes to resovlve 841 * lint * update incorrect comment
- Loading branch information
Bruce Martin
authored
Feb 22, 2024
1 parent
aaccb5b
commit f0593c4
Showing
4 changed files
with
67 additions
and
42 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
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
41 changes: 41 additions & 0 deletions
41
tools/cellxgene_census_builder/tests/test_tissue_mapper.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import unittest | ||
|
||
from cellxgene_census_builder.build_soma.tissue_mapper import TissueMapper | ||
|
||
|
||
class TissueMapperTest(unittest.TestCase): | ||
def setUp(self) -> None: | ||
self.tissue_mapper = TissueMapper() | ||
|
||
def test__high_level_tissue_retrieval_exists(self) -> None: | ||
low_level_tissue = "UBERON:0008951" # lef lung lobe | ||
expected_high_level_tissue = "UBERON:0002048" # lung | ||
self.assertEqual(self.tissue_mapper.get_high_level_tissue(low_level_tissue), expected_high_level_tissue) | ||
|
||
def test__high_level_tissue_retrieval_does_not_exist(self) -> None: | ||
low_level_tissue = "UBERON:noId" | ||
expected_high_level_tissue = "UBERON:noId" | ||
self.assertEqual(self.tissue_mapper.get_high_level_tissue(low_level_tissue), expected_high_level_tissue) | ||
|
||
def test__high_level_tissue_retrieval_suffix(self) -> None: | ||
low_level_tissue = "UBERON:0008951 (organoid)" # lef lung lobe | ||
expected_high_level_tissue = "UBERON:0008951 (organoid)" # lung | ||
self.assertEqual(self.tissue_mapper.get_high_level_tissue(low_level_tissue), expected_high_level_tissue) | ||
|
||
def test__making_ontology_id_writable(self) -> None: | ||
tissue = "UBERON_0008951" | ||
expected_tissue = "UBERON:0008951" | ||
|
||
self.assertEqual(self.tissue_mapper.reformat_ontology_term_id(tissue, to_writable=True), expected_tissue) | ||
|
||
def test__making_ontology_id_readable(self) -> None: | ||
tissue = "UBERON:0008951" | ||
expected_tissue = "UBERON_0008951" | ||
|
||
self.assertEqual(self.tissue_mapper.reformat_ontology_term_id(tissue, to_writable=False), expected_tissue) | ||
|
||
def test__get_label_from_id(self) -> None: | ||
tissue = "UBERON:0008951" | ||
expected_label = "left lung lobe" | ||
|
||
self.assertEqual(self.tissue_mapper.get_label_from_writable_id(tissue), expected_label) |