nglviewer / ngl

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

NGL does not display .cif files lacking secondary structure annotations MMCIF CIF ChimeraX #809

Open ChrisMoth opened 3 years ago

ChrisMoth commented 3 years ago

I saved a .cif file with ChimeraX and NGL Viewer won't display it. The web-debugger showing:

The javascript level error I see in firefox debugger from NGL Viewer is:

"Uncaught (in promise) TypeError: can't access property 0, u.pdbx_PDB_helix_class is undefined"

My failing .html is:

$ cat ngltest.html


<html lang="en">
<head>
  <meta charset="utf-8">
</head>
<body>
  HELLO THERE
  <script src="https://unpkg.com/ngl"></script>
  <script>
    document.addEventListener("DOMContentLoaded", function () {
      var stage = new NGL.Stage("viewport");
      stage.loadFile("4cox_chimeraX.cif", {defaultRepresentation: true});
    });
  </script>
  <div id="viewport" style="width:400px; height:300px;"></div>
</body>
</html>```

I have filed bug 3934 with the UCSF chimeraX developers.  However, NGL Viewer should be able to display a CIF file without helix/sheet annotations.  (It can display PDB files without annotations).

=================================================================================
More Details sent to Chimera X in their bug 3934:
ChimeraX does not record secondary structure information in saved .cif files.

1) Download 4COX.cif from rcsb.  Notice helix records:
$ grep -i helix 4cox.cif
_struct_conf.pdbx_PDB_helix_id 
_struct_conf.pdbx_PDB_helix_class 
_struct_conf.pdbx_PDB_helix_length 
2) Save using PDB format from chimeraX.  grep for HELIX records.  Note Many HELIX records.  Super!
3) Save 4COX_chimeraX.sif using mmcif from chimeraX, dialog presents no user settable options.
4) grep the  4COX_chimeraX.sif for "helix" - no hits.  Note also your saved .cif is (much) smaller than original .cif.

This is a _problem_ because I use chimera to Helix and Sheet annotate bare pdb files, which I then display with NGL viewer.

For long transcripts like TTN, residue numberings can be greater than 9999.   I need _some_ way to display these high-number iresidues in NGL viewer, which works well with rcsb cifs that are more populated.

The javascript level error I get from NGL Viewer is: "Uncaught (in promise) TypeError: can't access property 0, u.pdbx_PDB_helix_class is undefined"

I will create a bug report with the NGL Viewer team, but I can't move to .cif until this is sorted out (or until the world agrees on what hybrid36 should look like, another bug report perhaps for another day)
ppillot commented 3 years ago

Could you attach an example of failing cif file for reproducibility and testing? Thanks!

ChrisMoth commented 3 years ago

Here is a working example page using 4cox.cif as deposited at PDBe https://structbio.vanderbilt.edu/~mothcw/NGL_4COX_WorksGreat/

Here is a failing example using 4cox_chimeraX.cif (file I created by opening 4cox.cif in chimeraX, and saving as mmcif) There are no helix entries in this file, and NGL seems to want to see them:

https://structbio.vanderbilt.edu/~mothcw/NGL_4COX_chimeraX_Fails/

You can directly get the file from chimeraX with missing helix entries here: https://structbio.vanderbilt.edu/~mothcw/NGL_4COX_chimeraX_Fails/4cox_chimeraX.cif

Tracing through with web debugger I see:

"Paused on exception TypeError: can't access property 0, u.pdbx_PDB_helix_class is undefined"

image

I probably should find non-minified NGL... but the offending code in minified is this parseInt, presuably because PDB_helpx_class not a member of this structure:

.beg_auth_seq_id.length;r<n;++r){var h=parseInt(u.pdbx_PDB_helix_class[r]);Number.isNaN(h)||(o=u.pdbx_beg_PDB_ins_code[r],a=u

I attach the failing .cif, output by chimeraX without secondary structure notes, in next comment.

ChrisMoth commented 3 years ago

4cox_chimeraX.zip

I dragged a containing zip file from my Windows (sorry) desktop.