Skip to content

Commit 59fc568

Browse files
Merge pull request #101 from databio/dev
Release 0.14.3
2 parents 2af3260 + a4d9a23 commit 59fc568

5 files changed

Lines changed: 38 additions & 7 deletions

File tree

bbconf/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.14.2"
1+
__version__ = "0.14.3"

bbconf/bbagent.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,14 @@ def get_detailed_stats(self, concise: bool = False) -> FileStats:
156156
.order_by(func.count(BedMetadata.assay).desc())
157157
).all()
158158
}
159+
cell_line = {
160+
f[0]: f[1]
161+
for f in session.execute(
162+
select(BedMetadata.cell_line, func.count(BedMetadata.cell_line))
163+
.group_by(BedMetadata.cell_line)
164+
.order_by(func.count(BedMetadata.cell_line).desc())
165+
).all()
166+
}
159167

160168
slice_value = 20
161169

@@ -219,12 +227,23 @@ def get_detailed_stats(self, concise: bool = False) -> FileStats:
219227
)
220228
file_assay_concise.pop("OTHER")
221229

230+
cell_line_concise = dict(list(cell_line.items())[0:slice_value])
231+
cell_line_concise["other"] = sum(
232+
list(cell_line.values())[slice_value:]
233+
) + cell_line.get("other", 0)
234+
if "" in cell_line_concise:
235+
cell_line_concise["other"] = (
236+
cell_line_concise["other"] + cell_line_concise[""]
237+
)
238+
cell_line_concise.pop("")
239+
222240
return FileStats(
223241
data_format=data_format,
224242
bed_compliance=bed_compliance_concise,
225243
file_genome=file_genomes_concise,
226244
file_organism=file_organism_concise,
227245
file_assay=file_assay_concise,
246+
cell_line=cell_line_concise,
228247
bed_comments=bed_comments,
229248
geo_status=geo_status,
230249
mean_region_width=list_mean_width_bins,
@@ -239,6 +258,7 @@ def get_detailed_stats(self, concise: bool = False) -> FileStats:
239258
file_genome=file_genomes,
240259
file_organism=file_organism,
241260
file_assay=file_assay,
261+
cell_line=cell_line,
242262
bed_comments=bed_comments,
243263
geo_status=geo_status,
244264
mean_region_width=list_mean_width_bins,

bbconf/db_utils.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,9 @@ class GeoGsmStatus(Base):
532532
nullable=True, index=True, comment="Bed identifier"
533533
)
534534

535-
file_size: Mapped[int] = mapped_column(default=0, comment="Size of the file")
535+
file_size: Mapped[int] = mapped_column(
536+
BigInteger, default=0, comment="Size of the file"
537+
)
536538
genome: Mapped[str] = mapped_column(nullable=True, comment="Genome")
537539

538540
gse_status_mapper: Mapped["GeoGseStatus"] = relationship(
@@ -727,14 +729,16 @@ def _upload_licenses(self):
727729
"""
728730
Upload licenses to the database.
729731
"""
732+
# Check if licenses already exist to avoid duplicate key errors
733+
with Session(self.engine) as session:
734+
existing = session.scalar(select(License).limit(1))
735+
if existing:
736+
_LOGGER.info("Licenses already exist in the database, skipping upload.")
737+
return
730738

731739
_LOGGER.info("Uploading licenses to the database...")
732740
df = pd.read_csv(LICENSES_CSV_URL)
733741

734-
with Session(self.engine) as session:
735-
df.to_sql(
736-
License.__tablename__, self.engine, if_exists="append", index=False
737-
)
738-
session.commit()
742+
df.to_sql(License.__tablename__, self.engine, if_exists="append", index=False)
739743

740744
_LOGGER.info("Licenses uploaded successfully!")

bbconf/models/base_models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ class FileStats(BaseModel):
9797
file_genome: Dict[str, int]
9898
file_organism: Dict[str, int]
9999
file_assay: Dict[str, int]
100+
cell_line: Dict[str, int]
100101
geo_status: Dict[str, int]
101102
bed_comments: Dict[str, int]
102103
mean_region_width: BinValues

docs/changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
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.
44

5+
### [0.14.3] - 2026-01-31
6+
### Added:
7+
- Cell line to detailed bedbase statistics
8+
9+
### Fixed:
10+
- Saving of big file size (changed to bigint db column type)
511

612
### [0.14.2] - 2026-01-21
713
### Added:

0 commit comments

Comments
 (0)