Переглянути джерело

renamed CustomStructureProperty.getValue to .get

Alexander Rose 5 роки тому
батько
коміт
03228f7952

+ 2 - 2
src/mol-model-props/common/custom-property-registry.ts

@@ -85,7 +85,7 @@ namespace CustomStructureProperty {
         readonly getParams: (data: Structure) => Params
         readonly isApplicable: (data: Structure) => boolean
         readonly attach: (ctx: CustomPropertyContext, data: Structure, props?: Partial<PD.Values<Params>>) => Promise<void>
-        readonly getValue: (data: Structure) => ValueBox<Value | undefined>
+        readonly get: (data: Structure) => ValueBox<Value | undefined>
         readonly setProps: (data: Structure, props: PD.Values<Params>) => void
     }
 
@@ -134,7 +134,7 @@ namespace CustomStructureProperty {
                 data.customPropertyDescriptors.add(builder.descriptor);
                 set(data, p, value);
             },
-            getValue: (data: Structure) => get(data)?.data,
+            get: (data: Structure) => get(data)?.data,
             setProps: (data: Structure, props: Partial<PD.Values<Params>> = {}) => {
                 const property = get(data)
                 const p = { ...property.props, ...props }

+ 1 - 1
src/mol-model-props/computed/interactions/charged.ts

@@ -48,7 +48,7 @@ const PositvelyCharged = ['ARG', 'HIS', 'LYS']
 const NegativelyCharged = ['GLU', 'ASP']
 
 function getUnitValenceModel(structure: Structure, unit: Unit.Atomic) {
-    const valenceModel = ValenceModelProvider.getValue(structure).value
+    const valenceModel = ValenceModelProvider.get(structure).value
     if (!valenceModel) throw Error('expected valence model to be available')
     const unitValenceModel = valenceModel.get(unit.id)
     if (!unitValenceModel) throw Error('expected valence model for unit to be available')

+ 1 - 1
src/mol-model-props/computed/interactions/features.ts

@@ -145,7 +145,7 @@ namespace Features {
         idealGeometry: Int8Array
     }
     export function Info(structure: Structure, unit: Unit.Atomic, features: Features): Info {
-        const valenceModel = ValenceModelProvider.getValue(structure).value
+        const valenceModel = ValenceModelProvider.get(structure).value
         if (!valenceModel || !valenceModel.has(unit.id)) throw new Error('valence model required')
 
         return {

+ 1 - 1
src/mol-model-props/computed/interactions/hydrogen-bonds.ts

@@ -54,7 +54,7 @@ type WeakHydrogenBondsProps = PD.Values<WeakHydrogenBondsParams>
 // http://www.csb.yale.edu/userguides/datamanip/hbplus/hbplus_descrip.html
 
 function getUnitValenceModel(structure: Structure, unit: Unit.Atomic) {
-    const valenceModel = ValenceModelProvider.getValue(structure).value
+    const valenceModel = ValenceModelProvider.get(structure).value
     if (!valenceModel) throw Error('expected valence model to be available')
     const unitValenceModel = valenceModel.get(unit.id)
     if (!unitValenceModel) throw Error('expected valence model for unit to be available')

+ 1 - 1
src/mol-model-props/rcsb/assembly-symmetry.ts

@@ -45,7 +45,7 @@ export namespace AssemblySymmetry {
 export function getSymmetrySelectParam(structure?: Structure) {
     const param = PD.Select<number>(0, [[0, 'No Symmetries']])
     if (structure) {
-        const assemblySymmetry = AssemblySymmetryProvider.getValue(structure).value
+        const assemblySymmetry = AssemblySymmetryProvider.get(structure).value
         if (assemblySymmetry) {
             const options: [number, string][] = []
             for (let i = 0, il = assemblySymmetry.length; i < il; ++i) {

+ 1 - 1
src/mol-model-props/rcsb/representations/assembly-symmetry-axes.ts

@@ -55,7 +55,7 @@ function getAxesMesh(data: AssemblySymmetryValue, props: PD.Values<AssemblySymme
 
 export async function getAssemblySymmetryAxesRepresentation(ctx: RuntimeContext, structure: Structure, params: AssemblySymmetryAxesProps, prev?: ShapeRepresentation<AssemblySymmetryValue, Mesh, Mesh.Params>) {
     const repr = prev || ShapeRepresentation(getAxesShape, Mesh.Utils);
-    const data = AssemblySymmetryProvider.getValue(structure).value
+    const data = AssemblySymmetryProvider.get(structure).value
     await repr.createOrUpdate(params, data).runInContext(ctx);
     return repr;
 }

+ 1 - 1
src/mol-model-props/rcsb/themes/assembly-symmetry-cluster.ts

@@ -47,7 +47,7 @@ export function AssemblySymmetryClusterColorTheme(ctx: ThemeDataContext, props:
     let legend: ScaleLegend | TableLegend | undefined
 
     const { symmetryIndex } = props
-    const assemblySymmetry = ctx.structure && AssemblySymmetryProvider.getValue(ctx.structure)
+    const assemblySymmetry = ctx.structure && AssemblySymmetryProvider.get(ctx.structure)
     const contextHash = assemblySymmetry?.version
 
     const clusters = assemblySymmetry?.value?.[symmetryIndex]?.clusters

+ 1 - 1
src/mol-plugin/behavior/dynamic/custom-props/computed/accessible-surface-area.ts

@@ -24,7 +24,7 @@ export const AccessibleSurfaceArea = PluginBehavior.create<{ autoAttach: boolean
                     if (loci.elements.length === 0) return void 0;
                     // const e = loci.elements[0];
                     // const u = e.unit;
-                    if (!this.provider.getValue(loci.structure).value) return;
+                    if (!this.provider.get(loci.structure).value) return;
 
                     return `Accessible Surface Area: ${'TODO'} \u212B<sup>3</sup>`;
 

+ 1 - 1
src/mol-plugin/behavior/dynamic/custom-props/computed/interactions.ts

@@ -47,7 +47,7 @@ export const Interactions = PluginBehavior.create<{ autoAttach: boolean, showToo
                     const structures = this.getStructures(loci.structure)
 
                     for (const s of structures) {
-                        const interactions = this.provider.getValue(s).value
+                        const interactions = this.provider.get(s).value
                         if (!interactions) continue;
 
                         const l = StructureElement.Loci.remap(loci, s)

+ 1 - 1
src/mol-plugin/behavior/dynamic/custom-props/computed/valence-model.ts

@@ -46,7 +46,7 @@ export const ValenceModel = PluginBehavior.create<{ autoAttach: boolean, showToo
                     const structures = this.getStructures(loci.structure)
 
                     for (const s of structures) {
-                        const valenceModel = this.provider.getValue(s).value
+                        const valenceModel = this.provider.get(s).value
                         if (!valenceModel) continue;
 
                         const l = StructureElement.Loci.remap(loci, s)

+ 2 - 2
src/mol-plugin/behavior/dynamic/custom-props/rcsb/assembly-symmetry.ts

@@ -67,14 +67,14 @@ const AssemblySymmetryAxes3D = PluginStateTransform.BuiltIn({
         return Task.create('RCSB Assembly Symmetry Axes', async ctx => {
             await AssemblySymmetryProvider.attach({ runtime: ctx, fetch: plugin.fetch }, a.data)
             const repr = await getAssemblySymmetryAxesRepresentation(ctx, a.data, params)
-            const { symbol, kind } = AssemblySymmetryProvider.getValue(a.data).value![params.symmetryIndex]
+            const { symbol, kind } = AssemblySymmetryProvider.get(a.data).value![params.symmetryIndex]
             return new PluginStateObject.Shape.Representation3D({ repr, source: a }, { label: `Axes`, description: `${symbol} ${kind}` });
         });
     },
     update({ a, b, newParams }) {
         return Task.create('RCSB Assembly Symmetry Axes', async ctx => {
             await getAssemblySymmetryAxesRepresentation(ctx, a.data, newParams, b.data.repr);
-            const { symbol, kind } = AssemblySymmetryProvider.getValue(a.data).value![newParams.symmetryIndex]
+            const { symbol, kind } = AssemblySymmetryProvider.get(a.data).value![newParams.symmetryIndex]
             b.description = `${symbol} ${kind}`
             return StateTransformer.UpdateResult.Updated;
         });

+ 5 - 5
src/mol-repr/structure/visual/interactions-inter-unit-cylinder.ts

@@ -27,7 +27,7 @@ const tmpLoc = StructureElement.Location.create()
 function createInterUnitInteractionCylinderMesh(ctx: VisualContext, structure: Structure, theme: Theme, props: PD.Values<InteractionsInterUnitParams>, mesh?: Mesh) {
     if (!structure.hasAtomic) return Mesh.createEmpty(mesh)
 
-    const interactions = InteractionsProvider.getValue(structure).value!
+    const interactions = InteractionsProvider.get(structure).value!
     const { contacts, unitsFeatures } = interactions
 
     const { edgeCount, edges } = contacts
@@ -87,7 +87,7 @@ export function InteractionsInterUnitVisual(materialId: number): ComplexVisual<I
                 newProps.radialSegments !== currentProps.radialSegments
             )
 
-            const interactionsHash = InteractionsProvider.getValue(newStructure).version
+            const interactionsHash = InteractionsProvider.get(newStructure).version
             if ((state.info.interactionsHash as number) !== interactionsHash) {
                 state.createGeometry = true
                 state.updateTransform = true
@@ -100,7 +100,7 @@ export function InteractionsInterUnitVisual(materialId: number): ComplexVisual<I
 function getInteractionLoci(pickingId: PickingId, structure: Structure, id: number) {
     const { objectId, groupId } = pickingId
     if (id === objectId) {
-        const interactions = InteractionsProvider.getValue(structure).value!
+        const interactions = InteractionsProvider.get(structure).value!
         const c = interactions.contacts.edges[groupId]
         return Interactions.Loci(structure, interactions, [
             { unitA: c.unitA, indexA: c.indexA, unitB: c.unitB, indexB: c.indexB },
@@ -114,7 +114,7 @@ function eachInteraction(loci: Loci, structure: Structure, apply: (interval: Int
     let changed = false
     if (Interactions.isLoci(loci)) {
         if (!Structure.areEquivalent(loci.structure, structure)) return false
-        const interactions = InteractionsProvider.getValue(structure).value!
+        const interactions = InteractionsProvider.get(structure).value!
         if (loci.interactions !== interactions) return false
         const { contacts } = interactions
 
@@ -129,7 +129,7 @@ function eachInteraction(loci: Loci, structure: Structure, apply: (interval: Int
 }
 
 function createInteractionsIterator(structure: Structure): LocationIterator {
-    const interactions = InteractionsProvider.getValue(structure).value!
+    const interactions = InteractionsProvider.get(structure).value!
     const { contacts } = interactions
     const groupCount = contacts.edgeCount
     const instanceCount = 1

+ 5 - 5
src/mol-repr/structure/visual/interactions-intra-unit-cylinder.ts

@@ -27,7 +27,7 @@ async function createIntraUnitInteractionsCylinderMesh(ctx: VisualContext, unit:
 
     const location = StructureElement.Location.create(unit)
 
-    const interactions = InteractionsProvider.getValue(structure).value!
+    const interactions = InteractionsProvider.get(structure).value!
     const features = interactions.unitsFeatures.get(unit.id)
     const contacts = interactions.unitsContacts.get(unit.id)
 
@@ -82,7 +82,7 @@ export function InteractionsIntraUnitVisual(materialId: number): UnitsVisual<Int
                 newProps.radialSegments !== currentProps.radialSegments
             )
 
-            const interactionsHash = InteractionsProvider.getValue(newStructureGroup.structure).version
+            const interactionsHash = InteractionsProvider.get(newStructureGroup.structure).version
             if ((state.info.interactionsHash as number) !== interactionsHash) {
                 state.createGeometry = true
                 state.updateTransform = true
@@ -97,7 +97,7 @@ function getInteractionLoci(pickingId: PickingId, structureGroup: StructureGroup
     if (id === objectId) {
         const { structure, group } = structureGroup
         const unit = structure.unitMap.get(group.units[instanceId].id)
-        const interactions = InteractionsProvider.getValue(structure).value!
+        const interactions = InteractionsProvider.get(structure).value!
         const contacts = interactions.unitsContacts.get(unit.id)
         return Interactions.Loci(structure, interactions, [
             { unitA: unit, indexA: contacts.a[groupId], unitB: unit, indexB: contacts.b[groupId] },
@@ -112,7 +112,7 @@ function eachInteraction(loci: Loci, structureGroup: StructureGroup, apply: (int
     if (Interactions.isLoci(loci)) {
         const { structure, group } = structureGroup
         if (!Structure.areEquivalent(loci.structure, structure)) return false
-        const interactions = InteractionsProvider.getValue(structure).value!
+        const interactions = InteractionsProvider.get(structure).value!
         if (loci.interactions !== interactions) return false
         const unit = group.units[0]
         const contacts = interactions.unitsContacts.get(unit.id)
@@ -133,7 +133,7 @@ function eachInteraction(loci: Loci, structureGroup: StructureGroup, apply: (int
 function createInteractionsIterator(structureGroup: StructureGroup): LocationIterator {
     const { structure, group } = structureGroup
     const unit = group.units[0]
-    const interactions = InteractionsProvider.getValue(structure).value!
+    const interactions = InteractionsProvider.get(structure).value!
     const contacts = interactions.unitsContacts.get(unit.id)
     const groupCount = contacts.edgeCount * 2
     const instanceCount = group.units.length

+ 1 - 1
src/mol-repr/structure/visual/polymer-trace-mesh.ts

@@ -172,7 +172,7 @@ export function PolymerTraceVisual(materialId: number): UnitsVisual<PolymerTrace
                 newProps.arrowFactor !== currentProps.arrowFactor
             )
 
-            const secondaryStructureHash = SecondaryStructureProvider.getValue(newStructureGroup.structure).version
+            const secondaryStructureHash = SecondaryStructureProvider.get(newStructureGroup.structure).version
             if ((state.info.secondaryStructureHash as number) !== secondaryStructureHash) {
                 state.createGeometry = true;
                 state.info.secondaryStructureHash = secondaryStructureHash

+ 1 - 1
src/mol-repr/structure/visual/util/polymer/trace-iterator.ts

@@ -305,7 +305,7 @@ export class AtomicPolymerTraceIterator implements Iterator<PolymerTraceElement>
         this.value = createPolymerTraceElement(unit)
         this.hasNext = this.residueIt.hasNext && this.polymerIt.hasNext
 
-        const secondaryStructure = SecondaryStructureProvider.getValue(structure).value?.get(unit.invariantId)
+        const secondaryStructure = SecondaryStructureProvider.get(structure).value?.get(unit.invariantId)
         if (!secondaryStructure) throw new Error('missing secondary structure')
         this.secondaryStructureType = secondaryStructure.type
         this.secondaryStructureGetIndex = secondaryStructure.getIndex

+ 1 - 1
src/mol-theme/color/accessible-surface-area.ts

@@ -37,7 +37,7 @@ export function AccessibleSurfaceAreaColorTheme(ctx: ThemeDataContext, props: PD
     })
 
     const { label_comp_id } = StructureProperties.residue
-    const accessibleSurfaceArea = ctx.structure && AccessibleSurfaceAreaProvider.getValue(ctx.structure)
+    const accessibleSurfaceArea = ctx.structure && AccessibleSurfaceAreaProvider.get(ctx.structure)
     const contextHash = accessibleSurfaceArea?.version
 
     if (accessibleSurfaceArea?.value && ctx.structure) {

+ 1 - 1
src/mol-theme/color/interaction-type.ts

@@ -72,7 +72,7 @@ export function getInteractionTypeColorThemeParams(ctx: ThemeDataContext) {
 export function InteractionTypeColorTheme(ctx: ThemeDataContext, props: PD.Values<InteractionTypeColorThemeParams>): ColorTheme<InteractionTypeColorThemeParams> {
     let color: LocationColor
 
-    const interactions = ctx.structure ? InteractionsProvider.getValue(ctx.structure) : undefined
+    const interactions = ctx.structure ? InteractionsProvider.get(ctx.structure) : undefined
     const contextHash = interactions?.version
 
     if (interactions && interactions.value) {

+ 1 - 1
src/mol-theme/color/secondary-structure.ts

@@ -84,7 +84,7 @@ export function secondaryStructureColor(colorMap: SecondaryStructureColors, unit
 
 export function SecondaryStructureColorTheme(ctx: ThemeDataContext, props: PD.Values<SecondaryStructureColorThemeParams>): ColorTheme<SecondaryStructureColorThemeParams> {
 
-    const computedSecondaryStructure = ctx.structure && SecondaryStructureProvider.getValue(ctx.structure)
+    const computedSecondaryStructure = ctx.structure && SecondaryStructureProvider.get(ctx.structure)
     const contextHash = computedSecondaryStructure && computedSecondaryStructure.version
 
     const colorMap = getAdjustedColorMap(SecondaryStructureColors, props.saturation, props.lightness)

+ 1 - 1
src/tests/browser/render-structure.ts

@@ -130,7 +130,7 @@ async function init() {
     console.time('compute Interactions')
     await InteractionsProvider.attach(ctx, structure)
     console.timeEnd('compute Interactions');
-    console.log(InteractionsProvider.getValue(structure).value)
+    console.log(InteractionsProvider.get(structure).value)
 
     const show = {
         cartoon: true,