nextgenusfs / funannotate

Eukaryotic Genome Annotation Pipeline
http://funannotate.readthedocs.io
BSD 2-Clause "Simplified" License
300 stars 82 forks source link

"from Bio.SeqUtils import GC" fails as of Biopython 1.82 #1000

Closed peterjc closed 4 months ago

peterjc commented 4 months ago

Your code https://github.com/nextgenusfs/funannotate/blob/master/funannotate/library.py has two uses of from Bio.SeqUtils import GC which is a function deprecated in Biopython 1.80 and removed in Biopython 1.82.

Quoting https://github.com/biopython/biopython/blob/biopython-183/DEPRECATED.rst#biosequtils

Function 'GC' in Bio.SeqUtils was deprecated in Release 1.80, and removed in Release 1.82. Instead use function 'gc_fraction'.

Note gc_fraction returns a float between 0 and 1. This was introduced in Biopython 1.80.

Possible suggested code:

try:
    from Bio.SeqUtils import gc_fraction
    def GC(sequence):
        return 100 * gc_fraction(sequence, ambiguous="ignore")
except ImportError:
    # Older versions have this:
    from Bio.SeqUtils import GC

Cross reference https://github.com/biopython/biopython/issues/4622

caonetto commented 4 months ago

Yep, getting the same error.

sarjopp commented 4 months ago

Same issue here!

nextgenusfs commented 4 months ago

Your code https://github.com/nextgenusfs/funannotate/blob/master/funannotate/library.py has two uses of from Bio.SeqUtils import GC which is a function deprecated in Biopython 1.80 and removed in Biopython 1.82.

Quoting https://github.com/biopython/biopython/blob/biopython-183/DEPRECATED.rst#biosequtils

Function 'GC' in Bio.SeqUtils was deprecated in Release 1.80, and removed in Release 1.82. Instead use function 'gc_fraction'.

Note gc_fraction returns a float between 0 and 1. This was introduced in Biopython 1.80.

Possible suggested code:

try:
    from Bio.SeqUtils import gc_fraction
    def GC(sequence):
        return 100 * gc_fraction(sequence, ambiguous="ignore")
except ImportError:
    # Older versions have this:
    from Bio.SeqUtils import GC

Cross reference biopython/biopython#4622

Thanks @peterjc

nextgenusfs commented 4 months ago

Would someone be able to test the latest to see if this is resolved? If so I can tag a new release. Thanks.

sarjopp commented 4 months ago

I can try later today.

On Wed, Feb 28, 2024 at 2:16 PM Jon Palmer @.***> wrote:

Would someone be able to test the latest to see if this is resolved? If so I can tag a new release. Thanks.

— Reply to this email directly, view it on GitHub https://github.com/nextgenusfs/funannotate/issues/1000#issuecomment-1969678656, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC5QDJJV4NKHHUXIPGA25FTYV57B5AVCNFSM6AAAAABC77PI2GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRZGY3TQNRVGY . You are receiving this because you commented.Message ID: @.***>

sarjopp commented 4 months ago

Looking at this now and I need some guidance. I'm an end user and I don't know where to insert the edited bit.

nextgenusfs commented 4 months ago

Oh sorry, I just meant install the latest code and see if problem is fixed. The other way to fix it is to downgrade biopython to <1.80.

Can install the latest from GitHub like this, (assuming you are in the funannotate environment)

python -m pip install git+https://github.com/nextgenusfs/funannotate.git --upgrade --force --no-deps
sarjopp commented 4 months ago

I did the downgrade biopython option previously, that worked fine. I will try latest funanno with biopython 1.83 today.

On Wed, Feb 28, 2024 at 11:35 PM Jon Palmer @.***> wrote:

Oh sorry, I just meant install the latest code and see if problem is fixed. The other way to fix it is to downgrade biopython to <1.80.

Can install the latest from GitHub like this, (assuming you are in the funannotate environment)

python -m pip install git+https://github.com/nextgenusfs/funannotate.git

— Reply to this email directly, view it on GitHub https://github.com/nextgenusfs/funannotate/issues/1000#issuecomment-1970379379, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC5QDJPLNJAMCXVFVN6ICGTYWAAPXAVCNFSM6AAAAABC77PI2GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZQGM3TSMZXHE . You are receiving this because you commented.Message ID: @.***>

sarjopp commented 4 months ago

sorry, I meant I will try funannotate.v1.8.16 exactly as it comes, which I see is with an earlier version of biopython. It's running now.

sarjopp commented 4 months ago

Hello, everything worked great! funannotate v.1.8.16, no modifications.