Skip to content

Commit

Permalink
As a Computational Biologist, I want to see the various summaries for…
Browse files Browse the repository at this point in the history
… animal models in the relevant section so I can have all the information consolidated in one location (#92)

* Updated annotation configuration to have both automated and specificed alliance genome animal summaries, updated the fixtures to include both summaries and are accurate to the gene identifier, and updated the annotation rendering configuration to display the new annotations

* Updated the python tests to include the 4 extra annotations in the configuration

* updated the existing tests and removed the mongo ids from the imported fixtures

* updated the existing tests and removed the mongo ids from the imported fixtures

* Updated the Text Dataset in the Annotation components to display as unavailable if the value also has empty string

* Updated the fixtures for genomic unit collection

* Removed the mongoids from the genomic units collection initial seed
  • Loading branch information
JmScherer authored and SeriousHorncat committed Jun 28, 2023
1 parent 340606c commit d30e159
Show file tree
Hide file tree
Showing 8 changed files with 14,730 additions and 14,713 deletions.
4 changes: 2 additions & 2 deletions backend/tests/integration/test_analysis_routers.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def test_import_analysis_from_phenotips_json(
json=exported_phenotips_to_import_json,
)

assert mock_annotation_queue.put.call_count == 33
assert mock_annotation_queue.put.call_count == 37

mock_background_add_task.assert_called_once_with(
AnnotationService.process_tasks, mock_annotation_queue, mock_repositories['genomic_unit']
Expand Down Expand Up @@ -123,7 +123,7 @@ def test_import_analysis_with_phenotips_json(

phenotips_file.close()

assert mock_annotation_queue.put.call_count == 33
assert mock_annotation_queue.put.call_count == 37

mock_background_add_task.assert_called_once_with(
AnnotationService.process_tasks, mock_annotation_queue, mock_repositories['genomic_unit']
Expand Down
10 changes: 5 additions & 5 deletions backend/tests/unit/core/test_annotate.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def test_queuing_annotations_for_genomic_units(cpam0046_analysis, annotation_col
annotation_service = AnnotationService(annotation_collection)
mock_queue = Mock()
annotation_service.queue_annotation_tasks(cpam0046_analysis, mock_queue)
assert mock_queue.put.call_count == 33
assert mock_queue.put.call_count == 37


# Patching the temporary helper method that is writing to a file, this will be
Expand Down Expand Up @@ -52,11 +52,11 @@ def dependency_mock_side_effect(*args, **kwargs): # pylint: disable=unused-argu
AnnotationService.process_tasks(cpam0046_annotation_queue, mock_genomic_unit_collection)
assert cpam0046_annotation_queue.empty()

assert http_task_annotate.call_count == 27
assert http_task_annotate.call_count == 31
assert none_task_annotate.call_count == 0
assert forge_task_annotate.call_count == 6

assert annotate_extract_mock.call_count == 33
assert annotate_extract_mock.call_count == 37


@patch("src.core.annotation.log_to_file")
Expand Down Expand Up @@ -86,11 +86,11 @@ def test_processing_cpam0002_annotations_tasks(

AnnotationService.process_tasks(cpam0002_annotation_queue, mock_genomic_unit_collection)

assert http_task_annotate.call_count == 27
assert http_task_annotate.call_count == 31
assert forge_task_annotate.call_count == 6
assert none_task_annotate.call_count == 0

assert annotate_extract_mock.call_count == 33
assert annotate_extract_mock.call_count == 37

mock_genomic_unit_collection.annotate_genomic_unit.assert_called()

Expand Down
4 changes: 2 additions & 2 deletions backend/tests/unit/repository/test_annotation_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ def test_get_datasets_configuration_by_type(annotation_collection):
"""Tests getting the datasets for the provided types of genomic units"""
types = set({GenomicUnitType.GENE, GenomicUnitType.HGVS_VARIANT})
datasets = annotation_collection.datasets_to_annotate_by_type(types)
assert len(datasets) == 33
assert len(datasets) == 37


def test_get_datasets_to_annotate_for_units(annotation_collection, genomic_units_for_annotation):
"""Tests if the configuration for datasets is return as expected"""
actual_configuration = annotation_collection.datasets_to_annotate_for_units(genomic_units_for_annotation)
assert len(actual_configuration["gene"]) == 23
assert len(actual_configuration["gene"]) == 27
assert len(actual_configuration["hgvs_variant"]) == 10


Expand Down
60 changes: 48 additions & 12 deletions etc/fixtures/initial-seed/annotations-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,21 +111,30 @@
"attribute": "{ \"HPO_gene_search_url\": .HPO_gene_search_url }"
},
{
"data_set": "Model Systems - Rat",
"data_source": "Aliance Genome",
"data_set": "Rat Gene Identifier",
"data_source": "Alliance Genome",
"genomic_unit_type": "gene",
"annotation_source_type": "http",
"url": "https://www.alliancegenome.org/api/search_autocomplete?q={gene}",
"attribute": ".results[] | { \"name_key\": .name_key, \"name\": .name, \"primaryKey\": .primaryKey, \"searchKey\": \"{gene} (Rno)\" } | . + { \"searchKey\": .searchKey | ascii_downcase, \"name_key\": .name_key | ascii_downcase } | select( .name_key == .searchKey) | { \"Rat Gene Identifier\": .primaryKey }"
},
{
"data_set": "Rat_Alliance_Genome_Automated_Summary",
"data_source": "Alliance Genome",
"genomic_unit_type": "gene",
"annotation_source_type": "http",
"url": "https://www.alliancegenome.org/api/gene/{Rat Gene Identifier}",
"attribute": "{ \"Model Systems - Rat\": .geneSynopsis}",
"attribute": "{ \"Rat_Alliance_Genome_Automated_Summary\": .automatedGeneSynopsis }",
"dependencies": ["Rat Gene Identifier"]
},
{
"data_set": "Rat Gene Identifier",
"data_set": "Rat_Alliance_Genome_RGD_Summary",
"data_source": "Alliance Genome",
"genomic_unit_type": "gene",
"annotation_source_type": "http",
"url": "https://www.alliancegenome.org/api/search_autocomplete?q={gene}",
"attribute": ".results[] | { \"name_key\": .name_key, \"name\": .name, \"primaryKey\": .primaryKey, \"searchKey\": \"{gene} (Rno)\" } | . + { \"searchKey\": .searchKey | ascii_downcase, \"name_key\": .name_key | ascii_downcase } | select( .name_key == .searchKey) | { \"Rat Gene Identifier\": .primaryKey }"
"url": "https://www.alliancegenome.org/api/gene/{Rat Gene Identifier}",
"attribute": "{ \"Rat_Alliance_Genome_RGD_Summary\": .geneSynopsis}",
"dependencies": ["Rat Gene Identifier"]
},
{
"data_set": "Rat_Alliance_Genome_Models",
Expand All @@ -145,12 +154,21 @@
"attribute": ".results[] | { \"name_key\": .name_key, \"name\": .name, \"primaryKey\": .primaryKey, \"searchKey\": \"{gene} (Mmu)\" } | . + { \"searchKey\": .searchKey | ascii_downcase, \"name_key\": .name_key | ascii_downcase } | select( .name_key == .searchKey) | { \"Mouse Gene Identifier\": .primaryKey }"
},
{
"data_set": "Model Systems - Mouse - Automated",
"data_set": "Mouse_Alliance_Genome_Automated_Summary",
"data_source": "Alliance Genome",
"genomic_unit_type": "gene",
"annotation_source_type": "http",
"url": "https://www.alliancegenome.org/api/gene/{Mouse Gene Identifier}",
"attribute": "{ \"Model Systems - Mouse\": .automatedGeneSynopsis}",
"attribute": "{ \"Mouse_Alliance_Genome_Automated_Summary\": .automatedGeneSynopsis }",
"dependencies": ["Mouse Gene Identifier"]
},
{
"data_set": "Mouse_Alliance_Genome_MGI_Summary",
"data_source": "Alliance Genome",
"genomic_unit_type": "gene",
"annotation_source_type": "http",
"url": "https://www.alliancegenome.org/api/gene/{Mouse Gene Identifier}",
"attribute": "{ \"Mouse_Alliance_Genome_MGI_Summary\": .geneSynopsis }",
"dependencies": ["Mouse Gene Identifier"]
},
{
Expand All @@ -171,12 +189,21 @@
"attribute": ".results[] | { \"name_key\": .name_key, \"name\": .name, \"primaryKey\": .primaryKey, \"searchKey\": \"{gene} (Dre)\" } | . + { \"searchKey\": .searchKey | ascii_downcase, \"name_key\": .name_key | ascii_downcase } | select( .name_key == .searchKey) | { \"Zebrafish Gene Identifier\": .primaryKey }"
},
{
"data_set": "Model Systems - Zebrafish - Automated",
"data_set": "Zebrafish_Alliance_Genome_Automated_Summary",
"data_source": "Alliance Genome",
"genomic_unit_type": "gene",
"annotation_source_type": "http",
"url": "https://www.alliancegenome.org/api/gene/{Zebrafish Gene Identifier}",
"attribute": "{ \"Model Systems - Zebrafish\": .automatedGeneSynopsis}",
"attribute": "{ \"Zebrafish_Alliance_Genome_Automated_Summary\": .automatedGeneSynopsis }",
"dependencies": ["Zebrafish Gene Identifier"]
},
{
"data_set": "Zebrafish_Alliance_Genome_ZFIN_Summary",
"data_source": "Alliance Genome",
"genomic_unit_type": "gene",
"annotation_source_type": "http",
"url": "https://www.alliancegenome.org/api/gene/{Zebrafish Gene Identifier}",
"attribute": "{ \"Zebrafish_Alliance_Genome_ZFIN_Summary\": .geneSynopsis }",
"dependencies": ["Zebrafish Gene Identifier"]
},
{
Expand All @@ -197,12 +224,21 @@
"attribute": ".results[] | { \"name_key\": .name_key, \"name\": .name, \"primaryKey\": .primaryKey, \"searchKey\": \"{gene} (Cel)\" } | . + { \"searchKey\": .searchKey | ascii_downcase, \"name_key\": .name_key | ascii_downcase } | select( .name_key == .searchKey) | { \"C-Elegens Gene Identifier\": .primaryKey }"
},
{
"data_set": "Model Systems - C-Elegens - Automated",
"data_set": "C-Elegens_Alliance_Genome_Automated_Summary",
"data_source": "Alliance Genome",
"genomic_unit_type": "gene",
"annotation_source_type": "http",
"url": "https://www.alliancegenome.org/api/gene/{C-Elegens Gene Identifier}",
"attribute": "{ \"C-Elegens_Alliance_Genome_Automated_Summary\": .automatedGeneSynopsis }",
"dependencies": ["C-Elegens Gene Identifier"]
},
{
"data_set": "C-Elegens_Alliance_Genome_WB_Summary",
"data_source": "Alliance Genome",
"genomic_unit_type": "gene",
"annotation_source_type": "http",
"url": "https://www.alliancegenome.org/api/gene/{C-Elegens Gene Identifier}",
"attribute": "{ \"Model Systems - C-Elegens\": .automatedGeneSynopsis}",
"attribute": "{ \"C-Elegens_Alliance_Genome_WB_Summary\": .geneSynopsis }",
"dependencies": ["C-Elegens Gene Identifier"]
},
{
Expand Down
Loading

0 comments on commit d30e159

Please sign in to comment.