Cloufield / gwaslab

A Python package for handling and visualizing GWAS summary statistics. https://cloufield.github.io/gwaslab/
GNU General Public License v3.0
119 stars 22 forks source link

Adding is_q=False to scatterplot introduces 'Edge_color' error #31

Open michaelofrancis opened 1 year ago

michaelofrancis commented 1 year ago

Hi Cloufield,

As the title describes, running minimal options scatterplot with only one difference, is_q=False, makes a difference between it working or not. Here is the error log

File /group/tools/Anaconda/Anaconda3-2022.10/envs/R_422/lib/python3.11/site-packages/gwaslab/compare_effect.py:469, in compare_effect(path1, cols_name_list_1, effect_cols_list_1, path2, cols_name_list_2, effect_cols_list_2, eaf, maf_level, label, snplist, mode, anno, anno_het, anno_min, anno_min1, anno_min2, anno_diff, scaled, scaled1, scaled2, wc_correction, null_beta, is_q, include_all, q_level, sig_level, drop, wc_sig_level, reg_box, is_reg, fdr, allele_match, r_se, is_45_helper_line, legend_mode, legend_title, legend_title2, legend_pos, scatterargs, plt_args, xylabel_prefix, helper_line_args, fontargs, errargs, legend_args, sep, log, verbose) 466 if len(sum1only)>0: 467 ax.errorbar(sum1only["EFFECT_1"],sum1only["EFFECT_2_aligned"], xerr=sum1only["SE_1"],yerr=sum1only["SE_2"], 468 linewidth=0,zorder=1,errargs) --> 469 ax.scatter(sum1only["EFFECT_1"],sum1only["EFFECT_2_aligned"],label=label[0],zorder=2,color="#e6320e",edgecolors=sum1only["Edge_color"],marker="^",scatterargs) 470 #legend_elements.append(mpatches.Patch(facecolor='#e6320e', edgecolor='white', label=label[0])) 471 legend_elements.append(label[0])

File /group/tools/Anaconda/Anaconda3-2022.10/envs/R_422/lib/python3.11/site-packages/pandas/core/frame.py:3807, in DataFrame.getitem(self, key) 3805 if self.columns.nlevels > 1: 3806 return self._getitem_multilevel(key) -> 3807 indexer = self.columns.get_loc(key) 3808 if is_integer(indexer): 3809 indexer = [indexer]

File /group/tools/Anaconda/Anaconda3-2022.10/envs/R_422/lib/python3.11/site-packages/pandas/core/indexes/base.py:3804, in Index.get_loc(self, key, method, tolerance) 3802 return self._engine.get_loc(casted_key) 3803 except KeyError as err: -> 3804 raise KeyError(key) from err 3805 except TypeError: 3806 # If we have a listlike key, _check_indexing_error will raise 3807 # InvalidIndexError. Otherwise we fall through and re-raise 3808 # the TypeError. 3809 self._check_indexing_error(key)

KeyError: 'Edge_color'

Cloufield commented 1 year ago

Hi, Thanks for reporting the bug. It will be fixed in the next version.

Cloufield commented 1 year ago

Hi, It is fixed in v3.4.17. Thanks for reporting the bug.