diff --git a/src/mol-base/collections/_spec/iterators.spec.ts b/src/mol-base/collections/_spec/iterators.spec.ts index 8df989242574b29c3ba0f766f338e87ae7526eaa..7c8cabe4a0ad77f1d5181213ca2d32c624a93f61 100644 --- a/src/mol-base/collections/_spec/iterators.spec.ts +++ b/src/mol-base/collections/_spec/iterators.spec.ts @@ -27,4 +27,5 @@ describe('basic iterators', () => { check('array', Iterator.Array([1, 2, 3]), [1, 2, 3]); check('range', Iterator.Range(0, 3), [0, 1, 2, 3]); check('map', Iterator.map(Iterator.Range(0, 1), x => x + 1), [1, 2]); + check('filter', Iterator.filter(Iterator.Range(0, 3), x => x >= 2), [2, 3]); }); \ No newline at end of file diff --git a/src/mol-base/collections/integer.ts b/src/mol-base/collections/integer.ts new file mode 100644 index 0000000000000000000000000000000000000000..a7ca9107661d596bffcdc19ccda024683200bc06 --- /dev/null +++ b/src/mol-base/collections/integer.ts @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2017 molio contributors, licensed under MIT, See LICENSE file for more info. + * + * @author David Sehnal <david.sehnal@gmail.com> + */ + +import Interval from './integer/interval' +import OrderedSet from './integer/ordered-set' +import Segmentation from './integer/segmentation' +import SortedArray from './integer/sorted-array' +import Tuple from './integer/tuple' +import Iterator from './iterator' + +export { Interval, OrderedSet, Segmentation, SortedArray, Tuple, Iterator } \ No newline at end of file diff --git a/src/mol-base/collections/iterator.ts b/src/mol-base/collections/iterator.ts index 50ad41cecc7acee294cdede5d4ea83a6bfb45586..02f302d82301b4d3edbedbce7d24a18da3dd572a 100644 --- a/src/mol-base/collections/iterator.ts +++ b/src/mol-base/collections/iterator.ts @@ -21,7 +21,7 @@ class ArrayIteratorImpl<T> implements Iterator<T> { private length: number = 0; private lastValue: T; - hasNext: boolean; + hasNext: boolean = false; move() { ++this.index; @@ -41,9 +41,8 @@ class ArrayIteratorImpl<T> implements Iterator<T> { } class RangeIteratorImpl implements Iterator<number> { - private value: number; - - hasNext: boolean; + private value: number = 0; + hasNext: boolean = false; move() { ++this.value; @@ -64,7 +63,7 @@ class ValueIterator<T> implements Iterator<T> { } class MapIteratorImpl<T, R> implements Iterator<R> { - hasNext: boolean; + hasNext: boolean = false; move() { const v = this.f(this.base.move()); @@ -77,12 +76,36 @@ class MapIteratorImpl<T, R> implements Iterator<R> { } } +class FilterIteratorImpl<T> implements Iterator<T> { + private next: T; + hasNext: boolean; + + move() { + const ret = this.next; + this.hasNext = this.findNext(); + return ret; + } + + private findNext() { + while (this.base.hasNext) { + this.next = this.base.move(); + if (this.p(this.next)) return true; + } + return false; + } + + constructor(private base: Iterator<T>, private p: (v: T) => boolean) { + this.hasNext = this.findNext(); + } +} + namespace Iterator { export const Empty: Iterator<any> = new RangeIteratorImpl(0, -1); export function Array<T>(xs: ArrayLike<T>): Iterator<T> { return new ArrayIteratorImpl<T>(xs); } export function Value<T>(value: T): Iterator<T> { return new ValueIterator(value); } export function Range(min: number, max: number): Iterator<number> { return new RangeIteratorImpl(min, max); } export function map<T, R>(base: Iterator<T>, f: (v: T) => R): Iterator<R> { return new MapIteratorImpl(base, f); } + export function filter<T>(base: Iterator<T>, p: (v: T) => boolean): Iterator<T> { return new FilterIteratorImpl(base, p); } } export default Iterator \ No newline at end of file diff --git a/src/mol-data/_spec/atom-set.spec.ts b/src/mol-data/_spec/atom-set.spec.ts index 375e5ed379704fd4faca4fcadfeca1bd023c78c6..62e5ea804532c83350c71907521a0bf514baea98 100644 --- a/src/mol-data/_spec/atom-set.spec.ts +++ b/src/mol-data/_spec/atom-set.spec.ts @@ -4,8 +4,8 @@ * @author David Sehnal <david.sehnal@gmail.com> */ -import OrderedSet from '../../mol-base/collections/integer/ordered-set' -import AtomSet from '../structure/atom-set' +import { OrderedSet } from '../../mol-base/collections/integer' +import AtomSet from '../structure/atom/set' import Atom from '../structure/atom' describe('atom set', () => { diff --git a/src/mol-data/model/builders/mmcif.ts b/src/mol-data/model/builders/mmcif.ts index 5890965b0f844b475299102ef5e2d28c2cc4049e..240e1e5037666d1e6a7407c93bdd0000bac211c1 100644 --- a/src/mol-data/model/builders/mmcif.ts +++ b/src/mol-data/model/builders/mmcif.ts @@ -9,8 +9,7 @@ import { Frame as mmCIF } from '../../../mol-io/reader/cif/schema/mmcif' import Model from '../../model' import Column from '../../../mol-base/collections/column' import Table from '../../../mol-base/collections/table' -import Interval from '../../../mol-base/collections/integer/interval' -import Segmentation from '../../../mol-base/collections/integer/segmentation' +import { Interval, Segmentation } from '../../../mol-base/collections/integer' import { newUUID } from '../../../mol-base/utils/uuid' import * as Hierarchy from '../properties/hierarchy' import Conformation from '../properties/conformation' diff --git a/src/mol-data/model/properties/computed.ts b/src/mol-data/model/properties/computed.ts index 72b082ec5791a1abd4dc31ff08da63ce986c33bd..0cb9039cc326cec4a3efab1091de480622abb7dc 100644 --- a/src/mol-data/model/properties/computed.ts +++ b/src/mol-data/model/properties/computed.ts @@ -8,7 +8,6 @@ // secondary structure is also a computed property // import { SecondaryStructureType } from '../constants' -// import Segmentation from '../../../mol-base/collections/integer/segmentation' // interface SecondaryStructure { diff --git a/src/mol-data/model/properties/hierarchy.ts b/src/mol-data/model/properties/hierarchy.ts index ac0c96fa37b75749c53bd367949c99e599725226..e86fc8983c4b1683b2c4a3b446b42f058afea7a3 100644 --- a/src/mol-data/model/properties/hierarchy.ts +++ b/src/mol-data/model/properties/hierarchy.ts @@ -6,7 +6,7 @@ import Column from '../../../mol-base/collections/column' import Table from '../../../mol-base/collections/table' -import IntervalSegmentation from '../../../mol-base/collections/integer/segmentation' +import { Segmentation } from '../../../mol-base/collections/integer' import { Schema as mmCIF } from '../../../mol-io/reader/cif/schema/mmcif' const _esCache = Object.create(null); @@ -59,8 +59,8 @@ export interface Data { } export interface Segments { - residueSegments: IntervalSegmentation, - chainSegments: IntervalSegmentation + residueSegments: Segmentation, + chainSegments: Segmentation } export interface Keys { diff --git a/src/mol-data/model/utils/hierarchy-keys.ts b/src/mol-data/model/utils/hierarchy-keys.ts index ae9f9a176f2101f4a5187c04e767a9a8e1bec29b..6bc5a4a8c22a3b474a0406fc5d3474cfb36150da 100644 --- a/src/mol-data/model/utils/hierarchy-keys.ts +++ b/src/mol-data/model/utils/hierarchy-keys.ts @@ -6,8 +6,7 @@ import Column from '../../../mol-base/collections/column' import { Data, Segments, Keys } from '../properties/hierarchy' -import Segmentation from '../../../mol-base/collections/integer/segmentation' -import Interval from '../../../mol-base/collections/integer/interval' +import { Interval, Segmentation } from '../../../mol-base/collections/integer' function getResidueId(comp_id: string, seq_id: number, ins_code: string) { return `${comp_id} ${seq_id} ${ins_code}`; diff --git a/src/mol-data/query.ts b/src/mol-data/query.ts index 89aaef1c2cc095f6272a680affc5095d52fe81a2..e5684e1bd95aff112c12dcd3c9858fcaeca37dfd 100644 --- a/src/mol-data/query.ts +++ b/src/mol-data/query.ts @@ -4,7 +4,7 @@ * @author David Sehnal <david.sehnal@gmail.com> */ -import Structure from './structure' +import { Structure } from './structure' import Selection from './query/selection' interface Query { (s: Structure): Selection } diff --git a/src/mol-data/query/generators.ts b/src/mol-data/query/generators.ts index 28ce9a00172e698d50f8e908a3908248acf2ccb9..d91aad5eb7988bd0bea19ca36ee1108e04d25523 100644 --- a/src/mol-data/query/generators.ts +++ b/src/mol-data/query/generators.ts @@ -2,4 +2,12 @@ * Copyright (c) 2017 molio contributors, licensed under MIT, See LICENSE file for more info. * * @author David Sehnal <david.sehnal@gmail.com> - */ \ No newline at end of file + */ + +// import Selection from './selection' +// import AtomSet from '../structure/atom-set' +// import Atom from '../structure/atom' + +// class LinearGroupingBuilder { + +// } \ No newline at end of file diff --git a/src/mol-data/query/query.ts b/src/mol-data/query/query.ts new file mode 100644 index 0000000000000000000000000000000000000000..f3bd96b69fb723cb3157b3b44575a234f84b1623 --- /dev/null +++ b/src/mol-data/query/query.ts @@ -0,0 +1,11 @@ +/** + * Copyright (c) 2017 molio contributors, licensed under MIT, See LICENSE file for more info. + * + * @author David Sehnal <david.sehnal@gmail.com> + */ + +import { Structure } from '../structure' +import Selection from './selection' + +interface Query { (s: Structure): Selection } +export default Query \ No newline at end of file diff --git a/src/mol-data/query/selection.ts b/src/mol-data/query/selection.ts index 762c304ac90d1eab80943ec986b3ba48cab861e3..d2ef57dff8594e637dc26539ae6f80a0ce55cc42 100644 --- a/src/mol-data/query/selection.ts +++ b/src/mol-data/query/selection.ts @@ -6,9 +6,7 @@ import Iterator from '../../mol-base/collections/iterator' import HashSet from '../../mol-base/collections/hash-set' -import Structure from './../structure' -import Atom from './../structure/atom' -import AtomSet from './../structure/atom-set' +import { Structure, Atom, AtomSet } from '../structure' type Selection = | Structure // each atom is interpreted as a singleton structure diff --git a/src/mol-data/structure.ts b/src/mol-data/structure.ts index cab016bb1db415588ed41cf845676f805ba8235e..cc8bf49f34d41cddcc8c0333a9125dcf4a69137b 100644 --- a/src/mol-data/structure.ts +++ b/src/mol-data/structure.ts @@ -4,24 +4,10 @@ * @author David Sehnal <david.sehnal@gmail.com> */ -//import { Vec3 } from '../mol-base/math/linear-algebra' -import AtomSet from './structure/atom-set' +import Atom from './structure/atom' +import AtomSet from './structure/atom/set' +import Structure from './structure/structure' +import Operator from './structure/operator' import Unit from './structure/unit' -import * as Base from './structure/base' -//import Model from './model' -//import Operator from './structure/operator' -// TODO: do "single model" version of the structure? -interface Structure extends Readonly<{ - units: { readonly [id: number]: Unit }, - atoms: AtomSet -}> { } - -namespace Structure { - export const Empty = Base.Empty; - export const ofModel = Base.ofModel; - // TODO: "lift" atom set operators - // TODO: "diff" -} - -export default Structure \ No newline at end of file +export { Atom, AtomSet, Structure, Operator, Unit } \ No newline at end of file diff --git a/src/mol-data/structure/atom.ts b/src/mol-data/structure/atom.ts index 5dfb6d5daa02477b6feb5c4fd2601217508bbee3..30f5f60f1dc7efa20442b1bf09bdbeeb95814165 100644 --- a/src/mol-data/structure/atom.ts +++ b/src/mol-data/structure/atom.ts @@ -4,9 +4,9 @@ * @author David Sehnal <david.sehnal@gmail.com> */ -import Tuple from '../../mol-base/collections/integer/tuple' +import { Tuple } from '../../mol-base/collections/integer' import Unit from './unit' -import Structure from '../structure' +import Structure from './structure' /** Atom pointer */ interface Atom { '@type': Tuple['@type'] } diff --git a/src/mol-data/structure/atom-set.ts b/src/mol-data/structure/atom/set.ts similarity index 54% rename from src/mol-data/structure/atom-set.ts rename to src/mol-data/structure/atom/set.ts index 1e654f113c752bb7e67f903d23359f74340a689e..92a04dc706abe177ac4da6495571d46e95a7e455 100644 --- a/src/mol-data/structure/atom-set.ts +++ b/src/mol-data/structure/atom/set.ts @@ -4,41 +4,39 @@ * @author David Sehnal <david.sehnal@gmail.com> */ -import SortedArray from '../../mol-base/collections/integer/sorted-array' -import OrderedSet from '../../mol-base/collections/integer/ordered-set' -import Iterator from '../../mol-base/collections/iterator' -import Atom from './atom' -import * as Base from './atom-set/base' -import createBuilder from './atom-set/builder' +import { OrderedSet, SortedArray, Iterator } from '../../../mol-base/collections/integer' +import Atom from '../atom' +import * as Impl from './set/impl' +import createBuilder from './set/builder' /** A map-like representation of grouped atom set */ namespace AtomSet { - export const Empty: AtomSet = Base.Empty as any; + export const Empty: AtomSet = Impl.Empty as any; - export const create: (data: Atom | ArrayLike<Atom> | { [unitId: number]: OrderedSet }) => AtomSet = Base.create as any; + export const create: (data: Atom | ArrayLike<Atom> | { [unitId: number]: OrderedSet }) => AtomSet = Impl.create as any; - export const unitCount: (set: AtomSet) => number = Base.keyCount as any; - export const unitIds: (set: AtomSet) => SortedArray = Base.getKeys as any; - export const unitHas: (set: AtomSet, id: number) => boolean = Base.hasKey as any; - export const unitGetId: (set: AtomSet, i: number) => number = Base.getKey as any; + export const unitCount: (set: AtomSet) => number = Impl.keyCount as any; + export const unitIds: (set: AtomSet) => SortedArray = Impl.getKeys as any; + export const unitHas: (set: AtomSet, id: number) => boolean = Impl.hasKey as any; + export const unitGetId: (set: AtomSet, i: number) => number = Impl.getKey as any; - export const unitGetById: (set: AtomSet, key: number) => OrderedSet = Base.getByKey as any; - export const unitGetByIndex: (set: AtomSet, i: number) => OrderedSet = Base.getByIndex as any; + export const unitGetById: (set: AtomSet, key: number) => OrderedSet = Impl.getByKey as any; + export const unitGetByIndex: (set: AtomSet, i: number) => OrderedSet = Impl.getByIndex as any; - export const atomCount: (set: AtomSet) => number = Base.size as any; - export const atomHas: (set: AtomSet, x: Atom) => boolean = Base.hasAtom as any; - export const atomIndexOf: (set: AtomSet, x: Atom) => number = Base.indexOf as any; - export const atomGetAt: (set: AtomSet, i: number) => Atom = Base.getAt as any; - export const atoms: (set: AtomSet) => Iterator<Atom> = Base.values as any; + export const atomCount: (set: AtomSet) => number = Impl.size as any; + export const atomHas: (set: AtomSet, x: Atom) => boolean = Impl.hasAtom as any; + export const atomIndexOf: (set: AtomSet, x: Atom) => number = Impl.indexOf as any; + export const atomGetAt: (set: AtomSet, i: number) => Atom = Impl.getAt as any; + export const atoms: (set: AtomSet) => Iterator<Atom> = Impl.values as any; - export const hashCode: (set: AtomSet) => number = Base.hashCode as any; - export const areEqual: (a: AtomSet, b: AtomSet) => boolean = Base.areEqual as any; - export const areIntersecting: (a: AtomSet, b: AtomSet) => boolean = Base.areIntersecting as any; + export const hashCode: (set: AtomSet) => number = Impl.hashCode as any; + export const areEqual: (a: AtomSet, b: AtomSet) => boolean = Impl.areEqual as any; + export const areIntersecting: (a: AtomSet, b: AtomSet) => boolean = Impl.areIntersecting as any; - export const union: (a: AtomSet, b: AtomSet) => AtomSet = Base.union as any; - export const unionMany: (sets: AtomSet[]) => AtomSet = Base.unionMany as any; - export const intersect: (a: AtomSet, b: AtomSet) => AtomSet = Base.intersect as any; - export const subtract: (a: AtomSet, b: AtomSet) => AtomSet = Base.subtract as any; + export const union: (a: AtomSet, b: AtomSet) => AtomSet = Impl.union as any; + export const unionMany: (sets: AtomSet[]) => AtomSet = Impl.unionMany as any; + export const intersect: (a: AtomSet, b: AtomSet) => AtomSet = Impl.intersect as any; + export const subtract: (a: AtomSet, b: AtomSet) => AtomSet = Impl.subtract as any; export function SortedBuilder(parent: AtomSet) { return createBuilder(parent, true); } export function Builder(parent: AtomSet) { return createBuilder(parent, false); } diff --git a/src/mol-data/structure/atom-set/builder.ts b/src/mol-data/structure/atom/set/builder.ts similarity index 91% rename from src/mol-data/structure/atom-set/builder.ts rename to src/mol-data/structure/atom/set/builder.ts index e566c30dccbb7ff95ca71682eef90de2b471343f..d79afeb792bbbed3b058bb248145628b3e199ec0 100644 --- a/src/mol-data/structure/atom-set/builder.ts +++ b/src/mol-data/structure/atom/set/builder.ts @@ -4,9 +4,9 @@ * @author David Sehnal <david.sehnal@gmail.com> */ -import AtomSet from '../atom-set' -import OrderedSet from '../../../mol-base/collections/integer/ordered-set' -import { sortArray } from '../../../mol-base/collections/sort' +import AtomSet from '../set' +import { OrderedSet } from '../../../../mol-base/collections/integer' +import { sortArray } from '../../../../mol-base/collections/sort' class Builder { private keys: number[] = []; diff --git a/src/mol-data/structure/atom-set/base.ts b/src/mol-data/structure/atom/set/impl.ts similarity index 97% rename from src/mol-data/structure/atom-set/base.ts rename to src/mol-data/structure/atom/set/impl.ts index d8be533e77bc0dd07c754a40907e08f10252929e..fab4133aa2c8893318f49812005e26aefa859aa0 100644 --- a/src/mol-data/structure/atom-set/base.ts +++ b/src/mol-data/structure/atom/set/impl.ts @@ -4,13 +4,10 @@ * @author David Sehnal <david.sehnal@gmail.com> */ -import OrderedSet from '../../../mol-base/collections/integer/ordered-set' -import SortedArray from '../../../mol-base/collections/integer/sorted-array' -import Iterator from '../../../mol-base/collections/iterator' -import Interval from '../../../mol-base/collections/integer/interval' -import { sortArray } from '../../../mol-base/collections/sort' -import { hash1 } from '../../../mol-base/collections/hash-functions' -import Atom from '../atom' +import { SortedArray, Interval, Iterator, OrderedSet } from '../../../../mol-base/collections/integer' +import { sortArray } from '../../../../mol-base/collections/sort' +import { hash1 } from '../../../../mol-base/collections/hash-functions' +import Atom from '../../atom' /** Long and painful implementation starts here */ diff --git a/src/mol-data/structure/atom-set/properties.ts b/src/mol-data/structure/atom/set/properties.ts similarity index 100% rename from src/mol-data/structure/atom-set/properties.ts rename to src/mol-data/structure/atom/set/properties.ts diff --git a/src/mol-data/structure/base.ts b/src/mol-data/structure/base.ts deleted file mode 100644 index 210c7dcd5830df8e544358185bb6c940d910a5ac..0000000000000000000000000000000000000000 --- a/src/mol-data/structure/base.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright (c) 2017 molio contributors, licensed under MIT, See LICENSE file for more info. - * - * @author David Sehnal <david.sehnal@gmail.com> - */ - -import Model from '../model' -import Structure from '../structure' -import Unit from './unit' -import Operator from './operator' -import AtomSet from './atom-set' -import OrderedSet from '../../mol-base/collections/integer/ordered-set' - -export class StructureBuilder { - private units = Object.create(null); - private atoms = Object.create(null); - - addUnit(unit: Unit) { this.units[unit.id] = unit; } - addAtoms(unitId: number, atoms: OrderedSet) { this.atoms[unitId] = atoms; } - - getStructure(): Structure { return { units: this.units, atoms: AtomSet.create(this.atoms) }; } -} - -export const Empty: Structure = { units: {}, atoms: AtomSet.Empty }; - -export function ofModel(model: Model): Structure { - const chains = model.hierarchy.chainSegments; - const builder = new StructureBuilder(); - - for (let c = 0; c < chains.count; c++) { - const unit = Unit.create(model, Operator.Identity); - builder.addUnit(unit); - builder.addAtoms(unit.id, OrderedSet.ofBounds(chains.segments[c], chains.segments[c + 1])); - } - - return builder.getStructure(); -} \ No newline at end of file diff --git a/src/mol-data/structure/structure.ts b/src/mol-data/structure/structure.ts new file mode 100644 index 0000000000000000000000000000000000000000..fcfb15a9d89668aca2b9b3d1c9f510b70920add2 --- /dev/null +++ b/src/mol-data/structure/structure.ts @@ -0,0 +1,58 @@ +/** + * Copyright (c) 2017 molio contributors, licensed under MIT, See LICENSE file for more info. + * + * @author David Sehnal <david.sehnal@gmail.com> + */ + +import Model from '../model' +import Unit from './unit' +import Operator from './operator' +import AtomSet from './atom/set' +import { OrderedSet } from '../../mol-base/collections/integer' + +interface Structure extends Readonly<{ + units: { readonly [id: number]: Unit }, + atoms: AtomSet +}> { } + +namespace Structure { + export const Empty = { units: {}, atoms: AtomSet.Empty }; + + export function ofModel(model: Model): Structure { + const chains = model.hierarchy.chainSegments; + const builder = Builder(); + + for (let c = 0; c < chains.count; c++) { + const unit = Unit.create(model, Operator.Identity); + builder.addUnit(unit); + builder.addAtoms(unit.id, OrderedSet.ofBounds(chains.segments[c], chains.segments[c + 1])); + } + + return builder.getStructure(); + } + + export interface Builder { + addUnit(unit: Unit): void, + addAtoms(unitId: number, atoms: OrderedSet): void, + getStructure(): Structure, + readonly atomCount: number + } + + class BuilderImpl implements Builder { + private units = Object.create(null); + private atoms = Object.create(null); + atomCount = 0; + + addUnit(unit: Unit) { this.units[unit.id] = unit; } + addAtoms(unitId: number, atoms: OrderedSet) { this.atoms[unitId] = atoms; this.atomCount += OrderedSet.size(atoms); } + getStructure(): Structure { return this.atomCount > 0 ? { units: this.units, atoms: AtomSet.create(this.atoms) } : Empty; } + } + + export function Builder(): Builder { return new BuilderImpl(); } + + + // TODO: "lift" atom set operators? + // TODO: "diff" +} + +export default Structure \ No newline at end of file diff --git a/src/perf-tests/sets.ts b/src/perf-tests/sets.ts index b94f63786ea06b283a03884c5f5341a5feefd61f..e4f0670854dd9eeb97a2c0faf92797f1c6396e17 100644 --- a/src/perf-tests/sets.ts +++ b/src/perf-tests/sets.ts @@ -1,8 +1,6 @@ import * as B from 'benchmark' -import Tuple from '../mol-base/collections/integer/tuple' -import OrdSet from '../mol-base/collections/integer/ordered-set' -import AtomSet from '../mol-data/structure/atom-set' -import Segmentation from '../mol-base/collections/integer/segmentation' +import { Tuple, Segmentation, OrderedSet as OrdSet } from '../mol-base/collections/integer' +import { AtomSet } from '../mol-data/structure' export namespace Iteration { const U = 1000, V = 2500; diff --git a/src/perf-tests/structure.ts b/src/perf-tests/structure.ts index 31488d2e3c68b722ef98523f0ef70ae5fcbdc247..6549e7e16599d947ff3852354ada9bc9b2967004 100644 --- a/src/perf-tests/structure.ts +++ b/src/perf-tests/structure.ts @@ -11,11 +11,8 @@ import * as fs from 'fs' import CIF from '../mol-io/reader/cif' import Model from '../mol-data/Model' -import Structure from '../mol-data/structure' -import OrdSet from '../mol-base/collections/integer/ordered-set' -import Atom from '../mol-data/structure/atom' -import AtomSet from '../mol-data/structure/atom-set' -import Segmentation from '../mol-base/collections/integer/segmentation' +import { Structure, Atom, AtomSet } from '../mol-data/structure' +import { OrderedSet as OrdSet, Segmentation } from '../mol-base/collections/integer' require('util.promisify').shim(); const readFileAsync = util.promisify(fs.readFile);