Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bbconf/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.14.2"
__version__ = "0.14.3"
20 changes: 20 additions & 0 deletions bbconf/bbagent.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
16 changes: 10 additions & 6 deletions bbconf/db_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -727,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!")
1 change: 1 addition & 0 deletions bbconf/models/base_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

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:
- Cell line to detailed bedbase statistics

### Fixed:
- Saving of big file size (changed to bigint db column type)

### [0.14.2] - 2026-01-21
### Added:
Expand Down
Loading