question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Focus a specific unit/residue by ID from an external application

See original GitHub issue

Hello, I would like to embed the molstar viewer into a React application. It should be able to load a pdb source and then focus a specific residue by its generated name (for example “MEL 63” or “CYS 94”). This is basically the same behavior that is achieved by clicking on the sequence ui on one of the letters. The embedding of the viewer itself and the loading of the pdb works, thanks to your exposed viewer class, however I have problems understanding how to resolve the ID to a Loci, in order to focus it via viewer.plugin.managers.camera.focusLoci(loci).

I would be grateful for any hints.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Aysteincommented, Jan 22, 2021

Hi, thanks for all your help, I tried another approach, and this works for me, I post it here in case someone stumbles across similiar problems

let update = viewer.state.build()
let assembly = viewer.state.select(StateSelection.Generators.ofType(PluginStateObject.Molecule.Structure))[0]
let obj = assembly.obj as PluginStateObject.Molecule.Structure

const group = update.to(assembly)
    .group(StateTransforms.Misc.CreateGroup, { label: 'Surroundings' }, { ref: 'TEST' })

    group.apply(StateTransforms.Model.StructureSelectionFromExpression, { label: 'Surroundings', expression: this.surroundingsExpression(this.props.ligandName, this.props.excludedEntityTypes, this.props.radius) })
    .apply(StateTransforms.Representation.StructureRepresentation3D, createStructureRepresentationParams(viewer.plugin, obj.data, {
        type: 'label',
        typeParams: {level: 'residue'}
    }), { tags: ['labely'] })

PluginCommands.State.Update(viewer.plugin, { state: viewer.plugin.state.data, tree: update })

The missing piece was

let assembly = viewer.state.select(StateSelection.Generators.ofType(PluginStateObject.Molecule.Structure))[0]

which selected the right node for me

0reactions
arosecommented, Mar 13, 2021

@ydzdfci I will adress your issue in #122

Read more comments on GitHub >

github_iconTop Results From Across the Web

Correct way (in .NET) to switch the focus to another application
It has two problems. Some people have told me that SwitchToThisWindow is deprecated. If application B is minimized, this function silently fails from...
Read more >
Ensure that application windows become focused - Power ...
To verify that the Focus window action can't bring a specific window to focus, send some keystrokes using the Send keys action.
Read more >
Solved: How can I set the focus on an external application
Solved: Hi, I'm activating an external .exe application through Labile. When the application is activated a GUI is opened and I can ...
Read more >
Person Identifiers for External Applications - Oracle Help Center
A person identifier captures third-party payroll identifier or the time device badge identifier details from an external application for a person or an ......
Read more >
Set Focus - UiPath Documentation Portal
SetFocus Sets keyboard focus to a specified UI element. ... Applying Themes to Custom Activities ... How to retrieve object IDs. Activities.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found