gbouras13 / pharokka

fast phage annotation program
MIT License
146 stars 14 forks source link

pharokka failure due to missing BioPython function #320

Closed leahfa closed 8 months ago

leahfa commented 8 months ago

Description

conda install of pharokka (through bioconda) ends with no errors, but any pharokka script (including pharokka.py -h) fails due to a python error: ImportError: cannot import name 'GC' from 'Bio.SeqUtils' As far as I can tell from Biopython Docs, function GC has been deprecated way back, starting from BioPython release 1.79

What I Did

Tried downgrading BioPython within pharokka environment to 1.78, the latest release which seems to have BioSeq.Utils.GC. This resolves the above issue but also downgrades pharokka to 1.2.1, which seems a pity.... Commands below: conda install -c bioconda pharokka (phrokka) leah@green234:~/miniconda3/envs/phrokka> pharokka.py --help Traceback (most recent call last):
File "/home/leah/miniconda3/envs/phrokka/bin/pharokka.py", line 10, in
from databases import check_db_installation
File "/home/leah/miniconda3/envs/phrokka/bin/databases.py", line 32, in
from post_processing import remove_directory
File "/home/leah/miniconda3/envs/phrokka/bin/post_processing.py", line 12, in
from Bio.SeqUtils import GC
ImportError: cannot import name 'GC' from 'Bio.SeqUtils' (/home/leah/miniconda3/envs/phrokka/lib/python3.10/site-packages/Bio/SeqUtils/init.py)
Paste the command(s) you ran and the output. If there was a crash, please include the traceback here.

gbouras13 commented 8 months ago

Hi @leahfa ,

This is well timed as I am fixing some bugs this week. Thanks for reporting this.

Looks like it is an easy fix with gc_fraction being the correct function

https://biopython.org/docs/dev/api/Bio.SeqUtils.html

An update will be available as part of v1.6.

George

leahfa commented 8 months ago

That was fast ! Thanks for all your work, this is a great tool :-) Just as an FYI, I think there's another issue with a deprecated function from Bio, but this one comes from a function defined in GFFParser.py. Its not too bad since its at the end of the pipe, converting gff to genbank - GFFParser.py defines function get_feature with a call to Bio.SeqFeature.Seqfeature, using a 'strand' option which has been deprecated. Best Leah

gbouras13 commented 8 months ago

Hi @leahfa ,

Thanks for reporting this too - to be clear, is this a warning (not a bug)?

If it's a warning I might wait on putting in a fix, it might take a while to replace that (or make a PR to GFFParser.py)

George

gbouras13 commented 8 months ago

Ok looks like an error

https://github.com/chapmanb/bcbb/issues/138

gbouras13 commented 8 months ago

There is a PR to fix it - https://github.com/chapmanb/bcbb/pull/141

Therefore, what I will do is to enforce biopython <1.82 for now in the dependencies and hope the PR gets merged, after which time I will relax the version restriction.

leahfa commented 8 months ago

Its a bug alright, but didnt want to be too picky :-) especially as it originates in a different repo... downgrading to BioPython 1.81 worked perfectly Thanks for all! Leah