From 37ee3b90ff37cf1a351c0e346685f15d62af261b Mon Sep 17 00:00:00 2001 From: Nathan LeRoy Date: Fri, 1 Sep 2023 17:36:51 -0400 Subject: [PATCH 1/2] pydantic updates --- .gitignore | 1 + README.md | 20 ++++++++++---------- optipyzer/request_models.py | 2 +- optipyzer/response_models.py | 8 ++++---- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 21173f7b..c5687fdf 100644 --- a/.gitignore +++ b/.gitignore @@ -153,3 +153,4 @@ cython_debug/ .DS_Store .Rproj.user +.python-version \ No newline at end of file diff --git a/README.md b/README.md index babc96a5..9a318e01 100644 --- a/README.md +++ b/README.md @@ -30,13 +30,13 @@ import optipyzer api = optipyzer.API() -gblock = "ATGGCCCTTTAA" +dna_seq = "ATGGCCCTTTAA" result = api.optimize( - seq=dna_seq, - seq_type="dna", - weights={"human": 2, "mouse": 1}, - ) + seq=dna_seq, + seq_type="dna", + weights={"human": 2, "mouse": 1}, +) print(result['optimized_sd']) ``` @@ -65,13 +65,13 @@ import optipyzer api = optipyzer.API(local=True) # <--- specify you are using a local server -gblock = "ATGGCCCTTTAA" +dna_seq = "ATGGCCCTTTAA" result = api.optimize( - seq=dna_seq, - seq_type="dna", - weights={"human": 2, "mouse": 1}, - ) + seq=dna_seq, + seq_type="dna", + weights={"human": 2, "mouse": 1}, +) print(result['optimized_sd']) ``` diff --git a/optipyzer/request_models.py b/optipyzer/request_models.py index b430f56d..869e5168 100644 --- a/optipyzer/request_models.py +++ b/optipyzer/request_models.py @@ -10,7 +10,7 @@ class OptimizeQuery(BaseModel): seed: Optional[Union[int, str]] class Config: - schema_extra = { + json_schema_extra = { "description": "The optimization query that includes the sequence, and the organism weights", "example": { "seq": "ATGCGTACTAGTCAGTCAGACTGACTG", diff --git a/optipyzer/response_models.py b/optipyzer/response_models.py index a76e1a5b..b89dc84f 100644 --- a/optipyzer/response_models.py +++ b/optipyzer/response_models.py @@ -1,20 +1,20 @@ -from typing import Dict, List +from typing import Dict, List, Union from pydantic import BaseModel # model for an optimization result class OptimizationResult(BaseModel): query: str - weights: Dict[str, int] + weights: Dict[Union[str, int], int] seq_type: str peptide_seq: str dna_seq: str stop_codon: int optimized_sd: str min_difference_sumsquares: float - best_expression_sd: Dict[str, float] + best_expression_sd: Dict[Union[str, int], float] optimized_ad: str min_difference_absvalue: float - best_expression_ad: Dict[str, float] + best_expression_ad: Dict[Union[str, int], float] class Config: orm_mode = True From e9290cae51b30524698e615aaf8c097341375b36 Mon Sep 17 00:00:00 2001 From: Nathan LeRoy Date: Fri, 1 Sep 2023 17:37:21 -0400 Subject: [PATCH 2/2] bump version --- optipyzer/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/optipyzer/const.py b/optipyzer/const.py index f94c3557..5817ffb5 100644 --- a/optipyzer/const.py +++ b/optipyzer/const.py @@ -1,4 +1,4 @@ -VERSION = "0.2.0" +VERSION = "0.2.1" VALID_AMINO_ACIDS = "ARNDCQEGHILKMFPSTWYV"