UNPKG

molstar

Version:

A comprehensive macromolecular library.

33 lines 3.61 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var parser_1 = require("../mol/parser"); var MolString = "2244\n -OEChem-04072009073D\n\n 21 21 0 0 0 0 0 0 0999 V2000\n 1.2333 0.5540 0.7792 O 0 0 0 0 0 0 0 0 0 0 0 0\n -0.6952 -2.7148 -0.7502 O 0 0 0 0 0 0 0 0 0 0 0 0\n 0.7958 -2.1843 0.8685 O 0 0 0 0 0 0 0 0 0 0 0 0\n 1.7813 0.8105 -1.4821 O 0 0 0 0 0 0 0 0 0 0 0 0\n -0.0857 0.6088 0.4403 C 0 0 0 0 0 0 0 0 0 0 0 0\n -0.7927 -0.5515 0.1244 C 0 0 0 0 0 0 0 0 0 0 0 0\n -0.7288 1.8464 0.4133 C 0 0 0 0 0 0 0 0 0 0 0 0\n -2.1426 -0.4741 -0.2184 C 0 0 0 0 0 0 0 0 0 0 0 0\n -2.0787 1.9238 0.0706 C 0 0 0 0 0 0 0 0 0 0 0 0\n -2.7855 0.7636 -0.2453 C 0 0 0 0 0 0 0 0 0 0 0 0\n -0.1409 -1.8536 0.1477 C 0 0 0 0 0 0 0 0 0 0 0 0\n 2.1094 0.6715 -0.3113 C 0 0 0 0 0 0 0 0 0 0 0 0\n 3.5305 0.5996 0.1635 C 0 0 0 0 0 0 0 0 0 0 0 0\n -0.1851 2.7545 0.6593 H 0 0 0 0 0 0 0 0 0 0 0 0\n -2.7247 -1.3605 -0.4564 H 0 0 0 0 0 0 0 0 0 0 0 0\n -2.5797 2.8872 0.0506 H 0 0 0 0 0 0 0 0 0 0 0 0\n -3.8374 0.8238 -0.5090 H 0 0 0 0 0 0 0 0 0 0 0 0\n 3.7290 1.4184 0.8593 H 0 0 0 0 0 0 0 0 0 0 0 0\n 4.2045 0.6969 -0.6924 H 0 0 0 0 0 0 0 0 0 0 0 0\n 3.7105 -0.3659 0.6426 H 0 0 0 0 0 0 0 0 0 0 0 0\n -0.2555 -3.5916 -0.7337 H 0 0 0 0 0 0 0 0 0 0 0 0\n 1 5 1 0 0 0 0\n 1 12 1 0 0 0 0\n 2 11 1 0 0 0 0\n 2 21 1 0 0 0 0\n 3 11 2 0 0 0 0\n 4 12 2 0 0 0 0\n 5 6 1 0 0 0 0\n 5 7 2 0 0 0 0\n 6 8 2 0 0 0 0\n 6 11 1 0 0 0 0\n 7 9 1 0 0 0 0\n 7 14 1 0 0 0 0\n 8 10 1 0 0 0 0\n 8 15 1 0 0 0 0\n 9 10 2 0 0 0 0\n 9 16 1 0 0 0 0\n 10 17 1 0 0 0 0\n 12 13 1 0 0 0 0\n 13 18 1 0 0 0 0\n 13 19 1 0 0 0 0\n 13 20 1 0 0 0 0\nM END"; describe('mol reader', function () { it('basic', function () { return (0, tslib_1.__awaiter)(void 0, void 0, void 0, function () { var parsed, _a, atoms, bonds; return (0, tslib_1.__generator)(this, function (_b) { switch (_b.label) { case 0: return [4 /*yield*/, (0, parser_1.parseMol)(MolString).run()]; case 1: parsed = _b.sent(); if (parsed.isError) { throw new Error(parsed.message); } _a = parsed.result, atoms = _a.atoms, bonds = _a.bonds; // number of structures expect(atoms.count).toBe(21); expect(bonds.count).toBe(21); expect(atoms.x.value(0)).toBeCloseTo(1.2333, 0.001); expect(atoms.y.value(0)).toBeCloseTo(0.5540, 0.0001); expect(atoms.z.value(0)).toBeCloseTo(0.7792, 0.0001); expect(atoms.type_symbol.value(0)).toBe('O'); expect(bonds.atomIdxA.value(20)).toBe(13); expect(bonds.atomIdxB.value(20)).toBe(20); expect(bonds.order.value(20)).toBe(1); return [2 /*return*/]; } }); }); }); }); //# sourceMappingURL=mol.spec.js.map