Skip to content

Commit d69f8f0

Browse files
committed
cleanup
1 parent 299cce2 commit d69f8f0

File tree

5 files changed

+15
-22
lines changed

5 files changed

+15
-22
lines changed

src/anyvlm/anyvar/base_client.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,8 @@ def search_by_interval(
6262
"""Get all variation IDs located within the specified range
6363
6464
:param accession: sequence accession
65-
:param start: Inclusive, inter-residue genomic start position of the interval
66-
to search
67-
:param end: Inclusive, inter-residue genomic end position of the interval to
68-
search
65+
:param start: start position for genomic region
66+
:param end: end position for genomic region
6967
:return: list of matching variant objects
7068
:raise AnyVarClientConnectionError: if connection is unsuccessful during search query
7169
"""

src/anyvlm/anyvar/http_client.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,8 @@ def search_by_interval(
152152
"""Get all variation IDs located within the specified range
153153
154154
:param accession: sequence accession
155-
:param start: Inclusive, inter-residue genomic start position of the interval
156-
to search
157-
:param end: Inclusive, inter-residue genomic end position of the interval to
158-
search
155+
:param start: start position for genomic region
156+
:param end: end position for genomic region
159157
:return: list of matching variant objects
160158
:raise AnyVarClientError: if connection is unsuccessful during search query
161159
"""

src/anyvlm/anyvar/python_client.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,9 @@ def get_registered_allele_expression(
6969
:return: VRS Allele if translation succeeds and VRS Allele has already been registered, else `None`
7070
"""
7171
translated_variation = self._translate_allele_expression(expression, assembly)
72-
if translated_variation and translated_variation.id:
72+
if translated_variation:
7373
try:
74-
vrs_variation = self.av.get_object(translated_variation.id, Allele)
75-
if isinstance(vrs_variation, Allele):
76-
return vrs_variation
74+
return self.av.get_object(translated_variation.id, Allele) # type: ignore
7775
except KeyError:
7876
_logger.exception(
7977
"VRS Allele with ID %s not found", translated_variation.id
@@ -114,10 +112,8 @@ def search_by_interval(
114112
"""Get all variation IDs located within the specified range
115113
116114
:param accession: sequence accession
117-
:param start: Inclusive, inter-residue genomic start position of the interval
118-
to search
119-
:param end: Inclusive, inter-residue genomic end position of the interval to
120-
search
115+
:param start: start position for genomic region
116+
:param end: end position for genomic region
121117
:return: list of matching variant objects
122118
"""
123119
try:

src/anyvlm/functions/get_caf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,15 @@ def get_caf(
3636
:param reference_bases: Genomic bases ('T', 'AC', etc.)
3737
:param alternate_bases: Genomic bases ('T', 'AC', etc.)
3838
:raises ValueError: if unsupported assembly ID is provided
39-
:return: list of CAFs contained in search interval
39+
:return: list of CohortAlleleFrequencyStudyResult objects for the provided variant
4040
"""
4141
gnomad_vcf: str = f"{reference_name}-{start}-{reference_bases}-{alternate_bases}"
4242
try:
4343
assembly = ASSEMBLY_MAP[assembly_id]
4444
except KeyError as e:
4545
msg = "Unsupported assembly ID: {assembly_id}"
4646
raise ValueError(msg) from e
47+
4748
vrs_variation = anyvar_client.get_registered_allele_expression(gnomad_vcf, assembly)
4849
if not vrs_variation:
4950
return []

src/anyvlm/storage/mappers.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,16 @@ def from_db_entity(
4747
an = db_entity.an
4848

4949
if filter_ := db_entity.filter:
50-
filter_ = QualityMeasures(qcFilters=db_entity.filter).model_dump()
50+
quality_measures = QualityMeasures(qcFilters=filter_).model_dump()
5151
else:
52-
filter_ = None
52+
quality_measures = None
5353

5454
return CohortAlleleFrequencyStudyResult(
5555
focusAllele=iriReference(db_entity.vrs_id),
5656
focusAlleleCount=ac,
5757
locusAlleleCount=an,
5858
focusAlleleFrequency=round(ac / an, 9),
59-
qualityMeasures=filter_,
59+
qualityMeasures=quality_measures,
6060
ancillaryResults=AncillaryResults(
6161
homozygotes=homozygotes,
6262
heterozygotes=heterozygotes,
@@ -80,7 +80,7 @@ def to_db_entity(
8080
raise ValueError("Invalid ancillaryResults data") from e
8181

8282
try:
83-
filter_ = QualityMeasures(**va_model.qualityMeasures or {})
83+
quality_measures = QualityMeasures(**va_model.qualityMeasures or {})
8484
except ValidationError as e:
8585
raise ValueError("Invalid qualityMeasures data") from e
8686

@@ -98,6 +98,6 @@ def to_db_entity(
9898
ac_het=ancillary_results.heterozygotes,
9999
ac_hom=ancillary_results.homozygotes,
100100
ac_hemi=ancillary_results.hemizygotes,
101-
filter=filter_.qcFilters,
101+
filter=quality_measures.qcFilters,
102102
cohort=va_model.cohort.name,
103103
)

0 commit comments

Comments
 (0)