Skip to content

Commit

Permalink
fix test_get_insdc_biosample_identifiers() and test_get_img_identifie…
Browse files Browse the repository at this point in the history
…rs()
  • Loading branch information
sujaypatil96 committed Dec 6, 2024
1 parent b9a77f0 commit e6f6e06
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/test_data/test_gold_translator.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import collections
import pandas as pd
import pytest

Expand Down Expand Up @@ -134,6 +135,13 @@ def test_get_insdc_biosample_identifiers():
]
translator = GoldStudyTranslator(projects=projects)

translator._projects_by_id = {p["projectGoldId"]: p for p in projects}
translator._project_ids_by_biosample_id = collections.defaultdict(list)
for project in projects:
translator._project_ids_by_biosample_id[project["biosampleGoldId"]].append(
project["projectGoldId"]
)

insdc_biosample_identifiers = translator._get_insdc_biosample_identifiers(
"Gb0000001"
)
Expand Down Expand Up @@ -238,6 +246,20 @@ def test_get_img_identifiers():
projects=projects, analysis_projects=analysis_projects
)

translator._projects_by_id = {p["projectGoldId"]: p for p in projects}
translator._analysis_projects_by_id = {
ap["apGoldId"]: ap for ap in analysis_projects
}

translator._analysis_project_ids_by_biosample_id = collections.defaultdict(list)
for analysis_project in analysis_projects:
for project_id in analysis_project["projects"]:
if project_id in translator._projects_by_id:
biosample_id = translator._projects_by_id[project_id]["biosampleGoldId"]
translator._analysis_project_ids_by_biosample_id[biosample_id].append(
analysis_project["apGoldId"]
)

img_identifiers = translator._get_img_identifiers("Gb0000001")
assert "img.taxon:3300000001" in img_identifiers
assert "img.taxon:3300000002" in img_identifiers
Expand Down

0 comments on commit e6f6e06

Please sign in to comment.