Skip to content

Commit

Permalink
Add remaining VRS draft
Browse files Browse the repository at this point in the history
  • Loading branch information
jsstevenson committed Jan 15, 2024
1 parent 6fa532f commit 0bbd62c
Show file tree
Hide file tree
Showing 4 changed files with 261 additions and 236 deletions.
7 changes: 3 additions & 4 deletions src/dcd_mapping/lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from cool_seq_tool.schemas import TranscriptPriority
from ga4gh.core._internal.models import Extension, Gene
from ga4gh.vrs._internal.models import Allele, SequenceLocation
from ga4gh.vrs.extras.translator import Translator
from ga4gh.vrs.extras.translator import AlleleTranslator
from gene.database import create_db
from gene.query import QueryHandler
from gene.schemas import SourceName
Expand Down Expand Up @@ -79,15 +79,14 @@ def __new__(cls) -> QueryHandler:
class VrsTranslatorBuilder:
"""Singleton constructor for VRS-Python translator instance."""

# TODO this looks.... very wrong?
def __new__(cls) -> Translator:
def __new__(cls) -> AlleleTranslator:
"""Provide VRS-Python translator. Construct if unavailable.
:return: singleton instances of Translator
"""
if not hasattr(cls, "instance"):
cst = CoolSeqToolBuilder()
cls.instance = Translator(cst.seqrepo_access, normalize=False)
cls.instance = AlleleTranslator(cst.seqrepo_access, normalize=False)
return cls.instance


Expand Down
1 change: 1 addition & 0 deletions src/dcd_mapping/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"get_scoreset_urns",
"get_human_urns",
"get_raw_scoreset_metadata",
"get_scoreset_records",
"get_scoreset_metadata",
"get_human_urns",
"get_ref_genome_file",
Expand Down
10 changes: 8 additions & 2 deletions src/dcd_mapping/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,19 @@ class TxSelectResult(BaseModel):


class VrsMapping(BaseModel):
"""Define pre-post mapping pair structure for VRS-structured variations."""
"""Define pre-post mapping pair structure for VRS-structured variations.
Probably need to add score and accession to make json writing easier
"""

pre_mapping: Union[Allele, Haplotype]
mapped: Union[Allele, Haplotype]


class VrsMappingResult(BaseModel):
"""Define response object from VRS mappings method."""
"""Define response object from VRS mappings method.
Might not be necessary (should just be list of VrsMappings?)
"""

variations: List[VrsMapping]
Loading

0 comments on commit 0bbd62c

Please sign in to comment.