Skip to content

Commit

Permalink
float implementation of problematic input values
Browse files Browse the repository at this point in the history
  • Loading branch information
serareif committed Jun 19, 2024
1 parent 6f62f2a commit 65fa71e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
20 changes: 16 additions & 4 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,36 @@
import tempfile
import anndata as ad
import json
import numpy as np

from sliders import slider_ui, slider_server
from distributions import distributions_server
from plots import plots_server, plots_ui
from metadata import metadata_server, metadata_ui
from helpers import calculate_qc_metrics


'''
def convert_float32_to_float(data):
if isinstance(data, dict):
#print('dict')
for k, v in data.items():
if isinstance(v, np.float32):
print(f"Converting 32 {v} to float in dict")
return {k: convert_float32_to_float(v) for k, v in data.items()}
elif isinstance(data, list):
#print('list')
for v in data:
if isinstance(v, np.float32):
print(f"Converting 32 {v} to float in list")
return [convert_float32_to_float(v) for v in data]
elif isinstance(data, np.float32) or isinstance(data, np.float64):
elif isinstance(data, np.float32):
if isinstance(data, np.float32):
print(f"Converting 32 {data} to float")
#print(f"Converting {data} to float")
return float(data)
elif isinstance(data, np.ndarray):
for v in data:
if isinstance(v, np.float32):
print(f"Converting 32 {v} to float in ndarray")
#print('ndarray')
return data.tolist()
return data
Expand All @@ -37,6 +47,8 @@ def custom_json_dumps(data, *args, **kwargs):
json.dumps = custom_json_dumps
'''

_pretty_names = reactive.value({
'total_counts': 'Total counts',
'n_genes_by_counts': 'Number of genes with counts',
Expand Down
8 changes: 4 additions & 4 deletions src/sliders.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@ def update_absolute_by_mads():
if mads is None or absolute is None:
continue

min_val = (
min_val = float((
distributions[col]["median"] - mads * distributions[col]["std"]
)
max_val = (
))
max_val = float((
distributions[col]["median"] + mads * distributions[col]["std"]
)
))

ui.update_slider(absolute_name, value=[min_val, max_val])

Expand Down

0 comments on commit 65fa71e

Please sign in to comment.