LiteMol icon indicating copy to clipboard operation
LiteMol copied to clipboard

Problems selecting molecule entity

Open NRX-044 opened this issue 1 year ago • 2 comments

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!

NRX-044 avatar Dec 16 '23 11:12 NRX-044

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

dsehnal avatar Dec 17 '23 16:12 dsehnal

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.

NRX-044 avatar Dec 19 '23 01:12 NRX-044