gbouras13/pharokka

pharokka failure due to missing BioPython function

Closed this issue · 6 comments

leahfa commented
  • pharokka version: 1.5.1
  • Python version: 3.10.13
  • Operating System: Linux OpenSuse

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.

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

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

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

Ok looks like an error

chapmanb/bcbb#138

There is a PR to fix it - chapmanb/bcbb#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

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