Browse Source

interactions, links to contacts renaming

Alexander Rose 5 years ago
parent
commit
b16d13cc35

+ 12 - 12
src/mol-model-props/computed/interactions/interactions.ts

@@ -66,7 +66,7 @@ namespace Interactions {
         readonly kind: 'interaction-loci'
         readonly structure: Structure
         readonly interactions: Interactions
-        readonly links: ReadonlyArray<{
+        readonly contacts: ReadonlyArray<{
             unitA: Unit
             /** Index into features of unitA */
             indexA: Features.FeatureIndex
@@ -76,8 +76,8 @@ namespace Interactions {
         }>
     }
 
-    export function Loci(structure: Structure, interactions: Interactions, links: Loci['links']): Loci {
-        return { kind: 'interaction-loci', structure, interactions, links };
+    export function Loci(structure: Structure, interactions: Interactions, contacts: Loci['contacts']): Loci {
+        return { kind: 'interaction-loci', structure, interactions, contacts };
     }
 
     export function isLoci(x: any): x is Loci {
@@ -87,20 +87,20 @@ namespace Interactions {
     export function areLociEqual(a: Loci, b: Loci) {
         if (a.structure !== b.structure) return false
         if (a.interactions !== b.interactions) return false
-        if (a.links.length !== b.links.length) return false
-        for (let i = 0, il = a.links.length; i < il; ++i) {
-            const linkA = a.links[i]
-            const linkB = b.links[i]
-            if (linkA.unitA !== linkB.unitA) return false
-            if (linkA.unitB !== linkB.unitB) return false
-            if (linkA.indexA !== linkB.indexA) return false
-            if (linkA.indexB !== linkB.indexB) return false
+        if (a.contacts.length !== b.contacts.length) return false
+        for (let i = 0, il = a.contacts.length; i < il; ++i) {
+            const contactA = a.contacts[i]
+            const contactB = b.contacts[i]
+            if (contactA.unitA !== contactB.unitA) return false
+            if (contactA.unitB !== contactB.unitB) return false
+            if (contactA.indexA !== contactB.indexA) return false
+            if (contactA.indexB !== contactB.indexB) return false
         }
         return true
     }
 
     export function isLociEmpty(loci: Loci) {
-        return loci.links.length === 0 ? true : false
+        return loci.contacts.length === 0 ? true : false
     }
 }
 

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

@@ -118,8 +118,8 @@ function eachInteraction(loci: Loci, structure: Structure, apply: (interval: Int
         if (loci.interactions !== interactions) return false
         const { contacts } = interactions
 
-        for (const l of loci.links) {
-            const idx = contacts.getEdgeIndex(l.indexA, l.unitA, l.indexB, l.unitB)
+        for (const c of loci.contacts) {
+            const idx = contacts.getEdgeIndex(c.indexA, c.unitA, c.indexB, c.unitB)
             if (idx !== -1) {
                 if (apply(Interval.ofSingleton(idx))) changed = true
             }

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

@@ -117,10 +117,10 @@ function eachInteraction(loci: Loci, structureGroup: StructureGroup, apply: (int
         const unit = group.units[0]
         const contacts = interactions.unitsContacts.get(unit.id)
         const groupCount = contacts.edgeCount * 2
-        for (const l of loci.links) {
-            const unitIdx = group.unitIndexMap.get(l.unitA.id)
+        for (const c of loci.contacts) {
+            const unitIdx = group.unitIndexMap.get(c.unitA.id)
             if (unitIdx !== undefined) {
-                const idx = contacts.getDirectedEdgeIndex(l.indexA, l.indexB)
+                const idx = contacts.getDirectedEdgeIndex(c.indexA, c.indexB)
                 if (idx !== -1) {
                     if (apply(Interval.ofSingleton(unitIdx * groupCount + idx))) changed = true
                 }

+ 2 - 2
src/mol-theme/label.ts

@@ -33,8 +33,8 @@ export function lociLabel(loci: Loci, options: Partial<LabelOptions> = {}): stri
             const bond = loci.bonds[0]
             return bond ? bondLabel(bond) : 'Unknown'
         case 'interaction-loci':
-            const link = loci.links[0]
-            return link ? interactionLabel(Interactions.Location(loci.interactions, link.unitA, link.indexA, link.unitB, link.indexB)) : 'Unknown'
+            const contact = loci.contacts[0]
+            return contact ? interactionLabel(Interactions.Location(loci.interactions, contact.unitA, contact.indexA, contact.unitB, contact.indexB)) : 'Unknown'
         case 'shape-loci':
             return loci.shape.name
         case 'group-loci':