Skip to content

Commit

Permalink
Fix problems introduced by project configuration changes and dependen…
Browse files Browse the repository at this point in the history
…cy upgrades (#101)

* Add sqlalchemy to list of main dependencies

* Add response_model=None to pass FastAPI validation

* Update batch_add_mode setting to work properly

* Change test data from "efo:" to "EFO:" to make Pydantic happy

* Bump VRS to 2.0.0a11

* Code formatting
  • Loading branch information
ehclark authored Oct 21, 2024
1 parent 274a026 commit 0806b64
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ dependencies = [
"fastapi>=0.95.0",
"python-multipart", # required for fastapi file uploads
"uvicorn",
"ga4gh.vrs[extras]~=2.0.0a10",
"ga4gh.vrs[extras]~=2.0.0a11",
"sqlalchemy~=1.4.54",
]
dynamic = ["version"]

Expand Down
1 change: 1 addition & 0 deletions src/anyvar/restapi/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ def register_vrs_object(
summary="Register alleles from a VCF",
description="Provide a valid VCF. All reference and alternate alleles will be registered with AnyVar. The file is annotated with VRS IDs and returned.",
tags=[EndpointTag.VARIATIONS],
response_model=None,
)
async def annotate_vcf(
request: Request,
Expand Down
11 changes: 7 additions & 4 deletions src/anyvar/storage/snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def sf_create_connect_args_override(self, url: URL) -> tuple[list, dict]: # noq
#


class SnowflakeBatchAddMode(str, Enum):
class SnowflakeBatchAddMode(Enum):
"""Define values for snowflake batch add modes"""

merge = auto()
Expand Down Expand Up @@ -88,10 +88,13 @@ def __init__(
max_pending_batches,
flush_on_batchctx_exit,
)
self.batch_add_mode = batch_add_mode or os.environ.get(
"ANYVAR_SNOWFLAKE_BATCH_ADD_MODE", SnowflakeBatchAddMode.merge
env_batch_mode_name = os.environ.get(
"ANYVAR_SNOWFLAKE_BATCH_ADD_MODE", SnowflakeBatchAddMode.merge.name
)
if self.batch_add_mode not in SnowflakeBatchAddMode.__members__:
self.batch_add_mode = (
batch_add_mode or SnowflakeBatchAddMode[env_batch_mode_name]
)
if self.batch_add_mode not in SnowflakeBatchAddMode:
msg = "batch_add_mode must be one of 'merge', 'insert_notin', or 'insert'"
raise Exception(msg)

Expand Down
4 changes: 2 additions & 2 deletions tests/data/variations.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"ga4gh:CX.TvAhuGK6HYf53mXoUnon60cZ7DC_UgM3": {
"params": {
"definition": "NC_000013.11:g.26440969_26443305del",
"copy_change": "efo:0030069",
"copy_change": "EFO:0030069",
"input_type": "CopyNumberChange"
},
"copy_number_response": {
Expand All @@ -82,7 +82,7 @@
},
"type": "SequenceLocation"
},
"copyChange": "efo:0030069",
"copyChange": "EFO:0030069",
"type": "CopyNumberChange"
}
},
Expand Down

0 comments on commit 0806b64

Please sign in to comment.