Browse Source

added `objectPrimitive` to unit and mol-script

Alexander Rose 5 years ago
parent
commit
c28feb2d1c

+ 1 - 0
src/mol-model/structure/structure/properties.ts

@@ -123,6 +123,7 @@ const entity = {
 
 const unit = {
     id: p(l => l.unit.id),
+    object_primitive: p(l => l.unit.objectPrimitive),
     operator_name: p(l => l.unit.conformation.operator.name),
     model_index: p(l => l.unit.model.modelNum),
     model_label: p(l => l.unit.model.label),

+ 9 - 1
src/mol-model/structure/structure/unit.ts

@@ -17,6 +17,7 @@ import { ChainIndex, ResidueIndex, ElementIndex } from '../model/indexing';
 import { IntMap, SortedArray } from '../../../mol-data/int';
 import { hash2, hashFnv32a } from '../../../mol-data/util';
 import { getAtomicPolymerElements, getCoarsePolymerElements, getAtomicGapElements, getCoarseGapElements, getNucleotideElements, getProteinElements } from './util/polymer';
+import { mmCIF_Schema } from '../../../mol-io/reader/cif/schema/mmcif';
 
 /**
  * A building block of a structure that corresponds to an atomic or
@@ -95,7 +96,7 @@ namespace Unit {
 
     export interface Base {
         readonly id: number,
-        // invariant ID stays the same even if the Operator/conformation changes.
+        /** invariant ID stays the same even if the Operator/conformation changes. */
         readonly invariantId: number,
         readonly elements: StructureElement.Set,
         readonly model: Model,
@@ -107,6 +108,10 @@ namespace Unit {
         readonly lookup3d: Lookup3D
         readonly polymerElements: SortedArray<ElementIndex>
         readonly gapElements: SortedArray<ElementIndex>
+        /**
+         * From mmCIF/IHM schema: `_ihm_model_representation_details.model_object_primitive`.
+         */
+        readonly objectPrimitive: mmCIF_Schema['ihm_model_representation_details']['model_object_primitive']['T']
     }
 
     function getSphereRadiusFunc(model: Model) {
@@ -130,6 +135,7 @@ namespace Unit {
      */
     export class Atomic implements Base {
         readonly kind = Kind.Atomic;
+        readonly objectPrimitive = 'atomistic';
 
         readonly id: number;
         readonly invariantId: number;
@@ -237,6 +243,7 @@ namespace Unit {
 
     class Coarse<K extends Kind.Gaussians | Kind.Spheres, C extends CoarseSphereConformation | CoarseGaussianConformation> implements Base {
         readonly kind: K;
+        readonly objectPrimitive: 'sphere' | 'gaussian';
 
         readonly id: number;
         readonly invariantId: number;
@@ -287,6 +294,7 @@ namespace Unit {
 
         constructor(id: number, invariantId: number, model: Model, kind: K, elements: StructureElement.Set, conformation: SymmetryOperator.ArrayMapping<ElementIndex>, props: CoarseProperties) {
             this.kind = kind;
+            this.objectPrimitive = kind === Kind.Spheres ? 'sphere' : 'gaussian'
             this.id = id;
             this.invariantId = invariantId;
             this.model = model;

+ 5 - 3
src/mol-script/language/symbol-table/structure-query.ts

@@ -21,6 +21,7 @@ export namespace Types {
 
     export const RingFingerprint = Type.Value('Structure', 'RingFingerprint');
     export const EntityType = Type.OneOf('Structure', 'EntityType', Type.Str, ['polymer', 'non-polymer', 'water', 'branched', 'unknown']);
+    export const ObjectPrimitive = Type.OneOf('Structure', 'ObjectPrimitive', Type.Str, ['atomistic', 'sphere', 'gaussian', 'other']);
     export const ResidueId = Type.Value('Structure', 'ResidueId');
 
     export const ElementSet = Type.Value('Structure', 'ElementSet');
@@ -268,8 +269,8 @@ const atomProperty = {
         authResidueId: atomProp(Types.ResidueId, `type.auth-residue-id symbol executed on current atom's residue`),
         labelResidueId: atomProp(Types.ResidueId, `type.label-residue-id symbol executed on current atom's residue`),
 
-        residueKey: atomProp(Type.AnyValue, 'Unique value for each tuple ``(label_entity_id,auth_asym_id,auth_seq_id,pdbx_PDB_ins_code)``, main use case is grouping of atoms'),
-        chainKey: atomProp(Type.AnyValue, 'Unique value for each tuple ``(label_entity_id,auth_asym_id)``, main use case is grouping of atoms'),
+        residueKey: atomProp(Type.AnyValue, 'Unique value for each tuple ``(label_entity_id,auth_asym_id, auth_seq_id, pdbx_PDB_ins_code)``, main use case is grouping of atoms'),
+        chainKey: atomProp(Type.AnyValue, 'Unique value for each tuple ``(label_entity_id, auth_asym_id)``, main use case is grouping of atoms'),
         entityKey: atomProp(Type.AnyValue, 'Unique value for each tuple ``label_entity_id``, main use case is grouping of atoms'),
 
         isHet: atomProp(Type.Bool, 'Equivalent to atom_site.group_PDB !== ATOM'),
@@ -294,7 +295,8 @@ const atomProperty = {
         occupancy: atomProp(Type.Num),
         B_iso_or_equiv: atomProp(Type.Num),
 
-        entityType: atomProp(Types.EntityType, 'Type of the entity as defined in mmCIF (polymer, non-polymer, water, unknown)'),
+        entityType: atomProp(Types.EntityType, 'Type of the entity as defined in mmCIF (polymer, non-polymer, branched, water, unknown)'),
+        objectPrimitive: atomProp(Types.ObjectPrimitive, 'Type of the primitive object used to model this segment as defined in mmCIF/IHM (atomistic, sphere, gaussian, other)'),
 
         secondaryStructureKey: atomProp(Type.AnyValue, 'Unique value for each secondary structure element.'),
         secondaryStructureFlags: atomProp(Types.SecondaryStructureFlags),

+ 1 - 0
src/mol-script/runtime/query/table.ts

@@ -299,6 +299,7 @@ const symbols = [
     D(MolScript.structureQuery.atomProperty.macromolecular.B_iso_or_equiv, atomProp(StructureProperties.atom.B_iso_or_equiv)),
 
     D(MolScript.structureQuery.atomProperty.macromolecular.entityType, atomProp(StructureProperties.entity.type)),
+    D(MolScript.structureQuery.atomProperty.macromolecular.objectPrimitive, atomProp(StructureProperties.unit.object_primitive)),
 
     D(MolScript.structureQuery.atomProperty.macromolecular.isModified, (ctx, _) => ctx.element.unit.model.properties.modifiedResidues.parentId.has(StructureProperties.residue.label_comp_id(ctx.element))),
     D(MolScript.structureQuery.atomProperty.macromolecular.modifiedParentName, (ctx, _) => {

+ 1 - 0
src/mol-script/script/mol-script/symbols.ts

@@ -229,6 +229,7 @@ export const SymbolTable = [
             Alias(MolScript.structureQuery.atomProperty.macromolecular.occupancy, 'atom.occupancy'),
             Alias(MolScript.structureQuery.atomProperty.macromolecular.B_iso_or_equiv, 'atom.B_iso_or_equiv', 'atom.bfactor'),
             Alias(MolScript.structureQuery.atomProperty.macromolecular.entityType, 'atom.entity-type'),
+            Alias(MolScript.structureQuery.atomProperty.macromolecular.objectPrimitive, 'atom.object-primitive'),
 
             Alias(MolScript.structureQuery.atomProperty.macromolecular.secondaryStructureKey, 'atom.key.sec-struct'),