nglviewer / ngl

WebGL protein viewer
http://nglviewer.org/ngl/
MIT License
669 stars 170 forks source link

Bug loading some cif files from pdb #760

Open gustavo-salazar opened 4 years ago

gustavo-salazar commented 4 years ago

Hey there,

I found an issue when opening some .cif files from pdb.

I initially found this in my app but was able to replicate in your demo viewer. If for example you get this file: https://www.ebi.ac.uk/pdbe/static/entry/10mh_updated.cif

and try to open it in http://nglviewer.org/ngl/ it doesn't open and the browser console shows:

THREE.WebGLRenderer 95
ngl.js:1 STAGE LOG loading file '10mh_updated.cif'
ngl.js:1 STAGE LOG error loading file: 'TypeError: Cannot read property 'push' of undefined'
nglviewer.org/:1 Uncaught (in promise) error loading file: 'TypeError: Cannot read property 'push' of undefined'

I have similar issues with other structures: 2bp5 6owo But then there are others such 101m that work OK.

I have partially solved my issue by opening the sequence from a different source. But thought of reporting this here in case there is an issue with the library. If you think is something wrong with the .cif file, just let me know and I'll report this to pdb.

Cheers,

Gustavo

fredludlow commented 4 years ago

I think the problem is in this block

loop_
_citation_author.citation_id
_citation_author.name
_citation_author.ordinal
primary 'Sheikhnejad, G.' 1
primary 'Brank, A.' 2
primary 'Christman, J.K.' 3
primary 'Goddard, A.' 4
primary 'Alvarez, E.' 5
primary 'Ford Jr., H.' 6
primary 'Marquez, V.E.' 7
primary 'Marasco, C.J.' 8
primary 'Sufrin, J.R.' 9
primary
;O'gara, M.
; 10
primary 'Cheng, X.' 11`

There's a name with a quote in it and it's being rendered over multiple lines - a quick look at the standard (https://www.iucr.org/resources/cif/spec/version1.1/cifsyntax) suggests this is correct, and NGL is parsing it wrongly. (search for "The special sequence of end-of-line followed immediately by a semicolon" in above link)

Anyone fancy trying to fix this?