Skip to content

Commit

Permalink
chore: resolve warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
chansigit committed Jul 6, 2024
1 parent b582a4c commit 0be3cf0
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dynamo/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def use_default_var_if_none(val: Any, key: str, replace_val: Optional[Any] = Non
Returns:
`val` or config value set in DynamoAdataConfig according to the method description above.
"""
if not key in DynamoAdataConfig.config_key_to_values:
if key not in DynamoAdataConfig.config_key_to_values:
assert KeyError("Config %s not exist in DynamoAdataConfig." % (key))
if val == replace_val:
config_val = DynamoAdataConfig.config_key_to_values[key]
Expand Down
4 changes: 2 additions & 2 deletions dynamo/data_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def load_NASC_seq(
tot_RNA = None
cells_raw, cells = None, None

for f in tqdm(files, desc=f"reading rmse output files:"):
for f in tqdm(files, desc="reading rmse output files:"):
tmp = pd.read_csv(f, index_col=0, sep="\t")

if tot_RNA is None:
Expand Down Expand Up @@ -251,7 +251,7 @@ def aggregate_adata(file_list: list) -> AnnData:

if len(valid_cells) == 0 or len(valid_genes) == 0:
raise Exception(
f"we don't find any gene or cell names shared across different adata objects." f"Please check your data. "
"we don't find any gene or cell names shared across different adata objects."+"Please check your data. "
)

layer_dict = {}
Expand Down
2 changes: 1 addition & 1 deletion dynamo/estimation/csc/utils_velocity.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def fit_linreg_robust(
f"estimation method {est_method} is not implemented. "
f"Currently supported linear regression methods include `rlm` and `ransac`."
)
except:
except Exception as e:
if intercept:
ym = np.mean(yy)
xm = np.mean(xx)
Expand Down
3 changes: 2 additions & 1 deletion dynamo/estimation/csc/velocity.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from multiprocessing.dummy import Pool as ThreadPool
from warnings import warn

import numpy as np
from scipy.sparse import csr_matrix
from tqdm import tqdm

Expand Down Expand Up @@ -909,7 +910,7 @@ def fit(
for i in tqdm(range(n_genes), desc="estimating gamma"):
try:
gamma[i], u0[i] = fit_first_order_deg_lsq(t_uniq, uu_m[i])
except:
except Exception as e:
gamma[i], u0[i] = 0, 0
self.parameters["gamma"], self.aux_param["uu0"] = gamma, u0
alpha = np.zeros(n_genes)
Expand Down
6 changes: 3 additions & 3 deletions dynamo/estimation/fit_jacobian.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def fit_hill_grad(
msd_min = msd
p_opt_min = [A, K, n, g]

except:
except Exception as e: #TODO: not a good practice
pass

if p_opt_min is None:
Expand Down Expand Up @@ -236,7 +236,7 @@ def fit_hill_inh_grad(
msd_min = msd
p_opt_min = p_opt

except:
except Exception as e: #TODO: not a good practice
pass

return {"A": p_opt_min[0], "K": p_opt_min[1], "n": np.exp(p_opt_min[2]), "g": p_opt_min[3]}, msd_min
Expand Down Expand Up @@ -296,7 +296,7 @@ def fit_hill_act_grad(
msd_min = msd
p_opt_min = p_opt

except:
except Exception as e: # not a good practice
pass

return {"A": p_opt_min[0], "K": p_opt_min[1], "n": np.exp(p_opt_min[2]), "g": p_opt_min[3]}, msd_min
Expand Down
1 change: 1 addition & 0 deletions dynamo/plot/dynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
except ImportError:
from typing_extensions import Literal

import numpy as np
import pandas as pd
from anndata import AnnData
from matplotlib.figure import Figure
Expand Down

0 comments on commit 0be3cf0

Please sign in to comment.