Skip to content

Commit

Permalink
Merge pull request #30 from bento-platform/fix/feature-query
Browse files Browse the repository at this point in the history
fix: type hinting issues
  • Loading branch information
davidlougheed authored Dec 12, 2024
2 parents df7d9f4 + bf1733b commit 6567c1c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion bento_reference_service/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def deserialize_genome_feature(rec: asyncpg.Record) -> GenomeFeature:
feature_name=rec["feature_name"],
feature_type=rec["feature_type"],
source=rec["source"],
entries=tuple(map(Database.deserialize_genome_feature_entry, json.loads(rec["entries"] or "[]"))),
entries=list(map(Database.deserialize_genome_feature_entry, json.loads(rec["entries"] or "[]"))),
gene_id=rec["gene_nat_id"],
attributes=json.loads(rec["attributes"] or "{}"),
parents=tuple(rec["parents"] or ()), # tuple of parent IDs
Expand Down Expand Up @@ -524,6 +524,7 @@ async def bulk_ingest_genome_features(self, features: tuple[GenomeFeature, ...])

feature_types.add((feature.feature_type,))

e: GenomeFeatureEntry
entries.extend(
(
row_id,
Expand Down
2 changes: 1 addition & 1 deletion bento_reference_service/routers/refget.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ class RefGetSequenceMetadata(BaseModel):
md5: str
ga4gh: str
length: int
aliases: list[Alias]
aliases: tuple[Alias, ...]


class RefGetSequenceMetadataResponse(BaseModel):
Expand Down
1 change: 1 addition & 0 deletions tests/test_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ async def test_genome_features_summary(db: Database, db_cleanup):
(SARS_COV_2_GENOME_ID, dict(q="ORF1ab"), 3),
(SARS_COV_2_GENOME_ID, dict(q="ENSSASG00005000002"), 1),
(SARS_COV_2_GENOME_ID, dict(q="protein_coding", q_fzy=True, limit=100), 24),
(SARS_COV_2_GENOME_ID, dict(q="tein_cod", q_fzy=True, limit=100), 24),
# hg38 subset
(HG38_CHR1_F100K_GENOME_ID, dict(position="chr1:11869-"), 3),
(HG38_CHR1_F100K_GENOME_ID, dict(start=12000), 10),
Expand Down

0 comments on commit 6567c1c

Please sign in to comment.