|
1 | 1 | """Module for Variation Normalization.""" |
2 | 2 |
|
3 | 3 | import datetime |
| 4 | +from typing import Literal |
4 | 5 | from urllib.parse import unquote |
5 | 6 |
|
6 | 7 | from cool_seq_tool.handlers import SeqRepoAccess |
|
16 | 17 | NormalizeService, |
17 | 18 | ServiceMeta, |
18 | 19 | ) |
| 20 | +from variation.schemas.service_schema import ClinVarAssembly |
19 | 21 | from variation.schemas.token_response_schema import GnomadVcfToken, Token |
20 | 22 | from variation.schemas.translation_response_schema import ( |
21 | 23 | AC_PRIORITY_LABELS, |
@@ -175,14 +177,21 @@ async def normalize( |
175 | 177 | self, |
176 | 178 | q: str, |
177 | 179 | hgvs_dup_del_mode: HGVSDupDelModeOption | None = HGVSDupDelModeOption.DEFAULT, |
| 180 | + input_assembly: Literal[ClinVarAssembly.GRCH37, ClinVarAssembly.GRCH38] |
| 181 | + | None = None, |
178 | 182 | baseline_copies: int | None = None, |
179 | 183 | copy_change: models.CopyChange | None = None, |
180 | 184 | ) -> NormalizeService: |
181 | | - """Normalize a given variation. |
| 185 | + """Normalize and translate a HGVS, gnomAD VCF or Free Text description on GRCh37 |
| 186 | + or GRCh38 assembly to a VRS variation. Performs fully-justfied allele |
| 187 | + normalization. Will liftover to GRCh38 (if necessary) and align to a priority |
| 188 | + transcript. Will make inferences about the query. |
182 | 189 |
|
183 | 190 | :param q: HGVS, gnomAD VCF or Free Text description on GRCh37 or GRCh38 assembly |
184 | 191 | :param hgvs_dup_del_mode: This parameter determines how to interpret HGVS |
185 | 192 | dup/del expressions in VRS. |
| 193 | + :param input_assembly: Assembly used for `q`. Only used when `q` is using |
| 194 | + genomic free text or gnomad vcf format |
186 | 195 | :param baseline_copies: Baseline copies for HGVS duplications and deletions |
187 | 196 | :param copy_change: The copy change for HGVS duplications and deletions |
188 | 197 | represented as Copy Number Change Variation. |
@@ -226,7 +235,9 @@ async def normalize( |
226 | 235 | return NormalizeService(**params) |
227 | 236 |
|
228 | 237 | # Get validation summary for classification |
229 | | - validation_summary = await self.validator.perform(classification) |
| 238 | + validation_summary = await self.validator.perform( |
| 239 | + classification, input_assembly=input_assembly |
| 240 | + ) |
230 | 241 | if not validation_summary: |
231 | 242 | update_warnings_for_no_resp(label, validation_summary.warnings) |
232 | 243 | params["warnings"] = warnings |
|
0 commit comments