File size: 2,576 Bytes
71174bc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import { TreeNodeType } from "@/UI/Navigation/TreeView/TreeInterfaces";
import { ISelAndStyle } from "./SelAndStyleInterfaces";
import { colorDefinitionNameToScheme } from "./Colors/ColorSchemeDefinitions";

export const unbondedAtomsStyle: ISelAndStyle = {
    selection: {
        bonds: 0,
    },
    sphere: {
        radius: 0.5,
    },
};

const _sphereStyle: ISelAndStyle = {
    // NOTE: Proteins, metals, etc. are separated into different molecules, so
    // no need to select by residue name, for example. Each style will apply to
    // all atoms in the given molecule.
    selection: {},
    sphere: {},
};

const _stickStyle: ISelAndStyle = {
    // NOTE: Proteins, metals, etc. are separated into different molecules, so
    // no need to select by residue name, for example. Each style will apply to
    // all atoms in the given molecule.
    selection: {},
    stick: { colorscheme: "default" },
};

export const defaultProteinStyle: ISelAndStyle[] = [
    {
        // NOTE: Proteins, metals, etc. are separated into different molecules, so
        // no need to select by residue name, for example. Each style will apply to
        // all atoms in the given molecule.
        selection: {},

        // Not sure why you need to specify color here and not for default
        // styles.
        cartoon: colorDefinitionNameToScheme("Spectrum", ""),
    },
];

export const defaultNucleicStyle: ISelAndStyle[] = [_stickStyle];

export const defaultLigandsStyle: ISelAndStyle[] = [_stickStyle];

export const defaultMetalsStyle: ISelAndStyle[] = [_sphereStyle];

export const defaultLipidStyle: ISelAndStyle[] = [_stickStyle];

export const defaultIonsStyle: ISelAndStyle[] = [_sphereStyle];

export const defaultSolventStyle: ISelAndStyle[] = [_stickStyle];

// export const defaultOtherStyle: IStyle[] = [_sphereStyle];

// Empty on purpose to satisfy typescript
const regionStyle: ISelAndStyle[] = [];

// This is used to restore original styling, for example after hiding a
// representation and then bringing it back.
export const defaultStyles: { [key in TreeNodeType]: ISelAndStyle[] } = {
    [TreeNodeType.Protein]: defaultProteinStyle,
    [TreeNodeType.Nucleic]: defaultNucleicStyle,
    [TreeNodeType.Compound]: defaultLigandsStyle,
    [TreeNodeType.Metal]: defaultMetalsStyle,
    [TreeNodeType.Lipid]: defaultLipidStyle,
    [TreeNodeType.Ions]: defaultIonsStyle,
    [TreeNodeType.Solvent]: defaultSolventStyle,
    [TreeNodeType.Region]: regionStyle,
    [TreeNodeType.Other]: [], // Must be defined explicitly (TreeNode.styles = [{...}])
};