|
@@ -81,14 +81,24 @@ export class TmViewerStandalone extends Viewer {
|
|
|
|
|
|
/**
|
|
|
* Util function to handle overpaint logic.
|
|
|
- * @param labelAsymId
|
|
|
+ * @param labelAsymId if empty, it clears the overpaint color
|
|
|
* @param hexRgb default color grey, when it is false
|
|
|
* @param clear if true, it clears the overpaint color
|
|
|
*/
|
|
|
protected overPaint(labelAsymIds: string[], hexRgb: string|false = false, clear: boolean = false) {
|
|
|
+
|
|
|
+ let script: string;
|
|
|
if (labelAsymIds.length == 0) {
|
|
|
- console.warn('No specified chain(s) for overpaintings');
|
|
|
- return;
|
|
|
+ // switching to clear mode to reset overpaint,
|
|
|
+ // if there is no overpaint request for any chain
|
|
|
+ clear = true;
|
|
|
+ script = `(sel.atom.all)`;
|
|
|
+ } else {
|
|
|
+ const chainList = labelAsymIds.join(' ');
|
|
|
+ script = `(sel.atom.atom-groups :chain-test
|
|
|
+ (or (set.has (set ${chainList}) atom.auth_asym_id)
|
|
|
+ (set.has (set ${chainList}) atom.label_asym_id))
|
|
|
+ )`;
|
|
|
}
|
|
|
|
|
|
const state = this.plugin.state.data;
|
|
@@ -99,16 +109,12 @@ export class TmViewerStandalone extends Viewer {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- const chainList = labelAsymIds.join(' ');
|
|
|
selected.forEach(async (representation) => {
|
|
|
const update = this.plugin.build().to(representation);
|
|
|
update.apply(StateTransforms.Representation.OverpaintStructureRepresentation3DFromScript, {
|
|
|
layers: [
|
|
|
{
|
|
|
- script: Script(
|
|
|
- `(sel.atom.atom-groups :chain-test (set.has (set ${chainList}) atom.label_asym_id))`,
|
|
|
- 'mol-script'
|
|
|
- ),
|
|
|
+ script: Script(script, 'mol-script'),
|
|
|
color: hexRgb !== false ? Color.fromHexString(hexRgb) : ColorNames.white,
|
|
|
clear: clear
|
|
|
}
|