Skip to content

Commit 1f45c1b

Browse files
committed
rm consequence, ac, and af from table
1 parent ccfa8a2 commit 1f45c1b

File tree

4 files changed

+12
-18
lines changed

4 files changed

+12
-18
lines changed

src/anyvlm/storage/mappers.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,22 @@ def from_db_entity(
3636
:return: VA-Spec Cohort Allele Frequency Study Result instance. Will use
3737
iriReference for focusAllele
3838
"""
39+
homozygotes = db_entity.ac_hom
40+
heterozygotes = db_entity.ac_het
41+
hemizygotes = db_entity.ac_hemi
42+
ac = sum((homozygotes, heterozygotes, hemizygotes))
43+
an = db_entity.an
44+
3945
return CohortAlleleFrequencyStudyResult(
4046
focusAllele=iriReference(db_entity.vrs_id),
41-
focusAlleleCount=db_entity.ac,
42-
locusAlleleCount=db_entity.an,
43-
focusAlleleFrequency=db_entity.af,
47+
focusAlleleCount=ac,
48+
locusAlleleCount=an,
49+
focusAlleleFrequency=ac / an,
4450
qualityMeasures={"qcFilters": db_entity.filter},
4551
ancillaryResults={
46-
"homozygotes": db_entity.ac_hom,
47-
"heterozygotes": db_entity.ac_het,
48-
"hemizygotes": db_entity.ac_hemi,
49-
"consequence": db_entity.consequence,
52+
"homozygotes": homozygotes,
53+
"heterozygotes": heterozygotes,
54+
"hemizygotes": hemizygotes,
5055
},
5156
cohort=StudyGroup(name="rare disease"),
5257
)
@@ -69,12 +74,9 @@ def to_db_entity(
6974

7075
return orm.AlleleFrequencyData(
7176
vrs_id=vrs_id,
72-
af=va_model.focusAlleleFrequency,
73-
ac=va_model.focusAlleleCount,
7477
an=va_model.locusAlleleCount,
7578
ac_het=ancillary_results["heterozygotes"],
7679
ac_hom=ancillary_results["homozygotes"],
7780
ac_hemi=ancillary_results["hemizygotes"],
78-
consequence=ancillary_results["consequence"],
7981
filter=va_model.qualityMeasures["qcFilters"],
8082
)

src/anyvlm/storage/orm.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from anyvar.utils.funcs import camel_case_to_snake_case
44
from sqlalchemy import (
5-
Float,
65
Integer,
76
String,
87
create_engine,
@@ -42,13 +41,10 @@ def __tablename__(self) -> str:
4241
return "allele_frequency_data"
4342

4443
vrs_id: Mapped[str] = mapped_column(String, primary_key=True)
45-
af: Mapped[float] = mapped_column(Float)
46-
ac: Mapped[int] = mapped_column(Integer)
4744
an: Mapped[int] = mapped_column(Integer)
4845
ac_het: Mapped[int] = mapped_column(Integer)
4946
ac_hom: Mapped[int] = mapped_column(Integer)
5047
ac_hemi: Mapped[int] = mapped_column(Integer)
51-
consequence: Mapped[str] = mapped_column(String)
5248
filter: Mapped[list[str]] = mapped_column(ARRAY(String))
5349

5450

tests/conftest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ def caf_iri():
9999
"homozygotes": 0,
100100
"heterozygotes": 1,
101101
"hemizygotes": 0,
102-
"consequence": "intron_variant",
103102
},
104103
cohort=StudyGroup(name="rare disease"),
105104
)

tests/unit/storage/test_postgres_unit.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,9 @@ def insert_and_verify_one_row():
4040
db_record = rows[0]
4141

4242
assert db_record.vrs_id == "ga4gh:VA.J3Hi64dkKFKdnKIwB2419Qz3STDB2sJq"
43-
assert db_record.af == 0.000162232
44-
assert db_record.ac == 1
4543
assert db_record.an == 6164
4644
assert db_record.ac_het == 1
4745
assert db_record.ac_hom == 0
48-
assert db_record.consequence == "intron_variant"
4946
assert db_record.filter == ["LowQual", "NO_HQ_GENOTYPES"]
5047

5148
# first insert

0 commit comments

Comments
 (0)