浏览代码

Module refactoring

David Sehnal 7 年之前
父节点
当前提交
4efaf1c28b
共有 100 个文件被更改,包括 169 次插入125 次删除
  1. 1 1
      src/apps/cif2bcif/converter.ts
  2. 1 1
      src/apps/cif2bcif/field-classifier.ts
  3. 1 1
      src/apps/domain-annotation-server/mapping.ts
  4. 1 1
      src/apps/domain-annotation-server/schemas.ts
  5. 2 2
      src/apps/domain-annotation-server/utils.ts
  6. 0 12
      src/mol-base/collections/database.ts
  7. 0 15
      src/mol-base/collections/integer.ts
  8. 0 19
      src/mol-base/utils/uuid.ts
  9. 1 1
      src/mol-data/_spec/equiv-index.spec.ts
  10. 0 0
      src/mol-data/_spec/iterators.spec.ts
  11. 1 1
      src/mol-data/_spec/sort.spec.ts
  12. 12 0
      src/mol-data/db.ts
  13. 0 0
      src/mol-data/db/_spec/table.spec.ts
  14. 0 0
      src/mol-data/db/column-helpers.ts
  15. 1 1
      src/mol-data/db/column.ts
  16. 0 0
      src/mol-data/db/database.ts
  17. 1 1
      src/mol-data/db/table.ts
  18. 12 0
      src/mol-data/index.ts
  19. 15 0
      src/mol-data/int.ts
  20. 0 0
      src/mol-data/int/_spec/interval.spec.ts
  21. 0 0
      src/mol-data/int/_spec/linked-index.spec.ts
  22. 0 0
      src/mol-data/int/_spec/ordered-set.spec.ts
  23. 0 0
      src/mol-data/int/_spec/segmentation.spec.ts
  24. 0 0
      src/mol-data/int/_spec/sorted-array.spec.ts
  25. 0 0
      src/mol-data/int/_spec/tuple.spec.ts
  26. 0 0
      src/mol-data/int/impl/interval.ts
  27. 0 0
      src/mol-data/int/impl/ordered-set.ts
  28. 0 0
      src/mol-data/int/impl/segmentation.ts
  29. 1 2
      src/mol-data/int/impl/sorted-array.ts
  30. 0 0
      src/mol-data/int/interval.ts
  31. 0 0
      src/mol-data/int/linked-index.ts
  32. 0 0
      src/mol-data/int/ordered-set.ts
  33. 0 0
      src/mol-data/int/segmentation.ts
  34. 0 0
      src/mol-data/int/sorted-array.ts
  35. 1 1
      src/mol-data/int/tuple.ts
  36. 0 0
      src/mol-data/iterator.ts
  37. 15 0
      src/mol-data/util.ts
  38. 0 0
      src/mol-data/util/chunked-array.ts
  39. 0 0
      src/mol-data/util/equivalence-classes.ts
  40. 0 0
      src/mol-data/util/hash-functions.ts
  41. 0 0
      src/mol-data/util/hash-set.ts
  42. 0 0
      src/mol-data/util/sort.ts
  43. 0 0
      src/mol-data/util/unique-array.ts
  44. 1 1
      src/mol-io/common/binary-cif/array-encoder.ts
  45. 1 1
      src/mol-io/reader/_spec/cif.spec.ts
  46. 1 1
      src/mol-io/reader/_spec/column.spec.ts
  47. 1 1
      src/mol-io/reader/cif/binary/field.ts
  48. 1 1
      src/mol-io/reader/cif/binary/parser.ts
  49. 2 2
      src/mol-io/reader/cif/data-model.ts
  50. 1 1
      src/mol-io/reader/cif/schema.ts
  51. 1 1
      src/mol-io/reader/cif/schema/dic.ts
  52. 1 1
      src/mol-io/reader/cif/schema/mmcif.ts
  53. 1 1
      src/mol-io/reader/cif/text/field.ts
  54. 1 1
      src/mol-io/reader/cif/text/parser.ts
  55. 1 1
      src/mol-io/reader/common/text/column/fixed.ts
  56. 1 1
      src/mol-io/reader/common/text/column/token.ts
  57. 1 1
      src/mol-io/reader/common/text/tokenizer.ts
  58. 2 2
      src/mol-io/reader/gro/parser.ts
  59. 1 1
      src/mol-io/reader/gro/schema.d.ts
  60. 1 1
      src/mol-io/reader/mol2/schema.d.ts
  61. 2 2
      src/mol-io/writer/cif/encoder.ts
  62. 2 2
      src/mol-io/writer/cif/encoder/binary.ts
  63. 2 2
      src/mol-io/writer/cif/encoder/text.ts
  64. 0 0
      src/mol-math/geometry/grid-lookup.ts
  65. 0 0
      src/mol-math/geometry/sphere.ts
  66. 1 1
      src/mol-math/geometry/transform.ts
  67. 0 0
      src/mol-math/graph/graph.ts
  68. 8 0
      src/mol-math/linear-algebra.ts
  69. 7 4
      src/mol-math/linear-algebra/3d.ts
  70. 2 2
      src/mol-math/linear-algebra/_spec/tensor.spec.ts
  71. 31 5
      src/mol-math/linear-algebra/tensor.ts
  72. 0 0
      src/mol-model/sequence/TODO
  73. 0 0
      src/mol-model/structure.ts
  74. 1 1
      src/mol-model/structure/_spec/atom-set.spec.ts
  75. 2 2
      src/mol-model/structure/export/mmcif.ts
  76. 0 0
      src/mol-model/structure/model.ts
  77. 0 0
      src/mol-model/structure/model/format.ts
  78. 5 5
      src/mol-model/structure/model/formats/mmcif.ts
  79. 1 1
      src/mol-model/structure/model/model.ts
  80. 0 0
      src/mol-model/structure/model/properties/computed.ts
  81. 2 2
      src/mol-model/structure/model/properties/conformation.ts
  82. 0 0
      src/mol-model/structure/model/properties/format-specific.ts
  83. 2 2
      src/mol-model/structure/model/properties/hierarchy.ts
  84. 0 0
      src/mol-model/structure/model/properties/transforms.ts
  85. 1 1
      src/mol-model/structure/model/types.ts
  86. 2 2
      src/mol-model/structure/model/utils/hierarchy-keys.ts
  87. 0 0
      src/mol-model/structure/query.ts
  88. 1 1
      src/mol-model/structure/query/generators.ts
  89. 0 0
      src/mol-model/structure/query/predicates.ts
  90. 0 0
      src/mol-model/structure/query/properties.ts
  91. 0 0
      src/mol-model/structure/query/query.ts
  92. 2 2
      src/mol-model/structure/query/selection.ts
  93. 0 0
      src/mol-model/structure/structure.ts
  94. 1 1
      src/mol-model/structure/structure/atom.ts
  95. 1 1
      src/mol-model/structure/structure/atom/set.ts
  96. 2 2
      src/mol-model/structure/structure/atom/set/builder.ts
  97. 3 3
      src/mol-model/structure/structure/atom/set/impl.ts
  98. 0 0
      src/mol-model/structure/structure/atom/set/properties.ts
  99. 1 1
      src/mol-model/structure/structure/operator.ts
  100. 2 2
      src/mol-model/structure/structure/structure.ts

+ 1 - 1
src/apps/cif2bcif/converter.ts

@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import Iterator from 'mol-base/collections/iterator'
+import Iterator from 'mol-data/iterator'
 import CIF, { Category } from 'mol-io/reader/cif'
 import * as Encoder from 'mol-io/writer/cif'
 import * as fs from 'fs'

+ 1 - 1
src/apps/cif2bcif/field-classifier.ts

@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Column } from 'mol-base/collections/database'
+import { Column } from 'mol-data/db'
 import { Field } from 'mol-io/reader/cif/data-model'
 import { FieldDefinition, FieldType } from 'mol-io/writer/cif/encoder'
 

+ 1 - 1
src/apps/domain-annotation-server/mapping.ts

@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Table } from 'mol-base/collections/database'
+import { Table } from 'mol-data/db'
 import { CIFEncoder, create as createEncoder } from 'mol-io/writer/cif'
 import * as S from './schemas'
 import { getCategoryInstanceProvider } from './utils'

+ 1 - 1
src/apps/domain-annotation-server/schemas.ts

@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Column } from 'mol-base/collections/database'
+import { Column } from 'mol-data/db'
 
 import Type = Column.Schema
 

+ 2 - 2
src/apps/domain-annotation-server/utils.ts

@@ -4,8 +4,8 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Table } from 'mol-base/collections/database'
-import Iterator from 'mol-base/collections/iterator'
+import { Table } from 'mol-data/db'
+import Iterator from 'mol-data/iterator'
 import * as Encoder from 'mol-io/writer/cif'
 
 function columnValue(k: string) {

+ 0 - 12
src/mol-base/collections/database.ts

@@ -1,12 +0,0 @@
-/**
- * Copyright (c) 2017 mol* contributors, licensed under MIT, See LICENSE file for more info.
- *
- * @author David Sehnal <david.sehnal@gmail.com>
- */
-
-import Database from './database/database'
-import Table from './database/table'
-import Column from './database/column'
-import * as ColumnHelpers from './database/column-helpers'
-
-export { Database, Table, Column, ColumnHelpers }

+ 0 - 15
src/mol-base/collections/integer.ts

@@ -1,15 +0,0 @@
-/**
- * Copyright (c) 2017 mol* 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 LinkedIndex from './integer/linked-index'
-import Iterator from './iterator'
-
-export { Interval, OrderedSet, Segmentation, SortedArray, Tuple, LinkedIndex, Iterator }

+ 0 - 19
src/mol-base/utils/uuid.ts

@@ -1,19 +0,0 @@
-/**
- * Copyright (c) 2017 mol* contributors, licensed under MIT, See LICENSE file for more info.
- *
- * @author David Sehnal <david.sehnal@gmail.com>
- */
-
-import now from './time'
-
-export default interface UUID extends String { '@type': 'uuid' }
-
-export function newUUID(): UUID {
-    let d = (+new Date()) + now();
-    const uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
-        const r = (d + Math.random()*16)%16 | 0;
-        d = Math.floor(d/16);
-        return (c==='x' ? r : (r&0x3|0x8)).toString(16);
-    });
-    return uuid as any;
-}

+ 1 - 1
src/mol-base/collections/_spec/equiv-index.spec.ts → src/mol-data/_spec/equiv-index.spec.ts

@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import EquivalenceClasses from '../equivalence-classes'
+import EquivalenceClasses from '../util/equivalence-classes'
 
 describe('equiv-classes', () => {
     it('integer mod classes', () => {

+ 0 - 0
src/mol-base/collections/_spec/iterators.spec.ts → src/mol-data/_spec/iterators.spec.ts


+ 1 - 1
src/mol-base/collections/_spec/sort.spec.ts → src/mol-data/_spec/sort.spec.ts

@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import * as Sort from '../sort'
+import * as Sort from '../util/sort'
 
 function shuffle<T>(data: T, len: number, clone: (s: T) => T, swap: Sort.Swapper = Sort.arraySwap) {
     const a = clone(data);

+ 12 - 0
src/mol-data/db.ts

@@ -0,0 +1,12 @@
+/**
+ * Copyright (c) 2017 mol* contributors, licensed under MIT, See LICENSE file for more info.
+ *
+ * @author David Sehnal <david.sehnal@gmail.com>
+ */
+
+import Database from './db/database'
+import Table from './db/table'
+import Column from './db/column'
+import * as ColumnHelpers from './db/column-helpers'
+
+export { Database, Table, Column, ColumnHelpers }

+ 0 - 0
src/mol-base/collections/database/_spec/table.spec.ts → src/mol-data/db/_spec/table.spec.ts


+ 0 - 0
src/mol-base/collections/database/column-helpers.ts → src/mol-data/db/column-helpers.ts


+ 1 - 1
src/mol-base/collections/database/column.ts → src/mol-data/db/column.ts

@@ -5,7 +5,7 @@
  */
 
 import * as ColumnHelpers from './column-helpers'
-import Tensors from '../../math/tensor'
+import { Tensor as Tensors } from 'mol-math/linear-algebra'
 
 interface Column<T> {
     readonly '@type': Column.Type,

+ 0 - 0
src/mol-base/collections/database/database.ts → src/mol-data/db/database.ts


+ 1 - 1
src/mol-base/collections/database/table.ts → src/mol-data/db/table.ts

@@ -5,7 +5,7 @@
  */
 
 import Column from './column'
-import { sortArray } from '../sort'
+import { sortArray } from '../util/sort'
 
 /** A collection of columns */
 type Table<Schema extends Table.Schema> = {

+ 12 - 0
src/mol-data/index.ts

@@ -0,0 +1,12 @@
+/**
+ * Copyright (c) 2017 mol* contributors, licensed under MIT, See LICENSE file for more info.
+ *
+ * @author David Sehnal <david.sehnal@gmail.com>
+ */
+
+import * as DB from './db'
+import * as Int from './int'
+import Iterator from './iterator'
+import * as Util from './util'
+
+export { DB, Int, Iterator, Util }

+ 15 - 0
src/mol-data/int.ts

@@ -0,0 +1,15 @@
+/**
+ * Copyright (c) 2017 mol* contributors, licensed under MIT, See LICENSE file for more info.
+ *
+ * @author David Sehnal <david.sehnal@gmail.com>
+ */
+
+import Interval from './int/interval'
+import OrderedSet from './int/ordered-set'
+import Segmentation from './int/segmentation'
+import SortedArray from './int/sorted-array'
+import Tuple from './int/tuple'
+import LinkedIndex from './int/linked-index'
+import Iterator from './iterator'
+
+export { Interval, OrderedSet, Segmentation, SortedArray, Tuple, LinkedIndex, Iterator }

+ 0 - 0
src/mol-base/collections/integer/_spec/interval.spec.ts → src/mol-data/int/_spec/interval.spec.ts


+ 0 - 0
src/mol-base/collections/integer/_spec/linked-index.spec.ts → src/mol-data/int/_spec/linked-index.spec.ts


+ 0 - 0
src/mol-base/collections/integer/_spec/ordered-set.spec.ts → src/mol-data/int/_spec/ordered-set.spec.ts


+ 0 - 0
src/mol-base/collections/integer/_spec/segmentation.spec.ts → src/mol-data/int/_spec/segmentation.spec.ts


+ 0 - 0
src/mol-base/collections/integer/_spec/sorted-array.spec.ts → src/mol-data/int/_spec/sorted-array.spec.ts


+ 0 - 0
src/mol-base/collections/integer/_spec/tuple.spec.ts → src/mol-data/int/_spec/tuple.spec.ts


+ 0 - 0
src/mol-base/collections/integer/impl/interval.ts → src/mol-data/int/impl/interval.ts


+ 0 - 0
src/mol-base/collections/integer/impl/ordered-set.ts → src/mol-data/int/impl/ordered-set.ts


+ 0 - 0
src/mol-base/collections/integer/impl/segmentation.ts → src/mol-data/int/impl/segmentation.ts


+ 1 - 2
src/mol-base/collections/integer/impl/sorted-array.ts → src/mol-data/int/impl/sorted-array.ts

@@ -4,8 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { sortArray } from '../../sort'
-import { hash3, hash4 } from '../../hash-functions'
+import { sortArray, hash3, hash4 } from '../../util'
 import Interval from '../interval'
 
 type Nums = ArrayLike<number>

+ 0 - 0
src/mol-base/collections/integer/interval.ts → src/mol-data/int/interval.ts


+ 0 - 0
src/mol-base/collections/integer/linked-index.ts → src/mol-data/int/linked-index.ts


+ 0 - 0
src/mol-base/collections/integer/ordered-set.ts → src/mol-data/int/ordered-set.ts


+ 0 - 0
src/mol-base/collections/integer/segmentation.ts → src/mol-data/int/segmentation.ts


+ 0 - 0
src/mol-base/collections/integer/sorted-array.ts → src/mol-data/int/sorted-array.ts


+ 1 - 1
src/mol-base/collections/integer/tuple.ts → src/mol-data/int/tuple.ts

@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { hash2 } from '../hash-functions'
+import { hash2 } from '../util'
 
 /**
  * Represents a pair of two integers as a double,

+ 0 - 0
src/mol-base/collections/iterator.ts → src/mol-data/iterator.ts


+ 15 - 0
src/mol-data/util.ts

@@ -0,0 +1,15 @@
+/**
+ * Copyright (c) 2017 mol* contributors, licensed under MIT, See LICENSE file for more info.
+ *
+ * @author David Sehnal <david.sehnal@gmail.com>
+ */
+
+import ChunkedArray from './util/chunked-array'
+import EquivalenceClasses from './util/chunked-array'
+import HashSet from './util/hash-set'
+import UniqueArray from './util/unique-array'
+
+export * from './util/hash-functions'
+export * from './util/sort'
+
+export { ChunkedArray, EquivalenceClasses, HashSet, UniqueArray }

+ 0 - 0
src/mol-base/collections/chunked-array.ts → src/mol-data/util/chunked-array.ts


+ 0 - 0
src/mol-base/collections/equivalence-classes.ts → src/mol-data/util/equivalence-classes.ts


+ 0 - 0
src/mol-base/collections/hash-functions.ts → src/mol-data/util/hash-functions.ts


+ 0 - 0
src/mol-base/collections/hash-set.ts → src/mol-data/util/hash-set.ts


+ 0 - 0
src/mol-base/collections/sort.ts → src/mol-data/util/sort.ts


+ 0 - 0
src/mol-base/collections/unique-array.ts → src/mol-data/util/unique-array.ts


+ 1 - 1
src/mol-io/common/binary-cif/array-encoder.ts

@@ -7,7 +7,7 @@
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
 
-import ChunkedArray from 'mol-base/collections/chunked-array'
+import ChunkedArray from 'mol-data/util/chunked-array'
 import { Encoding, EncodedData } from './encoding'
 
 export interface ArrayEncoder {

+ 1 - 1
src/mol-io/reader/_spec/cif.spec.ts

@@ -7,7 +7,7 @@
 import * as Data from '../cif/data-model'
 import TextField from '../cif/text/field'
 import * as Schema from '../cif/schema'
-import { Column } from 'mol-base/collections/database'
+import { Column } from 'mol-data/db'
 
 const columnData = `123abc`;
 

+ 1 - 1
src/mol-io/reader/_spec/column.spec.ts

@@ -7,7 +7,7 @@
 
 import FixedColumn from '../common/text/column/fixed'
 import TokenColumn from '../common/text/column/token'
-import { Column, ColumnHelpers } from 'mol-base/collections/database'
+import { Column, ColumnHelpers } from 'mol-data/db'
 
 const lines = [
     '1.123 abc',

+ 1 - 1
src/mol-io/reader/cif/binary/field.ts

@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Column, ColumnHelpers } from 'mol-base/collections/database'
+import { Column, ColumnHelpers } from 'mol-data/db'
 import * as Data from '../data-model'
 import { EncodedColumn, decode } from '../../../common/binary-cif'
 import { parseInt as fastParseInt, parseFloat as fastParseFloat } from '../../common/text/number-parser'

+ 1 - 1
src/mol-io/reader/cif/binary/parser.ts

@@ -9,7 +9,7 @@ import { EncodedCategory, EncodedFile } from '../../../common/binary-cif'
 import Field from './field'
 import Result from '../../result'
 import decodeMsgPack from '../../../common/msgpack/decode'
-import Computation from 'mol-base/computation'
+import Computation from 'mol-util/computation'
 
 function checkVersions(min: number[], current: number[]) {
     for (let i = 0; i < 2; i++) {

+ 2 - 2
src/mol-io/reader/cif/data-model.ts

@@ -4,8 +4,8 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Column } from 'mol-base/collections/database'
-import Tensor from 'mol-base/math/tensor'
+import { Column } from 'mol-data/db'
+import { Tensor } from 'mol-math/linear-algebra'
 
 export interface File {
     readonly name?: string,

+ 1 - 1
src/mol-io/reader/cif/schema.ts

@@ -5,7 +5,7 @@
  */
 
 import * as Data from './data-model'
-import { Database, Table, Column, ColumnHelpers } from 'mol-base/collections/database'
+import { Database, Table, Column, ColumnHelpers } from 'mol-data/db'
 
 export function toDatabase<Schema extends Database.Schema, Frame extends Database<Schema> = Database<Schema>>(schema: Schema, frame: Data.Frame): Frame {
     return createDatabase(schema, frame) as Frame;

+ 1 - 1
src/mol-io/reader/cif/schema/dic.ts

@@ -4,7 +4,7 @@
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
 
-import { Database, Column } from 'mol-base/collections/database'
+import { Database, Column } from 'mol-data/db'
 
 import Schema = Column.Schema
 import FP = Schema.FP

+ 1 - 1
src/mol-io/reader/cif/schema/mmcif.ts

@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Database, Column } from 'mol-base/collections/database'
+import { Database, Column } from 'mol-data/db'
 
 import Schema = Column.Schema
 import FP = Schema.FP

+ 1 - 1
src/mol-io/reader/cif/text/field.ts

@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Column, ColumnHelpers } from 'mol-base/collections/database'
+import { Column, ColumnHelpers } from 'mol-data/db'
 import * as TokenColumn from '../../common/text/column/token'
 import { Tokens } from '../../common/text/tokenizer'
 import * as Data from '../data-model'

+ 1 - 1
src/mol-io/reader/cif/text/parser.ts

@@ -26,7 +26,7 @@ import * as Data from '../data-model'
 import Field from './field'
 import { Tokens, TokenBuilder } from '../../common/text/tokenizer'
 import Result from '../../result'
-import Computation from 'mol-base/computation'
+import Computation from 'mol-util/computation'
 
 /**
  * Types of supported mmCIF tokens.

+ 1 - 1
src/mol-io/reader/common/text/column/fixed.ts

@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Column, ColumnHelpers } from 'mol-base/collections/database'
+import { Column, ColumnHelpers } from 'mol-data/db'
 import { trimStr, Tokens } from '../tokenizer'
 import { parseIntSkipLeadingWhitespace, parseFloatSkipLeadingWhitespace } from '../number-parser'
 

+ 1 - 1
src/mol-io/reader/common/text/column/token.ts

@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Column, ColumnHelpers } from 'mol-base/collections/database'
+import { Column, ColumnHelpers } from 'mol-data/db'
 import { Tokens } from '../tokenizer'
 import { parseInt as fastParseInt, parseFloat as fastParseFloat } from '../number-parser'
 

+ 1 - 1
src/mol-io/reader/common/text/tokenizer.ts

@@ -6,7 +6,7 @@
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
 
-import Computation from 'mol-base/computation'
+import Computation from 'mol-util/computation'
 
 export interface Tokenizer {
     data: string,

+ 2 - 2
src/mol-io/reader/gro/parser.ts

@@ -5,12 +5,12 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Column } from 'mol-base/collections/database'
+import { Column } from 'mol-data/db'
 import Tokenizer from '../common/text/tokenizer'
 import FixedColumn from '../common/text/column/fixed'
 import * as Schema from './schema'
 import Result from '../result'
-import Computation from 'mol-base/computation'
+import Computation from 'mol-util/computation'
 
 interface State {
     tokenizer: Tokenizer,

+ 1 - 1
src/mol-io/reader/gro/schema.d.ts

@@ -5,7 +5,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Column } from 'mol-base/collections/database'
+import { Column } from 'mol-data/db'
 
 export interface Header {
     title: string,

+ 1 - 1
src/mol-io/reader/mol2/schema.d.ts

@@ -4,7 +4,7 @@
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
 
-import { Column } from 'mol-base/collections/database'
+import { Column } from 'mol-data/db'
 
 // Full format http://chemyang.ccnu.edu.cn/ccb/server/AIMMS/mol2.pdf
 // there are many records but for now ignore (pass over) all but the following

+ 2 - 2
src/mol-io/writer/cif/encoder.ts

@@ -4,8 +4,8 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import Iterator from 'mol-base/collections/iterator'
-import { Column } from 'mol-base/collections/database'
+import Iterator from 'mol-data/iterator'
+import { Column } from 'mol-data/db'
 import Encoder from '../encoder'
 
 // TODO: support for "coordinate fields", make "coordinate precision" a parameter of the encoder

+ 2 - 2
src/mol-io/writer/cif/encoder/binary.ts

@@ -6,8 +6,8 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import Iterator from 'mol-base/collections/iterator'
-import { Column } from 'mol-base/collections/database'
+import Iterator from 'mol-data/iterator'
+import { Column } from 'mol-data/db'
 import encodeMsgPack from '../../../common/msgpack/encode'
 import {
     EncodedColumn, EncodedData, EncodedFile, EncodedDataBlock, EncodedCategory, ArrayEncoder, ArrayEncoding as E, VERSION

+ 2 - 2
src/mol-io/writer/cif/encoder/text.ts

@@ -6,8 +6,8 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Column } from 'mol-base/collections/database'
-import StringBuilder from 'mol-base/utils/string-builder'
+import { Column } from 'mol-data/db'
+import StringBuilder from 'mol-util/string-builder'
 import * as Enc from '../encoder'
 import Writer from '../../writer'
 

+ 0 - 0
src/mol-base/geometry/grid-lookup.ts → src/mol-math/geometry/grid-lookup.ts


+ 0 - 0
src/mol-base/geometry/sphere.ts → src/mol-math/geometry/sphere.ts


+ 1 - 1
src/mol-base/geometry/transform.ts → src/mol-math/geometry/transform.ts

@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Mat4 } from '../math/linear-algebra-3d'
+import { Mat4 } from '../linear-algebra/3d'
 
 interface Transform extends Readonly<{
     transform: Mat4,

+ 0 - 0
src/mol-base/graph/graph.ts → src/mol-math/graph/graph.ts


+ 8 - 0
src/mol-math/linear-algebra.ts

@@ -0,0 +1,8 @@
+/**
+ * Copyright (c) 2017 mol* contributors, licensed under MIT, See LICENSE file for more info.
+ *
+ * @author David Sehnal <david.sehnal@gmail.com>
+ */
+
+export * from './linear-algebra/3d'
+export * from './linear-algebra/tensor'

+ 7 - 4
src/mol-base/math/linear-algebra-3d.ts → src/mol-math/linear-algebra/3d.ts

@@ -77,7 +77,7 @@ export namespace Mat4 {
         mat[15] = 1;
         return mat;
     }
-
+    
     export function ofRows(rows: number[][]): Mat4 {
         const out = zero();
         for (let i = 0; i < 4; i++) {
@@ -89,11 +89,14 @@ export namespace Mat4 {
         return out;
     }
 
+    const _id = identity();
+    export function isIdentity(m: Mat4, eps?: number) {
+        return areEqual(m, _id, typeof eps === 'undefined' ? EPSILON.Value : eps);
+    }
+
     export function areEqual(a: Mat4, b: Mat4, eps: number) {
         for (let i = 0; i < 16; i++) {
-            if (Math.abs(a[i] - b[i]) > eps) {
-                return false;
-            }
+            if (Math.abs(a[i] - b[i]) > eps) return false;
         }
         return true;
     }

+ 2 - 2
src/mol-base/math/_spec/tensor.spec.ts → src/mol-math/linear-algebra/_spec/tensor.spec.ts

@@ -4,8 +4,8 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import T from '../tensor'
-import { Mat4 } from '../linear-algebra-3d'
+import { Tensor as T } from '../tensor'
+import { Mat4 } from '../3d'
 
 describe('tensor', () => {
     it('vector', () => {

+ 31 - 5
src/mol-base/math/tensor.ts → src/mol-math/linear-algebra/tensor.ts

@@ -4,9 +4,11 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-interface Tensor extends Array<number> { '@type': 'tensor' }
+import { Mat4, Vec3, Vec4 } from './3d'
 
-namespace Tensor {
+export interface Tensor extends Array<number> { '@type': 'tensor' }
+
+export namespace Tensor {
     export type ArrayCtor = { new (size: number): ArrayLike<number> }
 
     export interface Space {
@@ -47,6 +49,32 @@ namespace Tensor {
     export function ColumnMajorMatrix(rows: number, cols: number, ctor?: ArrayCtor) { return Space([rows, cols], [1, 0], ctor); }
     export function RowMajorMatrix(rows: number, cols: number, ctor?: ArrayCtor) { return Space([rows, cols], [0, 1], ctor); }
 
+    export function toMat4(space: Space, data: Tensor): Mat4 {
+        if (space.rank !== 2) throw new Error('Invalid tensor rank');
+        const mat = Mat4.zero();
+        const d0 = Math.min(4, space.dimensions[0]), d1 = Math.min(4, space.dimensions[1]);
+        for (let i = 0; i < d0; i++) {
+            for (let j = 0; j < d1; j++) Mat4.setValue(mat, i, j, space.get(data, i, j));
+        }
+        return mat;
+    }
+
+    export function toVec3(space: Space, data: Tensor): Vec3 {
+        if (space.rank !== 1) throw new Error('Invalid tensor rank');
+        const vec = Vec3.zero();
+        const d0 = Math.min(3, space.dimensions[0]);
+        for (let i = 0; i < d0; i++) vec[i] = data[i];
+        return vec;
+    }
+
+    export function toVec4(space: Space, data: Tensor): Vec4 {
+        if (space.rank !== 1) throw new Error('Invalid tensor rank');
+        const vec = Vec4.zero();
+        const d0 = Math.min(4, space.dimensions[0]);
+        for (let i = 0; i < d0; i++) vec[i] = data[i];
+        return vec;
+    }
+
     function accessors(layout: Layout): { get: Space['get'], set: Space['set'] } {
         const { dimensions, axisOrderFastToSlow: ao } = layout;
         switch (dimensions.length) {
@@ -113,6 +141,4 @@ namespace Tensor {
         }
         return o;
     }
-}
-
-export default Tensor
+}

+ 0 - 0
src/mol-data/sequence/TODO → src/mol-model/sequence/TODO


+ 0 - 0
src/mol-data/structure.ts → src/mol-model/structure.ts


+ 1 - 1
src/mol-data/structure/_spec/atom-set.spec.ts → src/mol-model/structure/_spec/atom-set.spec.ts

@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { OrderedSet } from 'mol-base/collections/integer'
+import { OrderedSet } from 'mol-data/int'
 import AtomSet from '../structure/atom/set'
 import Atom from '../structure/atom'
 

+ 2 - 2
src/mol-data/structure/export/mmcif.ts → src/mol-model/structure/export/mmcif.ts

@@ -4,8 +4,8 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Column, Table } from 'mol-base/collections/database'
-import Iterator from 'mol-base/collections/iterator'
+import { Column, Table } from 'mol-data/db'
+import Iterator from 'mol-data/iterator'
 import * as Encoder from 'mol-io/writer/cif'
 //import { mmCIF_Schema } from 'mol-io/reader/cif/schema/mmcif'
 import { Structure, Atom, AtomSet } from '../structure'

+ 0 - 0
src/mol-data/structure/model.ts → src/mol-model/structure/model.ts


+ 0 - 0
src/mol-data/structure/model/format.ts → src/mol-model/structure/model/format.ts


+ 5 - 5
src/mol-data/structure/model/formats/mmcif.ts → src/mol-model/structure/model/formats/mmcif.ts

@@ -4,9 +4,9 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { newUUID } from 'mol-base/utils/uuid'
-import { Column, Table } from 'mol-base/collections/database'
-import { Interval, Segmentation } from 'mol-base/collections/integer'
+import UUID from 'mol-util/uuid'
+import { Column, Table } from 'mol-data/db'
+import { Interval, Segmentation } from 'mol-data/int'
 import Format from '../format'
 import Model from '../model'
 import * as Hierarchy from '../properties/hierarchy'
@@ -66,7 +66,7 @@ function getConformation({ data }: mmCIF_Format, bounds: Interval): Conformation
     const start = Interval.start(bounds), end = Interval.end(bounds);
     const { atom_site } = data;
     return {
-        id: newUUID(),
+        id: UUID.create(),
         atomId: Column.window(atom_site.id, start, end),
         occupancy: Column.window(atom_site.occupancy, start, end),
         B_iso_or_equiv: Column.window(atom_site.B_iso_or_equiv, start, end),
@@ -100,7 +100,7 @@ function createModel(format: mmCIF_Format, bounds: Interval, previous?: Model):
     }
     const hierarchyKeys = findHierarchyKeys(hierarchyData, hierarchySegments);
     return {
-        id: newUUID(),
+        id: UUID.create(),
         sourceData: format,
         modelNum: format.data.atom_site.pdbx_PDB_model_num.value(Interval.start(bounds)),
         hierarchy: { ...hierarchyData, ...hierarchyKeys, ...hierarchySegments },

+ 1 - 1
src/mol-data/structure/model/model.ts → src/mol-model/structure/model/model.ts

@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import UUID from 'mol-base/utils/uuid'
+import UUID from 'mol-util/uuid'
 import Format from './format'
 import HierarchyProperties from './properties/hierarchy'
 import ConformationProperties from './properties/conformation'

+ 0 - 0
src/mol-data/structure/model/properties/computed.ts → src/mol-model/structure/model/properties/computed.ts


+ 2 - 2
src/mol-data/structure/model/properties/conformation.ts → src/mol-model/structure/model/properties/conformation.ts

@@ -4,8 +4,8 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Column } from 'mol-base/collections/database'
-import UUID from 'mol-base/utils/uuid'
+import { Column } from 'mol-data/db'
+import UUID from 'mol-util/uuid'
 
 interface Conformation {
     id: UUID,

+ 0 - 0
src/mol-data/structure/model/properties/format-specific.ts → src/mol-model/structure/model/properties/format-specific.ts


+ 2 - 2
src/mol-data/structure/model/properties/hierarchy.ts → src/mol-model/structure/model/properties/hierarchy.ts

@@ -4,8 +4,8 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Column, Table } from 'mol-base/collections/database'
-import { Segmentation } from 'mol-base/collections/integer'
+import { Column, Table } from 'mol-data/db'
+import { Segmentation } from 'mol-data/int'
 import { mmCIF_Schema as mmCIF } from 'mol-io/reader/cif/schema/mmcif'
 import { ElementSymbol} from '../types'
 

+ 0 - 0
src/mol-data/structure/model/properties/transforms.ts → src/mol-model/structure/model/properties/transforms.ts


+ 1 - 1
src/mol-data/structure/model/types.ts → src/mol-model/structure/model/types.ts

@@ -5,7 +5,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import BitFlags from 'mol-base/utils/bit-flags'
+import BitFlags from 'mol-util/bit-flags'
 
 const _esCache = (function () {
     const cache = Object.create(null);

+ 2 - 2
src/mol-data/structure/model/utils/hierarchy-keys.ts → src/mol-model/structure/model/utils/hierarchy-keys.ts

@@ -4,9 +4,9 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Column } from 'mol-base/collections/database'
+import { Column } from 'mol-data/db'
 import { Data, Segments, Keys } from '../properties/hierarchy'
-import { Interval, Segmentation } from 'mol-base/collections/integer'
+import { Interval, Segmentation } from 'mol-data/int'
 
 function getResidueId(comp_id: string, seq_id: number, ins_code: string) {
     return `${comp_id} ${seq_id} ${ins_code}`;

+ 0 - 0
src/mol-data/structure/query.ts → src/mol-model/structure/query.ts


+ 1 - 1
src/mol-data/structure/query/generators.ts → src/mol-model/structure/query/generators.ts

@@ -8,7 +8,7 @@ import Query from './query'
 import Selection from './selection'
 import P from './properties'
 import { Structure, AtomSet, Atom } from '../structure'
-import { OrderedSet, Segmentation } from 'mol-base/collections/integer'
+import { OrderedSet, Segmentation } from 'mol-data/int'
 
 export const all: Query = s => s;
 

+ 0 - 0
src/mol-data/structure/query/predicates.ts → src/mol-model/structure/query/predicates.ts


+ 0 - 0
src/mol-data/structure/query/properties.ts → src/mol-model/structure/query/properties.ts


+ 0 - 0
src/mol-data/structure/query/query.ts → src/mol-model/structure/query/query.ts


+ 2 - 2
src/mol-data/structure/query/selection.ts → src/mol-model/structure/query/selection.ts

@@ -4,8 +4,8 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import Iterator from 'mol-base/collections/iterator'
-import HashSet from 'mol-base/collections/hash-set'
+import Iterator from 'mol-data/iterator'
+import HashSet from 'mol-data/util/hash-set'
 import { Structure, Atom, AtomSet } from '../structure'
 
 type Selection =

+ 0 - 0
src/mol-data/structure/structure.ts → src/mol-model/structure/structure.ts


+ 1 - 1
src/mol-data/structure/structure/atom.ts → src/mol-model/structure/structure/atom.ts

@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Tuple } from 'mol-base/collections/integer'
+import { Tuple } from 'mol-data/int'
 import Unit from './unit'
 import Structure from './structure'
 

+ 1 - 1
src/mol-data/structure/structure/atom/set.ts → src/mol-model/structure/structure/atom/set.ts

@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { OrderedSet, SortedArray, Iterator } from 'mol-base/collections/integer'
+import { OrderedSet, SortedArray, Iterator } from 'mol-data/int'
 import Atom from '../atom'
 import * as Impl from './set/impl'
 import createBuilder, { Builder as AtomSetBuilder } from './set/builder'

+ 2 - 2
src/mol-data/structure/structure/atom/set/builder.ts → src/mol-model/structure/structure/atom/set/builder.ts

@@ -6,8 +6,8 @@
 
 import AtomSet from '../set'
 import Atom from '../../atom'
-import { OrderedSet } from 'mol-base/collections/integer'
-import { sortArray } from 'mol-base/collections/sort'
+import { OrderedSet } from 'mol-data/int'
+import { sortArray } from 'mol-data/util/sort'
 
 export class Builder {
     private keys: number[] = [];

+ 3 - 3
src/mol-data/structure/structure/atom/set/impl.ts → src/mol-model/structure/structure/atom/set/impl.ts

@@ -4,9 +4,9 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-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 { SortedArray, Interval, Iterator, OrderedSet } from 'mol-data/int'
+import { sortArray } from 'mol-data/util/sort'
+import { hash1 } from 'mol-data/util/hash-functions'
 import Atom from '../../atom'
 
 /** Long and painful implementation starts here */

+ 0 - 0
src/mol-data/structure/structure/atom/set/properties.ts → src/mol-model/structure/structure/atom/set/properties.ts


+ 1 - 1
src/mol-data/structure/structure/operator.ts → src/mol-model/structure/structure/operator.ts

@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Mat4 } from 'mol-base/math/linear-algebra-3d'
+import { Mat4 } from 'mol-math/linear-algebra'
 
 interface Operator extends Readonly<{
     name: string,

+ 2 - 2
src/mol-data/structure/structure/structure.ts → src/mol-model/structure/structure/structure.ts

@@ -4,8 +4,8 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { OrderedSet, Iterator } from 'mol-base/collections/integer'
-import UniqueArray from 'mol-base/collections/unique-array'
+import { OrderedSet, Iterator } from 'mol-data/int'
+import UniqueArray from 'mol-data/util/unique-array'
 import { Model, Format } from '../model'
 import Unit from './unit'
 import Operator from './operator'

部分文件因为文件数量过多而无法显示