Explorar o código

mol-theme: include <1 occupancy in default label

David Sehnal %!s(int64=5) %!d(string=hai) anos
pai
achega
3b7c8963df
Modificáronse 1 ficheiros con 6 adicións e 0 borrados
  1. 6 0
      src/mol-theme/label.ts

+ 6 - 0
src/mol-theme/label.ts

@@ -177,11 +177,13 @@ function _atomicElementLabel(location: StructureElement.Location<Unit.Atomic>, g
     const comp_id = Props.residue.label_comp_id(location)
     const comp_id = Props.residue.label_comp_id(location)
     const atom_id = Props.atom.label_atom_id(location)
     const atom_id = Props.atom.label_atom_id(location)
     const alt_id = Props.atom.label_alt_id(location)
     const alt_id = Props.atom.label_alt_id(location)
+    const occupancy = Props.atom.occupancy(location);
 
 
     const microHetCompIds = Props.residue.microheterogeneityCompIds(location)
     const microHetCompIds = Props.residue.microheterogeneityCompIds(location)
     const compId = granularity === 'residue' && microHetCompIds.length > 1 ?
     const compId = granularity === 'residue' && microHetCompIds.length > 1 ?
         `(${microHetCompIds.join('|')})` : comp_id
         `(${microHetCompIds.join('|')})` : comp_id
 
 
+    
     const label: string[] = []
     const label: string[] = []
 
 
     switch (granularity) {
     switch (granularity) {
@@ -205,6 +207,10 @@ function _atomicElementLabel(location: StructureElement.Location<Unit.Atomic>, g
             }
             }
     }
     }
 
 
+    if (label.length > 0 && occupancy !== 1) {
+        label[0] = `${label[0]} <small>[occupancy</small> <b>${Math.round(100 * occupancy) / 100}</b><small>]</small>`;
+    }
+
     return label.reverse()
     return label.reverse()
 }
 }