chundruv / GFF-to-GenBank

Convert GFF file to GenBank file format while extracting the sequences between the annotated regions
7 stars 2 forks source link

Doesn't work with bcbio-gff 0.7.0 and biopython 1.81: AttributeError: module 'Bio.Seq' has no attribute 'UnknownSeq' #4

Open corneliusroemer opened 11 months ago

corneliusroemer commented 11 months ago

When trying out the script with bcbio-gff 0.7.0 and biopython 1.81 I get the following error:

python ~/code/GFF-to-GenBank/gff_to_genbank_edit.py results/genome_annotation.gff3 data/reference.fasta 
Traceback (most recent call last):
  File "/Users/corneliusromer/code/GFF-to-GenBank/gff_to_genbank_edit.py", line 88, in <module>
    main(*sys.argv[1:])
  File "/Users/corneliusromer/code/GFF-to-GenBank/gff_to_genbank_edit.py", line 25, in main
    SeqIO.write(_check_gff(_fix_ncbi_id(_extract_regions(gff_iter))), out_file, "genbank")
  File "/opt/homebrew/Caskroom/miniforge/base/envs/py11/lib/python3.11/site-packages/Bio/SeqIO/__init__.py", line 524, in write
    count = writer_class(handle).write_file(sequences)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniforge/base/envs/py11/lib/python3.11/site-packages/Bio/SeqIO/Interfaces.py", line 232, in write_file
    count = self.write_records(records, maxcount)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniforge/base/envs/py11/lib/python3.11/site-packages/Bio/SeqIO/Interfaces.py", line 205, in write_records
    for record in records:
  File "/Users/corneliusromer/code/GFF-to-GenBank/gff_to_genbank_edit.py", line 47, in _check_gff
    if isinstance(rec.seq, Seq.UnknownSeq):
                           ^^^^^^^^^^^^^^
AttributeError: module 'Bio.Seq' has no attribute 'UnknownSeq'
corneliusroemer commented 11 months ago

See: https://github.com/chapmanb/bcbb/commit/8a36af0c1af2c2b39e841cea2496f7a367ffdae5