text: /**
   * Copyright (c) 2017-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
   *
   * @author David Sehnal <david.sehnal@gmail.com>
   * @author Alexander Rose <alexander.rose@weirdbyte.de>
   */
  import { Task } from '../../mol-task';
  import { CIF } from '../../mol-io/reader/cif';
  import { createModels } from './basic/parser';
  import { ModelSymmetry } from './property/symmetry';
  import { ModelSecondaryStructure } from './property/secondary-structure';
  import { Table } from '../../mol-data/db';
  import { AtomSiteAnisotrop } from './property/anisotropic';
  import { ComponentBond } from './property/bonds/chem_comp';
  import { StructConn } from './property/bonds/struct_conn';
  import { GlobalModelTransformInfo } from '../../mol-model/structure/model/properties/global-transform';
  function modelSymmetryFromMmcif(model) {
      if (!MmcifFormat.is(model.sourceData))
          return;
      return ModelSymmetry.fromData(model.sourceData.data.db);
  }
  ModelSymmetry.Provider.formatRegistry.add('mmCIF', modelSymmetryFromMmcif);
  function secondaryStructureFromMmcif(model) {
      if (!MmcifFormat.is(model.sourceData))
          return;
      var _a = model.sourceData.data.db, struct_conf = _a.struct_conf, struct_sheet_range = _a.struct_sheet_range;
      return ModelSecondaryStructure.fromStruct(struct_conf, struct_sheet_range, model.atomicHierarchy);
  }
  ModelSecondaryStructure.Provider.formatRegistry.add('mmCIF', secondaryStructureFromMmcif);
  function atomSiteAnisotropFromMmcif(model) {
      if (!MmcifFormat.is(model.sourceData))
          return;
      var atom_site_anisotrop = model.sourceData.data.db.atom_site_anisotrop;
      var data = Table.ofColumns(AtomSiteAnisotrop.Schema, atom_site_anisotrop);
      var elementToAnsiotrop = AtomSiteAnisotrop.getElementToAnsiotrop(model.atomicConformation.atomId, atom_site_anisotrop.id);
      return { data: data, elementToAnsiotrop: elementToAnsiotrop };
  }
  function atomSiteAnisotropApplicableMmcif(model) {
      if (!MmcifFormat.is(model.sourceData))
          return false;
      return model.sourceData.data.db.atom_site_anisotrop.U.isDefined;
  }
  AtomSiteAnisotrop.Provider.formatRegistry.add('mmCIF', atomSiteAnisotropFromMmcif, atomSiteAnisotropApplicableMmcif);
  function componentBondFromMmcif(model) {
      if (!MmcifFormat.is(model.sourceData))
          return;
      var chem_comp_bond = model.sourceData.data.db.chem_comp_bond;
      if (chem_comp_bond._rowCount === 0)
          return;
      return {
          data: chem_comp_bond,
          entries: ComponentBond.getEntriesFromChemCompBond(chem_comp_bond)
      };
  }
  ComponentBond.Provider.formatRegistry.add('mmCIF', componentBondFromMmcif);
  function structConnFromMmcif(model) {
      if (!MmcifFormat.is(model.sourceData))
          return;
      var struct_conn = model.sourceData.data.db.struct_conn;
      if (struct_conn._rowCount === 0)
          return;
      var entries = StructConn.getEntriesFromStructConn(struct_conn, model);
      return {
          data: struct_conn,
          byAtomIndex: StructConn.getAtomIndexFromEntries(entries),
          entries: entries,
      };
  }
  StructConn.Provider.formatRegistry.add('mmCIF', structConnFromMmcif);
  GlobalModelTransformInfo.Provider.formatRegistry.add('mmCIF', GlobalModelTransformInfo.fromMmCif, GlobalModelTransformInfo.hasData);
  //
  export { MmcifFormat };
  var MmcifFormat;
  (function (MmcifFormat) {
      function is(x) {
          return (x === null || x === void 0 ? void 0 : x.kind) === 'mmCIF';
      }
      MmcifFormat.is = is;
      function fromFrame(frame, db, source) {
          if (!db)
              db = CIF.schema.mmCIF(frame);
          return { kind: 'mmCIF', name: db._name, data: { db: db, frame: frame, source: source } };
      }
      MmcifFormat.fromFrame = fromFrame;
  })(MmcifFormat || (MmcifFormat = {}));
  export function trajectoryFromMmCIF(frame) {
      var format = MmcifFormat.fromFrame(frame);
      return Task.create('Create mmCIF Model', function (ctx) { return createModels(format.data.db, format, ctx); });
  }
  //# sourceMappingURL=mmcif.js.map