Skip to content
Snippets Groups Projects
Commit 6a330a6d authored by Michal Malý's avatar Michal Malý
Browse files

ReDNATCO plugin stage 4

parent ac9f69ff
No related branches found
No related tags found
No related merge requests found
export type ID ='data'|'trajectory'|'model'|'structure'|'visual'|'pyramids'; export type ID ='data'|'trajectory'|'model'|'structure'|'visual'|'pyramids'|'superposition';
export type Substructure = 'nucleic'|'protein'|'water'; export type Substructure = 'nucleic'|'protein'|'water';
export function ID(id: ID, sub: Substructure|'', ref: string) { export function ID(id: ID, sub: Substructure|'', ref: string) {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<meta charset="utf-8" /> <meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="molstar.css" /> <link rel="stylesheet" type="text/css" href="molstar.css" />
</head> </head>
<body style="height: 100vh; display: flex; overflow: hidden;"> <body style="height: 95vh; display: flex; overflow: hidden;">
<div id="xxx-app" style="flex: 1"></div> <div id="xxx-app" style="flex: 1"></div>
<script type="text/javascript" src="./molstar.js"></script> <script type="text/javascript" src="./molstar.js"></script>
<script> <script>
......
This diff is collapsed.
Source diff could not be displayed: it is too large. Options to address this: view the blob.
export type Ring = 'purine'|'pyrimidine';
/* eslint-disable array-bracket-spacing, no-multi-spaces */
export const ReferenceCompounds: Record<string, [string, string]> = {
AA00: [ 'A', 'G'],
AA01: ['DC', 'DG'],
AA02: ['DA', 'DA'],
AA03: [ 'U', 'C'],
AA04: [ 'A', 'G'],
AA05: [ 'A', 'G'],
AA06: [ 'U', 'G'],
AA07: [ 'U', 'A'],
AA08: [ 'G', 'C'],
AA09: [ 'A', 'A'],
AA10: [ 'A', 'G'],
AA11: [ 'A', 'A'],
AA12: [ 'U', 'G'],
AA13: [ 'G', 'U'],
AB01: ['DC', 'DG'],
AB02: ['DG', 'DG'],
AB03: ['DC', 'DA'],
AB04: ['DT', 'DA'],
AB05: [ 'G', 'U'],
BA01: ['DA', 'DT'],
BA05: ['DA', 'DC'],
BA09: ['DG', 'DG'],
BA08: ['DC', 'DG'],
BA10: ['DA', 'DG'],
BA13: ['DG', 'DA'],
BA16: [ 'U', 'U'],
BA17: ['DC', 'DT'],
BB00: ['DG', 'DA'],
BB01: ['DA', 'DA'],
BB17: ['DC', 'DC'],
BB02: ['DA', 'DC'],
BB03: ['DA', 'DG'],
BB11: ['DT', 'DT'],
BB16: ['DC', 'DG'],
BB04: ['DC', 'DG'],
BB05: ['DA', 'DC'],
BB07: ['DC', 'DG'],
BB08: ['DC', 'DG'],
BB10: ['DG', 'DG'],
BB12: ['DG', 'DA'],
BB13: ['DA', 'DC'],
BB14: ['DC', 'DA'],
BB15: ['DG', 'DC'],
BB20: ['DT', 'DT'],
IC01: [ 'C', 'C'],
IC02: [ 'U', 'U'],
IC03: [ 'G', 'A'],
IC04: ['DC', 'DG'],
IC05: ['DC', 'DG'],
IC06: ['DC', 'DG'],
IC07: [ 'G', 'U'],
OP01: [ 'C', 'A'],
OP02: [ 'G', 'U'],
OP03: [ 'G', 'A'],
OP04: [ 'G', 'A'],
OP05: [ 'G', 'U'],
OP06: [ 'U', 'U'],
OP07: [ 'G', 'C'],
OP08: [ 'G', 'A'],
OP09: [ 'U', 'U'],
OP10: [ 'G', 'A'],
OP11: [ 'A', 'G'],
OP12: [ 'U', 'C'],
OP13: [ 'U', 'G'],
OP14: [ 'A', 'G'],
OP15: [ 'G', 'U'],
OP16: [ 'G', 'G'],
OP17: [ 'G', 'U'],
OP18: [ 'U', 'U'],
OP19: ['DG', 'DT'],
OP20: ['DA', 'DC'],
OP21: [ 'U', 'U'],
OP22: ['DU', 'DU'],
OP23: [ 'A', 'G'],
OP24: [ 'A', 'A'],
OP25: [ 'A', 'U'],
OP26: [ 'U', 'C'],
OP27: [ 'C', 'G'],
OP28: [ 'G', 'U'],
OP29: [ 'A', 'U'],
OP30: [ 'C', 'G'],
OP31: [ 'A', 'G'],
OPS1: [ 'U', 'C'],
OP1S: ['DT', 'DG'],
AAS1: [ 'C', 'A'],
AB1S: ['DA', 'DG'],
AB2S: [ 'G', 'G'],
BB1S: ['DG', 'DG'],
BB2S: ['DG', 'DG'],
BBS1: ['DG', 'DG'],
ZZ01: [ 'U', 'C'],
ZZ02: [ 'A', 'C'],
ZZ1S: ['DC', 'DG'],
ZZ2S: ['DC', 'DG'],
ZZS1: ['DG', 'DC'],
ZZS2: ['DG', 'DC'],
};
export type ReferenceCompounds = typeof ReferenceCompounds;
/* eslint-disable no-multi-spaces */
export const CompoundRings: Record<string, Ring> = {
A: 'purine',
G: 'purine',
DA: 'purine',
DG: 'purine',
DDG: 'purine',
EDA: 'purine',
GNE: 'purine',
N2G: 'purine',
N5I: 'purine',
'2DA': 'purine',
'7DA': 'purine',
PRN: 'purine',
AD2: 'purine',
A3P: 'purine',
A5L: 'purine',
FMG: 'purine',
MA7: 'purine',
MG1: 'purine',
O2G: 'purine',
PPW: 'purine',
'1AP': 'purine',
'2FI': 'purine',
'2PR': 'purine',
'6MA': 'purine',
'6OG': 'purine',
'7GU': 'purine',
'8OG': 'purine',
TGP: 'purine',
GFL: 'purine',
A2M: 'purine',
OMG: 'purine',
GTP: 'purine',
GDP: 'purine',
'2MG': 'purine',
G7M: 'purine',
IGU: 'purine',
'6NW': 'purine',
T: 'pyrimidine',
C: 'pyrimidine',
U: 'pyrimidine',
DT: 'pyrimidine',
'2DT': 'pyrimidine',
'5NC': 'pyrimidine',
DC: 'pyrimidine',
DU: 'pyrimidine',
BRU: 'pyrimidine',
CBR: 'pyrimidine',
C38: 'pyrimidine',
DOC: 'pyrimidine',
ME6: 'pyrimidine',
OMC: 'pyrimidine',
UMP: 'pyrimidine',
Z: 'pyrimidine',
'5CM': 'pyrimidine',
'5IU': 'pyrimidine',
'5PY': 'pyrimidine',
PST: 'pyrimidine',
SPT: 'pyrimidine',
TPC: 'pyrimidine',
TSP: 'pyrimidine',
UPS: 'pyrimidine',
US1: 'pyrimidine',
'4PC': 'pyrimidine',
'5HU': 'pyrimidine',
'5FC': 'pyrimidine',
UFT: 'pyrimidine',
CFL: 'pyrimidine',
TAF: 'pyrimidine',
'5HC': 'pyrimidine',
CCC: 'pyrimidine',
IMC: 'pyrimidine',
'5BU': 'pyrimidine',
'6OO': 'pyrimidine',
F2T: 'pyrimidine',
XFC: 'pyrimidine'
};
export type CompoundRings = typeof CompoundRings;
export const BackboneAtoms = {
first: ["C5'", "C4'", "O4'", "C3'", "O3'", "C1'"],
/* eslint-disable @typescript-eslint/quotes */
second: ["P", "O5'", "C5'", "C4'", "O4'", "C3'", "O3'", "C1'"],
purine: ['N9', 'C4'],
pyrimidine: ['N1', 'C2'],
};
import { OrderedSet } from '../../mol-data/int/ordered-set';
import { StructureElement, StructureProperties } from '../../mol-model/structure';
import { Location } from '../../mol-model/structure/structure/element/location';
export namespace Step {
export type Description = {
model: number;
entryId: string;
chain: string;
resNo1: number;
comp1: string;
altId1?: string;
insCode1?: string;
resNo2: number;
comp2: string;
altId2?: string;
insCode2?: string;
};
function nameResidue(seqId: number, compId: string, altId?: string, insCode?: string) {
return `${compId}${altId ? `.${altId}` : ''}_${seqId}${insCode ? `.${insCode}` : '' }`;
}
export function describe(loci: StructureElement.Loci) {
const es = loci.elements[0]; // Ignore multiple selections
const loc = Location.create(loci.structure, es.unit);
loc.element = es.unit.elements[OrderedSet.getAt(es.indices, 0)]; // We're assuming a non-empty set
const description: Description = {
model: es.unit.model.modelNum,
entryId: loci.structure.model.entryId.toLowerCase(),
chain: StructureProperties.chain.auth_asym_id(loc),
resNo1: StructureProperties.residue.auth_seq_id(loc),
comp1: StructureProperties.atom.auth_comp_id(loc),
altId1: StructureProperties.atom.label_alt_id(loc),
insCode1: StructureProperties.residue.pdbx_PDB_ins_code(loc),
resNo2: -1,
comp2: '',
altId2: void 0,
insCode2: void 0,
};
let found = false;
const len = OrderedSet.size(es.indices);
for (let idx = 1; idx < len; idx++) {
loc.element = es.unit.elements[OrderedSet.getAt(es.indices, idx)];
if (StructureProperties.residue.auth_seq_id(loc) !== description.resNo1) {
found = true;
break;
}
}
if (!found)
return void 0;
description.resNo2 = StructureProperties.residue.auth_seq_id(loc);
description.comp2 = StructureProperties.atom.auth_comp_id(loc);
description.altId2 = StructureProperties.atom.label_alt_id(loc);
description.insCode2 = StructureProperties.residue.pdbx_PDB_ins_code(loc);
return description;
}
export function name(description: Description, multipleModels: boolean) {
const res1 = nameResidue(description.resNo1, description.comp1, description.altId1, description.insCode1);
const res2 = nameResidue(description.resNo2, description.comp2, description.altId2, description.insCode2);
return `${description.entryId}${multipleModels ? `-m${description.model}` : ''}_${description.chain}_${res1}_${res2}`;
}
}
import { SymmetryOperator } from '../../mol-math/geometry/symmetry-operator';
import { MinimizeRmsd } from '../../mol-math/linear-algebra/3d/minimize-rmsd';
import { ElementIndex } from '../../mol-model/structure';
export namespace Superpose {
export type Input = {
elements: ElementIndex[],
conformation: SymmetryOperator.ArrayMapping<ElementIndex>,
}
export function positions(points: ElementIndex[], conformation: SymmetryOperator.ArrayMapping<ElementIndex>) {
const positions = MinimizeRmsd.Positions.empty(points.length);
const { x, y, z } = conformation;
points.forEach((v, idx) => {
positions.x[idx] = x(v);
positions.y[idx] = y(v);
positions.z[idx] = z(v);
});
return positions;
}
export function superposition(ofWhat: Input, onto: Input) {
const a = Superpose.positions(onto.elements, onto.conformation);
const b = Superpose.positions(ofWhat.elements, ofWhat.conformation);
return MinimizeRmsd.compute({ a, b });
}
}
import { OrderedSet } from '../../mol-data/int/ordered-set';
import { ElementIndex, StructureElement, Unit } from '../../mol-model/structure';
export function lociElements(loci: StructureElement.Loci) {
const es = loci.elements[0]; // Ignore anything but the first chuck
if (!Unit.isAtomic(es.unit))
return [];
const elems = new Array<ElementIndex>();
OrderedSet.forEach(es.indices, uI => elems.push(es.unit.elements[uI]));
return elems;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment