Ver código fonte

renamed model-parses to model-formats

David Sehnal 6 anos atrás
pai
commit
916ef886f5
36 arquivos alterados com 30 adições e 40 exclusões
  1. 1 1
      package.json
  2. 3 4
      src/apps/structure-info/model.ts
  3. 2 1
      src/apps/structure-info/volume.ts
  4. 0 0
      src/mol-model-formats/structure/format.ts
  5. 0 0
      src/mol-model-formats/structure/gro.ts
  6. 3 3
      src/mol-model-formats/structure/mmcif.ts
  7. 0 0
      src/mol-model-formats/structure/mmcif/assembly.ts
  8. 0 0
      src/mol-model-formats/structure/mmcif/atomic.ts
  9. 0 0
      src/mol-model-formats/structure/mmcif/bonds.ts
  10. 0 0
      src/mol-model-formats/structure/mmcif/bonds/comp.ts
  11. 0 0
      src/mol-model-formats/structure/mmcif/bonds/struct_conn.ts
  12. 0 0
      src/mol-model-formats/structure/mmcif/ihm.ts
  13. 0 0
      src/mol-model-formats/structure/mmcif/pair-restraint.ts
  14. 0 0
      src/mol-model-formats/structure/mmcif/pair-restraints/cross-links.ts
  15. 0 0
      src/mol-model-formats/structure/mmcif/pair-restraints/predicted-contacts.ts
  16. 0 0
      src/mol-model-formats/structure/mmcif/parser.ts
  17. 0 0
      src/mol-model-formats/structure/mmcif/secondary-structure.ts
  18. 0 0
      src/mol-model-formats/structure/mmcif/sequence.ts
  19. 0 0
      src/mol-model-formats/structure/mmcif/sort.ts
  20. 0 0
      src/mol-model-formats/structure/mmcif/util.ts
  21. 0 0
      src/mol-model-formats/structure/pdb.ts
  22. 0 0
      src/mol-model-formats/structure/pdb/to-cif.ts
  23. 0 0
      src/mol-model-formats/volume/ccp4.ts
  24. 0 0
      src/mol-model-formats/volume/density-server.ts
  25. 0 0
      src/mol-model-formats/volume/dsn6.ts
  26. 1 1
      src/mol-model/structure/model/model.ts
  27. 2 2
      src/mol-model/structure/structure/unit/links/data.ts
  28. 1 1
      src/mol-model/structure/structure/unit/links/inter-compute.ts
  29. 1 1
      src/mol-model/structure/structure/unit/links/intra-compute.ts
  30. 1 1
      src/mol-model/structure/structure/unit/pair-restraints/extract-cross-links.ts
  31. 1 2
      src/mol-model/volume.ts
  32. 5 6
      src/mol-plugin/state/transforms/model.ts
  33. 3 5
      src/perf-tests/lookup3d.ts
  34. 3 8
      src/perf-tests/structure.ts
  35. 2 3
      src/servers/model/server/structure-wrapper.ts
  36. 1 1
      tsconfig.json

+ 1 - 1
package.json

@@ -54,7 +54,7 @@
       "mol-math($|/.*)": "<rootDir>/src/mol-math$1",
       "mol-model($|/.*)": "<rootDir>/src/mol-model$1",
       "mol-model-props($|/.*)": "<rootDir>/src/mol-model-props$1",
-      "mol-model-parsers($|/.*)": "<rootDir>/src/mol-model-parsers$1",
+      "mol-model-formats($|/.*)": "<rootDir>/src/mol-model-formats$1",
       "mol-plugin($|/.*)": "<rootDir>/src/mol-plugin$1",
       "mol-ql($|/.*)": "<rootDir>/src/mol-ql$1",
       "mol-repr($|/.*)": "<rootDir>/src/mol-repr$1",

+ 3 - 4
src/apps/structure-info/model.ts

@@ -14,8 +14,7 @@ import { Model, Structure, StructureElement, Unit, StructureProperties, UnitRing
 import { OrderedSet } from 'mol-data/int';
 import { openCif, downloadCif } from './helpers';
 import { Vec3 } from 'mol-math/linear-algebra';
-import { trajecotryFromMmCIF } from 'mol-model-parsers/structure/mmcif';
-import { ModelFormat } from 'mol-model-parsers/structure/format';
+import { trajectoryFromMmCIF } from 'mol-model-formats/structure/mmcif';
 
 
 async function downloadFromPdb(pdb: string) {
@@ -200,7 +199,7 @@ export function printModelStats(models: ReadonlyArray<Model>) {
 }
 
 export async function getModelsAndStructure(frame: CifFrame) {
-    const models = await trajecotryFromMmCIF(ModelFormat.mmCIF(frame)).run();
+    const models = await trajectoryFromMmCIF(frame).run();
     const structure = Structure.ofModel(models[0]);
     return { models, structure };
 }
@@ -249,7 +248,7 @@ interface Args {
     download?: string,
     file?: string,
 
-    models?:boolean,
+    models?: boolean,
     seq?: boolean,
     ihm?: boolean,
     units?: boolean,

+ 2 - 1
src/apps/structure-info/volume.ts

@@ -8,7 +8,7 @@ import * as fs from 'fs'
 import * as argparse from 'argparse'
 import * as util from 'util'
 
-import { VolumeData, parseDensityServerData, VolumeIsoValue } from 'mol-model/volume'
+import { VolumeData, VolumeIsoValue } from 'mol-model/volume'
 import { downloadCif } from './helpers'
 import CIF from 'mol-io/reader/cif'
 import { DensityServer_Data_Database } from 'mol-io/reader/cif/schema/density-server';
@@ -17,6 +17,7 @@ import { StringBuilder } from 'mol-util';
 import { Task } from 'mol-task';
 import { createVolumeIsosurfaceMesh } from 'mol-repr/volume/isosurface';
 import { createEmptyTheme } from 'mol-theme/theme';
+import { parseDensityServerData } from 'mol-model-formats/volume/density-server';
 
 require('util.promisify').shim();
 const writeFileAsync = util.promisify(fs.writeFile);

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


+ 0 - 0
src/mol-model-parsers/structure/gro.ts → src/mol-model-formats/structure/gro.ts


+ 3 - 3
src/mol-model-parsers/structure/mmcif.ts → src/mol-model-formats/structure/mmcif.ts

@@ -9,8 +9,8 @@ import { Model } from 'mol-model/structure/model/model';
 import { Task } from 'mol-task';
 import { ModelFormat } from './format';
 import { _parse_mmCif } from './mmcif/parser';
-import mmCIF_Format = ModelFormat.mmCIF
+import { CifFrame } from 'mol-io/reader/cif';
 
-export function trajecotryFromMmCIF(format: mmCIF_Format): Task<Model.Trajectory> {
-    return Task.create('Create mmCIF Model', ctx => _parse_mmCif(format, ctx));
+export function trajectoryFromMmCIF(frame: CifFrame): Task<Model.Trajectory> {
+    return Task.create('Create mmCIF Model', ctx => _parse_mmCif(ModelFormat.mmCIF(frame), ctx));
 }

+ 0 - 0
src/mol-model-parsers/structure/mmcif/assembly.ts → src/mol-model-formats/structure/mmcif/assembly.ts


+ 0 - 0
src/mol-model-parsers/structure/mmcif/atomic.ts → src/mol-model-formats/structure/mmcif/atomic.ts


+ 0 - 0
src/mol-model-parsers/structure/mmcif/bonds.ts → src/mol-model-formats/structure/mmcif/bonds.ts


+ 0 - 0
src/mol-model-parsers/structure/mmcif/bonds/comp.ts → src/mol-model-formats/structure/mmcif/bonds/comp.ts


+ 0 - 0
src/mol-model-parsers/structure/mmcif/bonds/struct_conn.ts → src/mol-model-formats/structure/mmcif/bonds/struct_conn.ts


+ 0 - 0
src/mol-model-parsers/structure/mmcif/ihm.ts → src/mol-model-formats/structure/mmcif/ihm.ts


+ 0 - 0
src/mol-model-parsers/structure/mmcif/pair-restraint.ts → src/mol-model-formats/structure/mmcif/pair-restraint.ts


+ 0 - 0
src/mol-model-parsers/structure/mmcif/pair-restraints/cross-links.ts → src/mol-model-formats/structure/mmcif/pair-restraints/cross-links.ts


+ 0 - 0
src/mol-model-parsers/structure/mmcif/pair-restraints/predicted-contacts.ts → src/mol-model-formats/structure/mmcif/pair-restraints/predicted-contacts.ts


+ 0 - 0
src/mol-model-parsers/structure/mmcif/parser.ts → src/mol-model-formats/structure/mmcif/parser.ts


+ 0 - 0
src/mol-model-parsers/structure/mmcif/secondary-structure.ts → src/mol-model-formats/structure/mmcif/secondary-structure.ts


+ 0 - 0
src/mol-model-parsers/structure/mmcif/sequence.ts → src/mol-model-formats/structure/mmcif/sequence.ts


+ 0 - 0
src/mol-model-parsers/structure/mmcif/sort.ts → src/mol-model-formats/structure/mmcif/sort.ts


+ 0 - 0
src/mol-model-parsers/structure/mmcif/util.ts → src/mol-model-formats/structure/mmcif/util.ts


+ 0 - 0
src/mol-model-parsers/structure/pdb.ts → src/mol-model-formats/structure/pdb.ts


+ 0 - 0
src/mol-model-parsers/structure/pdb/to-cif.ts → src/mol-model-formats/structure/pdb/to-cif.ts


+ 0 - 0
src/mol-model-parsers/volume/ccp4.ts → src/mol-model-formats/volume/ccp4.ts


+ 0 - 0
src/mol-model-parsers/volume/density-server.ts → src/mol-model-formats/volume/density-server.ts


+ 0 - 0
src/mol-model-parsers/volume/dsn6.ts → src/mol-model-formats/volume/dsn6.ts


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

@@ -14,7 +14,7 @@ import { CustomProperties } from './properties/custom';
 import { SecondaryStructure } from './properties/seconday-structure';
 import { ChemicalComponentMap } from './properties/chemical-component';
 import { SaccharideComponentMap } from '../structure/carbohydrates/constants';
-import { ModelFormat } from 'mol-model-parsers/structure/format';
+import { ModelFormat } from 'mol-model-formats/structure/format';
 
 /**
  * Interface to the "source data" of the molecule.

+ 2 - 2
src/mol-model/structure/structure/unit/links/data.ts

@@ -66,10 +66,10 @@ class InterUnitBonds {
                 pairBonds.linkedElementIndices.forEach(indexA => {
                     pairBonds.getBonds(indexA).forEach(bondInfo => {
                         const { unitA, unitB } = pairBonds
-                        
+
                         const bondKey = InterUnitBonds.getBondKey(indexA, unitA, bondInfo.indexB, unitB)
                         bondKeyIndex.set(bondKey, bonds.length)
-                        
+
                         const elementKey = InterUnitBonds.getElementKey(indexA, unitA)
                         const e = elementKeyIndex.get(elementKey)
                         if (e === undefined) elementKeyIndex.set(elementKey, [bonds.length])

+ 1 - 1
src/mol-model/structure/structure/unit/links/inter-compute.ts

@@ -13,7 +13,7 @@ import { UniqueArray } from 'mol-data/generic';
 import { SortedArray } from 'mol-data/int';
 import { Vec3, Mat4 } from 'mol-math/linear-algebra';
 import StructureElement from '../../element';
-import { StructConn } from 'mol-model-parsers/structure/mmcif/bonds';
+import { StructConn } from 'mol-model-formats/structure/mmcif/bonds';
 
 const MAX_RADIUS = 4;
 

+ 1 - 1
src/mol-model/structure/structure/unit/links/intra-compute.ts

@@ -10,7 +10,7 @@ import Unit from '../../unit'
 import { IntAdjacencyGraph } from 'mol-math/graph';
 import { LinkComputationParameters, getElementIdx, MetalsSet, getElementThreshold, isHydrogen, getElementPairThreshold } from './common';
 import { SortedArray } from 'mol-data/int';
-import { StructConn, ComponentBond } from 'mol-model-parsers/structure/mmcif/bonds';
+import { StructConn, ComponentBond } from 'mol-model-formats/structure/mmcif/bonds';
 
 function getGraph(atomA: number[], atomB: number[], _order: number[], _flags: number[], atomCount: number): IntraUnitLinks {
     const builder = new IntAdjacencyGraph.EdgeBuilder(atomCount, atomA, atomB);

+ 1 - 1
src/mol-model/structure/structure/unit/pair-restraints/extract-cross-links.ts

@@ -8,7 +8,7 @@ import Unit from '../../unit';
 import Structure from '../../structure';
 import { PairRestraints, CrossLinkRestraint } from './data';
 import { StructureElement } from '../../../structure';
-import { IHMCrossLinkRestraint } from 'mol-model-parsers/structure/mmcif/pair-restraint';
+import { IHMCrossLinkRestraint } from 'mol-model-formats/structure/mmcif/pair-restraint';
 
 function _addRestraints(map: Map<number, number>, unit: Unit, restraints: IHMCrossLinkRestraint) {
     const { elements } = unit;

+ 1 - 2
src/mol-model/volume.ts

@@ -4,5 +4,4 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-export * from './volume/data'
-export * from '../mol-model-parsers/volume/density-server'
+export * from './volume/data'

+ 5 - 6
src/mol-plugin/state/transforms/model.ts

@@ -16,13 +16,12 @@ import { MolScriptBuilder } from 'mol-script/language/builder';
 import { StateObject } from 'mol-state';
 import { PluginContext } from 'mol-plugin/context';
 import { stringToWords } from 'mol-util/string';
-import { volumeFromCcp4 } from 'mol-model-parsers/volume/ccp4';
+import { volumeFromCcp4 } from 'mol-model-formats/volume/ccp4';
 import { Vec3 } from 'mol-math/linear-algebra';
-import { volumeFromDsn6 } from 'mol-model-parsers/volume/dsn6';
-import { trajecotryFromMmCIF } from 'mol-model-parsers/structure/mmcif';
-import { ModelFormat } from 'mol-model-parsers/structure/format';
+import { volumeFromDsn6 } from 'mol-model-formats/volume/dsn6';
+import { trajectoryFromMmCIF } from 'mol-model-formats/structure/mmcif';
 import { parsePDB } from 'mol-io/reader/pdb/parser';
-import { trajectoryFromPDB } from 'mol-model-parsers/structure/pdb';
+import { trajectoryFromPDB } from 'mol-model-formats/structure/pdb';
 
 export { TrajectoryFromMmCif }
 type TrajectoryFromMmCif = typeof TrajectoryFromMmCif
@@ -49,7 +48,7 @@ const TrajectoryFromMmCif = PluginStateTransform.BuiltIn({
             const header = params.blockHeader || a.data.blocks[0].header;
             const block = a.data.blocks.find(b => b.header === header);
             if (!block) throw new Error(`Data block '${[header]}' not found.`);
-            const models = await trajecotryFromMmCIF(ModelFormat.mmCIF(block)).runInContext(ctx);
+            const models = await trajectoryFromMmCIF(block).runInContext(ctx);
             if (models.length === 0) throw new Error('No models found.');
             const props = { label: models[0].label, description: `${models.length} model${models.length === 1 ? '' : 's'}` };
             return new SO.Molecule.Trajectory(models, props);

+ 3 - 5
src/perf-tests/lookup3d.ts

@@ -7,8 +7,7 @@ import { Structure } from 'mol-model/structure'
 import { GridLookup3D } from 'mol-math/geometry';
 // import { sortArray } from 'mol-data/util';
 import { OrderedSet } from 'mol-data/int';
-import { ModelFormat } from 'mol-model-parsers/structure/format';
-import { trajecotryFromMmCIF } from 'mol-model-parsers/structure/mmcif';
+import { trajectoryFromMmCIF } from 'mol-model-formats/structure/mmcif';
 
 require('util.promisify').shim();
 const readFileAsync = util.promisify(fs.readFile);
@@ -33,11 +32,10 @@ export async function readCIF(path: string) {
         throw parsed;
     }
 
-    const mmcif = ModelFormat.mmCIF(parsed.result.blocks[0]);
-    const models = await trajecotryFromMmCIF(mmcif).run();
+    const models = await trajectoryFromMmCIF(parsed.result.blocks[0]).run();
     const structures = models.map(Structure.ofModel);
 
-    return { mmcif: mmcif.data, models, structures };
+    return { mmcif: models[0].sourceData.data, models, structures };
 }
 
 export async function test() {

+ 3 - 8
src/perf-tests/structure.ts

@@ -16,8 +16,7 @@ import { Structure, Model, Queries as Q, StructureElement, StructureSelection, S
 
 import to_mmCIF from 'mol-model/structure/export/mmcif'
 import { Vec3 } from 'mol-math/linear-algebra';
-import { ModelFormat } from 'mol-model-parsers/structure/format';
-import { trajecotryFromMmCIF } from 'mol-model-parsers/structure/mmcif';
+import { trajectoryFromMmCIF } from 'mol-model-formats/structure/mmcif';
 // import { printUnits } from 'apps/structure-info/model';
 // import { EquivalenceClasses } from 'mol-data/util';
 
@@ -71,16 +70,12 @@ export async function readCIF(path: string) {
     }
 
     const data = parsed.result.blocks[0];
-    console.time('schema')
-    const mmcif = ModelFormat.mmCIF(data);
-
-    console.timeEnd('schema')
     console.time('buildModels')
-    const models = await trajecotryFromMmCIF(mmcif).run();
+    const models = await trajectoryFromMmCIF(data).run();
     console.timeEnd('buildModels')
     const structures = models.map(Structure.ofModel);
 
-    return { mmcif, models, structures };
+    return { mmcif: models[0].sourceData.data, models, structures };
 }
 
 const DATA_DIR = './build/data';

+ 2 - 3
src/servers/model/server/structure-wrapper.ts

@@ -15,8 +15,7 @@ import * as zlib from 'zlib'
 import { Job } from './jobs';
 import { ConsoleLogger } from 'mol-util/console-logger';
 import { ModelPropertiesProvider } from '../property-provider';
-import { trajecotryFromMmCIF } from 'mol-model-parsers/structure/mmcif';
-import { ModelFormat } from 'mol-model-parsers/structure/format';
+import { trajectoryFromMmCIF } from 'mol-model-formats/structure/mmcif';
 
 require('util.promisify').shim();
 
@@ -110,7 +109,7 @@ export async function readStructureWrapper(key: string, sourceId: string | '_loc
     const frame = (await parseCif(data)).blocks[0];
     perf.end('parse');
     perf.start('createModel');
-    const models = await trajecotryFromMmCIF(ModelFormat.mmCIF(frame)).run();
+    const models = await trajectoryFromMmCIF(frame).run();
     perf.end('createModel');
 
     const modelMap = new Map<number, Model>();

+ 1 - 1
tsconfig.json

@@ -23,7 +23,7 @@
             "mol-math": ["./mol-math"],
             "mol-model": ["./mol-model"],
             "mol-model-props": ["./mol-model-props", "./mol-model-props/index.ts"],
-            "mol-model-parsers": ["./mol-model-parsers"],
+            "mol-model-formats": ["./mol-model-formats"],
             "mol-ql": ["./mol-ql"],
             "mol-repr": ["./mol-repr"],
             "mol-script": ["./mol-script"],