Edinburgh-Genome-Foundry / DnaFeaturesViewer

:eye: Python library to plot DNA sequence features (e.g. from Genbank files)
https://edinburgh-genome-foundry.github.io/DnaFeaturesViewer/
MIT License
584 stars 90 forks source link

Add support for biopython 1.81 #79

Closed Benedict-Carling closed 11 months ago

Benedict-Carling commented 1 year ago

Hello,

I'm excited to contribute to this repository! I've cloned the repository and ran the tests. I noticed that the test_gff is currently broken when using the latest version of Biopython.

In the latest Biopython version (1.81), UnknownSeq has been depreciated. As a result, attempts to access the sequence of unknown sequences now throw an error called UndefinedSequenceError.

To address this issue, I suggest adding a check to verify if the sequence is defined before attempting to access its content. By doing this, we can avoid the UndefinedSequenceError and proceed with a value of None in such cases.

I've also included an additional test for a GFF file with a known sequence to ensure that sequences are correctly passed through when they are provided.

I'm eager to hear your thoughts on this. Please let me know if there's anything else I need to do.

Best regards, Ben

veghp commented 1 year ago

Thanks for bringing attention to this, I'll have a look.

antonkulaga commented 1 year ago

So will it eventually be merged?

veghp commented 1 year ago

@antonkulaga yes, certainly. I was tied up in another project recently published among other things, but now can work on this.

photocyte commented 10 months ago

Hi there, I also ran into this UndefinedSequenceError issue with plotting gff files that were working in the past.

Note: The test gff file in the PR includes embedded ##FASTA sequence. In my experience that is rather rare, and my particular gff file doesn't include it

I've been installing dna_feature_viewer from conda/mamba . If this PR cannot be merged, I presume it should also be possible to mark dna_feature_viewer v3.12 as only compatible with biopython <=1.8.0 in pip/conda so that incompatible environments aren't made. From my troubleshooting, this is a past conda environment that worked:

channels:
  - conda-forge
  - bioconda
  - defaults
dependencies:
  - jupyterlab
  - matplotlib
  - bcbio-gff=0.6.9=pyh5e36f6f_0
  - biopython=1.80=py310h5764c6d_0
  - bx-python=0.9.0=py310hdacdf33_0
  - dna_features_viewer=3.1.2=pyh7cba7a3_0

This is a current conda environment that does not work. Note that bcbio-gff and bx-python were also updated, but the root cause clearly seems to be the updated biopython.

channels:
  - conda-forge
  - bioconda
  - defaults
dependencies:
  - jupyterlab
  - matplotlib
  - bcbio-gff=0.7.0=pyh7cba7a3_0
  - biopython=1.81=py310h2372a71_1
  - bx-python=0.10.0=py310h551a815_0
  - dna_features_viewer=3.1.2=pyh7cba7a3_0