From 8123d8eaff940a092225e079be77c0aa8256b49a Mon Sep 17 00:00:00 2001 From: Khoroshevskyi Date: Sat, 31 Jan 2026 20:40:34 -0500 Subject: [PATCH 1/4] Fixed saving of big file size (changed to bigint db column type) --- bbconf/_version.py | 2 +- bbconf/db_utils.py | 4 +++- docs/changelog.md | 5 +++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/bbconf/_version.py b/bbconf/_version.py index 745162e7..23f00709 100644 --- a/bbconf/_version.py +++ b/bbconf/_version.py @@ -1 +1 @@ -__version__ = "0.14.2" +__version__ = "0.14.3" diff --git a/bbconf/db_utils.py b/bbconf/db_utils.py index b2520e94..54b75c22 100644 --- a/bbconf/db_utils.py +++ b/bbconf/db_utils.py @@ -532,7 +532,9 @@ class GeoGsmStatus(Base): nullable=True, index=True, comment="Bed identifier" ) - file_size: Mapped[int] = mapped_column(default=0, comment="Size of the file") + file_size: Mapped[int] = mapped_column( + BigInteger, default=0, comment="Size of the file" + ) genome: Mapped[str] = mapped_column(nullable=True, comment="Genome") gse_status_mapper: Mapped["GeoGseStatus"] = relationship( diff --git a/docs/changelog.md b/docs/changelog.md index f021748f..769646ab 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.3] - 2026-01-31 +### Added: + +### Fixed: +- Saving of big file size (changed to bigint db column type) ### [0.14.2] - 2026-01-21 ### Added: From 3aa833764275630325c11ea7d8088e9868567cbd Mon Sep 17 00:00:00 2001 From: Khoroshevskyi Date: Sat, 31 Jan 2026 21:13:50 -0500 Subject: [PATCH 2/4] Fixed https://github.com/databio/bedhost/issues/246 --- bbconf/bbagent.py | 20 ++++++++++++++++++++ bbconf/models/base_models.py | 1 + 2 files changed, 21 insertions(+) diff --git a/bbconf/bbagent.py b/bbconf/bbagent.py index 2a6169d5..19b8d3a5 100644 --- a/bbconf/bbagent.py +++ b/bbconf/bbagent.py @@ -156,6 +156,14 @@ def get_detailed_stats(self, concise: bool = False) -> FileStats: .order_by(func.count(BedMetadata.assay).desc()) ).all() } + cell_line = { + f[0]: f[1] + for f in session.execute( + select(BedMetadata.cell_line, func.count(BedMetadata.cell_line)) + .group_by(BedMetadata.cell_line) + .order_by(func.count(BedMetadata.cell_line).desc()) + ).all() + } slice_value = 20 @@ -219,12 +227,23 @@ def get_detailed_stats(self, concise: bool = False) -> FileStats: ) file_assay_concise.pop("OTHER") + cell_line_concise = dict(list(cell_line.items())[0:slice_value]) + cell_line_concise["other"] = sum( + list(cell_line.values())[slice_value:] + ) + cell_line.get("other", 0) + if "" in cell_line_concise: + cell_line_concise["other"] = ( + cell_line_concise["other"] + cell_line_concise[""] + ) + cell_line_concise.pop("") + return FileStats( data_format=data_format, bed_compliance=bed_compliance_concise, file_genome=file_genomes_concise, file_organism=file_organism_concise, file_assay=file_assay_concise, + cell_line=cell_line_concise, bed_comments=bed_comments, geo_status=geo_status, mean_region_width=list_mean_width_bins, @@ -239,6 +258,7 @@ def get_detailed_stats(self, concise: bool = False) -> FileStats: file_genome=file_genomes, file_organism=file_organism, file_assay=file_assay, + cell_line=cell_line, bed_comments=bed_comments, geo_status=geo_status, mean_region_width=list_mean_width_bins, diff --git a/bbconf/models/base_models.py b/bbconf/models/base_models.py index 20c1c26f..8e104927 100644 --- a/bbconf/models/base_models.py +++ b/bbconf/models/base_models.py @@ -97,6 +97,7 @@ class FileStats(BaseModel): file_genome: Dict[str, int] file_organism: Dict[str, int] file_assay: Dict[str, int] + cell_line: Dict[str, int] geo_status: Dict[str, int] bed_comments: Dict[str, int] mean_region_width: BinValues From a0c0e36476778cdca2753013c512b61119af57aa Mon Sep 17 00:00:00 2001 From: Khoroshevskyi Date: Sat, 31 Jan 2026 22:00:46 -0500 Subject: [PATCH 3/4] Fixing uploading licenses --- bbconf/db_utils.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bbconf/db_utils.py b/bbconf/db_utils.py index 54b75c22..971f2e1e 100644 --- a/bbconf/db_utils.py +++ b/bbconf/db_utils.py @@ -729,14 +729,16 @@ def _upload_licenses(self): """ Upload licenses to the database. """ + # Check if licenses already exist to avoid duplicate key errors + with Session(self.engine) as session: + existing = session.scalar(select(License).limit(1)) + if existing: + _LOGGER.info("Licenses already exist in the database, skipping upload.") + return _LOGGER.info("Uploading licenses to the database...") df = pd.read_csv(LICENSES_CSV_URL) - with Session(self.engine) as session: - df.to_sql( - License.__tablename__, self.engine, if_exists="append", index=False - ) - session.commit() + df.to_sql(License.__tablename__, self.engine, if_exists="append", index=False) _LOGGER.info("Licenses uploaded successfully!") From a4d9a2381511aa756597e276537e05a0ca117fd5 Mon Sep 17 00:00:00 2001 From: Khoroshevskyi Date: Sat, 31 Jan 2026 23:48:38 -0500 Subject: [PATCH 4/4] updated changelog --- docs/changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog.md b/docs/changelog.md index 769646ab..b7a2d3c1 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -4,6 +4,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### [0.14.3] - 2026-01-31 ### Added: +- Cell line to detailed bedbase statistics ### Fixed: - Saving of big file size (changed to bigint db column type)