Skip to content
Snippets Groups Projects
Commit 5ed17ce4 authored by David Sehnal's avatar David Sehnal
Browse files

proteopedia-wrapper: evolutionary coloring on current representation

parent 3c9b82dc
No related branches found
No related tags found
No related merge requests found
...@@ -149,7 +149,8 @@ ...@@ -149,7 +149,8 @@
addSeparator(); addSeparator();
addHeader('Misc'); addHeader('Misc');
addControl('Apply Evo Cons', () => PluginWrapper.coloring.evolutionaryConservation()); addControl('Apply Evo Cons Style', () => PluginWrapper.coloring.evolutionaryConservation());
addControl('Apply Evo Cons Colors', () => PluginWrapper.coloring.evolutionaryConservation({ sequence: true, het: false, keepStyle: true }));
addControl('Default Visuals', () => PluginWrapper.updateStyle()); addControl('Default Visuals', () => PluginWrapper.updateStyle());
addSeparator(); addSeparator();
......
...@@ -253,18 +253,26 @@ class MolStarProteopediaWrapper { ...@@ -253,18 +253,26 @@ class MolStarProteopediaWrapper {
} }
coloring = { coloring = {
evolutionaryConservation: async () => { evolutionaryConservation: async (params?: { sequence?: boolean, het?: boolean, keepStyle?: boolean }) => {
await this.updateStyle({ sequence: { kind: 'spacefill' } }, true); if (!params || !params.keepStyle) {
await this.updateStyle({ sequence: { kind: 'spacefill' } }, true);
}
const state = this.state; const state = this.state;
// const visuals = state.selectQ(q => q.ofType(PluginStateObject.Molecule.Structure.Representation3D).filter(c => c.transform.transformer === StateTransforms.Representation.StructureRepresentation3D)); // const visuals = state.selectQ(q => q.ofType(PluginStateObject.Molecule.Structure.Representation3D).filter(c => c.transform.transformer === StateTransforms.Representation.StructureRepresentation3D));
// for (const v of visuals) {
// }
const tree = state.build(); const tree = state.build();
const colorTheme = { name: EvolutionaryConservation.Descriptor.name, params: this.plugin.structureRepresentation.themeCtx.colorThemeRegistry.get(EvolutionaryConservation.Descriptor.name).defaultValues }; const colorTheme = { name: EvolutionaryConservation.Descriptor.name, params: this.plugin.structureRepresentation.themeCtx.colorThemeRegistry.get(EvolutionaryConservation.Descriptor.name).defaultValues };
tree.to(StateElements.SequenceVisual).update(StateTransforms.Representation.StructureRepresentation3D, old => ({ ...old, colorTheme })); if (!params || !!params.sequence) {
// for (const v of visuals) { tree.to(StateElements.SequenceVisual).update(StateTransforms.Representation.StructureRepresentation3D, old => ({ ...old, colorTheme }));
// } }
if (params && !!params.het) {
tree.to(StateElements.HetVisual).update(StateTransforms.Representation.StructureRepresentation3D, old => ({ ...old, colorTheme }));
}
await PluginCommands.State.Update.dispatch(this.plugin, { state, tree }); await PluginCommands.State.Update.dispatch(this.plugin, { state, tree });
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment