LiteMol
LiteMol copied to clipboard
Residue Labels
Hi David, Thank you so much for developing litemol, it is impressive how fast it is, considering it also looks great!
I am using litemol in a (currently-in-development) website that shows the active centre of enzymes. After some fiddling, I was able to select and zoom in residues in the active centre, but I was not able to find how to label residues/ligands. Is there a way to do this?
You mentioned in a previous "issue" you were thinking about developing an easier interface. I think that would be really useful. It was challenging for me just to select a few residues and change their representation.
Anyway, great job on what is already done! Thanks, Antonio.
Hi Antonio,
currently it is not possible to show text labels inside a 3D scene.
At the moment I am working on a feature to save the state of the application and I was going to work on the labels next-ish (say 1-3 months from now).
However, I can shift my priorities and do at least a partial implementation of the labels now that would be good enough for you needs.
The alternative is that you show the information in a different way such as coloring each residue differently and using a legend rendered in HTML to convey the information. Or maybe both :)
What do you think?
David
Hi David, thank you for your quick reply and willingness to help.
I think I really need the labels in the 3D view (there could be several catalytic residues, more than ten, say, at which point a legend is not very practical). Also, the identity of each atom is important. However, my website will not go into production in the next 3 months, so your schedule fits mine nicely.
Just another quick question. Are you thinking about developing support for animations? Say I have a pdb file with several snapshots of the same structure. It would be very difficult to show them in quick succession with litemol? That would be great for me because I want to show animations of the chemical reactions. I can imagine it could be also useful for showing Molecular Dynamics results or NMR structures.
Thank you again!
I think I really need the labels in the 3D view (there could be several catalytic residues, more than ten, say, at which point a legend is not very practical). Also, the identity of each atom is important. However, my website will not go into production in the next 3 months, so your schedule fits mine nicely.
OK, I will wait. If it is needed I think I can put something working together in 1-3 days so we would solve it that way.
Just another quick question. Are you thinking about developing support for animations? Say I have a pdb file with several snapshots of the same structure. It would be very difficult to show them in quick succession with litemol? That would be great for me because I want to show animations of the chemical reactions. I can imagine it could be also useful for showing Molecular Dynamics results or NMR structures.
Yes, I am thinking about it. The prerequisite to it is the state saving which will allow to automatically "replay" transforms, making it almost "free feature".
It is also possible to do it now, although you would have to do it "by hand". In pseudocode:
function createModelAndVisual(plugin, modelIndex) {
const t = plugin.createTransform()
.add('molecule', CreateModel, { modelIndex }, { ref: 'model' })
.then(CreateMacromoleculeVisual, { het: true, polymer: true, water: false });
plugin.command(Delete, plugin.select('model'));
return plugin.applyTransform(t);
// Unfortunately, doing it like this will reset the camera
// so for this to work a special flag would need to added
// that would modify the default camera behaviour.
// Also, the model would disappear for a brief period before the new
// one is created. If the delete was done after the transform, there would
// temporarily be two models at the same time.
}
async function downloadAndParse(plugin, url) {
const t = plugin.createTransform()
.add(plugin.context.root, Download, { url })
.then(Parse, { format }, { ref: 'molecule' });
await plugin.applyTransform(t);
const m = plugin.select('molecule')[0];
return { modelCount: m.props.molecule.models.length };
}
async function init(plugin, url) {
const { modelCount } = await downloadAndParse(plugin, url);
let currentModel = 0;
const next = async () => {
await createModelAndVisual(plugin, currentModel);
currentModel = (currentModel + 1) % modelCount;
}
setInterval(next, 1000);
}
const plugin = Plugin.create(...);
init(plugin, '//path.to.molecule');
EDIT: clarified createModelAndVisual a bit.