Skip to content

3. Helper Methods_v0.1.0

Mandar Deshpande edited this page May 26, 2020 · 1 revision

Helper Methods (v0.1.0)

Helper functions are useful to programatically control the visualization. Check here the example to see how the helper function can be used with -

The plugin/ web-component instance provides helper functions for categories below

Canvas/ layout methods

No. Function Parameters Description
1 setBgColor color
Type: json
{r:number, g:number, b:number}
Set Canvas background color
Example:Instance.canvas.setBgColor({r:255, g:255, b:255})
will set the background to white
2 toggleControls isVisible
Type: boolean
true|false
Optional
Toggle controls menu
Example:Instance.canvas.toggleControls(true)
will make the controls visible
3 toggleExpanded isExpanded
Type: boolean
true|false
Optional
Toggle full-screen
Example:Instance.canvas.toggleExpanded(true)
will switch to full-screen

Visual methods

No. Function Parameters Description
1 visibility data
Type: json
{polymer: boolean, het: boolean, water: boolean, carbs: boolean, density: boolean}
Change the visual entities visibility
Example:Instance.visual.visibility({het:false, water:false})
will hide the HET and water visuals
2 toggleSpin isSpinning
Type: boolean
true|false
Optional
Toggle visual rotation
Example:Instance.visual.toggleSpin(true)
will rotate the visual
3 focus params
Type: json
{entity_id: string, struct_asym_id: string, start_residue_number: number, end_residue_number: number}[]
Focus on a particular visual section
Example:Instance.visual.focus([{entity_id: '1', struct_asym_id: 'A', start_residue_number: 10, end_residue_number: 15}])
will focus on residue range 10-15 of Chain 'A' of Entity 1
4 selection params, defaultColor, focus
Type: params: {entity_id: string, struct_asym_id: string, start_residue_number: number, end_residue_number: number, color: any}[],
defaultColor:{r:number, g:number, b:number},
focus:boolean
Color and focus on a specific visual section
Example:Instance.visual.selection([{entity_id: '1', struct_asym_id: 'A', start_residue_number: 10, end_residue_number: 15, color:{r:255,g:0,b:0}], {r:255,g:255,b:0}, true)
will color residue range 10-15 of Chain 'A' of Entity 1 in red and other residues with the provided default yellow color. The last boolean param is for focus, if set to true, the visual will get focused on the given selection
5 reset resetCamera,resetTheme
Type: boolean
Reset theme to default coloring
Example:Instance.visual.reset(true, true)
This method can be used to clear a selection
6 update plugin parameters Refer here Updates the instance
Example:Instance.visual.update({moleculeId: '1cbs'})
This method particularly used to update the main data(source)

Interactivity methods

No. Function Parameters Description
1 highlight params
Type: json
{entity_id: string, struct_asym_id: string, start_residue_number: number, end_residue_number: number}[]
Trigger highlight
Example:Instance.interactivity.highlight([{entity_id: '1', struct_asym_id: 'A', start_residue_number: 10, end_residue_number: 15}])
2 clearHighlight - Clear highlight
Example:Instance.interactivity.clearHighlight()
3 select params
Type: json
{entity_id: string, struct_asym_id: string, start_residue_number: number, end_residue_number: number}[]
Trigger Selection
Example:Instance.interactivity.select([{entity_id: '1', struct_asym_id: 'A', start_residue_number: 10, end_residue_number: 15}])
4 clearSelection - Clear selection
Example:Instance.interactivity.clearSelection()
Clone this wiki locally