DnaFeaturesViewer icon indicating copy to clipboard operation
DnaFeaturesViewer copied to clipboard

AttributeError: 'Seq' object has no attribute 'defined'

Open sbassi opened this issue 1 year ago • 1 comments

Got this error:

Traceback (most recent call last):
  File "/opt/MitoHiFi/src/mitohifi.py", line 566, in <module>
    main()
  File "/opt/MitoHiFi/src/mitohifi.py", line 491, in main
    plot_annotation.plot_annotation("final_mitogenome.gb", "final_mitogenome.annotation.png")
  File "/opt/MitoHiFi/src/plot_annotation.py", line 38, in plot_annotation
    graphic_record = MyCustomTranslator().translate_record(in_gb)
  File "/usr/local/lib/python3.6/dist-packages/dna_features_viewer/BiopythonTranslator/BiopythonTranslatorBase.py", line 89, in translate_record
    sequence=str(record.seq) if record.seq.defined else None,
AttributeError: 'Seq' object has no attribute 'defined'

I did a modification to line 89 and it worked, so will commit my patch.

Changing:

sequence=str(record.seq) if record.seq.defined else None

To:

sequence=str(record.seq) if record.seq else None

Since I don't know about defined for Biopython Seq, maybe is something old?

sbassi avatar Aug 19 '24 01:08 sbassi

Thank you, actually it's a new property: https://biopython.org/docs/1.81/api/Bio.Seq.html and has been addressed in https://github.com/Edinburgh-Genome-Foundry/DnaFeaturesViewer/pull/79

My solution would be to update Biopython (and Python as support for 3.6 ended a while ago).

veghp avatar Aug 29 '24 11:08 veghp