Skip to content

Commit

Permalink
cleanup + fix test dir
Browse files Browse the repository at this point in the history
  • Loading branch information
korikuzma committed Apr 1, 2024
1 parent ba64fcb commit 65fc51b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
20 changes: 12 additions & 8 deletions src/metakb/transform/moa.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,15 +364,14 @@ async def _get_variation_members(
representation, if variation-normalizer was able to successfully normalize
"""
members = None
chromosome = moa_rep_coord["chromosome"]
pos = moa_rep_coord["start_position"]
ref = moa_rep_coord["reference_allele"]
alt = moa_rep_coord["alternate_allele"]

if all(
(chromosome is not None, pos is not None, ref is not None, alt is not None)
):
chromosome = moa_rep_coord.get("chromosome")
pos = moa_rep_coord.get("start_position")
ref = moa_rep_coord.get("reference_allele")
alt = moa_rep_coord.get("alternate_allele")

if all((chromosome, pos is not None, ref and ref != "-", alt and alt != "-")):
gnomad_vcf = f"{chromosome}-{pos}-{ref}-{alt}"

vrs_genomic_variation = await self.vicc_normalizers.normalize_variation(
[gnomad_vcf]
)
Expand All @@ -386,6 +385,11 @@ async def _get_variation_members(
"Variation Normalizer unable to normalize genomic representation: %s",
gnomad_vcf,
)
else:
logger.debug(
"MOA does not provide enough information to create genomic representation: %s",
moa_rep_coord,
)

return members

Expand Down
3 changes: 3 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
"""Module for pytest fixtures."""
import json
from copy import deepcopy
from pathlib import Path

import pytest

from metakb.normalizers import ViccNormalizers

TEST_DATA_DIR = Path(__file__).resolve().parents[0] / "data"


@pytest.fixture(scope="session")
def cetuximab_extensions():
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/transform/test_moa_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

import pytest
import pytest_asyncio
from tests.conftest import TEST_DATA_DIR

from metakb import PROJECT_ROOT
from metakb.transform.moa import MoaTransform

DATA_DIR = PROJECT_ROOT / "tests" / "data" / "transform"
DATA_DIR = TEST_DATA_DIR / "transform"
FILENAME = "moa_cdm.json"


Expand Down

0 comments on commit 65fc51b

Please sign in to comment.