Skip to content

Commit 3364bf0

Browse files
committed
Update check_list
1 parent 8c39643 commit 3364bf0

File tree

5 files changed

+12
-2
lines changed

5 files changed

+12
-2
lines changed

aaanalysis/_utils/check_type.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,6 @@ def check_list_like(name=None, val=None, accept_none=False, convert=True, accept
183183
str_error = add_str(str_error=f"'{name}' should not contain at least {min_len} elements",
184184
str_add=str_add)
185185
raise ValueError(str_error)
186+
# Check for numpy string objects and convert them to Python strings
187+
val = [x.item() if hasattr(x, 'item') and isinstance(x, np.str_) else x for x in val]
186188
return val

aaanalysis/feature_engineering/_backend/cpp/cpp_plot_feature_map.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,9 @@ def plot_feature_map(df_feat=None, df_cat=None,
269269
df_feat=df_feat.copy(),
270270
df_cat=df_cat.copy(),
271271
col_imp=col_imp,
272-
col_cat=col_cat)
272+
col_cat=col_cat,
273+
start=start,
274+
**args_len)
273275
ut.ticks_0(ax_bt, axis="y", **args_ticks_0)
274276

275277
# Plot heatmap

aaanalysis/feature_engineering/_backend/cpp_run.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ def cpp_run_single(df_parts=None, split_kws=None, df_scales=None, df_cat=None, v
8686
# Adjust df_feat
8787
df_feat.reset_index(drop=True, inplace=True)
8888
df_feat[ut.COLS_FEAT_STAT] = df_feat[ut.COLS_FEAT_STAT].round(3)
89+
df_feat[ut.COL_FEATURE] = df_feat[ut.COL_FEATURE].astype(str)
8990
if verbose:
9091
ut.print_out(f"4. CPP returns df of {len(df_feat)} unique features with general information and statistics")
9192
return df_feat
@@ -169,6 +170,7 @@ def cpp_run_batch(df_parts=None, split_kws=None, df_scales=None, df_cat=None, ve
169170
# Adjust df_feat
170171
df_feat.reset_index(drop=True, inplace=True)
171172
df_feat[ut.COLS_FEAT_STAT] = df_feat[ut.COLS_FEAT_STAT].round(3)
173+
df_feat[ut.COL_FEATURE] = df_feat[ut.COL_FEATURE].astype(str)
172174
if verbose:
173175
ut.print_out(f"4. CPP returns df of {len(df_feat)} unique features with general information and statistics")
174176
return df_feat

aaanalysis/seq_analysis/_aalogo_plot.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def check_parts_len(jmd_n_len=None, jmd_c_len=None, df_logo=None):
3333
return tmd_len, jmd_n_len, jmd_c_len
3434

3535

36+
# TODO add if target site to be positions (without P or with, e.g., kinases)
3637
# TODO add checks, complete docstring (consistency with cpp_plot functions!), tests for both plots
3738
# II Main Functions
3839
class AALogoPlot:

aaanalysis/seq_analysis/_backend/_aalogo/aalogo_plot.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ def multi_logo_(list_df_logo=None, target_p1_site=None, figsize_per_logo=(8, 3),
146146
figsize = (figsize_per_logo[0], figsize_per_logo[1] * n_plots)
147147
fig, axes = plt.subplots(nrows=n_plots, figsize=figsize)
148148
y_max = max([d.T.sum().max() for d in list_df_logo])
149+
if y_label == "Probability [%]":
150+
y_max *= 100
149151
for i, df_logo in enumerate(list_df_logo):
150152
name_data = list_name_data[i] if list_name_data else None
151153
name_data_color = list_name_data_color[i] if isinstance(list_name_data_color, list) else list_name_data_color
@@ -178,7 +180,8 @@ def multi_logo_(list_df_logo=None, target_p1_site=None, figsize_per_logo=(8, 3),
178180
else:
179181
ax_logo.set_xticks([])
180182
if highlight_tmd_area:
181-
ut.highlight_tmd_area(**args_parts, x_shift=-0.5, alpha=highlight_alpha, y_max=y_max)
183+
ut.highlight_tmd_area(**args_parts, x_shift=-0.5,
184+
alpha=highlight_alpha, y_max=y_max)
182185

183186
# Adjust labels and formatting
184187
sns.despine(ax=ax_logo, top=True, bottom=True)

0 commit comments

Comments
 (0)