dsehnal / LiteMol

A library/plugin for handling 3D structural molecular data (not only) in the browser.
Other
157 stars 38 forks source link

Problems selecting molecule entity #80

Open NRX-044 opened 11 months ago

NRX-044 commented 11 months ago

Hello ! I am interested in integrating LiteMol into my web-based tool by including LiteMol-plugin.js into HTML page. It works well and can display model from uploaded string data. However, when I tried to select the molecule entity and highlight specific residues by indices, it failed to select any molecule model entity, my code is as follows:

    function display_3d(localdata,rid){
        var plugin = LiteMol.Plugin.create({target: '#app'});
        console.log("displaying structure from "+rid);
        plugin.loadMolecule({
            id: rid,
            data: localdata,
            modelRef: 'model',
            moleculeRef: 'molecule',
            format: 'pdb'
        })

        var molecule = plugin.context.select('model')[0];
        if(!molecule){
            console.log('molecule not loaded '+molecule);
        }else{
            console.log('molecule selected '+molecule);
        }
    }

after executing the above function, the model was displayed on the web page successfully , but the variable molecule remained undefined which indicated that it did not captured any entity. I've check the code from examples/Commands and still get no idea why it failed. Do I missed something? Or is there any alternative solution? Would appreciate any help!

dsehnal commented 11 months ago

Hi @NRX-044, that's for the interest. Would it work for you to integrate Mol* instead? It's an official successor to LiteMol.

NRX-044 commented 11 months ago

Hi @NRX-044, that's for the interest. Would it work for you to integrate Mol* instead? It's an official successor to LiteMol.

Thanks for the reply, I just found PDBe-Molstar provides compiled JS plugin which has custom control over plugin instances, I'll give it a try.