From 45b538c0edc685c40b63990e4ffbc49e1c11cc1c Mon Sep 17 00:00:00 2001 From: Khoroshevskyi Date: Tue, 17 Oct 2023 17:27:54 +0200 Subject: [PATCH] minor code and test fixes --- .github/workflows/run-pytest.yml | 2 +- bbconf/_version.py | 2 +- bbconf/bbconf.py | 12 ++++++++---- bbconf/const.py | 1 + docs/changelog.md | 4 +++- interactive_testing.py | 0 requirements/requirements-all.txt | 6 +++--- setup.py | 8 +++++--- tests/conftest.py | 4 ++-- tests/test_bbconf.py | 4 ++-- 10 files changed, 26 insertions(+), 17 deletions(-) delete mode 100644 interactive_testing.py diff --git a/.github/workflows/run-pytest.yml b/.github/workflows/run-pytest.yml index 0b37a9f..ab50d25 100644 --- a/.github/workflows/run-pytest.yml +++ b/.github/workflows/run-pytest.yml @@ -12,7 +12,7 @@ jobs: pytest: strategy: matrix: - python-version: ["3.8", "3.11"] + python-version: ["3.8", "3.12"] os: [ubuntu-latest] # can't use macOS when using service containers or container jobs runs-on: ${{ matrix.os }} services: diff --git a/bbconf/_version.py b/bbconf/_version.py index b147458..6a9beea 100644 --- a/bbconf/_version.py +++ b/bbconf/_version.py @@ -1 +1 @@ -__version__ = "0.4.0a5" +__version__ = "0.4.0" diff --git a/bbconf/bbconf.py b/bbconf/bbconf.py index fc54cd5..4cdfe8b 100644 --- a/bbconf/bbconf.py +++ b/bbconf/bbconf.py @@ -37,6 +37,7 @@ CFG_QDRANT_HOST_KEY, CFG_QDRANT_COLLECTION_NAME_KEY, DEFAULT_HF_MODEL, + DEFAULT_VEC2VEC_MODEL, ) from bbconf.exceptions import MissingConfigDataError, BedBaseConfError from bbconf.helpers import raise_missing_key, get_bedbase_cfg @@ -106,9 +107,10 @@ def __init__(self, config_path: str = None, database_only: bool = False): f"{CFG_PATH_REGION2VEC_KEY} was not provided in config file!" ) if not self.config[CFG_PATH_KEY].get(CFG_PATH_VEC2VEC_KEY): - _LOGGER.error( - f"{CFG_PATH_VEC2VEC_KEY} was not provided in config file!" - ) + self.config[CFG_PATH_KEY][ + CFG_PATH_VEC2VEC_KEY + ] = DEFAULT_VEC2VEC_MODEL + except qdrant_client.http.exceptions.ResponseHandlingException as err: _LOGGER.error(f"error in Connection to qdrant! skipping... Error: {err}") @@ -156,7 +158,9 @@ def _read_config_file(self, config_path: str) -> yacman.YAMLConfigManager: def search_bed_by_text( self, query: str - ) -> List[Dict[str, Union[int, float, Dict[str, str], List[float]]]]: + ) -> Tuple[ + Union[List[int], List[List[int]]], Union[List[float], List[List[float]]] + ]: """ Search for bed files by text query in the qdrant database diff --git a/bbconf/const.py b/bbconf/const.py index 78eb69f..8ef2cb5 100644 --- a/bbconf/const.py +++ b/bbconf/const.py @@ -93,3 +93,4 @@ } DEFAULT_HF_MODEL = "sentence-transformers/all-MiniLM-L12-v2" +DEFAULT_VEC2VEC_MODEL = "databio/v2v-ChIP-atlas-hg38-ATAC" diff --git a/docs/changelog.md b/docs/changelog.md index 8a69e0d..91d205c 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,9 +2,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format. -## [0.3.0a1] - 2023-08-02 +## [0.4.0] - 2023-10-17 ### Change - bbconf to use pipestat v0.4.1 and SQLModel +- Added qdrant search, and insert methods +- Fixed tests ## [0.3.0] - 2022-08-18 ### Change diff --git a/interactive_testing.py b/interactive_testing.py deleted file mode 100644 index e69de29..0000000 diff --git a/requirements/requirements-all.txt b/requirements/requirements-all.txt index 9609001..bdbbb0a 100644 --- a/requirements/requirements-all.txt +++ b/requirements/requirements-all.txt @@ -1,7 +1,7 @@ logmuse yacman>=0.9.1 -#pipestat>=0.6.0a1 -pipestat @ git+https://github.com/pepkit/pipestat@dev#egg=pipestat +pipestat>=0.6.0a2 +#pipestat @ git+https://github.com/pepkit/pipestat@dev#egg=pipestat sqlalchemy<2.0.0 qdrant_client -# geniml \ No newline at end of file +# geniml diff --git a/setup.py b/setup.py index 934443f..245fdeb 100644 --- a/setup.py +++ b/setup.py @@ -41,9 +41,11 @@ classifiers=[ "Development Status :: 4 - Beta", "License :: OSI Approved :: BSD License", - "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Topic :: Scientific/Engineering :: Bio-Informatics", ], keywords="", diff --git a/tests/conftest.py b/tests/conftest.py index 4511ba5..3bbee11 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -7,13 +7,13 @@ @pytest.fixture def test_data_bed(): s = "test_string" - return {"bedfile_name": s, "bedfile": {"path": s, "title": s}, "regions_no": 1} + return {"name": s, "bedfile": {"path": s, "title": s}, "regions_no": 1} @pytest.fixture def test_data_bedset(): s = "test_string" - return {"bedset_name": s, "bedset_tar_archive_path": {"path": s, "title": s}} + return {"name": s, "bedset_tar_archive_path": {"path": s, "title": s}} @pytest.fixture diff --git a/tests/test_bbconf.py b/tests/test_bbconf.py index 7462bfd..3e53022 100644 --- a/tests/test_bbconf.py +++ b/tests/test_bbconf.py @@ -6,11 +6,11 @@ from bbconf import BedBaseConf, get_bedbase_cfg from bbconf.exceptions import * -from sqlmodel import Session, SQLModel, create_engine +from sqlmodel import SQLModel, create_engine from sqlmodel.main import default_registry -DB_URL = "postgresql+psycopg2://postgres:docker@127.0.0.1:5432/pep-db" +DB_URL = "postgresql+psycopg2://postgres:dockerpassword@127.0.0.1:5432/pipestat-test" class ContextManagerDBTesting: