Download tasks/data/forward/3d-beacons__3d-beacons-hub-api.489ca02/tests/test_patch.diff from Lego-X/ProgramGen: direct link, hf CLI and curl.
- Browser
- Download file 68.5 kB
-
https://huggingface.co/datasets/Lego-X/ProgramGen/resolve/main/tasks/data/forward/3d-beacons__3d-beacons-hub-api.489ca02/tests/test_patch.diff
- Command line
-
hf download hf://datasets/Lego-X/ProgramGen/tasks/data/forward/3d-beacons__3d-beacons-hub-api.489ca02/tests/test_patch.diff
-
curl -L -o test_patch.diff https://huggingface.co/datasets/Lego-X/ProgramGen/resolve/main/tasks/data/forward/3d-beacons__3d-beacons-hub-api.489ca02/tests/test_patch.diff
68.5 kB
diff --git a/tests/__init__.py b/tests/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/tests/conftest.py b/tests/conftest.py
new file mode 100644
--- /dev/null
+++ b/tests/conftest.py
@@ -0,0 +1,120 @@
+import hashlib
+import json
+from typing import List
+
+import pytest
+
+from app.uniprot.schema import UniprotSummary
+from tests.utils import StubResponse
+
+
+class AsyncResult:
+ def __init__(self, status, result):
+ self.result = result
+ self.status = status
+
+ def get(self):
+ return self.result
+
+
+@pytest.fixture(scope="session")
+def invalid_uniprot():
+ return "X0"
+
+
+@pytest.fixture(scope="session")
+def valid_uniprot():
+ return "P0DTD1"
+
+
+@pytest.fixture(scope="session")
+def valid_uniprot_structures():
+ valid_structures = []
+ valid_structures.append(StubResponse(status_code=200, stub_for="uniprot"))
+ return valid_structures
+
+
+@pytest.fixture(scope="session")
+def valid_uniprot_structures_summary():
+ valid_structures = []
+ valid_structures.append(StubResponse(status_code=200, stub_for="uniprot_summary"))
+ return valid_structures
+
+
+@pytest.fixture(scope="session")
+def registry():
+ with open("tests/stubs/registry.json") as fp:
+ data = json.load(fp)
+ return data
+
+
+@pytest.fixture(scope="session")
+def valid_gifts_response():
+ with open("tests/stubs/gifts_response.json") as fp:
+ data = json.load(fp)
+ return data
+
+
+@pytest.fixture(scope="session")
+def valid_annotation_response():
+ with open("tests/stubs/annotations_response.json") as fp:
+ data = json.load(fp)
+ return data
+
+
+@pytest.fixture(scope="session")
+def valid_uniprot_list_summary():
+ return StubResponse(status_code=200, stub_for="uniprot_list_summary")
+
+
+@pytest.fixture(scope="session")
+def seq_search_response():
+ return StubResponse(status_code=200, stub_for="seq_search_response")
+
+
+@pytest.fixture(scope="session")
+def sample_sequence():
+ return "MVLSEGEWQLVLHVWAKVEADVAGHGQDILIRLFKSH"
+
+
+@pytest.fixture(scope="session")
+def sample_sequence_hash():
+ return hashlib.md5("MVLSEGEWQLVLHVWAKVEADVAGHGQDILIRLFKSH".encode()).hexdigest()
+
+
+@pytest.fixture(scope="session")
+def uniprot_summary_obj_list():
+ summary_results: List[UniprotSummary] = []
+
+ with open("tests/stubs/uniprot_list_summary.json") as f:
+ for item in json.load(f):
+ summary_results.append(UniprotSummary(**item))
+
+ return summary_results
+
+
+@pytest.fixture(scope="session")
+def uniprot_details():
+ with open("tests/stubs/uniprot.json") as f:
+ return json.load(f)
+
+
+@pytest.fixture(scope="session")
+def uniprot_summary():
+ with open("tests/stubs/uniprot_summary.json") as f:
+ return json.load(f)
+
+
+@pytest.fixture(scope="session")
+def pending_async_result():
+ return AsyncResult("PENDING", None)
+
+
+@pytest.fixture(scope="session")
+def failed_async_result():
+ return AsyncResult("FAILURE", None)
+
+
+@pytest.fixture(scope="session")
+def finished_none_async_result():
+ return AsyncResult("SUCCESS", None)
diff --git a/tests/test_cli.py b/tests/test_cli.py
new file mode 100644
--- /dev/null
+++ b/tests/test_cli.py
@@ -0,0 +1,14 @@
+import pytest
+from click.testing import CliRunner
+
+from app import cli
+
+
+@pytest.fixture(scope="module")
+def runner():
+ return CliRunner()
+
+
+def test_main(runner):
+ result = runner.invoke(cli.main, ["--help"])
+ assert result.exit_code == 0
diff --git a/tests/test_health.py b/tests/test_health.py
new file mode 100644
--- /dev/null
+++ b/tests/test_health.py
@@ -0,0 +1,109 @@
+from unittest.mock import AsyncMock, patch
+
+import pytest
+from fastapi import FastAPI, status
+from starlette.testclient import TestClient
+
+from app.health.health import health_route
+
+app = FastAPI()
+app.include_router(health_route, prefix="/health")
+
+
+@pytest.fixture
+def client():
+ return TestClient(app)
+
+
+@pytest.mark.asyncio
+@patch("app.health.health.get_services")
+@patch("app.health.health.get_base_service_url")
+@patch("app.health.health.get_final_service_url")
+@patch("app.health.health.send_async_requests", new_callable=AsyncMock)
+async def test_health_check_success(
+ mock_send_async_requests,
+ mock_get_final_service_url,
+ mock_get_base_service_url,
+ mock_get_services,
+ client,
+):
+ # Mock service discovery
+ mock_get_services.return_value = [
+ {"provider": "pdbe", "accessPoint": "/api/health"}
+ ]
+ mock_get_base_service_url.return_value = "http://mocked"
+ mock_get_final_service_url.return_value = "http://mocked/api/health"
+
+ # Mock response from downstream service
+ class MockResponse:
+ status_code = status.HTTP_200_OK
+
+ def json(self):
+ return [
+ {
+ "status": "pass",
+ "service_id": "pdbe",
+ "beacons_api_version": "2.7.0",
+ "output": "",
+ }
+ ]
+
+ mock_send_async_requests.return_value = [MockResponse()]
+
+ response = client.get("/health/")
+ assert response.status_code == status.HTTP_200_OK
+ assert response.headers["content-type"].startswith("application/health+json")
+ assert response.json() == [
+ {
+ "status": "pass",
+ "service_id": "pdbe",
+ "beacons_api_version": "2.7.0",
+ "output": "",
+ }
+ ]
+
+
+@pytest.mark.asyncio
+@patch("app.health.health.get_services")
+@patch("app.health.health.get_base_service_url")
+@patch("app.health.health.get_final_service_url")
+@patch("app.health.health.send_async_requests", new_callable=AsyncMock)
+async def test_health_check_failure(
+ mock_send_async_requests,
+ mock_get_final_service_url,
+ mock_get_base_service_url,
+ mock_get_services,
+ client,
+):
+ mock_get_services.return_value = [
+ {"provider": "pdbe", "accessPoint": "/api/health"}
+ ]
+ mock_get_base_service_url.return_value = "http://mocked"
+ mock_get_final_service_url.return_value = "http://mocked/api/health"
+
+ class MockResponse:
+ status_code = status.HTTP_500_INTERNAL_SERVER_ERROR
+
+ def json(self):
+ return [
+ {
+ "status": "fail",
+ "service_id": "pdbe",
+ "beacons_api_version": "2.7.0",
+ "output": "Service is unhealthy, not able to reach the backend!",
+ }
+ ]
+
+ mock_send_async_requests.return_value = [MockResponse()]
+
+ response = client.get("/health/")
+ assert response.status_code == status.HTTP_500_INTERNAL_SERVER_ERROR
+ assert response.headers["content-type"].startswith("application/health+json")
+ assert response.json() == [
+ {
+ "status": "fail",
+ "service_id": "pdbe",
+ "beacons_api_version": "2.7.0",
+ "output": "Service is unhealthy, not able to reach the backend!",
+ }
+ ]
diff --git a/tests/test_hub.py b/tests/test_hub.py
new file mode 100644
--- /dev/null
+++ b/tests/test_hub.py
@@ -0,0 +1,110 @@
+import asyncio
+
+import pytest
+from async_asgi_testclient import TestClient
+from starlette import status
+
+from app.app import app
+
+client = TestClient(app)
+
+
+# Using 'with TestClient' to test the startup and shutdown events
+@pytest.mark.asyncio
+async def test_get_uniprot_api(mocker, valid_uniprot, uniprot_details, registry):
+ async with TestClient(app) as client:
+ future = asyncio.Future()
+ future.set_result(uniprot_details)
+ mocker.patch(
+ "app.uniprot.helper.get_services", return_value=registry["services"]
+ )
+ mocker.patch("app.uniprot.uniprot.get_uniprot_helper", return_value=future)
+ mocker.patch(
+ "app.uniprot.helper.get_base_service_url", return_value="http://test"
+ )
+ response = await client.get(f"/uniprot/{valid_uniprot}.json")
+ assert response.status_code == status.HTTP_200_OK
+
+
+@pytest.mark.asyncio
+async def test_get_uniprot_summary_api(
+ mocker, valid_uniprot, uniprot_summary, registry
+):
+ future = asyncio.Future()
+ future.set_result(uniprot_summary)
+ mocker.patch("app.uniprot.helper.get_services", return_value=registry["services"])
+ mocker.patch("app.uniprot.uniprot.get_uniprot_summary_helper", return_value=future)
+ mocker.patch("app.uniprot.helper.get_base_service_url", return_value="http://test")
+ response = await client.get(f"/uniprot/summary/{valid_uniprot}.json")
+ assert response.status_code == status.HTTP_200_OK
+
+
+@pytest.mark.asyncio
+async def test_get_uniprot_summaries_api(mocker, uniprot_summary_obj_list, registry):
+ future = asyncio.Future()
+ future.set_result(uniprot_summary_obj_list)
+ mocker.patch("app.uniprot.helper.get_services", return_value=registry["services"])
+ mocker.patch(
+ "app.uniprot.uniprot.get_list_of_uniprot_summary_helper", return_value=future
+ )
+ mocker.patch("app.uniprot.helper.get_base_service_url", return_value="http://test")
+ response = await client.post(
+ "/uniprot/summary", json={"accessions": ["P12345", "P23456"]}
+ )
+
+ assert response.status_code == status.HTTP_200_OK
+
+
+@pytest.mark.asyncio
+async def test_get_ensembl_summaries_api(
+ mocker,
+ valid_gifts_response,
+ uniprot_summary_obj_list,
+):
+ mocker.patch(
+ "app.ensembl.ensembl.get_ensembl_mappings", return_value=valid_gifts_response
+ )
+
+ mocker.patch(
+ "app.ensembl.ensembl.get_list_of_uniprot_summary_helper",
+ return_value=uniprot_summary_obj_list,
+ )
+ mocker.patch(
+ "app.ensembl.ensembl.get_uniprot_api_results",
+ return_value={},
+ )
+ mocker.patch(
+ "app.ensembl.ensembl.get_uniprot_name",
+ return_value="Test protein",
+ )
+
+ response = await client.get(
+ "/ensembl/summary/ENSG00000288864.json",
+ )
+
+ assert response.status_code == status.HTTP_200_OK
+ response_json = response.json()
+ assert response_json["uniprot_mappings"]
+ assert all(
+ isinstance(mapping["ensembl_transcript"]["transcript_id"], str)
+ for mapping in response_json["uniprot_mappings"]
+ )
+
+
+@pytest.mark.asyncio
+async def test_annotations_api(
+ mocker, valid_annotation_response, registry, valid_uniprot
+):
+ future = asyncio.Future()
+ future.set_result(valid_annotation_response)
+ mocker.patch(
+ "app.annotations.annotations.get_services", return_value=registry["services"]
+ )
+ mocker.patch(
+ "app.annotations.annotations.get_annotations_api_helper", return_value=future
+ )
+ mocker.patch(
+ "app.annotations.annotations.get_base_service_url", return_value="http://test"
+ )
+ response = await client.get(f"/annotations/{valid_uniprot}.json?type=DOMAIN")
+ assert response.status_code == status.HTTP_200_OK
diff --git a/tests/test_sequence.py b/tests/test_sequence.py
new file mode 100644
--- /dev/null
+++ b/tests/test_sequence.py
@@ -0,0 +1,277 @@
+import asyncio
+
+import msgpack
+import pytest
+from async_asgi_testclient import TestClient
+from pydantic import ValidationError
+from starlette import status
+
+from app.app import app
+from app.constants import (
+ JOB_FAILED_ERROR_MESSAGE,
+ NO_JOB_FOUND_MESSAGE,
+ SEARCH_IN_PROGRESS_MESSAGE,
+)
+from app.exception import RequestSubmissionException
+from app.sequence.helper import submit_sequence_search_job
+from app.sequence.schema import SequenceIdType, SequenceOverview
+from app.sequence.sequence import fetch_sequence_summary
+from tests.utils import StubHttpResponse
+
+client = TestClient(app)
+
+
+@pytest.mark.asyncio
+async def test_search_job_id_from_cache(
+ mocker,
+ sample_sequence,
+ sample_sequence_hash,
+):
+ mocker.patch(
+ "app.sequence.sequence.get_jobdispatcher_id", return_value="non-existing-job-id"
+ )
+
+ response = await client.post("/sequence/search", json={"sequence": sample_sequence})
+
+ assert response.json() == {"job_id": sample_sequence_hash}
+ assert response.status_code == status.HTTP_200_OK
+
+
+@pytest.mark.asyncio
+async def test_result_api_no_job_id(
+ mocker,
+):
+ mocker.patch("app.sequence.sequence.get_celery_task_id", return_value=None)
+ clear_mock = mocker.patch("app.sequence.helper.clear_jobdispatcher_id")
+
+ response = await client.get(
+ "/sequence/result?job_id=ncbiblast-2021-01-01-12-12-12",
+ )
+
+ clear_mock.assert_called_once()
+ assert response.status_code == status.HTTP_400_BAD_REQUEST
+ assert response.json() == {"message": NO_JOB_FOUND_MESSAGE}
+
+
+@pytest.mark.asyncio
+async def test_result_api_valid_job_id_and_issue_in_celery_job(
+ mocker,
+ failed_async_result,
+):
+ mocker.patch(
+ "app.sequence.sequence.get_celery_task_id", return_value="valid-job-id"
+ )
+ mocker.patch("app.sequence.sequence.AsyncResult", return_value=failed_async_result)
+ clear_mock_one = mocker.patch("app.sequence.sequence.clear_jobdispatcher_id")
+ clear_mock_two = mocker.patch("app.sequence.sequence.clear_celery_task_id")
+
+ response = await client.get(
+ "/sequence/result?job_id=ncbiblast-2021-01-01-12-12-12",
+ )
+
+ clear_mock_one.assert_called_once()
+ clear_mock_two.assert_called_once()
+ assert response.status_code == status.HTTP_400_BAD_REQUEST
+ assert response.json() == {"message": JOB_FAILED_ERROR_MESSAGE}
+
+
+@pytest.mark.asyncio
+async def test_result_api_valid_job_id_and_job_pending(mocker, pending_async_result):
+ mocker.patch(
+ "app.sequence.sequence.get_celery_task_id", return_value="valid-job-id"
+ )
+
+ mocker.patch("app.sequence.sequence.AsyncResult", return_value=pending_async_result)
+
+ response = await client.get(
+ "/sequence/result?job_id=ncbiblast-2021-01-01-12-12-12",
+ )
+
+ assert response.status_code == status.HTTP_202_ACCEPTED
+ assert response.json() == {"message": SEARCH_IN_PROGRESS_MESSAGE}
+
+
+@pytest.mark.asyncio
+async def test_result_api_valid_job_id_and_job_finished(
+ mocker,
+ finished_none_async_result,
+):
+ future = asyncio.Future()
+ future.set_result(msgpack.dumps("ncbiblast-2021-01-01-12-12-12"))
+ mocker.patch(
+ "app.sequence.sequence.get_celery_task_id", return_value="valid-job-id"
+ )
+
+ mocker.patch(
+ "app.sequence.sequence.AsyncResult", return_value=finished_none_async_result
+ )
+
+ response = await client.get(
+ "/sequence/result?job_id=ncbiblast-2021-01-01-12-12-12",
+ )
+
+ assert response.status_code == status.HTTP_404_NOT_FOUND
+ assert response.json() == {}
+
+
+@pytest.mark.asyncio
+async def test_submit_sequence_search_job_valid(mocker, sample_sequence):
+ future = asyncio.Future()
+ future.set_result(
+ StubHttpResponse(status_code=200, data="ncbiblast-2021-01-01-12-12-12")
+ )
+ mocker.patch("app.sequence.helper.request_post", return_value=future)
+
+ with pytest.raises(RequestSubmissionException):
+ assert (
+ await submit_sequence_search_job(sample_sequence)
+ == "ncbiblast-2021-01-01-12-12-12"
+ )
+
+
+@pytest.mark.asyncio
+async def test_submit_sequence_search_job_invalid(mocker, sample_sequence):
+ future = asyncio.Future()
+ future.set_result(None)
+ mocker.patch("app.sequence.helper.request_post", return_value=future)
+
+ with pytest.raises(RequestSubmissionException):
+ assert await submit_sequence_search_job(sample_sequence)
+
+ @pytest.mark.asyncio
+ async def test_fetch_sequence_summary_success(mocker):
+ # Mock get_services to return a single service
+ mocker.patch(
+ "app.sequence.sequence.get_services",
+ return_value=[
+ {"provider": "test_provider", "accessPoint": "test_access"}
+ ],
+ )
+ # Mock get_base_service_url to return a base url
+ mocker.patch(
+ "app.sequence.sequence.get_base_service_url",
+ return_value="http://test-service",
+ )
+ # Mock get_final_service_url to return a final url
+ mocker.patch(
+ "app.sequence.sequence.get_final_service_url",
+ return_value="http://test-service/test_access?id=abc&type=sequence",
+ )
+ # Prepare a valid response
+ valid_json = {
+ "entry": {"id": "abc", "name": "test_entry"},
+ "structures": [
+ {"id": "str1", "provider": "test_provider", "other_field": "value"}
+ ],
+ }
+
+ # Patch send_async_requests to return a list with a mock response
+ class MockResponse:
+ status_code = 200
+
+ def json(self):
+ return valid_json
+
+ mocker.patch(
+ "app.sequence.sequence.send_async_requests",
+ return_value=[MockResponse()],
+ )
+ # Patch SequenceOverview and Entry to accept the test dicts
+ mocker.patch(
+ "app.sequence.sequence.SequenceOverview",
+ side_effect=lambda **kwargs: type("S", (), kwargs)(),
+ )
+ mocker.patch(
+ "app.sequence.sequence.Entry",
+ side_effect=lambda **kwargs: type("E", (), kwargs)(),
+ )
+ # Patch SequenceSummary to accept the test dicts
+ mocker.patch(
+ "app.sequence.sequence.SequenceSummary",
+ side_effect=lambda **kwargs: type("SS", (), kwargs)(),
+ )
+
+ result = await fetch_sequence_summary("abc", SequenceIdType.SEQUENCE)
+ assert result is not None
+
+ @pytest.mark.asyncio
+ async def test_fetch_sequence_summary_no_services(mocker):
+ mocker.patch("app.sequence.sequence.get_services", return_value=[])
+ result = await fetch_sequence_summary("abc", SequenceIdType.SEQUENCE)
+ assert result is None
+
+ @pytest.mark.asyncio
+ async def test_fetch_sequence_summary_no_valid_responses(mocker):
+ mocker.patch(
+ "app.sequence.sequence.get_services",
+ return_value=[
+ {"provider": "test_provider", "accessPoint": "test_access"}
+ ],
+ )
+ mocker.patch(
+ "app.sequence.sequence.get_base_service_url",
+ return_value="http://test-service",
+ )
+ mocker.patch(
+ "app.sequence.sequence.get_final_service_url",
+ return_value="http://test-service/test_access?id=abc&type=sequence",
+ )
+
+ # Mock send_async_requests to return a response with non-200 status
+ class MockResponse:
+ status_code = 404
+
+ def json(self):
+ return {}
+
+ mocker.patch(
+ "app.sequence.sequence.send_async_requests",
+ return_value=[MockResponse()],
+ )
+ result = await fetch_sequence_summary("abc", SequenceIdType.SEQUENCE)
+ assert result is None
+
+ @pytest.mark.asyncio
+ async def test_fetch_sequence_summary_invalid_structure_response(mocker):
+ mocker.patch(
+ "app.sequence.sequence.get_services",
+ return_value=[
+ {"provider": "test_provider", "accessPoint": "test_access"}
+ ],
+ )
+ mocker.patch(
+ "app.sequence.sequence.get_base_service_url",
+ return_value="http://test-service",
+ )
+ mocker.patch(
+ "app.sequence.sequence.get_final_service_url",
+ return_value="http://test-service/test_access?id=abc&type=sequence",
+ )
+ # Prepare a response with an invalid structure (will raise ValidationError)
+ invalid_json = {
+ "entry": {"id": "abc", "name": "test_entry"},
+ "structures": [
+ {
+ "provider": "test_provider"
+ # missing required fields for SequenceOverview
+ }
+ ],
+ }
+
+ class MockResponse:
+ status_code = 200
+
+ def json(self):
+ return invalid_json
+
+ mocker.patch(
+ "app.sequence.sequence.send_async_requests",
+ return_value=[MockResponse()],
+ )
+ # Patch SequenceOverview to raise ValidationError
+ mocker.patch(
+ "app.sequence.sequence.SequenceOverview",
+ side_effect=ValidationError([], model=SequenceOverview),
+ )
+ result = await fetch_sequence_summary("abc", SequenceIdType.SEQUENCE)
+ assert result is None
diff --git a/tests/test_utils.py b/tests/test_utils.py
new file mode 100644
--- /dev/null
+++ b/tests/test_utils.py
@@ -0,0 +1,97 @@
+from app.config import get_base_service_url, get_services
+from app.uniprot.uniprot import filter_on_checksum, get_first_entry_with_checksum
+from app.utils import get_final_service_url
+from app.version import __major__version__
+
+
+def test_get_final_service_url():
+ assert (
+ get_final_service_url("http://example.com", "api", "v1")
+ == f"http://example.com/api/v1?version={__major__version__}"
+ )
+
+
+def test_filter_on_checksum():
+ in_list = [
+ {"uniprot_entry": {"uniprot_checksum": "123"}},
+ {"uniprot_entry": {"uniprot_checksum": "1234"}},
+ {"uniprot_entry": {}},
+ ]
+
+ assert filter_on_checksum(in_list, "123") == [
+ {"uniprot_entry": {"uniprot_checksum": "123"}}
+ ]
+
+
+def test_get_first_entry_with_checksum_valid():
+ in_list = [
+ {"uniprot_entry": {"ac": "P12345"}},
+ {"uniprot_entry": {"ac": "P23456", "uniprot_checksum": "123"}},
+ {"uniprot_entry": {"ac": "P34567", "uniprot_checksum": "123"}},
+ ]
+
+ assert get_first_entry_with_checksum(in_list) == {
+ "ac": "P23456",
+ "uniprot_checksum": "123",
+ }
+
+
+def test_get_first_entry_with_checksum_none():
+ in_list = []
+
+ assert not get_first_entry_with_checksum(in_list)
+
+
+def test_get_first_entry_with_checksum_valid_no_checksum():
+ in_list = [
+ {"uniprot_entry": {"ac": "P12345"}},
+ {"uniprot_entry": {"ac": "P23456"}},
+ {"uniprot_entry": {"ac": "P34567"}},
+ ]
+
+ assert get_first_entry_with_checksum(in_list) == {"ac": "P12345"}
+
+
+def test_get_services(mocker, registry):
+ mocker.patch("app.config.read_data_file", return_value=registry)
+ assert get_services(service_type="serviceOne") == [
+ {
+ "serviceType": "serviceOne",
+ "provider": "providerOne",
+ "accessPoint": "service/",
+ },
+ {
+ "serviceType": "serviceOne",
+ "provider": "providerTwo",
+ "accessPoint": "service/v/",
+ },
+ ]
+
+
+def test_get_services_exclude_provider(mocker, registry):
+ mocker.patch("app.config.read_data_file", return_value=registry)
+ assert get_services(service_type="serviceOne", exclude_provider="providerTwo") == [
+ {
+ "serviceType": "serviceOne",
+ "provider": "providerOne",
+ "accessPoint": "service/",
+ },
+ ]
+
+
+def test_get_services_provider(mocker, registry):
+ mocker.patch("app.config.read_data_file", return_value=registry)
+ assert get_services(service_type="serviceOne", provider="providerOne") == [
+ {
+ "serviceType": "serviceOne",
+ "provider": "providerOne",
+ "accessPoint": "service/",
+ },
+ ]
+
+
+def test_get_base_service_url(mocker, registry):
+ mocker.patch("app.config.get_providers", return_value=registry["providers"])
+ assert (
+ get_base_service_url("providerOneId") == "https://providerOneDevBaseServiceUrl"
+ )
diff --git a/tests/test_worker.py b/tests/test_worker.py
new file mode 100644
--- /dev/null
+++ b/tests/test_worker.py
@@ -0,0 +1,58 @@
+import json
+
+import pytest
+
+from tests.utils import StubHttpResponse
+from worker.helper import (
+ JobResultsNotFoundException,
+ filter_json_results,
+ get_job_dispatcher_json_results,
+ prepare_accession_list,
+ prepare_hit_dictionary,
+)
+from worker.schema import AccessionListRequest
+
+
+def test_prepare_accession_list():
+ accessions = ["P12345", "P23456", "P34567"]
+ assert prepare_accession_list(accessions) == AccessionListRequest(
+ accessions=accessions
+ )
+
+
+def test_filter_json_results_90(seq_search_response):
+ assert len(filter_json_results(seq_search_response.data, 90)) == 6
+
+
+def test_filter_json_results_95(seq_search_response):
+ assert len(filter_json_results(seq_search_response.data, 95)) == 4
+
+
+def test_prepare_hit_dictionary(seq_search_response):
+ filtered_hits = filter_json_results(seq_search_response.data, 95)
+ expected_hit_dictionary = {}
+
+ with open("tests/stubs/hit_dictionary.json", "r") as f:
+ expected_hit_dictionary = json.loads(f.read())
+
+ assert prepare_hit_dictionary(filtered_hits) == expected_hit_dictionary
+
+
+@pytest.mark.asyncio
+async def test_get_job_dispatcher_json_results_valid(mocker, sample_sequence_hash):
+ mocker.patch(
+ "worker.helper.requests.get",
+ return_value=StubHttpResponse(status_code=200, data={"results": "results"}),
+ )
+
+ assert get_job_dispatcher_json_results(sample_sequence_hash) == {
+ "results": "results"
+ }
+
+
+@pytest.mark.asyncio
+async def test_get_job_dispatcher_json_results_invalid(mocker, sample_sequence_hash):
+ mocker.patch("worker.helper.requests.get", return_value=None)
+
+ with pytest.raises(JobResultsNotFoundException):
+ assert get_job_dispatcher_json_results(sample_sequence_hash)
diff --git a/tests/utils.py b/tests/utils.py
new file mode 100644
--- /dev/null
+++ b/tests/utils.py
@@ -0,0 +1,47 @@
+import json
+
+
+async def request_get_stub(url: str, stub_for: str, status_code: int = 200):
+ """Returns an object with stub response.
+
+ Args:
+ url (str): A request URL.
+ stub_for (str): Type of stub required.
+
+ Returns:
+ StubResponse: A StubResponse object.
+ """
+ return StubResponse(stub_for=stub_for, status_code=status_code)
+
+
+class StubResponse:
+ """A Stub response class to return a response from JSON."""
+
+ def __init__(self, status_code: int, stub_for: str) -> None:
+ self.status_code = status_code
+ self.prefix = "tests/stubs/"
+ self.data = {}
+
+ with open(f"{self.prefix}/{stub_for}.json") as f:
+ self.data = json.load(f)
+
+ def json(self):
+ return self.data
+
+
+class Content:
+ def __init__(self, data) -> None:
+ self.data = data
+
+ def decode(self):
+ return self.data
+
+
+class StubHttpResponse:
+ def __init__(self, status_code: int, data):
+ self.status_code = status_code
+ self.content = Content(data)
+ self.data = data
+
+ def json(self):
+ return self.data
diff --git a/tests/stubs/annotations_response.json b/tests/stubs/annotations_response.json
new file mode 100644
--- /dev/null
+++ b/tests/stubs/annotations_response.json
@@ -0,0 +1,49 @@
+{
+ "accession": "Q14676",
+ "id": "MDC1_HUMAN",
+ "sequence": "MEDTQAIDWDVEEEEETEQSSESLRCNVEPVGRLHIFSGAHGPEKDFPLHLGKNVVGRMPDCSVALPFPSISKQHAEIEILAWDKAPILRDCGSLNGTQILRPPKVLSPGVSHRLRDQELILFADLLCQYHRLDVSLPFVSRGPLTVEETPRVQGETQPQRLLLAEDSEEEVDFLSERRMVKKSRTTSSSVIVPESDEEGHSPVLGGLGPPFAFNLNSDTDVEEGQQPATEEASSAARRGATVEAKQSEAEVVTEIQLEKDQPLVKERDNDTKVKRGAGNGVVPAGVILERSQPPGEDSDTDVDDDSRPPGRPAEVHLERAQPFGFIDSDTDAEEERIPATPVVIPMKKRKIFHGVGTRGPGAPGLAHLQESQAGSDTDVEEGKAPQAVPLEKSQASMVINSDTDDEEEVSAALTLAHLKESQPAIWNRDAEEDMPQRVVLLQRSQTTTERDSDTDVEEEELPVENREAVLKDHTKIRALVRAHSEKDQPPFGDSDDSVEADKSSPGIHLERSQASTTVDINTQVEKEVPPGSAIIHIKKHQVSVEGTNQTDVKAVGGPAKLLVVSLEEAWPLHGDCETDAEEGTSLTASVVADVRKSQLPAEGDAGAEWAAAVLKQERAHEVGAQGGPPVAQVEQDLPISRENLTDLVVDTDTLGESTQPQREGAQVPTGREREQHVGGTKDSEDNYGDSEDLDLQATQCFLENQGLEAVQSMEDEPTQAFMLTPPQELGPSHCSFQTTGTLDEPWEVLATQPFCLRESEDSETQPFDTHLEAYGPCLSPPRAIPGDQHPESPVHTEPMGIQGRGRQTVDKVMGIPKETAERVGPERGPLERETEKLLPERQTDVTGEEELTKGKQDREQKQLLARDTQRQESDKNGESASPERDRESLKVEIETSEEIQEKQVQKQTLPSKAFEREVERPVANRECDPAELEEKVPKVILERDTQRGEPEGGSQDQKGQASSPTPEPGVGAGDLPGPTSAPVPSGSQSGGRGSPVSPRRHQKGLLNCKMPPAEKASRIRAAEKVSRGDQESPDACLPPTVPEAPAPPQKPLNSQSQKHLAPPPLLSPLLPSIKPTVRKTRQDGSQEAPEAPLSSELEPFHPKPKIRTRKSSRMTPFPATSAAPEPHPSTSTAQPVTPKPTSQATRSRTNRSSVKTPEPVVPTAPELQPSTSTDQPVTSEPTSQVTRGRKSRSSVKTPETVVPTALELQPSTSTDRPVTSEPTSQATRGRKNRSSVKTPEPVVPTAPELQPSTSTDQPVTSEPTYQATRGRKNRSSVKTPEPVVPTAPELRPSTSTDRPVTPKPTSRTTRSRTNMSSVKTPETVVPTAPELQISTSTDQPVTPKPTSRTTRSRTNMSSVKNPESTVPIAPELPPSTSTEQPVTPEPTSRATRGRKNRSSGKTPETLVPTAPKLEPSTSTDQPVTPEPTSQATRGRTNRSSVKTPETVVPTAPELQPSTSTDQPVTPEPTSQATRGRTDRSSVKTPETVVPTAPELQASASTDQPVTSEPTSRTTRGRKNRSSVKTPETVVPAAPELQPSTSTDQPVTPEPTSRATRGRTNRSSVKTPESIVPIAPELQPSTSRNQLVTPEPTSRATRCRTNRSSVKTPEPVVPTAPEPHPTTSTDQPVTPKLTSRATRRKTNRSSVKTPKPVEPAASDLEPFTPTDQSVTPEAIAQGGQSKTLRSSTVRAMPVPTTPEFQSPVTTDQPISPEPITQPSCIKRQRAAGNPGSLAAPIDHKPCSAPLEPKSQASRNQRWGAVRAAESLTAIPEPASPQLLETPIHASQIQKVEPAGRSRFTPELQPKASQSRKRSLATMDSPPHQKQPQRGEVSQKTVIIKEEEEDTAEKPGKEEDVVTPKPGKRKRDQAEEEPNRIPSRSLRRTKLNQESTAPKVLFTGVVDARGERAVLALGGSLAGSAAEASHLVTDRIRRTVKFLCALGRGIPILSLDWLHQSRKAGFFLPPDEYVVTDPEQEKNFGFSLQDALSRARERRLLEGYEIYVTPGVQPPPPQMGEIISCCGGTYLPSMPRSYKPQRVVITCPQDFPHCSIPLRVGLPLLSPEFLLTGVLKQEAKPEAFVLSPLEMSST",
+ "annotation": [
+ {
+ "type": "DOMAIN",
+ "description": "Tumour Suppressor Smad4 (3uotA00)",
+ "source_name": "CATH",
+ "evidence": "COMPUTATIONAL/PREDICTED",
+ "residues": [
+ 19,
+ 20,
+ 21,
+ 22,
+ 23
+ ],
+ "regions": [
+ {
+ "start": 19,
+ "end": 23
+ }
+ ]
+ },
+ {
+ "type": "DOMAIN",
+ "description": "BRCT domain (IPR001357)",
+ "source_name": "InterPro",
+ "evidence": "COMPUTATIONAL/PREDICTED",
+ "residues": [
+ 1889,
+ 1890,
+ 1891,
+ 1892,
+ 1893,
+ 1894,
+ 1895,
+ 1896,
+ 1897
+ ],
+ "regions": [
+ {
+ "start": 1889,
+ "end": 1897
+ }
+ ]
+ }
+ ]
+ }
diff --git a/tests/stubs/gifts_response.json b/tests/stubs/gifts_response.json
new file mode 100644
--- /dev/null
+++ b/tests/stubs/gifts_response.json
@@ -0,0 +1,1 @@
+{"taxonomy":{"species":"Homo sapiens","ensemblTaxId":9606,"uniprotTaxId":9606},"entryMappings":[{"id":3946552,"mappingId":5357997,"groupingId":2010220,"timeMapped":"2022-05-31T12:31:15.321882Z","uniprotRelease":"2022_02","ensemblRelease":"105","uniprotEntry":{"uniprot_id":1263210,"uniprotAccession":"A0A8I5KS94","entryType":"TrEMBL","sequenceVersion":1,"upi":"UPI001E246DBC","md5":"2664563FCA54B44536D4380662BE87E3","isCanonical":true,"alias":null,"ensemblDerived":true,"gene_symbol":"ARHGAP11A-SCG5","gene_accession":"","length":623,"protein_existence_id":4},"ensemblTranscript":{"transcript_id":5507799,"enstId":"ENST00000689909","enstVersion":1,"upi":null,"biotype":"protein_coding","deleted":false,"chromosome":"15","regionAccession":"CM000677.2","seqRegionStart":32613860,"seqRegionEnd":32697077,"seqRegionStrand":1,"ensgId":"ENSG00000288864","ensgName":"ARHGAP11A-SCG5 readthrough","sequence":null,"ensgSymbol":"ARHGAP11A-SCG5","ensgAccession":"114118903","ensgRegionAccession":"CM000677.2","enspId":"ENSP00000510704","enspLen":623,"source":"havana","select":null},"alignment_difference":0,"status":"NOT_REVIEWED","status_history":[]},{"id":3946310,"mappingId":5357480,"groupingId":2010220,"timeMapped":"2022-05-31T12:31:15.321882Z","uniprotRelease":"2022_02","ensemblRelease":"105","uniprotEntry":{"uniprot_id":1263749,"uniprotAccession":"A0A8I5KWH8","entryType":"TrEMBL","sequenceVersion":1,"upi":"UPI00100D9C18","md5":"2AD04D04A00DD95D1864432478D7E2F7","isCanonical":true,"alias":null,"ensemblDerived":true,"gene_symbol":"ARHGAP11A-SCG5","gene_accession":"","length":625,"protein_existence_id":4},"ensemblTranscript":{"transcript_id":5507800,"enstId":"ENST00000692248","enstVersion":1,"upi":"UPI00100D9C18","biotype":"protein_coding","deleted":false,"chromosome":"15","regionAccession":"CM000677.2","seqRegionStart":32615448,"seqRegionEnd":32697095,"seqRegionStrand":1,"ensgId":"ENSG00000288864","ensgName":"ARHGAP11A-SCG5 readthrough","sequence":null,"ensgSymbol":"ARHGAP11A-SCG5","ensgAccession":"114118903","ensgRegionAccession":"CM000677.2","enspId":"ENSP00000510771","enspLen":625,"source":"havana","select":null},"alignment_difference":null,"status":"NOT_REVIEWED","status_history":[]}]}
diff --git a/tests/stubs/hit_dictionary.json b/tests/stubs/hit_dictionary.json
new file mode 100644
--- /dev/null
+++ b/tests/stubs/hit_dictionary.json
@@ -0,0 +1,86 @@
+{
+ "B4DKT3": {
+ "accession": "B4DKT3",
+ "description": "cDNA FLJ58390, highly similar to Aldo-keto reductase family 1 member C3homolog OS=Homo sapiens OX=9606 PE=2 SV=1",
+ "hit_length": 138,
+ "id": "B4DKT3_HUMAN",
+ "hit_uni_os":"Homo sapiens",
+ "hit_uni_ox": 9606,
+ "hit_hsps": [
+ {
+ "hsp_score": 637,
+ "hsp_bit_score": 249.98,
+ "hsp_expect": 1.8e-83,
+ "hsp_align_len": 122,
+ "hsp_identity": 100,
+ "hsp_positive": 100,
+ "hsp_qseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK",
+ "hsp_mseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK",
+ "hsp_hseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK"
+ }
+ ]
+ },
+ "A0A2I3HVB7": {
+ "accession": "A0A2I3HVB7",
+ "description": "Aldo-keto reductase family 1 member C3 OS=Nomascus leucogenys OX=61853 GN=AKR1C3 PE=3 SV=1",
+ "hit_length": 323,
+ "id": "A0A2I3HVB7_NOMLE",
+ "hit_uni_os": "Nomascus leucogenys",
+ "hit_uni_ox": 61853,
+ "hit_hsps": [
+ {
+ "hsp_score": 637,
+ "hsp_bit_score": 249.98,
+ "hsp_align_len": 122,
+ "hsp_expect": 7.7e-81,
+ "hsp_identity": 100,
+ "hsp_positive": 100,
+ "hsp_qseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK",
+ "hsp_mseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK",
+ "hsp_hseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK"
+ }
+ ]
+ },
+ "A0A2R9A0L9": {
+ "accession": "A0A2R9A0L9",
+ "description": "Aldo-keto reductase family 1 member C3 OS=Pan paniscus OX=9597 GN=AKR1C3 PE=3 SV=1",
+ "hit_length": 323,
+ "id": "A0A2R9A0L9_PANPA",
+ "hit_uni_os": "Pan paniscus",
+ "hit_uni_ox": 9597,
+ "hit_hsps": [
+ {
+ "hsp_score": 637,
+ "hsp_bit_score": 249.98,
+ "hsp_align_len": 122,
+ "hsp_expect": 7.7e-81,
+ "hsp_identity": 100,
+ "hsp_positive": 100,
+ "hsp_qseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK",
+ "hsp_mseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK",
+ "hsp_hseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK"
+ }
+ ]
+ },
+ "K7D0S3": {
+ "accession": "K7D0S3",
+ "description": "Aldo-keto reductase family 1, member C3 (3-alpha hydroxysteroid dehydrogenase, type II) OS=Pan troglodytes OX=9598 GN=AKR1C3 PE=2 SV=1",
+ "hit_length": 323,
+ "id": "K7D0S3_PANTR",
+ "hit_uni_os": "Pan troglodytes",
+ "hit_uni_ox": 9598,
+ "hit_hsps": [
+ {
+ "hsp_score": 637,
+ "hsp_bit_score": 249.98,
+ "hsp_align_len": 122,
+ "hsp_expect": 7.7e-81,
+ "hsp_identity": 95,
+ "hsp_positive": 100,
+ "hsp_qseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK",
+ "hsp_mseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK",
+ "hsp_hseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK"
+ }
+ ]
+ }
+}
diff --git a/tests/stubs/registry.json b/tests/stubs/registry.json
new file mode 100644
--- /dev/null
+++ b/tests/stubs/registry.json
@@ -0,0 +1,37 @@
+{
+ "providers": [
+ {
+ "providerId": "providerOneId",
+ "providerName": "providerOneName",
+ "providerDescription": "providerOneDesc",
+ "providerUrl": "https://providerOneUrl",
+ "baseServiceUrl": "https://providerOneBaseServiceUrl",
+ "devBaseServiceUrl": "https://providerOneDevBaseServiceUrl"
+ },
+ {
+ "providerId": "providerTwoId",
+ "providerName": "providerTwoName",
+ "providerDescription": "providerTwoDesc",
+ "providerUrl": "https://providerTwoUrl",
+ "baseServiceUrl": "https://providerTwoBaseServiceUrl",
+ "devBaseServiceUrl": "https://providerTwoDevBaseServiceUrl"
+ }
+ ],
+ "services": [
+ {
+ "serviceType": "serviceOne",
+ "provider": "providerOne",
+ "accessPoint": "service/"
+ },
+ {
+ "serviceType": "serviceOne",
+ "provider": "providerTwo",
+ "accessPoint": "service/v/"
+ },
+ {
+ "serviceType": "serviceTwo",
+ "provider": "providerOne",
+ "accessPoint": "service/2/"
+ }
+ ]
+}
diff --git a/tests/stubs/seq_search_response.json b/tests/stubs/seq_search_response.json
new file mode 100644
--- /dev/null
+++ b/tests/stubs/seq_search_response.json
@@ -0,0 +1,427 @@
+{
+ "program": "blastp",
+ "version": "BLASTP 2.12.0+",
+ "command": "$APPBIN/ncbi-blast-2.9.0+/bin/blastp -db "uniprotkb" -query ncbiblast-R20230109-174035-0934-49668747-p2m.sequence -num_threads 32 -outfmt 11 -out ncbiblast-R20230109-174035-0934-49668747-p2m.archive -seg no -comp_based_stats F",
+ "query_def": "EMBOSS_001",
+ "query_stype": "protein",
+ "query_len": 129,
+ "db_count": 1,
+ "db_num": 230190369,
+ "db_len": 81010115241,
+ "dbs": [
+ {
+ "name": "uniprotkb",
+ "stype": "protein",
+ "created": "2022-12-14T02:19:00+00:00"
+ }
+ ],
+ "expect_upper": 10,
+ "filter": "F",
+ "gap_extend": 1,
+ "gap_open": 11,
+ "matrix": "BLOSUM62",
+ "start": "2023-01-09T17:40:35+00:00",
+ "end": "2023-01-09T17:43:29+00:00",
+ "search": "P0Y0M0DT0H0M174.000S",
+ "hits": [
+ {
+ "hit_num": 1,
+ "hit_def": "TR:B4DKT3 B4DKT3_HUMAN cDNA FLJ58390, highly similar to Aldo-keto reductase family 1 member C3homolog OS=Homo sapiens OX=9606 PE=2 SV=1",
+ "hit_db": "TR",
+ "hit_id": "B4DKT3_HUMAN",
+ "hit_acc": "B4DKT3",
+ "hit_desc": "cDNA FLJ58390, highly similar to Aldo-keto reductase family 1 member C3homolog OS=Homo sapiens OX=9606 PE=2 SV=1",
+ "hit_url": "https://www.uniprot.org/uniprot/B4DKT3",
+ "hit_xref_url": "https://www.ebi.ac.uk/ebisearch/search.ebi?db=uniprot&query=B4DKT3",
+ "hit_os": "Homo sapiens",
+ "hit_uni_de": "cDNA FLJ58390, highly similar to Aldo-keto reductase family 1 member C3homolog",
+ "hit_uni_os": "Homo sapiens",
+ "hit_uni_ox": "9606",
+ "hit_uni_pe": "2",
+ "hit_uni_sv": "1",
+ "hit_len": 138,
+ "hit_hsps": [
+ {
+ "hsp_num": 1,
+ "hsp_score": 637,
+ "hsp_bit_score": 249.98,
+ "hsp_expect": 1.8e-83,
+ "hsp_align_len": 122,
+ "hsp_identity": 100,
+ "hsp_positive": 100,
+ "hsp_gaps": 0,
+ "hsp_query_frame": "0",
+ "hsp_hit_frame": "0",
+ "hsp_strand": "none/none",
+ "hsp_query_from": 8,
+ "hsp_query_to": 129,
+ "hsp_hit_from": 2,
+ "hsp_hit_to": 123,
+ "hsp_qseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK",
+ "hsp_mseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK",
+ "hsp_hseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK"
+ }
+ ]
+ },
+ {
+ "hit_num": 2,
+ "hit_def": "TR:A0A2I3HVB7 A0A2I3HVB7_NOMLE Aldo-keto reductase family 1 member C3 OS=Nomascus leucogenys OX=61853 GN=AKR1C3 PE=3 SV=1",
+ "hit_db": "TR",
+ "hit_id": "A0A2I3HVB7_NOMLE",
+ "hit_acc": "A0A2I3HVB7",
+ "hit_desc": "Aldo-keto reductase family 1 member C3 OS=Nomascus leucogenys OX=61853 GN=AKR1C3 PE=3 SV=1",
+ "hit_url": "https://www.uniprot.org/uniprot/A0A2I3HVB7",
+ "hit_xref_url": "https://www.ebi.ac.uk/ebisearch/search.ebi?db=uniprot&query=A0A2I3HVB7",
+ "hit_os": "Nomascus leucogenys",
+ "hit_uni_de": "Aldo-keto reductase family 1 member C3",
+ "hit_uni_os": "Nomascus leucogenys",
+ "hit_uni_ox": "61853",
+ "hit_uni_gn": "AKR1C3",
+ "hit_uni_pe": "3",
+ "hit_uni_sv": "1",
+ "hit_len": 323,
+ "hit_hsps": [
+ {
+ "hsp_num": 1,
+ "hsp_score": 637,
+ "hsp_bit_score": 249.98,
+ "hsp_expect": 7.7e-81,
+ "hsp_align_len": 122,
+ "hsp_identity": 100,
+ "hsp_positive": 100,
+ "hsp_gaps": 0,
+ "hsp_query_frame": "0",
+ "hsp_hit_frame": "0",
+ "hsp_strand": "none/none",
+ "hsp_query_from": 8,
+ "hsp_query_to": 129,
+ "hsp_hit_from": 2,
+ "hsp_hit_to": 123,
+ "hsp_qseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK",
+ "hsp_mseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK",
+ "hsp_hseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK"
+ }
+ ]
+ },
+ {
+ "hit_num": 3,
+ "hit_def": "TR:A0A2R9A0L9 A0A2R9A0L9_PANPA Aldo-keto reductase family 1 member C3 OS=Pan paniscus OX=9597 GN=AKR1C3 PE=3 SV=1",
+ "hit_db": "TR",
+ "hit_id": "A0A2R9A0L9_PANPA",
+ "hit_acc": "A0A2R9A0L9",
+ "hit_desc": "Aldo-keto reductase family 1 member C3 OS=Pan paniscus OX=9597 GN=AKR1C3 PE=3 SV=1",
+ "hit_url": "https://www.uniprot.org/uniprot/A0A2R9A0L9",
+ "hit_xref_url": "https://www.ebi.ac.uk/ebisearch/search.ebi?db=uniprot&query=A0A2R9A0L9",
+ "hit_os": "Pan paniscus",
+ "hit_uni_de": "Aldo-keto reductase family 1 member C3",
+ "hit_uni_os": "Pan paniscus",
+ "hit_uni_ox": "9597",
+ "hit_uni_gn": "AKR1C3",
+ "hit_uni_pe": "3",
+ "hit_uni_sv": "1",
+ "hit_len": 323,
+ "hit_hsps": [
+ {
+ "hsp_num": 1,
+ "hsp_score": 637,
+ "hsp_bit_score": 249.98,
+ "hsp_expect": 7.7e-81,
+ "hsp_align_len": 122,
+ "hsp_identity": 100,
+ "hsp_positive": 100,
+ "hsp_gaps": 0,
+ "hsp_query_frame": "0",
+ "hsp_hit_frame": "0",
+ "hsp_strand": "none/none",
+ "hsp_query_from": 8,
+ "hsp_query_to": 129,
+ "hsp_hit_from": 2,
+ "hsp_hit_to": 123,
+ "hsp_qseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK",
+ "hsp_mseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK",
+ "hsp_hseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK"
+ }
+ ]
+ },
+ {
+ "hit_num": 4,
+ "hit_def": "TR:K7D0S3 K7D0S3_PANTR Aldo-keto reductase family 1, member C3 (3-alpha hydroxysteroid dehydrogenase, type II) OS=Pan troglodytes OX=9598 GN=AKR1C3 PE=2 SV=1",
+ "hit_db": "TR",
+ "hit_id": "K7D0S3_PANTR",
+ "hit_acc": "K7D0S3",
+ "hit_desc": "Aldo-keto reductase family 1, member C3 (3-alpha hydroxysteroid dehydrogenase, type II) OS=Pan troglodytes OX=9598 GN=AKR1C3 PE=2 SV=1",
+ "hit_url": "https://www.uniprot.org/uniprot/K7D0S3",
+ "hit_xref_url": "https://www.ebi.ac.uk/ebisearch/search.ebi?db=uniprot&query=K7D0S3",
+ "hit_os": "Pan troglodytes",
+ "hit_uni_de": "Aldo-keto reductase family 1, member C3 (3-alpha hydroxysteroid dehydrogenase, type II)",
+ "hit_uni_os": "Pan troglodytes",
+ "hit_uni_ox": "9598",
+ "hit_uni_gn": "AKR1C3",
+ "hit_uni_pe": "2",
+ "hit_uni_sv": "1",
+ "hit_len": 323,
+ "hit_hsps": [
+ {
+ "hsp_num": 1,
+ "hsp_score": 637,
+ "hsp_bit_score": 249.98,
+ "hsp_expect": 7.7e-81,
+ "hsp_align_len": 122,
+ "hsp_identity": 95,
+ "hsp_positive": 100,
+ "hsp_gaps": 0,
+ "hsp_query_frame": "0",
+ "hsp_hit_frame": "0",
+ "hsp_strand": "none/none",
+ "hsp_query_from": 8,
+ "hsp_query_to": 129,
+ "hsp_hit_from": 2,
+ "hsp_hit_to": 123,
+ "hsp_qseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK",
+ "hsp_mseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK",
+ "hsp_hseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK"
+ }
+ ]
+ },
+ {
+ "hit_num": 5,
+ "hit_def": "TR:A0A6D2VZ66 A0A6D2VZ66_PANTR AKR1C3 isoform 2 OS=Pan troglodytes OX=9598 GN=CK820_G0036122 PE=3 SV=1",
+ "hit_db": "TR",
+ "hit_id": "A0A6D2VZ66_PANTR",
+ "hit_acc": "A0A6D2VZ66",
+ "hit_desc": "AKR1C3 isoform 2 OS=Pan troglodytes OX=9598 GN=CK820_G0036122 PE=3 SV=1",
+ "hit_url": "https://www.uniprot.org/uniprot/A0A6D2VZ66",
+ "hit_xref_url": "https://www.ebi.ac.uk/ebisearch/search.ebi?db=uniprot&query=A0A6D2VZ66",
+ "hit_os": "Pan troglodytes",
+ "hit_uni_de": "AKR1C3 isoform 2",
+ "hit_uni_os": "Pan troglodytes",
+ "hit_uni_ox": "9598",
+ "hit_uni_gn": "CK820_G0036122",
+ "hit_uni_pe": "3",
+ "hit_uni_sv": "1",
+ "hit_len": 323,
+ "hit_hsps": [
+ {
+ "hsp_num": 1,
+ "hsp_score": 637,
+ "hsp_bit_score": 249.98,
+ "hsp_expect": 7.7e-81,
+ "hsp_align_len": 122,
+ "hsp_identity": 94,
+ "hsp_positive": 100,
+ "hsp_gaps": 0,
+ "hsp_query_frame": "0",
+ "hsp_hit_frame": "0",
+ "hsp_strand": "none/none",
+ "hsp_query_from": 8,
+ "hsp_query_to": 129,
+ "hsp_hit_from": 2,
+ "hsp_hit_to": 123,
+ "hsp_qseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK",
+ "hsp_mseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK",
+ "hsp_hseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK"
+ }
+ ]
+ },
+ {
+ "hit_num": 6,
+ "hit_def": "TR:K7CEU8 K7CEU8_PANTR Aldo-keto reductase family 1, member C3 (3-alpha hydroxysteroid dehydrogenase, type II) OS=Pan troglodytes OX=9598 GN=AKR1C3 PE=2 SV=1",
+ "hit_db": "TR",
+ "hit_id": "K7CEU8_PANTR",
+ "hit_acc": "K7CEU8",
+ "hit_desc": "Aldo-keto reductase family 1, member C3 (3-alpha hydroxysteroid dehydrogenase, type II) OS=Pan troglodytes OX=9598 GN=AKR1C3 PE=2 SV=1",
+ "hit_url": "https://www.uniprot.org/uniprot/K7CEU8",
+ "hit_xref_url": "https://www.ebi.ac.uk/ebisearch/search.ebi?db=uniprot&query=K7CEU8",
+ "hit_os": "Pan troglodytes",
+ "hit_uni_de": "Aldo-keto reductase family 1, member C3 (3-alpha hydroxysteroid dehydrogenase, type II)",
+ "hit_uni_os": "Pan troglodytes",
+ "hit_uni_ox": "9598",
+ "hit_uni_gn": "AKR1C3",
+ "hit_uni_pe": "2",
+ "hit_uni_sv": "1",
+ "hit_len": 323,
+ "hit_hsps": [
+ {
+ "hsp_num": 1,
+ "hsp_score": 637,
+ "hsp_bit_score": 249.98,
+ "hsp_expect": 7.7e-81,
+ "hsp_align_len": 122,
+ "hsp_identity": 91,
+ "hsp_positive": 100,
+ "hsp_gaps": 0,
+ "hsp_query_frame": "0",
+ "hsp_hit_frame": "0",
+ "hsp_strand": "none/none",
+ "hsp_query_from": 8,
+ "hsp_query_to": 129,
+ "hsp_hit_from": 2,
+ "hsp_hit_to": 123,
+ "hsp_qseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK",
+ "hsp_mseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK",
+ "hsp_hseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK"
+ }
+ ]
+ },
+ {
+ "hit_num": 7,
+ "hit_def": "TR:A0A2I3SPE1 A0A2I3SPE1_PANTR Aldo-keto reductase family 1 member C3 OS=Pan troglodytes OX=9598 GN=AKR1C3 PE=2 SV=1",
+ "hit_db": "TR",
+ "hit_id": "A0A2I3SPE1_PANTR",
+ "hit_acc": "A0A2I3SPE1",
+ "hit_desc": "Aldo-keto reductase family 1 member C3 OS=Pan troglodytes OX=9598 GN=AKR1C3 PE=2 SV=1",
+ "hit_url": "https://www.uniprot.org/uniprot/A0A2I3SPE1",
+ "hit_xref_url": "https://www.ebi.ac.uk/ebisearch/search.ebi?db=uniprot&query=A0A2I3SPE1",
+ "hit_os": "Pan troglodytes",
+ "hit_uni_de": "Aldo-keto reductase family 1 member C3",
+ "hit_uni_os": "Pan troglodytes",
+ "hit_uni_ox": "9598",
+ "hit_uni_gn": "AKR1C3",
+ "hit_uni_pe": "2",
+ "hit_uni_sv": "1",
+ "hit_len": 323,
+ "hit_hsps": [
+ {
+ "hsp_num": 1,
+ "hsp_score": 637,
+ "hsp_bit_score": 249.98,
+ "hsp_expect": 7.7e-81,
+ "hsp_align_len": 122,
+ "hsp_identity": 89,
+ "hsp_positive": 100,
+ "hsp_gaps": 0,
+ "hsp_query_frame": "0",
+ "hsp_hit_frame": "0",
+ "hsp_strand": "none/none",
+ "hsp_query_from": 8,
+ "hsp_query_to": 129,
+ "hsp_hit_from": 2,
+ "hsp_hit_to": 123,
+ "hsp_qseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK",
+ "hsp_mseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK",
+ "hsp_hseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK"
+ }
+ ]
+ },
+ {
+ "hit_num": 8,
+ "hit_def": "SP:Q5R7C9 AK1C3_PONAB Aldo-keto reductase family 1 member C3 OS=Pongo abelii OX=9601 GN=AKR1C3 PE=2 SV=1",
+ "hit_db": "SP",
+ "hit_id": "AK1C3_PONAB",
+ "hit_acc": "Q5R7C9",
+ "hit_desc": "Aldo-keto reductase family 1 member C3 OS=Pongo abelii OX=9601 GN=AKR1C3 PE=2 SV=1",
+ "hit_url": "https://www.uniprot.org/uniprot/Q5R7C9",
+ "hit_xref_url": "https://www.ebi.ac.uk/ebisearch/search.ebi?db=uniprot&query=Q5R7C9",
+ "hit_os": "Pongo abelii",
+ "hit_uni_de": "Aldo-keto reductase family 1 member C3",
+ "hit_uni_os": "Pongo abelii",
+ "hit_uni_ox": "9601",
+ "hit_uni_gn": "AKR1C3",
+ "hit_uni_pe": "2",
+ "hit_uni_sv": "1",
+ "hit_len": 323,
+ "hit_hsps": [
+ {
+ "hsp_num": 1,
+ "hsp_score": 637,
+ "hsp_bit_score": 249.98,
+ "hsp_expect": 7.7e-81,
+ "hsp_align_len": 122,
+ "hsp_identity": 70,
+ "hsp_positive": 100,
+ "hsp_gaps": 0,
+ "hsp_query_frame": "0",
+ "hsp_hit_frame": "0",
+ "hsp_strand": "none/none",
+ "hsp_query_from": 8,
+ "hsp_query_to": 129,
+ "hsp_hit_from": 2,
+ "hsp_hit_to": 123,
+ "hsp_qseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK",
+ "hsp_mseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK",
+ "hsp_hseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK"
+ }
+ ]
+ },
+ {
+ "hit_num": 9,
+ "hit_def": "SP:P42330 AK1C3_HUMAN Aldo-keto reductase family 1 member C3 OS=Homo sapiens OX=9606 GN=AKR1C3 PE=1 SV=4",
+ "hit_db": "SP",
+ "hit_id": "AK1C3_HUMAN",
+ "hit_acc": "P42330",
+ "hit_desc": "Aldo-keto reductase family 1 member C3 OS=Homo sapiens OX=9606 GN=AKR1C3 PE=1 SV=4",
+ "hit_url": "https://www.uniprot.org/uniprot/P42330",
+ "hit_xref_url": "https://www.ebi.ac.uk/ebisearch/search.ebi?db=uniprot&query=P42330",
+ "hit_os": "Homo sapiens",
+ "hit_uni_de": "Aldo-keto reductase family 1 member C3",
+ "hit_uni_os": "Homo sapiens",
+ "hit_uni_ox": "9606",
+ "hit_uni_gn": "AKR1C3",
+ "hit_uni_pe": "1",
+ "hit_uni_sv": "4",
+ "hit_len": 323,
+ "hit_hsps": [
+ {
+ "hsp_num": 1,
+ "hsp_score": 637,
+ "hsp_bit_score": 249.98,
+ "hsp_expect": 7.7e-81,
+ "hsp_align_len": 122,
+ "hsp_identity": 87,
+ "hsp_positive": 100,
+ "hsp_gaps": 0,
+ "hsp_query_frame": "0",
+ "hsp_hit_frame": "0",
+ "hsp_strand": "none/none",
+ "hsp_query_from": 8,
+ "hsp_query_to": 129,
+ "hsp_hit_from": 2,
+ "hsp_hit_to": 123,
+ "hsp_qseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK",
+ "hsp_mseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK",
+ "hsp_hseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK"
+ }
+ ]
+ },
+ {
+ "hit_num": 10,
+ "hit_def": "TR:A0A2R9A1P7 A0A2R9A1P7_PANPA Aldo-keto reductase family 1 member C3 OS=Pan paniscus OX=9597 GN=AKR1C3 PE=3 SV=1",
+ "hit_db": "TR",
+ "hit_id": "A0A2R9A1P7_PANPA",
+ "hit_acc": "A0A2R9A1P7",
+ "hit_desc": "Aldo-keto reductase family 1 member C3 OS=Pan paniscus OX=9597 GN=AKR1C3 PE=3 SV=1",
+ "hit_url": "https://www.uniprot.org/uniprot/A0A2R9A1P7",
+ "hit_xref_url": "https://www.ebi.ac.uk/ebisearch/search.ebi?db=uniprot&query=A0A2R9A1P7",
+ "hit_os": "Pan paniscus",
+ "hit_uni_de": "Aldo-keto reductase family 1 member C3",
+ "hit_uni_os": "Pan paniscus",
+ "hit_uni_ox": "9597",
+ "hit_uni_gn": "AKR1C3",
+ "hit_uni_pe": "3",
+ "hit_uni_sv": "1",
+ "hit_len": 323,
+ "hit_hsps": [
+ {
+ "hsp_num": 1,
+ "hsp_score": 634,
+ "hsp_bit_score": 248.825,
+ "hsp_expect": 2.2e-80,
+ "hsp_align_len": 122,
+ "hsp_identity": 82,
+ "hsp_positive": 100,
+ "hsp_gaps": 0,
+ "hsp_query_frame": "0",
+ "hsp_hit_frame": "0",
+ "hsp_strand": "none/none",
+ "hsp_query_from": 8,
+ "hsp_query_to": 129,
+ "hsp_hit_from": 2,
+ "hsp_hit_to": 123,
+ "hsp_qseq": "DSKHQCVKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK",
+ "hsp_mseq": "DSKHQC+KLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK",
+ "hsp_hseq": "DSKHQCLKLNDGHFMPVLGFGTYAPPEVPRSKALEVTKLAIEAGFRHIDSAHLYNNEEQVGLAIRSKIADGSVKREDIFYTSKLWSTFHRPELVRPALENSLKKAQLDYVDLYLIHSPMSLK"
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/stubs/uniprot.json b/tests/stubs/uniprot.json
new file mode 100644
--- /dev/null
+++ b/tests/stubs/uniprot.json
@@ -0,0 +1,1 @@
+{"uniprot_entry":{"ac":"P07550","id":"ADRB2_HUMAN","uniprot_checksum":"408C22731C6EDFBE","sequence_length":413,"segment_start":null,"segment_end":null},"structures":[{"summary":{"model_identifier":"4lde","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/4lde_updated.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/4lde","provider":"PDBe","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2013-06-24","sequence_identity":90,"uniprot_start":29,"uniprot_end":348,"coverage":70.7,"experimental_method":"X-RAY DIFFRACTION","resolution":2.79,"confidence_type":null,"confidence_version":null,"confidence_avg_local_score":null,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"P00720","identifier_category":"UNIPROT","description":"Lysozyme, Beta-2 adrenergic receptor","chain_ids":["A"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"NA","identifier_category":"CCD","description":"SODIUM ION","chain_ids":["A"]}]},"chains":[{"chain_id":"A","segments":[{"templates":null,"seqres":{"aligned_sequence":"DEVWVVGMGIVMSLIVLAIVFGNVLVITAIAKFERLQTVTNYFITSLACADLVMGLAVVPFGAAHILTKTWTFGNFWCEFWTSIDVLCVTASIETLCVIAVDRYFAITSPFKYQSLLTKNKARVIILMVWIVSGLTSFLPIQMHWYRATHQEAINCYAEETCCDFFTNQAYAIASSIVSFYVPLVIMVFVYSRVFQEAKRQLQKIDKFALKEHKALKTLGIIMGTFTLCWLPFFIVNIVHVIQDNLIRKEVYILLNWIGYVNSGFNPLIYCRSPDFRIAFQELLCLRRSSLK","from":178,"to":384},"uniprot":{"aligned_sequence":"DEVWVVGMGIVMSLIVLAIVFGNVLVITAIAKFERLQTVTNYFITSLACADLVMGLAVVPFGAAHILMKMWTFGNFWCEFWTSIDVLCVTASIETLCVIAVDRYFAITSPFKYQSLLTKNKARVIILMVWIVSGLTSFLPIQMHWYRATHQEAINCYANETCCDFFTNQAYAIASSIVSFYVPLVIMVFVYSRVFQEAKRQLQKIDKFCLKEHKALKTLGIIMGTFTLCWLPFFIVNIVHVIQDNLIRKEVYILLNWIGYVNSGFNPLIYCRSPDFRIAFQELLCLRRSSLK","from":29,"to":235},"residues":[{"confidence":null,"model_residue_label":178,"uniprot_residue_number":29},{"confidence":null,"model_residue_label":179,"uniprot_residue_number":30}]},{"templates":null,"seqres":{"aligned_sequence":"DEVWVVGMGIVMSLIVLAIVFGNVLVITAIAKFERLQTVTNYFITSLACADLVMGLAVVPFGAAHILTKTWTFGNFWCEFWTSIDVLCVTASIETLCVIAVDRYFAITSPFKYQSLLTKNKARVIILMVWIVSGLTSFLPIQMHWYRATHQEAINCYAEETCCDFFTNQAYAIASSIVSFYVPLVIMVFVYSRVFQEAKRQLQKIDKFALKEHKALKTLGIIMGTFTLCWLPFFIVNIVHVIQDNLIRKEVYILLNWIGYVNSGFNPLIYCRSPDFRIAFQELLCLRRSSLK","from":385,"to":469},"uniprot":{"aligned_sequence":"DEVWVVGMGIVMSLIVLAIVFGNVLVITAIAKFERLQTVTNYFITSLACADLVMGLAVVPFGAAHILMKMWTFGNFWCEFWTSIDVLCVTASIETLCVIAVDRYFAITSPFKYQSLLTKNKARVIILMVWIVSGLTSFLPIQMHWYRATHQEAINCYANETCCDFFTNQAYAIASSIVSFYVPLVIMVFVYSRVFQEAKRQLQKIDKFCLKEHKALKTLGIIMGTFTLCWLPFFIVNIVHVIQDNLIRKEVYILLNWIGYVNSGFNPLIYCRSPDFRIAFQELLCLRRSSLK","from":264,"to":348},"residues":[{"confidence":null,"model_residue_label":385,"uniprot_residue_number":264},{"confidence":null,"model_residue_label":386,"uniprot_residue_number":265}]}]}]}]}
diff --git a/tests/stubs/uniprot_list_summary.json b/tests/stubs/uniprot_list_summary.json
new file mode 100644
--- /dev/null
+++ b/tests/stubs/uniprot_list_summary.json
@@ -0,0 +1,1 @@
+[{"uniprot_entry":{"ac":"A0A8I5KS94","id":"A0A8I5KS94_HUMAN","uniprot_checksum":"EA44F0E7563755ED","sequence_length":623,"segment_start":41,"segment_end":250},"structures":[{"summary":{"model_identifier":"A0A8I5KS94_41-250:3eap.1.A","model_category":"TEMPLATE-BASED","model_url":"https://swissmodel.expasy.org/3d-beacons/uniprot/A0A8I5KS94.pdb?range=41-250&template=3eap.1.A&provider=swissmodel","model_format":"PDB","model_type":"ATOMIC","model_page_url":"https://swissmodel.expasy.org/repository/uniprot/A0A8I5KS94?range=41-250&template=3eap.1.A","provider":"SWISS-MODEL","created":"2022-11-13","sequence_identity":1,"uniprot_start":41,"uniprot_end":250,"coverage":0.337,"confidence_type":"QMEANDisCo","confidence_version":"4.3.0","confidence_avg_local_score":0.76,"oligomeric_state":"MONOMER","entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"A0A8I5KS94","identifier_category":"UNIPROT","description":"model based on template 3eap.1.A:Rho GTPase-activating protein 11A","chain_ids":["A"]}]}}]},{"uniprot_entry":{"ac":"A0A8I5KWH8","id":"A0A8I5KWH8_HUMAN","uniprot_checksum":"7AA3847ABA0CC68B","sequence_length":625,"segment_start":1,"segment_end":252},"structures":[{"summary":{"model_identifier":"A0A8I5KWH8_1-252:3eap.1.A","model_category":"TEMPLATE-BASED","model_url":"https://swissmodel.expasy.org/3d-beacons/uniprot/A0A8I5KWH8.pdb?range=1-252&template=3eap.1.A&provider=swissmodel","model_format":"PDB","model_type":"ATOMIC","model_page_url":"https://swissmodel.expasy.org/repository/uniprot/A0A8I5KWH8?range=1-252&template=3eap.1.A","provider":"SWISS-MODEL","created":"2022-11-13","sequence_identity":1,"uniprot_start":1,"uniprot_end":252,"coverage":0.403,"confidence_type":"QMEANDisCo","confidence_version":"4.3.0","confidence_avg_local_score":0.791,"oligomeric_state":"MONOMER","entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"A0A8I5KWH8","identifier_category":"UNIPROT","description":"model based on template 3eap.1.A:Rho GTPase-activating protein 11A","chain_ids":["A"]}]}}]}]
diff --git a/tests/stubs/uniprot_summary.json b/tests/stubs/uniprot_summary.json
new file mode 100644
--- /dev/null
+++ b/tests/stubs/uniprot_summary.json
@@ -0,0 +1,1 @@
+{"uniprot_entry":{"ac":"P07550","id":"ADRB2_HUMAN","sequence_length":413},"structures":[{"summary":{"model_identifier":"4lde","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/4lde_updated.cif","model_format":"MMCIF","model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/4lde","provider":"PDBe","created":"2013-06-24","sequence_identity":90,"uniprot_start":29,"uniprot_end":348,"coverage":70.7,"experimental_method":"X-RAY DIFFRACTION","resolution":2.79,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"P00720","identifier_category":"UNIPROT","description":"Lysozyme, Beta-2 adrenergic receptor","chain_ids":["A"]},{"entity_type":"NON-POLYMER","identifier":"NA","identifier_category":"CCD","description":"SODIUM ION","chain_ids":["A"]}]}},{"summary":{"model_identifier":"6mxt","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/6mxt_updated.cif","model_format":"MMCIF","model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/6mxt","provider":"PDBe","created":"2018-10-31","sequence_identity":91,"uniprot_start":29,"uniprot_end":365,"coverage":74.82,"experimental_method":"X-RAY DIFFRACTION","resolution":2.95934213525,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"P00720","identifier_category":"UNIPROT","description":"Endolysin, Beta-2 adrenergic receptor chimera","chain_ids":["A"]},{"entity_type":"NON-POLYMER","identifier":"OLA","identifier_category":"CCD","description":"OLEIC ACID","chain_ids":["A"]}]}}]}
diff --git a/tests/__init__.py b/tests/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/tests/conftest.py b/tests/conftest.py
new file mode 100644
--- /dev/null
+++ b/tests/conftest.py
+import hashlib
+import json
+from typing import List
+
+import pytest
+
+from app.uniprot.schema import UniprotSummary
+from tests.utils import StubResponse
+
+
+class AsyncResult:
+ def __init__(self, status, result):
+ self.result = result
+ self.status = status
+
+ def get(self):
+ return self.result
+
+
+@pytest.fixture(scope="session")
+def invalid_uniprot():
+ return "X0"
+
+
+@pytest.fixture(scope="session")
+def valid_uniprot():
+ return "P0DTD1"
+
+
+@pytest.fixture(scope="session")
+def valid_uniprot_structures():
+ valid_structures = []
+ valid_structures.append(StubResponse(status_code=200, stub_for="uniprot"))
+ return valid_structures
+
+
+@pytest.fixture(scope="session")
+def valid_uniprot_structures_summary():
+ valid_structures = []
+ valid_structures.append(StubResponse(status_code=200, stub_for="uniprot_summary"))
+ return valid_structures
+
+
+@pytest.fixture(scope="session")
+def registry():
+ with open("tests/stubs/registry.json") as fp:
+ data = json.load(fp)
+ return data
+
+
+@pytest.fixture(scope="session")
+def valid_gifts_response():
+ with open("tests/stubs/gifts_response.json") as fp:
+ data = json.load(fp)
+ return data
+
+
+@pytest.fixture(scope="session")
+def valid_annotation_response():
+ with open("tests/stubs/annotations_response.json") as fp:
+ data = json.load(fp)
+ return data
+
+
+@pytest.fixture(scope="session")
+def valid_uniprot_list_summary():
+ return StubResponse(status_code=200, stub_for="uniprot_list_summary")
+
+
+@pytest.fixture(scope="session")
+def seq_search_response():
+ return StubResponse(status_code=200, stub_for="seq_search_response")
+
+
+@pytest.fixture(scope="session")
+def sample_sequence():
+ return "MVLSEGEWQLVLHVWAKVEADVAGHGQDILIRLFKSH"
+
+
+@pytest.fixture(scope="session")
+def sample_sequence_hash():
+ return hashlib.md5("MVLSEGEWQLVLHVWAKVEADVAGHGQDILIRLFKSH".encode()).hexdigest()
+
+
+@pytest.fixture(scope="session")
+def uniprot_summary_obj_list():
+ summary_results: List[UniprotSummary] = []
+
+ with open("tests/stubs/uniprot_list_summary.json") as f:
+ for item in json.load(f):
+ summary_results.append(UniprotSummary(**item))
+