Edinburgh-Genome-Foundry / DnaFeaturesViewer

:eye: Python library to plot DNA sequence features (e.g. from Genbank files)
https://edinburgh-genome-foundry.github.io/DnaFeaturesViewer/
MIT License
584 stars 90 forks source link

type error for global variable related to BioPython update #76

Closed xonq closed 1 year ago

xonq commented 1 year ago
Traceback (most recent call last):
  File "/users/PAS1046/osu10393/scripts/mycotools/gff2svg.py", line 12, in <module>
    from dna_features_viewer import GraphicFeature, GraphicRecord
  File "miniconda3/envs/mycotools/lib/python3.11/site-packages/dna_features_viewer/__init__.py", line 3, in <module>
    from .GraphicRecord import GraphicRecord
  File "miniconda3/envs/mycotools/lib/python3.11/site-packages/dna_features_viewer/GraphicRecord/__init__.py", line 1, in <module>
    from .GraphicRecord import GraphicRecord
  File "miniconda3/envs/mycotools/lib/python3.11/site-packages/dna_features_viewer/GraphicRecord/GraphicRecord.py", line 1, in <module>
    from ..biotools import find_narrowest_text_wrap
  File "miniconda3/envs/mycotools/lib/python3.11/site-packages/dna_features_viewer/biotools.py", line 38, in <module>
    _aa1: _aa3[0] + _aa3[1:].lower() for _aa1, _aa3 in zip(aa1 + "*", aa3 + ["*"])
                                                           ~~~~^~~~~
TypeError: can only concatenate tuple (not "str") to tuple

aa_short_to_long_form_dict is a global variable and the issue is fixed if moved into the translate function within biotools.py. I imagine it is still broken, potentially because of biopython Bio.PDB.Polypeptide aa1 and aa3. It should ideally not be a global variable anyway.

Biopython 1.78 works, this failure occurs on 1.81

veghp commented 1 year ago

Thanks. The same error was recently fixed in https://github.com/Edinburgh-Genome-Foundry/DnaFeaturesViewer/issues/73. Perhaps the newest Biopython had an additional change. Can you please confirm that you use the latest v3.1.2 ? (it's also on PyPI)

xonq commented 1 year ago

I must have been installing a cached package when trying to reinstall dna_features_viewer - my bad. thank you!