|
7 | 7 |
|
8 | 8 | from anyvlm.anyvar.base_client import BaseAnyVarClient |
9 | 9 | from anyvlm.storage.base_storage import Storage |
| 10 | +from anyvlm.utils.types import ChromosomeName, GrcAssemblyId, UcscAssemblyBuild |
10 | 11 |
|
11 | 12 |
|
12 | 13 | def get_caf( |
13 | | - anyvar: BaseAnyVarClient, |
| 14 | + anyvar_client: BaseAnyVarClient, |
14 | 15 | anyvlm_storage: Storage, |
15 | | - accession_id: str, |
| 16 | + assembly_id: GrcAssemblyId | UcscAssemblyBuild, |
| 17 | + chromosome_name: ChromosomeName, |
16 | 18 | start: int, |
17 | 19 | end: int, |
18 | 20 | ) -> list[CohortAlleleFrequencyStudyResult]: |
19 | | - """Retrieve Cohort Allele Frequency data for all known variants matching provided search params |
| 21 | + """Retrieve Cohort Allele Frequency data for all known variants matching provided |
| 22 | + search params |
20 | 23 |
|
21 | | - :param anyvar: AnyVar client (variant lookup) |
| 24 | + :param anyvar_client: AnyVar client (variant lookup) |
22 | 25 | :param anyvlm_storage: AnyVLM Storage (CAF storage and retrieval) |
23 | | - :param accession_id: ID for sequence to search upon |
24 | | - :param start: start of range search |
| 26 | + :param assembly_id: The reference assembly to utilize - must be one of: "GRCh37", |
| 27 | + "GRCh38", "hg38", "hg19" |
| 28 | + :param chromosome_name: The chromosome to search on, with an optional "chr" prefix |
| 29 | + - e.g., "1", "chr22", "X", "chrY", etc. |
| 30 | + :param start: Inclusive, inter-residue genomic start position of the interval to |
| 31 | + search |
| 32 | + :param end: Inclusive, inter-residue genomic end position of the interval to search |
25 | 33 | :param reference_bases: Genomic bases ('T', 'AC', etc.) |
26 | 34 | :param alternate_bases: Genomic bases ('T', 'AC', etc.) |
27 | 35 | :return: list of CAFs contained in search interval |
28 | 36 | """ |
29 | | - vrs_variations: list[VrsVariation] = anyvar.search_by_interval( |
30 | | - accession_id, start, end |
| 37 | + vrs_variations: list[VrsVariation] = anyvar_client.search_by_interval( |
| 38 | + f"{assembly_id}:{chromosome_name}", start, end |
31 | 39 | ) |
32 | 40 | vrs_variations_map: dict[str, Allele] = { |
33 | 41 | vrs_variation.id: vrs_variation |
34 | 42 | for vrs_variation in vrs_variations |
35 | 43 | if vrs_variation.id and isinstance(vrs_variation, Allele) |
36 | 44 | } |
37 | 45 |
|
38 | | - cafs: list[CohortAlleleFrequencyStudyResult] = anyvlm_storage.get_caf_by_vrs_ids( |
39 | | - list(vrs_variations_map) |
| 46 | + cafs: list[CohortAlleleFrequencyStudyResult] = ( |
| 47 | + anyvlm_storage.get_caf_by_vrs_allele_ids(list(vrs_variations_map)) |
40 | 48 | ) |
41 | 49 |
|
42 | 50 | for caf in cafs: |
|
0 commit comments