@@ -80,9 +80,7 @@ def aggregate_collection(
8080# ---------------------------------------------------------------------------
8181
8282
83- def _sql_aggregate_composition (
84- session : Session , bed_ids : List [str ]
85- ) -> Optional [dict ]:
83+ def _sql_aggregate_composition (session : Session , bed_ids : List [str ]) -> Optional [dict ]:
8684 """Count distinct values per metadata column via SQL GROUP BY."""
8785 fields = ["genome_alias" , "assay" , "cell_type" , "tissue" , "target" ]
8886 result = {}
@@ -116,9 +114,7 @@ def _sql_aggregate_composition(
116114 return result if result else None
117115
118116
119- def _sql_aggregate_scalars (
120- session : Session , bed_ids : List [str ]
121- ) -> Optional [dict ]:
117+ def _sql_aggregate_scalars (session : Session , bed_ids : List [str ]) -> Optional [dict ]:
122118 """Compute mean, sd, and histogram for scalar columns in SQL.
123119
124120 Uses a single query for mean/sd/min/max/count, then width_bucket
@@ -155,9 +151,7 @@ def _sql_aggregate_scalars(
155151 col_max = float (getattr (row , f"{ col } _max" ))
156152
157153 # 2. Histogram via width_bucket (PostgreSQL)
158- histogram = _sql_histogram (
159- session , bed_ids , col , col_min , col_max , n
160- )
154+ histogram = _sql_histogram (session , bed_ids , col , col_min , col_max , n )
161155
162156 result [col ] = {
163157 "mean" : mean_val ,
@@ -349,9 +343,7 @@ def _sql_aggregate_tss_histogram(
349343 return result
350344
351345
352- def _sql_aggregate_partitions (
353- session : Session , bed_ids : List [str ]
354- ) -> Optional [dict ]:
346+ def _sql_aggregate_partitions (session : Session , bed_ids : List [str ]) -> Optional [dict ]:
355347 """Aggregate genomic partitions from flat percentage columns.
356348
357349 Uses the pre-computed *_percentage columns on bed_stats, which are
@@ -373,9 +365,7 @@ def _sql_aggregate_partitions(
373365 f"COUNT({ col } ) AS { name } _n"
374366 for name , col in partition_columns
375367 )
376- sql = text (
377- f"SELECT { agg_exprs } FROM bed_stats WHERE id = ANY(:bed_ids)"
378- )
368+ sql = text (f"SELECT { agg_exprs } FROM bed_stats WHERE id = ANY(:bed_ids)" )
379369
380370 row = session .execute (sql , {"bed_ids" : bed_ids }).one ()
381371
0 commit comments