diff --git a/src/dcd_mapping/annotate.py b/src/dcd_mapping/annotate.py index d6e95d6..5b48409 100644 --- a/src/dcd_mapping/annotate.py +++ b/src/dcd_mapping/annotate.py @@ -29,7 +29,7 @@ ScoresetMetadata, TargetSequenceType, TxSelectResult, - VrsObject1_x, + VrsMapping1_3, ) _logger = logging.getLogger(__name__) @@ -247,7 +247,7 @@ def get_mapped_reference_sequence( ) -def _set_layer(ss: str, mappings: list[VrsObject1_x]) -> AnnotationLayer: +def _set_layer(ss: str, mappings: list[VrsMapping1_3]) -> AnnotationLayer: if ss.startswith("urn:mavedb:00000097"): return AnnotationLayer.PROTEIN for var in mappings: @@ -256,7 +256,7 @@ def _set_layer(ss: str, mappings: list[VrsObject1_x]) -> AnnotationLayer: return AnnotationLayer.PROTEIN -def _format_score_mapping(var: VrsObject1_x, layer: AnnotationLayer) -> dict | None: +def _format_score_mapping(var: VrsMapping1_3, layer: AnnotationLayer) -> dict | None: if var and var.layer == layer: if "members" in var.pre_mapped_variants: pre_mapped_members = [] @@ -282,7 +282,7 @@ def _format_score_mapping(var: VrsObject1_x, layer: AnnotationLayer) -> dict | N def save_mapped_output_json( ss: str, - mappings: list[VrsObject1_x], + mappings: list[VrsMapping1_3], align_result: AlignmentResult, tx_output: TxSelectResult | None = None, output_path: Path | None = None, @@ -346,9 +346,9 @@ def _format_start_end(ss: str, start: int, end: int) -> list[int]: def annotate( tx_select_results: TxSelectResult | None, - vrs_results: list[VrsObject1_x], + vrs_results: list[VrsMapping1_3], metadata: ScoresetMetadata, -) -> list[VrsObject1_x]: +) -> list[VrsMapping1_3]: """TODO""" sr = get_seqrepo() for var in vrs_results: diff --git a/src/dcd_mapping/schemas.py b/src/dcd_mapping/schemas.py index 626823f..57ede9a 100644 --- a/src/dcd_mapping/schemas.py +++ b/src/dcd_mapping/schemas.py @@ -168,7 +168,7 @@ class TxSelectResult(BaseModel): ###################### WORKING: ################################ -class VrsObject1_x(BaseModel): # noqa: N801 +class VrsMapping1_3(BaseModel): # noqa: N801 """Define response object for VRS 1.x object""" mavedb_id: StrictStr @@ -261,7 +261,7 @@ def generate_allele_structure(self, var: Allele) -> dict: }, } - def output_vrs_variations(self, layer: AnnotationLayer) -> VrsObject1_x: + def output_vrs_variations(self, layer: AnnotationLayer) -> VrsMapping1_3: """Construct VRS 1.3 compatible objects from 2.0a models. :param layer: The Annotation Layer (genomic or protein) @@ -319,7 +319,7 @@ def output_vrs_variations(self, layer: AnnotationLayer) -> VrsObject1_x: else: post_mapped_variants = post_mapped_variants[0] - return VrsObject1_x( + return VrsMapping1_3( mavedb_id=self.mavedb_id, pre_mapped_variants=pre_mapped_variants, post_mapped_variants=post_mapped_variants, diff --git a/src/dcd_mapping/vrs_map.py b/src/dcd_mapping/vrs_map.py index af64a7a..ad92604 100644 --- a/src/dcd_mapping/vrs_map.py +++ b/src/dcd_mapping/vrs_map.py @@ -21,7 +21,7 @@ TargetType, TxSelectResult, VrsMapping, - VrsObject1_x, + VrsMapping1_3, ) __all__ = ["vrs_map"] @@ -69,7 +69,7 @@ def _map_protein_coding_pro( align_result: AlignmentResult, sequence_id: str, transcript: TxSelectResult, -) -> VrsObject1_x | None: +) -> VrsMapping1_3 | None: """Construct VRS object mapping for ``hgvs_pro`` variant column entry These arguments are a little lazy and could be pruned down later @@ -159,7 +159,7 @@ def _map_protein_coding( records: list[ScoreRow], transcript: TxSelectResult, align_result: AlignmentResult, -) -> list[VrsObject1_x]: +) -> list[VrsMapping1_3]: """Perform mapping on protein coding experiment results :param metadata: The metadata for a score set @@ -168,7 +168,7 @@ def _map_protein_coding( :param align_results: The alignment data for a score set :return: A list of mappings """ - variations: list[VrsObject1_x] = [] + variations: list[VrsMapping1_3] = [] if metadata.target_sequence_type == TargetSequenceType.DNA: sequence = str( Seq(metadata.target_sequence).translate(table="1", stop_symbol="") @@ -223,7 +223,7 @@ def _map_regulatory_noncoding( metadata: ScoresetMetadata, records: list[ScoreRow], align_result: AlignmentResult, -) -> list[VrsObject1_x]: +) -> list[VrsMapping1_3]: """Perform mapping on noncoding/regulatory experiment results :param metadata: metadata for URN @@ -231,7 +231,7 @@ def _map_regulatory_noncoding( :param align_result: An AlignmentResult object for a score set :return: A list of VRS mappings """ - variations: list[VrsObject1_x] = [] + variations: list[VrsMapping1_3] = [] sequence_id = store_sequence(metadata.target_sequence) for row in records: @@ -380,7 +380,7 @@ def vrs_map( records: list[ScoreRow], transcript: TxSelectResult | None = None, silent: bool = True, -) -> list[VrsObject1_x] | None: +) -> list[VrsMapping1_3] | None: """Given a description of a MAVE scoreset and an aligned transcript, generate the corresponding VRS objects. diff --git a/tests/test_vrs_map.py b/tests/test_vrs_map.py index a7b342a..af955e2 100644 --- a/tests/test_vrs_map.py +++ b/tests/test_vrs_map.py @@ -9,13 +9,13 @@ AlignmentResult, ScoresetMetadata, TxSelectResult, - VrsObject1_x, + VrsMapping1_3, ) from dcd_mapping.vrs_map import vrs_map def _assert_correct_vrs_map( - mapping: VrsObject1_x, expected_mappings_data: dict[str, dict] + mapping: VrsMapping1_3, expected_mappings_data: dict[str, dict] ): assert ( mapping.mavedb_id in expected_mappings_data