molstar
molstar copied to clipboard
How do I get the corresponding Atom loci ?
I have an SDF Data, as follows:
How do I get the corresponding Atom loci ? I try do this:
const data = this.plugin.managers.structure.hierarchy.current.structures[0]?.cell.obj?.data; if (!data) return; const sel = Script.getStructureSelection(Q => Q.struct.generator.atomGroups({ "atom-test":Q.core.rel.eq([Q.struct.atomProperty.macromolecular.id, 1]), "group-by": Q.struct.atomProperty.macromolecular.label_entity_id() }), data); const loci = StructureSelection.toLociWithSourceUnits(sel); this.plugin.managers.camera.focusLoci(loci);
same question
I think
const loci = Structure.toStructureElementLoci(data);
should be what you are looking for.
I think
const loci = Structure.toStructureElementLoci(data);
should be what you are looking for.
Thank you very much. I'll try
I think
const loci = Structure.toStructureElementLoci(data);
should be what you are looking for.
I feel like I'm getting a little complicated. Maybe there's a simpler way to do this. What I want is: when the mouse moves over one atom, the other atom is highlighted. I'm going to use the method "camera.focusloci".
this.plugin.canvas3d!.input.move.subscribe((obj) => {
const { x, y } = obj;
const pickingId = this.plugin.canvas3d!.identify(x, y)?.id;
//todo: Gets the current source data, return:[40.5922,17.4164,12.4629]
const getPickingSourceData = getPickingSourceData(pickingId);
//todo: Finding Associated Data,return :[43.4349,13.9762,16.5152]
const associatedData = findAssociatedData(getPickingSourceData);
const anotherPickingId = Structure.toStructureElementLoci(associatedData);
this.plugin.managers.camera.focusLoci(anotherPickingId);
});
Can you give me some advice? Thank you very much!