pdb.ts 741 B

123456789101112131415161718192021
  1. /**
  2. * Copyright (c) 2017-2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
  3. *
  4. * @author David Sehnal <david.sehnal@gmail.com>
  5. */
  6. import { PdbFile } from 'mol-io/reader/pdb/schema';
  7. import { pdbToMmCif } from './pdb/to-cif';
  8. import { Model } from 'mol-model/structure/model';
  9. import { Task } from 'mol-task';
  10. import { ModelFormat } from './format';
  11. import { _parse_mmCif } from './mmcif/parser';
  12. export function trajectoryFromPDB(pdb: PdbFile): Task<Model.Trajectory> {
  13. return Task.create('Parse PDB', async ctx => {
  14. await ctx.update('Converting to mmCIF');
  15. const cif = await pdbToMmCif(pdb);
  16. const format = ModelFormat.mmCIF(cif);
  17. return _parse_mmCif(format, ctx);
  18. })
  19. }