From 9c751a0914f5cdea315a2196fc9188020931f5b3 Mon Sep 17 00:00:00 2001 From: Khoroshevskyi Date: Wed, 15 Apr 2026 19:28:18 -0400 Subject: [PATCH] Updated encode id lookup --- bbconf/modules/bedfiles.py | 29 +++++++++++++++++++++++++++++ docs/changelog.md | 5 +++++ pyproject.toml | 2 +- 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/bbconf/modules/bedfiles.py b/bbconf/modules/bedfiles.py index 0d3fc9b..c45d0be 100644 --- a/bbconf/modules/bedfiles.py +++ b/bbconf/modules/bedfiles.py @@ -2374,6 +2374,7 @@ def search_external_file(self, source: str, accession: str) -> BedListSearchResu Returns: List of bed file metadata. """ + if source not in ["geo", "encode"]: raise BedBaseConfError( f"Source {source} is not supported. Supported sources are: 'geo', 'encode'." @@ -2392,6 +2393,34 @@ def search_external_file(self, source: str, accession: str) -> BedListSearchResu ) ) ) + elif source == "geo" and accession.upper().startswith("GSM"): + statement = ( + select(Bed) + .join(BedMetadata, Bed.id == BedMetadata.id) + .where( + BedMetadata.global_sample_id.contains( + cast( + [f"{source}:{accession}"], + postgresql.ARRAY(postgresql.VARCHAR), + ) + ) + ) + ) + elif source == "encode" and accession.upper().startswith("ENCSR"): + accession = accession.upper() + statement = ( + select(Bed) + .join(BedMetadata, Bed.id == BedMetadata.id) + .where( + BedMetadata.global_experiment_id.contains( + cast( + [f"{source}:{accession}"], + postgresql.ARRAY(postgresql.VARCHAR), + ) + ) + ) + ) + print(statement) else: statement = ( select(Bed) diff --git a/docs/changelog.md b/docs/changelog.md index 2a6ceb2..79cac91 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,6 +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.14.11] - 2026-04-15 +### Fixed: +- External id search + + ### [0.14.10] - 2026-04-05 ### Fixed: - version info bug diff --git a/pyproject.toml b/pyproject.toml index 0e5a2aa..fde706c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "bbconf" -version = "0.14.10" +version = "0.14.11" description = "Configuration and data management tool for BEDbase" readme = "README.md" license = "BSD-2-Clause"