jbloomlab / dmslogo

draw sequence logos tailored to deep mutational scanning (DMS) data
GNU General Public License v3.0
12 stars 1 forks source link

Error: import dmslogo #18

Closed yeli7068 closed 2 years ago

yeli7068 commented 2 years ago

Dear Dr. Bloom,

Thanks for your works in DMS. I faced errors while importing dmslogo.

TypeError                                 Traceback (most recent call last)
<ipython-input-1-ff7d270783ed> in <module>()
     10 import pandas as pd
     11 
---> 12 import dmslogo
     13 from dmslogo.colorschemes import CBPALETTE

~/anaconda3/lib/python3.7/site-packages/dmslogo/__init__.py in <module>()
     21 from dmslogo.facet import facet_plot  # noqa: F401
     22 from dmslogo.line import draw_line  # noqa: F401
---> 23 from dmslogo.logo import draw_logo  # noqa: F401

~/anaconda3/lib/python3.7/site-packages/dmslogo/logo.py in <module>()
     41 for _fontfile in matplotlib.font_manager.findSystemFonts(None):
     42     try:
---> 43         matplotlib.font_manager.fontManager.addfont(_fontfile)
     44     except RuntimeError:
     45         # problem with loading emoji fonts; solution here is just to

~/anaconda3/lib/python3.7/site-packages/matplotlib/font_manager.py in addfont(self, path)
   1098         else:
   1099             font = ft2font.FT2Font(path)
-> 1100             prop = ttfFontProperty(font)
   1101             self.ttflist.append(prop)
   1102 

~/anaconda3/lib/python3.7/site-packages/matplotlib/font_manager.py in ttfFontProperty(font)
    462         return 500  # "medium", not "regular"!
    463 
--> 464     weight = int(get_weight())
    465 
    466     #  Stretch can be absolute and relative

~/anaconda3/lib/python3.7/site-packages/matplotlib/font_manager.py in get_weight()
    445         try:
    446             ps_font_info_weight = (
--> 447                 font.get_ps_font_info()["weight"].replace(" ", "") or "")
    448         except ValueError:
    449             pass

TypeError: tuple indices must be integers or slices, not str

Python: 3.8.12 ; 3.7.2 matplotlib: 3.3.1

jbloom commented 2 years ago

@yeli7068, this should be fixed in the newest version 0.6.3. Let me know if the fix didn't work. At least for me, this error only shows up on Mac and not Linux so a bit hard to diagnose.

yeli7068 commented 2 years ago

Merry Christmas and Happy New Year, Dr. Bloom!

What a coincidence that I am using Mac.

I am going to try the new version. Before that, I fixed this issue by installing the matplotlib=3.2.1.

Another issue is regarding the line plot. I am applying dms_logo to high_antibody_results.csv. It was a little bit weird about drawing the line plot with error: x_col not sequential unbroken integers. Even after reading the instruction, I still felt confused especially there was a gap between original and new in BG505_to_HXB2.csv (e.g. original: 141, 142, new:142, 151).

jbloom commented 2 years ago

I don't quite understand above problem. Can you open a new issue describing it in detail: the exact code you are running and the resulting error?