3dmol / 3Dmol.js

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

[BUG]Is pdb database available? #542

Closed pboysen closed 2 years ago

pboysen commented 2 years ago

*$3Dmol.download("pdb:1MO8",viewer,{multimodel:true, frames:true},function(){ viewer.setStyle({}, {cartoon:{color:"spectrum"}}); viewer.render(); }); I attempted this code and got: fetch of https://files.rcsb.org/view/1MO8.mmtf failed: Not Found Using a CIT source and embedding html works with pdb. Looking at https://files.rcsb.org/view/ is empty.

Firefox Version 94.0 (64-bit) What’s new

dkoes commented 2 years ago

I have to assume this is an old version of 3Dmol since the current version does not use that URL (as it is no longer valid). If for some reason you must use an out-of-date version, you can try explicitly requesting pdb instead of mmtf:

$3Dmol.download("pdb:1MO8",viewer,{multimodel:true, frames:true, format:"pdb"},function(){
viewer.setStyle({}, {cartoon:{color:"spectrum"}});
viewer.render();
});
pboysen commented 2 years ago

I got this version on npm (1.7.1) a few weeks ago. It was published a month ago. I am importing it with import * as $3Dmol from '3dmol/build/3Dmol-nojquery-min' I get falling back to pdb format 3Dmol-nojquery-min.js:10:16555 XHRGEThttps://files.rcsb.org/view/1MO8.mmtf [HTTP/1.1 404 Not Found 401ms]

fetch of https://files.rcsb.org/view/1MO8.mmtf failed: Not Found 3Dmol-nojquery-min.js:10:16715

pboysen commented 2 years ago

BTW, adding the format does work.

dkoes commented 2 years ago

The "falling back to pdb format" message was the clue I needed. For some reason it is failing to fetch the mmtf file (I don't observe problems when I do it - perhaps something about your network configuration?). It turns out there was a bug in the fallback code where it wasn't changing the mmtf extension to the pdb extension. I've pushed a fix. 99edbc7888a7931829ae58915524edcf4b2c498d

pboysen commented 2 years ago

And how many times have I said as a developer, "It works for me!". Thanks for the update. Fantastic tool BTW!