@@ -99,6 +99,7 @@ def summarize(output_dir: str, table: biom.Table,
99
99
100
100
sample_summary , sample_frequencies = _frequency_summary (
101
101
table , axis = 'sample' )
102
+
102
103
if number_of_samples > 1 :
103
104
104
105
# Calculate the bin count, with a minimum of 5 bins
@@ -166,6 +167,10 @@ def summarize(output_dir: str, table: biom.Table,
166
167
167
168
feature_qualitative_data = _compute_qualitative_summary (table )
168
169
sample_frequencies .sort_values (inplace = True , ascending = False )
170
+
171
+ sample_frequencies_json = pd .Series (["{:,}" .format (int (x )) for x in
172
+ sample_frequencies ])
173
+
169
174
feature_frequencies .sort_values (inplace = True , ascending = False )
170
175
171
176
feature_frequencies = feature_frequencies .astype (int ) \
@@ -190,7 +195,7 @@ def summarize(output_dir: str, table: biom.Table,
190
195
191
196
# Create a JSON object containing the Sample Frequencies to build the
192
197
# table in sample-frequency-detail.html
193
- sample_frequencies_json = sample_frequencies .to_json ()
198
+ sample_frequencies_json = sample_frequencies_json .to_json ()
194
199
195
200
templates = [index , sample_frequency_template , feature_frequency_template ]
196
201
context .update ({'frequencies_list' :
@@ -356,12 +361,21 @@ def _frequencies(table, axis):
356
361
return pd .Series (data = table .sum (axis = axis ), index = table .ids (axis = axis ))
357
362
358
363
359
- def _frequency_summary (table , axis = 'sample' ):
364
+ def _frequency_summary (table : biom . Table , axis = 'sample' ):
360
365
frequencies = _frequencies (table , axis = axis )
361
366
362
- summary = pd .Series ([frequencies .min (), frequencies .quantile (0.25 ),
363
- frequencies .median (), frequencies .quantile (0.75 ),
364
- frequencies .max (), frequencies .mean ()],
367
+ first = frequencies .quantile (0.25 )
368
+ third = frequencies .quantile (0.75 )
369
+ _fst = round (first , 1 )
370
+ _min = round (frequencies .min (), 1 )
371
+ _thd = round (third , 1 )
372
+ _med = round (frequencies .median (), 1 )
373
+ _max = round (frequencies .max (), 1 )
374
+ mean = round (frequencies .mean (), 1 )
375
+
376
+ summary = pd .Series ([_min , _fst ,
377
+ _med , _thd ,
378
+ _max , mean ],
365
379
index = ['Minimum frequency' , '1st quartile' ,
366
380
'Median frequency' , '3rd quartile' ,
367
381
'Maximum frequency' , 'Mean frequency' ])
0 commit comments