biopython / biopython

Official git repository for Biopython (originally converted from CVS)
http://biopython.org/
Other
4.38k stars 1.76k forks source link

SwissProt.read Assertion Error #2957

Closed DGMichael closed 4 years ago

DGMichael commented 4 years ago

Setup

I am reporting a problem with Biopython 1.76, Python 3.7.4, and operating system as follows:

from Bio import SwissProt
handle = ExPASy.get_sprot_raw('B5ZC00')
record = SwissProt.read(handle)

(Please copy and run the above in your Python, and copy-and-paste the output)

Expected behaviour

dir(record) [..., 'accessions', 'annotation_update', 'comments', 'created', 'cross_references', 'data_class', 'description', 'entry_name', 'features', 'gene_name', 'host_organism', 'host_taxonomy_id', 'keywords', 'molecule_type', 'organelle', 'organism', 'organism_classification', 'references', 'seqinfo', 'sequence', 'sequence_length', 'sequence_update', 'taxonomy_id']

Actual behaviour

AssertionError                            Traceback (most recent call last)
<ipython-input-2-ed0d52f57cb2> in <module>
      2 from Bio import SwissProt
      3 handle = ExPASy.get_sprot_raw('B5ZC00')
----> 4 record = SwissProt.read(handle)

/opt/anaconda3/lib/python3.7/site-packages/Bio/SwissProt/__init__.py in read(handle)
    149     Returns a Record() object.
    150     """
--> 151     record = _read(handle)
    152     if not record:
    153         raise ValueError("No SwissProt record found")

/opt/anaconda3/lib/python3.7/site-packages/Bio/SwissProt/__init__.py in _read(handle)
    253             _read_kw(record, value)
    254         elif key == "FT":
--> 255             _read_ft(record, line)
    256         elif key == "SQ":
    257             cols = value.split()

/opt/anaconda3/lib/python3.7/site-packages/Bio/SwissProt/__init__.py in _read_ft(record, line)
    592         description = line[29:70].rstrip()
    593     if not name:  # is continuation of last one
--> 594         assert not from_res and not to_res, line
    595         name, from_res, to_res, old_description, old_ft_id = record.features[-1]
    596         del record.features[-1]

AssertionError:                 /note="Glycine--tRNA ligase"

Steps to reproduce

1) Anaconda install of Biopython 2) Run above code in jupyter notebook.

DGMichael commented 4 years ago

Update: When I pulled the SwissProt functions from this repo, I no longer get this error. Checking on Anaconda now.

peterjc commented 4 years ago

Looks like a duplicate of #2417, so Biopython 1.77 should fix this.

DGMichael commented 4 years ago

Yep, can confirm it is related to Anaconda conda version not having the fix.

1) Latest conda update still has issue (Biopython 1.76) 2) Local install of Biopython does not have the issue (Biopython 1.77).

-> Biopython 1.77 fixes. Closing out.

peterjc commented 4 years ago

Yeah, Biopython 1.77 on conda-forge needs some assistance, see: https://github.com/conda-forge/biopython-feedstock/pull/24