运行TOBIAS的BINDetect步骤时遇Matplotlib属性错误求助
问题
使用TOBIAS分析ATAC-seq数据,运行BINDetect模块时执行以下命令:
TOBIAS BINDetect --motifs test_data/motifs.jaspar --signals test_data/Bcell_footprints.bw test_data/Tcell_footprints.bw --genome test_data/genome.fa --peaks test_data/merged_peaks_annotated.bed --peak_header test_data/merged_peaks_annotated_header.txt --outdir BINDetect_test --cond_names Bcell Tcell --cores 4
出现如下报错:
2023-07-05 08:54:45 (488) [INFO] Writing all_bindetect files 2023-07-05 08:54:45 (488) [INFO] Creating BINDetect plot(s) 2023-07-05 08:54:45 (488) [INFO] - Bcell / Tcell (static plot) Traceback (most recent call last): File "/home/usrname/.local/bin/TOBIAS", line 8, in <module> sys.exit(main()) File "/home/usrname/.local/lib/python3.10/site-packages/tobias/TOBIAS.py", line 154, in main args.func(args) File "/home/usrname/.local/lib/python3.10/site-packages/tobias/tools/bindetect.py", line 819, in run_bindetect fig = plot_bindetect(motif_list, clustering, [cond1, cond2], args) File "/home/usrname/.local/lib/python3.10/site-packages/tobias/tools/bindetect_functions.py", line 769, in plot_bindetect adjust_text(txts, ax=ax1, add_objects=[l], text_from_points=True, arrowprops=dict(arrowstyle='-', color='black', lw=0.5)) #, expand_text=(0.1,1.2), expand_objects=(0.1,0.1)) File "/home/usrname/.local/lib/python3.10/site-packages/adjustText/__init__.py", line 730, in adjust_text ax.annotate( File "/home/usrname/.local/lib/python3.10/site-packages/matplotlib/axes/_axes.py", line 699, in annotate a = mtext.Annotation(text, xy, xytext=xytext, xycoords=xycoords, File "/home/usrname/.local/lib/python3.10/site-packages/matplotlib/text.py", line 1885, in __init__ Text.__init__(self, x, y, text, **kwargs) File "/home/usrname/.local/lib/python3.10/site-packages/matplotlib/_api/deprecation.py", line 454, in wrapper return func(*args, **kwargs) File "/home/usrname/.local/lib/python3.10/site-packages/matplotlib/text.py", line 183, in __init__ self.update(kwargs) File "/home/usrname/.local/lib/python3.10/site-packages/matplotlib/text.py", line 231, in update super().update(kwargs) File "/home/usrname/.local/lib/python3.10/site-packages/matplotlib/artist.py", line 1213, in update return self._update_props( File "/home/usrname/.local/lib/python3.10/site-packages/matplotlib/artist.py", line 1197, in _update_props raise AttributeError( AttributeError: 'Annotation' object has no property 'text_from_points'
已尝试升级matplotlib至3.7.1,卸载重装后问题依旧,使用的是TOBIAS官方测试数据,排除输入文件问题。
解决方案
错误根源是adjustText库版本不兼容:TOBIAS代码中调用了text_from_points参数,但该参数在新版adjustText中已被移除/更名。可通过以下方法解决:
- 安装兼容版本的adjustText:
pip install adjustText==0.7.3
- 若不需要绘图结果,可直接禁用BINDetect的绘图功能,跳过报错步骤,修改命令如下:
TOBIAS BINDetect --motifs test_data/motifs.jaspar --signals test_data/Bcell_footprints.bw test_data/Tcell_footprints.bw --genome test_data/genome.fa --peaks test_data/merged_peaks_annotated.bed --peak_header test_data/merged_peaks_annotated_header.txt --outdir BINDetect_test --cond_names Bcell Tcell --cores 4 --no-plots
- 升级TOBIAS到最新版本,检查是否已修复该参数兼容问题:
pip install --upgrade tobias
内容的提问来源于stack exchange,提问作者pythonquestions
相关产品推荐
相关产品推荐

