ngl icon indicating copy to clipboard operation
ngl copied to clipboard

Feature Annotation Question

Open markfortner opened this issue 5 years ago • 3 comments

Is there a way to highlight a feature on a model in NGL Viewer? For example, if you have a series of sequence annotations, and you want to click on each one, and highlight the associated portion of the model. Or perhaps to colour-code each annotation, and the corresponding part of the model?

markfortner avatar Aug 28 '19 22:08 markfortner

Hi @markfortner,

you want to click on each one

In NGL or in an outside DOM element? In NGL you can get a clicked selection through picking, then determine if it's in your feature from the picked atom.

highlight the associated portion of the model. Or perhaps to colour-code each annotation, and the corresponding part of the model?

If you're happy to use colouring to highlight, you can use a selection scheme to highlight just the residues matching your annotations.

harryjubb avatar Sep 01 '19 19:09 harryjubb

These would be DOM elements outside of the NGL viewer that the user would click on. These would be created using feature data from UniProt. The data is usually in the following format:

<feature type="helix" evidence="1">
<location>
<begin position="31"/>
<end position="38"/>
</location>
</feature>

I'd like to convert this into something more user friendly that the user can click on to highlight the corresponding portion of the model.

markfortner avatar Sep 02 '19 22:09 markfortner

In which case, I'd expect using a selection scheme (see "Selection-based coloring") is what you'd want. I'd expect it could work by keeping track of the user's selections, then converting the user selections into a colour scheme each time the user updates their selections, removing older color schemes and applying the new scheme by updating the representation parameters for each representation you have for your StructureComponent.

It's worth bearing in mind that UniProt residue numbering does not necessarily map directly to PDB residue mapping; in which case a service like SIFTS may be useful for conversion. These mappings are also sensitive to which biological unit you're using.

harryjubb avatar Sep 03 '19 14:09 harryjubb