3dmol / 3Dmol.js

WebGL accelerated JavaScript molecular graphics library
https://3dmol.org/
Other
794 stars 194 forks source link

ligand information of pdb files lost #685

Closed KKKKK-tech closed 1 year ago

KKKKK-tech commented 1 year ago

Some pdb files contain protein structure information and ligand small molecule information, but when I imported these files, I found that the ligand information was lost. Is there any way to display them together? Thanks for your help! Here's my code: var element=$("#pdb"+$suffix); var config={backgroundColor:'#E6FFFF'}; let viewer = $3Dmol.createViewer( element, config ); let pdbUri = 'pdb/2NYJ.pdb'; $.ajax( pdbUri, { success: function(data) { let v = viewer; v.addModel( data, "pdb" ); v.setStyle({}, {cartoon: {"color":"spectrum"}}); v.zoomTo(); v.render(); }, error: function(hdr, status, err) { console.error( "Failed to load PDB " + pdbUri + ": " + err ); }, });

dkoes commented 1 year ago

The information isn't lost, you just aren't displaying it. The cartoon style only applies to macromolecules. Show the ligand as stick/sphere/line if you want to see it.

https://3dmol.org/viewer.html?pdb=3erk&select=all&style=cartoon&select=resn:SB4&style=stick:colorscheme~greenCarbon