Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BINDetect - 'Annotation' object has no property 'text_from_points' only for time series #269

Closed
sngholee opened this issue May 6, 2024 · 4 comments

Comments

@sngholee
Copy link

sngholee commented May 6, 2024

Hello,

I'm getting this issue w/ BINDetct. I've tried downgrading adjusttext but still get this error message. This issue only arises when I do the time series, and running on single timepoints does not give any issues. I can't view the pdf output from the output when I try the time series. However, the other outputs (bindetect_results, bindetect_distances) seem fine. I'd appreciate any suggestions.

Code attempted:

TOBIAS BINDetect --motifs ${JASPAR} --signals ${BIGWIGS}/Lo_{0,2,24,48,72}_REP2_score.bw $i  --genome \ /public/groups/shariatilab/slee/RefGenomes/mm10.fa --peaks \ /public/groups/shariatilab/slee/MEKiRound3/ATACSeq/redo/consensusPeaks/consensusPeaksBEDCoordsOnly.txt \ --outdir ${OUTDIR}/ --time-series --cores 12

The error message:
Traceback (most recent call last): File "/public/home/slee393/miniconda3/bin/TOBIAS",
 line 33, in <module> sys.exit(load_entry_point('tobias==0.16.1', 'console_scripts', 'TOBIAS')()) 
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
File "/public/home/slee393/miniconda3/lib/python3.11/site-packages/tobias-0.16.1-py3.11-linux-x86_64.egg/tobias/TOBIAS.py", 
line 162, in main args.func(args) 
^^^^^^^^^^^^^^^ 
File "/public/home/slee393/miniconda3/lib/python3.11/site-packages/tobias-0.16.1-py3.11-linux-x86_64.egg/tobias/tools/bindetect.py",
 line 819, in run_bindetect fig = plot_bindetect(motif_list, clustering, [cond1, cond2], args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
File "/public/home/slee393/miniconda3/lib/python3.11/site-packages/tobias-0.16.1-py3.11-linux-x86_64.egg/tobias/tools/bindetect_functions.py", 
line 773, 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 "/public/home/slee393/miniconda3/lib/python3.11/site-packages/adjustText/__init__.py", 
line 730, in adjust_text ax.annotate(
 File "/public/home/slee393/miniconda3/lib/python3.11/site-packages/matplotlib/axes/_axes.py",
 line 711, in annotate a = mtext.Annotation(text, xy, xytext=xytext, xycoords=xycoords, 
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
File "/public/home/slee393/miniconda3/lib/python3.11/site-packages/matplotlib/text.py",
 line 1845, in __init__ Text.__init__(self, x, y, text, **kwargs)
 File "/public/home/slee393/miniconda3/lib/python3.11/site-packages/matplotlib/text.py",
 line 155, in __init__ self.update(kwargs)
 File "/public/home/slee393/miniconda3/lib/python3.11/site-packages/matplotlib/text.py",
 line 205, in update ret.extend(super().update(kwargs)) 
^^^^^^^^^^^^^^^^^^^^^^ 
File "/public/home/slee393/miniconda3/lib/python3.11/site-packages/matplotlib/artist.py",
 line 1209, in update return self._update_props( 
^^^^^^^^^^^^^^^^^^^
 File "/public/home/slee393/miniconda3/lib/python3.11/site-packages/matplotlib/artist.py", 
line 1193, in _update_props raise AttributeError( AttributeError: 'Annotation' object has no property 'text_from_points'

Thank you

mohobein added a commit that referenced this issue May 21, 2024
fixed problems related to deprecated adjustText parameters #269 #259 etc
@mohobein
Copy link
Collaborator

Hey @sngholee,

sorry for the late reply. I tried reproducing the error with the test data and was able to find a solution for it. The fix will be part of the next full release, but if you want to try it out already, you can install the dev branch via pip install git+https://github.com/loosolab/TOBIAS@dev. You might need to run pip install numpy cython in your environment beforehand.

I hope this fixes your problem. If not, we can look into it more closely.

Best regards,
Moritz

@sngholee
Copy link
Author

Hello,

Thank you for looking into this. I tried installing the dev branch and reran the same code for time series, and got the below:

2024-05-22 15:17:14 (3017104) [INFO] Creating BINDetect plot(s) 2024-05-22 15:17:14 (3017104) [INFO] - Lo_0_REP2_score / Lo_2_REP2_score (static plot) Traceback (most recent call last): File "/public/home/slee393/miniconda3/bin/TOBIAS", line 8, in <module> sys.exit(main()) ^^^^^^ File "/public/home/slee393/miniconda3/lib/python3.11/site-packages/tobias/TOBIAS.py", line 162, in main args.func(args) ^^^^^^^^^^^^^^^ File "/public/home/slee393/miniconda3/lib/python3.11/site-packages/tobias/tools/bindetect.py", line 824, in run_bindetect fig = plot_bindetect(motif_list, clustering, [cond1, cond2], args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/public/home/slee393/miniconda3/lib/python3.11/site-packages/tobias/tools/bindetect_functions.py", line 776, in plot_bindetect adjust_text(txts, ax=ax1, objects=[l], arrowprops=dict(arrowstyle='-', color='black', lw=0.5)) #, expand_text=(0.1,1.2), expand_objects=(0.1,0.1)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/public/home/slee393/miniconda3/lib/python3.11/site-packages/adjustText/__init__.py", line 730, in adjust_text ax.annotate( File "/public/home/slee393/miniconda3/lib/python3.11/site-packages/matplotlib/axes/_axes.py", line 711, in annotate a = mtext.Annotation(text, xy, xytext=xytext, xycoords=xycoords, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/public/home/slee393/miniconda3/lib/python3.11/site-packages/matplotlib/text.py", line 1845, in __init__ Text.__init__(self, x, y, text, **kwargs) File "/public/home/slee393/miniconda3/lib/python3.11/site-packages/matplotlib/text.py", line 155, in __init__ self.update(kwargs) File "/public/home/slee393/miniconda3/lib/python3.11/site-packages/matplotlib/text.py", line 205, in update ret.extend(super().update(kwargs)) ^^^^^^^^^^^^^^^^^^^^^^ File "/public/home/slee393/miniconda3/lib/python3.11/site-packages/matplotlib/artist.py", line 1209, in update return self._update_props( ^^^^^^^^^^^^^^^^^^^ File "/public/home/slee393/miniconda3/lib/python3.11/site-packages/matplotlib/artist.py", line 1193, in _update_props raise AttributeError( AttributeError: 'Annotation' object has no property 'objects'

@mohobein
Copy link
Collaborator

mohobein commented May 23, 2024

My bad, I forgot to mention this. adjusttext is still downgraded in your environment from your earlier attempt at fixing it, right? The library changed multiple parameter names between versions, so with the newest TOBIAS version, you also need a version of adjusttext post these changes. Can you try updating adjusttext to the newest version and check if the issue persists? For me, it works with version 1.1.1.

@sngholee
Copy link
Author

This worked, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants