You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following error indicates that grit should be calculated per perturbation. Cytominer eval should be aware of the "group_id" structure and enable multiple groups (as opposed to only a single group allowed now).
With the single group option, we need to calculate grit for each group independently.
---------------------------------------------------------------------------AssertionErrorTraceback (mostrecentcalllast)
<ipython-input-6-61c106f993e9>in<module>6 }
7---->8grit_results_df=evaluate(
9profiles=df,
10features=features,
/usr/local/lib/python3.9/site-packages/cytominer_eval/evaluate.pyinevaluate(profiles, features, meta_features, replicate_groups, operation, similarity_metric, percent_strong_quantile, precision_recall_k, grit_control_perts, mp_value_params)
51 )
52elifoperation=="grit":
--->53metric_result=grit(
54similarity_melted_df=similarity_melted_df,
55control_perts=grit_control_perts,
/usr/local/lib/python3.9/site-packages/cytominer_eval/operations/grit.pyingrit(similarity_melted_df, control_perts, replicate_id, group_id)
59# Calculate grit for each perturbation60grit_df= (
--->61similarity_melted_df.groupby(replicate_col_name)
62 .apply(lambdax: calculate_grit(x, control_perts, column_id_info))
63 .reset_index(drop=True)
/usr/local/lib/python3.9/site-packages/pandas/core/groupby/groupby.pyinapply(self, func, *args, **kwargs)
892withoption_context("mode.chained_assignment", None):
893try:
-->894result=self._python_apply_general(f, self._selected_obj)
895exceptTypeError:
896# gh-20949/usr/local/lib/python3.9/site-packages/pandas/core/groupby/groupby.pyin_python_apply_general(self, f, data)
926dataafterapplyingf927"""--> 928 keys, values, mutated = self.grouper.apply(f, data, self.axis) 929 930 return self._wrap_applied_output(/usr/local/lib/python3.9/site-packages/pandas/core/groupby/ops.py in apply(self, f, data, axis) 236 # group might be modified 237 group_axes = group.axes--> 238 res = f(group) 239 if not _is_indexed_like(res, group_axes, axis): 240 mutated = True/usr/local/lib/python3.9/site-packages/cytominer_eval/operations/grit.py in <lambda>(x) 60 grit_df = ( 61 similarity_melted_df.groupby(replicate_col_name)---> 62 .apply(lambda x: calculate_grit(x, control_perts, column_id_info)) 63 .reset_index(drop=True) 64 )/usr/local/lib/python3.9/site-packages/cytominer_eval/operations/util.py in calculate_grit(replicate_group_df, control_perts, column_id_info) 94 Usage: Designed to be called within a pandas.DataFrame().groupby().apply() 95 """--->96group_entry=get_grit_entry(replicate_group_df, column_id_info["group"]["id"])
97pert=get_grit_entry(replicate_group_df, column_id_info["replicate"]["id"])
98/usr/local/lib/python3.9/site-packages/cytominer_eval/operations/util.pyinget_grit_entry(df, col)
135defget_grit_entry(df: pd.DataFrame, col: str) ->str:
136entries=df.loc[:, col]
-->137assert (
138len(entries.unique()) ==1139 ), "grit is calculated for each perturbation independently"AssertionError: gritiscalculatedforeachperturbationindependently
The text was updated successfully, but these errors were encountered:
The following error indicates that grit should be calculated per perturbation. Cytominer eval should be aware of the "group_id" structure and enable multiple groups (as opposed to only a single group allowed now).
With the single group option, we need to calculate grit for each group independently.
The text was updated successfully, but these errors were encountered: