molstar / pdbe-molstar

Molstar PDBe implementation
Apache License 2.0
89 stars 30 forks source link

Passing data directly without loading from URLs #86

Closed CrisSherban closed 7 months ago

CrisSherban commented 1 year ago

Hi,

Many thanks for the pdbe-molstar implementation, I'm using it daily within the panel-chemistry. It's extremely cool and useful 🚀🎉!

I know it's a bit out of scope here, but would it be possible to use the URL given with customData in such a way that: if it's a true URL then it goes ahead and downloads it, otherwise it loads directly the string? This would ease quite a lot a huge number of things such as: not having to serve files separately in panel, allowing to load PDBs directly from within python.

I was thinking one could start probably from here and slightly modify the load() here.

I don't know if it's possible, but it would be a great addition for my use cases.

CrisSherban commented 1 year ago

As a workaround and with some inspiration from here, it could be possible to encode the whole structure as a byte 64 URL and pass it to the pdbe-molstar viewer.

orangeSi commented 9 months ago

As a workaround and with some inspiration from here, it could be possible to encode the whole structure as a byte 64 URL and pass it to the pdbe-molstar viewer.

it works?

CrisSherban commented 9 months ago

I ended up saving first to .bcif files and loading those as it was really fast. So I haven't tried in the end, sorry.
Please let me know if you manage to try the workaround and make it work @orangeSi.

orangeSi commented 9 months ago

first to .bcif

save first to http:/xxx.bcif ? if save to file by Virtual File System(VFS) is possiable to load by pbe-molstar.js ?

orangeSi commented 9 months ago

my goal is load load pdb file which is uploaded by user by <input type="file" id="pdb_file" name="filename"> at https://github.com/molstar/pdbe-molstar/issues/95

orangeSi commented 9 months ago

ok, I resolved it by change to molstar.js (https://github.com/molstar) to use viewer.loadStructureFromData(pdbString, 'pdb', { dataLabel: label }); from https://github.com/molstar/molstar/issues/521 @CrisSherban

orangeSi commented 9 months ago

first to .bcif

save first to http:/xxx.bcif ? if save to file by Virtual File System(VFS) is possiable to load by pbe-molstar.js ?

you mean save first to a local bcif or http:/xxx.bcif? because I want to know how to load from local file instead of remove file(example http://xx.bcif)

orangeSi commented 8 months ago

fixed it at https://github.com/molstar/pdbe-molstar/issues/95