Open nataliarosa9 opened 1 month ago
What are you trying to achieve?
I want to repaint a specific section of the structure on a particular chain. ...
// Get polymer representation
const cartoon = structure.representation.representations.polymer;
// Create and apply custom representation
const reprParamsStructureResetColor = createStructureRepresentationParams(plugin, undefined, {
type: 'cartoon',
color: 'uniform',
colorParams: { value: ColorNames.gray }
});
const update = await plugin
.build()
.to(cartoon)
.update(reprParamsStructureResetColor);
// Set script language
const language = 'mol-script';
// Create params object
const params = {
layers: []
};
// Add layers to params object
for (let i = 0; i < positions.length; i++) {
const start = positions[i];
const stop = positions[i];
const chain = 'B';
params.layers.push({
script: Script(
`(sel.atom.res (in-range atom.resno ${start} ${stop}))`,
language
),
color: Color(0xf0e68c),
clear: false
});
}
// Apply yellow color
const update2 = plugin.build();
update
.to(cartoon)
.apply(StateTransforms.Representation.OverpaintStructureRepresentation3DFromScript, params);
await update.commit();
await update2.commit();
...
I'm trying to select a chain in the query using Mol-script language. I can do it when the query is like this:
But I need to figure out how to do it in this scenario.