diff --git a/src/mol-model-formats/structure/mmcif/parser.ts b/src/mol-model-formats/structure/mmcif/parser.ts index 44835f9e96254479326925d00c25bc863ce7363a..d31b63d1a8a6d0eaa4368ee6660178a237f0f59b 100644 --- a/src/mol-model-formats/structure/mmcif/parser.ts +++ b/src/mol-model-formats/structure/mmcif/parser.ts @@ -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); diff --git a/src/mol-model/structure/structure/properties.ts b/src/mol-model/structure/structure/properties.ts index b2cfa785cdc9534bf57ea26dc13bb252b7db3904..ce4d02dc13be2d0e5768a008534d8bfd034783cb 100644 --- a/src/mol-model/structure/structure/properties.ts +++ b/src/mol-model/structure/structure/properties.ts @@ -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)), diff --git a/src/mol-script/language/symbol-table/structure-query.ts b/src/mol-script/language/symbol-table/structure-query.ts index 5ce9110e49611b5518af323c6e5896c340fe2b06..6e345445a88e4d88376f5c1ebd22f52e407986c2 100644 --- a/src/mol-script/language/symbol-table/structure-query.ts +++ b/src/mol-script/language/symbol-table/structure-query.ts @@ -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: { diff --git a/src/mol-script/runtime/query/table.ts b/src/mol-script/runtime/query/table.ts index 6a4d2be3f2910763ef0ac73bba9fe56d352ee851..2b6b45dcf34e940bdebc532c50948e1785976ee7 100644 --- a/src/mol-script/runtime/query/table.ts +++ b/src/mol-script/runtime/query/table.ts @@ -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: diff --git a/src/mol-script/script/mol-script/symbols.ts b/src/mol-script/script/mol-script/symbols.ts index 0e2f2a741d8c859c1a74e8ab9c9016475192e1e9..43aa954f111bcb83f046ecfb26eec59eaf2b88c6 100644 --- a/src/mol-script/script/mol-script/symbols.ts +++ b/src/mol-script/script/mol-script/symbols.ts @@ -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'),