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

added sourceIndex property to mol-script

parent a81bcf43
No related branches found
No related tags found
No related merge requests found
......@@ -292,6 +292,7 @@ async function readIHM(ctx: RuntimeContext, format: mmCIF_Format, formatData: Fo
const atom_sites = splitTable(format.data.atom_site, format.data.atom_site.ihm_model_id);
// TODO: will coarse IHM records require sorting or will we trust it?
// ==> Probably implement a sort as as well and store the sourceIndex same as with atomSite
// If the sorting is implemented, updated mol-model/structure/properties: atom.sourceIndex
const sphere_sites = splitTable(format.data.ihm_sphere_obj_site, format.data.ihm_sphere_obj_site.model_id);
const gauss_sites = splitTable(format.data.ihm_gaussian_obj_site, format.data.ihm_gaussian_obj_site.model_id);
......
......@@ -35,6 +35,10 @@ const atom = {
id: StructureElement.property(l => !Unit.isAtomic(l.unit) ? notAtomic() : l.unit.model.atomicConformation.atomId.value(l.element)),
occupancy: StructureElement.property(l => !Unit.isAtomic(l.unit) ? notAtomic() : l.unit.model.atomicConformation.occupancy.value(l.element)),
B_iso_or_equiv: StructureElement.property(l => !Unit.isAtomic(l.unit) ? notAtomic() : l.unit.model.atomicConformation.B_iso_or_equiv.value(l.element)),
sourceIndex: StructureElement.property(l => Unit.isAtomic(l.unit)
? l.unit.model.atomicHierarchy.atoms.sourceIndex.value(l.element)
// TODO: when implemented, this should map to the source index.
: l.element),
// Hierarchy
type_symbol: StructureElement.property(l => !Unit.isAtomic(l.unit) ? notAtomic() : l.unit.model.atomicHierarchy.atoms.type_symbol.value(l.element)),
......
......@@ -242,7 +242,9 @@ const atomProperty = {
bondCount: symbol(Arguments.Dictionary({
0: Argument(Types.ElementReference, { isOptional: true, defaultValue: 'slot.current-atom' }),
flags: Argument(Types.BondFlags, { isOptional: true, defaultValue: 'covalent' as any }),
}), Type.Num, 'Number of bonds (by default only covalent bonds are counted).')
}), Type.Num, 'Number of bonds (by default only covalent bonds are counted).'),
sourceIndex: atomProp(Type.Num, 'Index of the atom/element in the input file.'),
},
topology: {
......
......@@ -205,6 +205,7 @@ const symbols = [
D(MolScript.structureQuery.atomProperty.core.x, atomProp(StructureProperties.atom.x)),
D(MolScript.structureQuery.atomProperty.core.y, atomProp(StructureProperties.atom.y)),
D(MolScript.structureQuery.atomProperty.core.z, atomProp(StructureProperties.atom.z)),
D(MolScript.structureQuery.atomProperty.core.sourceIndex, atomProp(StructureProperties.atom.sourceIndex)),
D(MolScript.structureQuery.atomProperty.core.atomKey, (ctx, _) => cantorPairing(ctx.element.unit.id, ctx.element.element)),
// TODO:
......
......@@ -196,6 +196,7 @@ export const SymbolTable = [
Alias(MolScript.structureQuery.atomProperty.core.x, 'atom.x'),
Alias(MolScript.structureQuery.atomProperty.core.y, 'atom.y'),
Alias(MolScript.structureQuery.atomProperty.core.z, 'atom.z'),
Alias(MolScript.structureQuery.atomProperty.core.sourceIndex, 'atom.src-index'),
Alias(MolScript.structureQuery.atomProperty.core.atomKey, 'atom.key'),
Alias(MolScript.structureQuery.atomProperty.core.bondCount, 'atom.bond-count'),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment