smiles-js 2.0.3 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/API.md +162 -0
  2. package/README.md +39 -0
  3. package/docs/MIRROR_PLAN.md +204 -0
  4. package/docs/smiles.peggy +215 -0
  5. package/package.json +1 -1
  6. package/scripts/coverage-summary.js +1 -1
  7. package/src/codegen/branch-crossing-ring.js +27 -6
  8. package/src/codegen/interleaved-fused-ring.js +24 -0
  9. package/src/decompiler.js +236 -51
  10. package/src/decompiler.test.js +232 -60
  11. package/src/fragment.test.js +7 -2
  12. package/src/manipulation.js +409 -4
  13. package/src/manipulation.test.js +359 -1
  14. package/src/method-attachers.js +37 -8
  15. package/src/node-creators.js +7 -0
  16. package/src/parser/ast-builder.js +23 -8
  17. package/src/parser/ring-group-builder.js +14 -2
  18. package/src/parser/ring-utils.js +28 -0
  19. package/test-integration/__snapshots__/acetaminophen.test.js.snap +20 -0
  20. package/test-integration/__snapshots__/adjuvant-analgesics.test.js.snap +63 -1
  21. package/test-integration/__snapshots__/cholesterol-drugs.test.js.snap +437 -0
  22. package/test-integration/__snapshots__/dexamethasone.test.js.snap +31 -0
  23. package/test-integration/__snapshots__/endocannabinoids.test.js.snap +79 -2
  24. package/test-integration/__snapshots__/endogenous-opioids.test.js.snap +1116 -0
  25. package/test-integration/__snapshots__/hypertension-medication.test.js.snap +70 -1
  26. package/test-integration/__snapshots__/local-anesthetics.test.js.snap +97 -0
  27. package/test-integration/__snapshots__/nsaids-otc.test.js.snap +61 -1
  28. package/test-integration/__snapshots__/nsaids-prescription.test.js.snap +115 -2
  29. package/test-integration/__snapshots__/opioids.test.js.snap +113 -4
  30. package/test-integration/__snapshots__/steroids.test.js.snap +381 -2
  31. package/test-integration/acetaminophen.test.js +15 -3
  32. package/test-integration/adjuvant-analgesics.test.js +43 -7
  33. package/test-integration/cholesterol-drugs.test.js +127 -20
  34. package/test-integration/cholesterol.test.js +112 -0
  35. package/test-integration/dexamethasone.test.js +8 -2
  36. package/test-integration/endocannabinoids.test.js +48 -12
  37. package/test-integration/endogenous-opioids.smiles.js +32 -0
  38. package/test-integration/endogenous-opioids.test.js +192 -0
  39. package/test-integration/hypertension-medication.test.js +32 -8
  40. package/test-integration/local-anesthetics.smiles.js +33 -0
  41. package/test-integration/local-anesthetics.test.js +64 -16
  42. package/test-integration/mirror.test.js +151 -0
  43. package/test-integration/nsaids-otc.test.js +40 -10
  44. package/test-integration/nsaids-prescription.test.js +72 -18
  45. package/test-integration/opioids.test.js +56 -14
  46. package/test-integration/polymer.test.js +148 -0
  47. package/test-integration/steroids.test.js +112 -28
  48. package/test-integration/utils.js +4 -2
  49. package/todo +2 -3
@@ -227,6 +227,37 @@ exports[`Dexamethasone Integration Test parses dexamethasone 1`] = `
227
227
  `;
228
228
 
229
229
  exports[`Dexamethasone Integration Test generates valid code via toCode() 1`] = `
230
+ "export const v1 = Fragment('C');
231
+ export const v2 = Fragment('C1CCCC1');
232
+ export const v3 = Fragment('C');
233
+ export const v4 = v2.attach(4, v3);
234
+ export const v5 = Fragment('O');
235
+ export const v6 = v4.attach(5, v5);
236
+ export const v7 = Fragment('C2CCCCC2');
237
+ export const v8 = Fragment('F');
238
+ export const v9 = v7.attach(3, v8);
239
+ export const v10 = Fragment('O');
240
+ export const v11 = v9.attach(4, v10);
241
+ export const v12 = Fragment('C');
242
+ export const v13 = v11.attach(6, v12);
243
+ export const v14 = Fragment('C3CCCCC3');
244
+ export const v15 = Fragment('C');
245
+ export const v16 = v14.attach(5, v15);
246
+ export const v17 = Fragment('F');
247
+ export const v18 = v16.attach(6, v17);
248
+ export const v19 = Fragment('C4=CCC=CC4');
249
+ export const v20 = Linear(['O'], ['=']);
250
+ export const v21 = v19.attach(3, v20);
251
+ export const v22 = Fragment('C');
252
+ export const v23 = v21.attach(6, v22);
253
+ export const v24 = FusedRing({ metadata: { rings: [{ ring: v6, start: 1, end: 22, atoms: [{ position: 1, depth: 0, value: 'C', rings: [1, 1] }, { position: 2, depth: 0, value: 'C', rings: [1] }, { position: 3, depth: 0, value: 'C', rings: [2, 2, 1] }, { position: 20, depth: 0, value: 'C', rings: [2, 1] }, { position: 22, depth: 0, value: 'C', rings: [1] }] }, { ring: v13, start: 3, end: 20, atoms: [{ position: 3, depth: 0, value: 'C', rings: [2, 2, 1] }, { position: 4, depth: 0, value: 'C', rings: [3, 3, 2] }, { position: 15, depth: 0, value: 'C', rings: [3, 2] }, { position: 17, depth: 0, value: 'C', rings: [2] }, { position: 19, depth: 0, value: 'C', rings: [2] }, { position: 20, depth: 0, value: 'C', rings: [2, 1] }] }, { ring: v18, start: 4, end: 15, atoms: [{ position: 4, depth: 0, value: 'C', rings: [3, 3, 2] }, { position: 5, depth: 0, value: 'C', rings: [3] }, { position: 6, depth: 0, value: 'C', rings: [3] }, { position: 7, depth: 0, value: 'C', rings: [4, 4, 3] }, { position: 13, depth: 0, value: 'C', rings: [4, 3] }, { position: 15, depth: 0, value: 'C', rings: [3, 2] }] }, { ring: v23, start: 7, end: 13, atoms: [{ position: 7, depth: 0, value: 'C', rings: [4, 4, 3] }, { position: 8, depth: 0, value: 'C', bond: '=', rings: [4] }, { position: 9, depth: 0, value: 'C', rings: [4] }, { position: 11, depth: 0, value: 'C', rings: [4] }, { position: 12, depth: 0, value: 'C', bond: '=', rings: [4] }, { position: 13, depth: 0, value: 'C', rings: [4, 3] }] }] } });
254
+ export const v25 = Fragment('CCO');
255
+ export const v26 = Linear(['O'], ['=']);
256
+ export const v27 = v25.attach(1, v26);
257
+ export const v28 = Molecule([v1, v24, v27]);"
258
+ `;
259
+
260
+ exports[`Dexamethasone Integration Test generates valid verbose code via toCode() 1`] = `
230
261
  "export const v1 = Linear(['C']);
231
262
  export const v2 = Ring({ atoms: 'C', size: 5 });
232
263
  export const v3 = Linear(['C']);
@@ -77,6 +77,12 @@ export const v2 = Linear(['O'], ['=']);
77
77
  export const v3 = v1.attach(20, v2);"
78
78
  `;
79
79
 
80
+ exports[`Anandamide Integration Test generates valid verbose code via toCode() 1`] = `
81
+ "export const v1 = Linear(['C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'N', 'C', 'C', 'O'], [null, null, null, null, null, '=', null, null, '=', null, null, '=', null, null, '=', null, null, null, null, null, null, null, null]);
82
+ export const v2 = Linear(['O'], ['=']);
83
+ export const v3 = v1.attach(20, v2);"
84
+ `;
85
+
80
86
  exports[`2-Arachidonoylglycerol Integration Test parses 2-arachidonoylglycerol 1`] = `
81
87
  {
82
88
  "atoms": [
@@ -166,6 +172,14 @@ exports[`2-Arachidonoylglycerol Integration Test generates valid code via toCode
166
172
  "export const v1 = Linear(['C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'O', 'C', 'C', 'O'], [null, null, null, null, null, '=', null, null, '=', null, null, '=', null, null, '=', null, null, null, null, null, null, null, null]);
167
173
  export const v2 = Linear(['O'], ['=']);
168
174
  export const v3 = v1.attach(20, v2);
175
+ export const v4 = Fragment('CO');
176
+ export const v5 = v3.attach(22, v4);"
177
+ `;
178
+
179
+ exports[`2-Arachidonoylglycerol Integration Test generates valid verbose code via toCode() 1`] = `
180
+ "export const v1 = Linear(['C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'O', 'C', 'C', 'O'], [null, null, null, null, null, '=', null, null, '=', null, null, '=', null, null, '=', null, null, null, null, null, null, null, null]);
181
+ export const v2 = Linear(['O'], ['=']);
182
+ export const v3 = v1.attach(20, v2);
169
183
  export const v4 = Linear(['C', 'O']);
170
184
  export const v5 = v3.attach(22, v4);"
171
185
  `;
@@ -298,6 +312,22 @@ exports[`THC Integration Test parses THC 1`] = `
298
312
  `;
299
313
 
300
314
  exports[`THC Integration Test generates valid code via toCode() 1`] = `
315
+ "export const v1 = Fragment('CCCCC');
316
+ export const v2 = Fragment('C1=CC(=CCC=C(CCCC(CC=C1)))');
317
+ export const v3 = Fragment('C1=CC(=CCC=C(CCCC(OC=C1)))');
318
+ export const v4 = Fragment('C');
319
+ export const v5 = v3.attach(11, v4, { sibling: true });
320
+ export const v6 = Ring({ atoms: 'C', size: 6, ringNumber: 2, offset: 3, branchDepths: [1, 1, 2, 2, 3, 3], leadingBond: '=' });
321
+ export const v7 = v6.substitute(5, 'O');
322
+ export const v8 = Fragment('C');
323
+ export const v9 = v7.attach(4, v8, { sibling: true });
324
+ export const v10 = Fragment('C3C=C(CCC3)');
325
+ export const v11 = FusedRing({ metadata: { rings: [{ ring: v5, start: 5, end: 18, atoms: [{ position: 5, depth: 0, value: 'C', rings: [1, 1] }, { position: 6, depth: 0, value: 'C', bond: '=', rings: [1] }, { position: 7, depth: 0, value: 'C', rings: [1] }, { position: 8, depth: 1, value: 'C', bond: '=', rings: [2, 2, 1], branchId: 10 }, { position: 9, depth: 1, value: 'C', rings: [3, 3, 2, 1], branchId: 10 }, { position: 10, depth: 1, value: 'C', rings: [3, 1], branchId: 10 }, { position: 11, depth: 1, value: 'C', bond: '=', rings: [3, 1], branchId: 10 }, { position: 12, depth: 2, value: 'C', rings: [3, 1], branchId: 19 }, { position: 13, depth: 2, value: 'C', rings: [3, 1], branchId: 19 }, { position: 14, depth: 2, value: 'C', rings: [3, 2, 1], branchId: 19 }, { position: 15, depth: 2, value: 'C', rings: [2, 1], branchId: 19 }, { position: 16, depth: 3, value: 'O', rings: [2, 1], branchId: 25 }, { position: 17, depth: 3, value: 'C', rings: [2, 1], branchId: 25 }, { position: 18, depth: 3, value: 'C', bond: '=', rings: [1], branchId: 25 }] }, { ring: v9, start: 8, end: 17, atoms: [{ position: 8, depth: 1, value: 'C', bond: '=', rings: [2, 2, 1], branchId: 10 }, { position: 9, depth: 1, value: 'C', rings: [3, 3, 2, 1], branchId: 10 }, { position: 14, depth: 2, value: 'C', rings: [3, 2, 1], branchId: 19 }, { position: 15, depth: 2, value: 'C', rings: [2, 1], branchId: 19 }, { position: 16, depth: 3, value: 'O', rings: [2, 1], branchId: 25 }, { position: 17, depth: 3, value: 'C', rings: [2, 1], branchId: 25 }] }, { ring: v10, start: 9, end: 14, atoms: [{ position: 9, depth: 1, value: 'C', rings: [3, 3, 2, 1], branchId: 10 }, { position: 10, depth: 1, value: 'C', rings: [3, 1], branchId: 10 }, { position: 11, depth: 1, value: 'C', bond: '=', rings: [3, 1], branchId: 10 }, { position: 12, depth: 2, value: 'C', rings: [3, 1], branchId: 19 }, { position: 13, depth: 2, value: 'C', rings: [3, 1], branchId: 19 }, { position: 14, depth: 2, value: 'C', rings: [3, 2, 1], branchId: 19 }] }], atoms: [{ position: 20, depth: 2, value: 'C', branchId: 19 }, { position: 21, depth: 1, value: 'C', branchId: 10 }] } });
326
+ export const v12 = Fragment('O');
327
+ export const v13 = Molecule([v1, v11, v12]);"
328
+ `;
329
+
330
+ exports[`THC Integration Test generates valid verbose code via toCode() 1`] = `
301
331
  "export const v1 = Linear(['C', 'C', 'C', 'C', 'C']);
302
332
  export const v2 = Ring({ atoms: 'C', size: 14, bonds: ['=', null, '=', null, null, '=', null, null, null, null, null, null, '=', null], branchDepths: [0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3] });
303
333
  export const v3 = v2.substitute(12, 'O');
@@ -308,7 +338,7 @@ export const v7 = v6.substitute(5, 'O');
308
338
  export const v8 = Linear(['C']);
309
339
  export const v9 = v7.attach(4, v8, { sibling: true });
310
340
  export const v10 = Ring({ atoms: 'C', size: 6, ringNumber: 3, offset: 4, bonds: [null, '=', null, null, null, null], branchDepths: [1, 1, 1, 2, 2, 2] });
311
- export const v11 = FusedRing({ metadata: { rings: [{ ring: v5, start: 5, end: 18, atoms: [{ position: 5, depth: 0, value: 'C', rings: [1, 1] }, { position: 6, depth: 0, value: 'C', bond: '=', rings: [1] }, { position: 7, depth: 0, value: 'C', rings: [1] }, { position: 8, depth: 1, value: 'C', bond: '=', rings: [2, 2, 1] }, { position: 9, depth: 1, value: 'C', rings: [3, 3, 2, 1] }, { position: 10, depth: 1, value: 'C', rings: [3, 1] }, { position: 11, depth: 1, value: 'C', bond: '=', rings: [3, 1] }, { position: 12, depth: 2, value: 'C', rings: [3, 1] }, { position: 13, depth: 2, value: 'C', rings: [3, 1] }, { position: 14, depth: 2, value: 'C', rings: [3, 2, 1] }, { position: 15, depth: 2, value: 'C', rings: [2, 1] }, { position: 16, depth: 3, value: 'O', rings: [2, 1] }, { position: 17, depth: 3, value: 'C', rings: [2, 1] }, { position: 18, depth: 3, value: 'C', bond: '=', rings: [1] }] }, { ring: v9, start: 8, end: 17, atoms: [{ position: 8, depth: 1, value: 'C', bond: '=', rings: [2, 2, 1] }, { position: 9, depth: 1, value: 'C', rings: [3, 3, 2, 1] }, { position: 14, depth: 2, value: 'C', rings: [3, 2, 1] }, { position: 15, depth: 2, value: 'C', rings: [2, 1] }, { position: 16, depth: 3, value: 'O', rings: [2, 1] }, { position: 17, depth: 3, value: 'C', rings: [2, 1] }] }, { ring: v10, start: 9, end: 14, atoms: [{ position: 9, depth: 1, value: 'C', rings: [3, 3, 2, 1] }, { position: 10, depth: 1, value: 'C', rings: [3, 1] }, { position: 11, depth: 1, value: 'C', bond: '=', rings: [3, 1] }, { position: 12, depth: 2, value: 'C', rings: [3, 1] }, { position: 13, depth: 2, value: 'C', rings: [3, 1] }, { position: 14, depth: 2, value: 'C', rings: [3, 2, 1] }] }], atoms: [{ position: 20, depth: 2, value: 'C' }, { position: 21, depth: 1, value: 'C' }] } });
341
+ export const v11 = FusedRing({ metadata: { rings: [{ ring: v5, start: 5, end: 18, atoms: [{ position: 5, depth: 0, value: 'C', rings: [1, 1] }, { position: 6, depth: 0, value: 'C', bond: '=', rings: [1] }, { position: 7, depth: 0, value: 'C', rings: [1] }, { position: 8, depth: 1, value: 'C', bond: '=', rings: [2, 2, 1], branchId: 10 }, { position: 9, depth: 1, value: 'C', rings: [3, 3, 2, 1], branchId: 10 }, { position: 10, depth: 1, value: 'C', rings: [3, 1], branchId: 10 }, { position: 11, depth: 1, value: 'C', bond: '=', rings: [3, 1], branchId: 10 }, { position: 12, depth: 2, value: 'C', rings: [3, 1], branchId: 19 }, { position: 13, depth: 2, value: 'C', rings: [3, 1], branchId: 19 }, { position: 14, depth: 2, value: 'C', rings: [3, 2, 1], branchId: 19 }, { position: 15, depth: 2, value: 'C', rings: [2, 1], branchId: 19 }, { position: 16, depth: 3, value: 'O', rings: [2, 1], branchId: 25 }, { position: 17, depth: 3, value: 'C', rings: [2, 1], branchId: 25 }, { position: 18, depth: 3, value: 'C', bond: '=', rings: [1], branchId: 25 }] }, { ring: v9, start: 8, end: 17, atoms: [{ position: 8, depth: 1, value: 'C', bond: '=', rings: [2, 2, 1], branchId: 10 }, { position: 9, depth: 1, value: 'C', rings: [3, 3, 2, 1], branchId: 10 }, { position: 14, depth: 2, value: 'C', rings: [3, 2, 1], branchId: 19 }, { position: 15, depth: 2, value: 'C', rings: [2, 1], branchId: 19 }, { position: 16, depth: 3, value: 'O', rings: [2, 1], branchId: 25 }, { position: 17, depth: 3, value: 'C', rings: [2, 1], branchId: 25 }] }, { ring: v10, start: 9, end: 14, atoms: [{ position: 9, depth: 1, value: 'C', rings: [3, 3, 2, 1], branchId: 10 }, { position: 10, depth: 1, value: 'C', rings: [3, 1], branchId: 10 }, { position: 11, depth: 1, value: 'C', bond: '=', rings: [3, 1], branchId: 10 }, { position: 12, depth: 2, value: 'C', rings: [3, 1], branchId: 19 }, { position: 13, depth: 2, value: 'C', rings: [3, 1], branchId: 19 }, { position: 14, depth: 2, value: 'C', rings: [3, 2, 1], branchId: 19 }] }], atoms: [{ position: 20, depth: 2, value: 'C', branchId: 19 }, { position: 21, depth: 1, value: 'C', branchId: 10 }] } });
312
342
  export const v12 = Linear(['O']);
313
343
  export const v13 = Molecule([v1, v11, v12]);"
314
344
  `;
@@ -437,6 +467,23 @@ exports[`CBD Integration Test parses CBD 1`] = `
437
467
  `;
438
468
 
439
469
  exports[`CBD Integration Test generates valid code via toCode() 1`] = `
470
+ "export const v1 = Fragment('CCCCC');
471
+ export const v2 = Fragment('C1=CC(=C(C(=C1)))');
472
+ export const v3 = Fragment('C2C=C(CCC2)');
473
+ export const v4 = Fragment('CC');
474
+ export const v5 = Linear(['C'], ['=']);
475
+ export const v6 = v4.attach(1, v5);
476
+ export const v7 = v3.attach(3, v6, { sibling: false });
477
+ export const v8 = Fragment('C');
478
+ export const v9 = Molecule([v7, v8]);
479
+ export const v10 = v2.attach(3, v9, { sibling: false });
480
+ export const v11 = Fragment('O');
481
+ export const v12 = v10.attach(4, v11, { sibling: false });
482
+ export const v13 = Fragment('O');
483
+ export const v14 = Molecule([v1, v12, v13]);"
484
+ `;
485
+
486
+ exports[`CBD Integration Test generates valid verbose code via toCode() 1`] = `
440
487
  "export const v1 = Linear(['C', 'C', 'C', 'C', 'C']);
441
488
  export const v2 = Ring({ atoms: 'C', size: 6, bonds: ['=', null, '=', null, '=', null], branchDepths: [0, 0, 0, 1, 2, 3] });
442
489
  export const v3 = Ring({ atoms: 'C', size: 6, ringNumber: 2, bonds: [null, '=', null, null, null, null], branchDepths: [1, 1, 1, 2, 2, 2] });
@@ -633,6 +680,30 @@ exports[`Nabilone Integration Test parses nabilone 1`] = `
633
680
  `;
634
681
 
635
682
  exports[`Nabilone Integration Test generates valid code via toCode() 1`] = `
683
+ "export const v1 = Fragment('CCCCCCC');
684
+ export const v2 = Fragment('C');
685
+ export const v3 = v1.attach(7, v2);
686
+ export const v4 = Fragment('C');
687
+ export const v5 = v3.attach(7, v4);
688
+ export const v6 = Fragment('C1=CC(=CCCCCCCC(CC=C1))');
689
+ export const v7 = Fragment('C1=CC(=CCCCCCCC(OC=C1))');
690
+ export const v8 = Linear(['O'], ['=']);
691
+ export const v9 = v7.attach(7, v8, { sibling: true });
692
+ export const v10 = Fragment('C');
693
+ export const v11 = v9.attach(11, v10, { sibling: true });
694
+ export const v12 = Ring({ atoms: 'C', size: 6, ringNumber: 2, offset: 3, branchDepths: [1, 1, 1, 1, 2, 2], leadingBond: '=' });
695
+ export const v13 = v12.substitute(5, 'O');
696
+ export const v14 = Fragment('C');
697
+ export const v15 = v13.attach(4, v14, { sibling: true });
698
+ export const v16 = Fragment('C3CCCCC3');
699
+ export const v17 = Linear(['O'], ['=']);
700
+ export const v18 = v16.attach(3, v17);
701
+ export const v19 = FusedRing({ metadata: { rings: [{ ring: v11, start: 9, end: 23, atoms: [{ position: 9, depth: 0, value: 'C', rings: [1, 1] }, { position: 10, depth: 0, value: 'C', bond: '=', rings: [1] }, { position: 11, depth: 0, value: 'C', rings: [1] }, { position: 12, depth: 1, value: 'C', bond: '=', rings: [2, 2, 1], branchId: 18 }, { position: 13, depth: 1, value: 'C', rings: [3, 3, 2, 1], branchId: 18 }, { position: 14, depth: 1, value: 'C', rings: [3, 1], branchId: 18 }, { position: 15, depth: 1, value: 'C', rings: [3, 1], branchId: 18 }, { position: 17, depth: 1, value: 'C', rings: [3, 1], branchId: 18 }, { position: 18, depth: 1, value: 'C', rings: [3, 1], branchId: 18 }, { position: 19, depth: 1, value: 'C', rings: [3, 2, 1], branchId: 18 }, { position: 20, depth: 1, value: 'C', rings: [2, 1], branchId: 18 }, { position: 21, depth: 2, value: 'O', rings: [2, 1], branchId: 35 }, { position: 22, depth: 2, value: 'C', rings: [2, 1], branchId: 35 }, { position: 23, depth: 2, value: 'C', bond: '=', rings: [1], branchId: 35 }] }, { ring: v15, start: 12, end: 22, atoms: [{ position: 12, depth: 1, value: 'C', bond: '=', rings: [2, 2, 1], branchId: 18 }, { position: 13, depth: 1, value: 'C', rings: [3, 3, 2, 1], branchId: 18 }, { position: 19, depth: 1, value: 'C', rings: [3, 2, 1], branchId: 18 }, { position: 20, depth: 1, value: 'C', rings: [2, 1], branchId: 18 }, { position: 21, depth: 2, value: 'O', rings: [2, 1], branchId: 35 }, { position: 22, depth: 2, value: 'C', rings: [2, 1], branchId: 35 }] }, { ring: v18, start: 13, end: 19, atoms: [{ position: 13, depth: 1, value: 'C', rings: [3, 3, 2, 1], branchId: 18 }, { position: 14, depth: 1, value: 'C', rings: [3, 1], branchId: 18 }, { position: 15, depth: 1, value: 'C', rings: [3, 1], branchId: 18 }, { position: 17, depth: 1, value: 'C', rings: [3, 1], branchId: 18 }, { position: 18, depth: 1, value: 'C', rings: [3, 1], branchId: 18 }, { position: 19, depth: 1, value: 'C', rings: [3, 2, 1], branchId: 18 }] }], atoms: [{ position: 25, depth: 1, value: 'C', branchId: 18 }] } });
702
+ export const v20 = Fragment('O');
703
+ export const v21 = Molecule([v5, v19, v20]);"
704
+ `;
705
+
706
+ exports[`Nabilone Integration Test generates valid verbose code via toCode() 1`] = `
636
707
  "export const v1 = Linear(['C', 'C', 'C', 'C', 'C', 'C', 'C']);
637
708
  export const v2 = Linear(['C']);
638
709
  export const v3 = v1.attach(7, v2);
@@ -651,7 +722,7 @@ export const v15 = v13.attach(4, v14, { sibling: true });
651
722
  export const v16 = Ring({ atoms: 'C', size: 6, ringNumber: 3, offset: 4 });
652
723
  export const v17 = Linear(['O'], ['=']);
653
724
  export const v18 = v16.attach(3, v17);
654
- export const v19 = FusedRing({ metadata: { rings: [{ ring: v11, start: 9, end: 23, atoms: [{ position: 9, depth: 0, value: 'C', rings: [1, 1] }, { position: 10, depth: 0, value: 'C', bond: '=', rings: [1] }, { position: 11, depth: 0, value: 'C', rings: [1] }, { position: 12, depth: 1, value: 'C', bond: '=', rings: [2, 2, 1] }, { position: 13, depth: 1, value: 'C', rings: [3, 3, 2, 1] }, { position: 14, depth: 1, value: 'C', rings: [3, 1] }, { position: 15, depth: 1, value: 'C', rings: [3, 1] }, { position: 17, depth: 1, value: 'C', rings: [3, 1] }, { position: 18, depth: 1, value: 'C', rings: [3, 1] }, { position: 19, depth: 1, value: 'C', rings: [3, 2, 1] }, { position: 20, depth: 1, value: 'C', rings: [2, 1] }, { position: 21, depth: 2, value: 'O', rings: [2, 1] }, { position: 22, depth: 2, value: 'C', rings: [2, 1] }, { position: 23, depth: 2, value: 'C', bond: '=', rings: [1] }] }, { ring: v15, start: 12, end: 22, atoms: [{ position: 12, depth: 1, value: 'C', bond: '=', rings: [2, 2, 1] }, { position: 13, depth: 1, value: 'C', rings: [3, 3, 2, 1] }, { position: 19, depth: 1, value: 'C', rings: [3, 2, 1] }, { position: 20, depth: 1, value: 'C', rings: [2, 1] }, { position: 21, depth: 2, value: 'O', rings: [2, 1] }, { position: 22, depth: 2, value: 'C', rings: [2, 1] }] }, { ring: v18, start: 13, end: 19, atoms: [{ position: 13, depth: 1, value: 'C', rings: [3, 3, 2, 1] }, { position: 14, depth: 1, value: 'C', rings: [3, 1] }, { position: 15, depth: 1, value: 'C', rings: [3, 1] }, { position: 17, depth: 1, value: 'C', rings: [3, 1] }, { position: 18, depth: 1, value: 'C', rings: [3, 1] }, { position: 19, depth: 1, value: 'C', rings: [3, 2, 1] }] }], atoms: [{ position: 25, depth: 1, value: 'C' }] } });
725
+ export const v19 = FusedRing({ metadata: { rings: [{ ring: v11, start: 9, end: 23, atoms: [{ position: 9, depth: 0, value: 'C', rings: [1, 1] }, { position: 10, depth: 0, value: 'C', bond: '=', rings: [1] }, { position: 11, depth: 0, value: 'C', rings: [1] }, { position: 12, depth: 1, value: 'C', bond: '=', rings: [2, 2, 1], branchId: 18 }, { position: 13, depth: 1, value: 'C', rings: [3, 3, 2, 1], branchId: 18 }, { position: 14, depth: 1, value: 'C', rings: [3, 1], branchId: 18 }, { position: 15, depth: 1, value: 'C', rings: [3, 1], branchId: 18 }, { position: 17, depth: 1, value: 'C', rings: [3, 1], branchId: 18 }, { position: 18, depth: 1, value: 'C', rings: [3, 1], branchId: 18 }, { position: 19, depth: 1, value: 'C', rings: [3, 2, 1], branchId: 18 }, { position: 20, depth: 1, value: 'C', rings: [2, 1], branchId: 18 }, { position: 21, depth: 2, value: 'O', rings: [2, 1], branchId: 35 }, { position: 22, depth: 2, value: 'C', rings: [2, 1], branchId: 35 }, { position: 23, depth: 2, value: 'C', bond: '=', rings: [1], branchId: 35 }] }, { ring: v15, start: 12, end: 22, atoms: [{ position: 12, depth: 1, value: 'C', bond: '=', rings: [2, 2, 1], branchId: 18 }, { position: 13, depth: 1, value: 'C', rings: [3, 3, 2, 1], branchId: 18 }, { position: 19, depth: 1, value: 'C', rings: [3, 2, 1], branchId: 18 }, { position: 20, depth: 1, value: 'C', rings: [2, 1], branchId: 18 }, { position: 21, depth: 2, value: 'O', rings: [2, 1], branchId: 35 }, { position: 22, depth: 2, value: 'C', rings: [2, 1], branchId: 35 }] }, { ring: v18, start: 13, end: 19, atoms: [{ position: 13, depth: 1, value: 'C', rings: [3, 3, 2, 1], branchId: 18 }, { position: 14, depth: 1, value: 'C', rings: [3, 1], branchId: 18 }, { position: 15, depth: 1, value: 'C', rings: [3, 1], branchId: 18 }, { position: 17, depth: 1, value: 'C', rings: [3, 1], branchId: 18 }, { position: 18, depth: 1, value: 'C', rings: [3, 1], branchId: 18 }, { position: 19, depth: 1, value: 'C', rings: [3, 2, 1], branchId: 18 }] }], atoms: [{ position: 25, depth: 1, value: 'C', branchId: 18 }] } });
655
726
  export const v20 = Linear(['O']);
656
727
  export const v21 = Molecule([v5, v19, v20]);"
657
728
  `;
@@ -720,6 +791,12 @@ exports[`Palmitoylethanolamide Integration Test parses palmitoylethanolamide 1`]
720
791
  `;
721
792
 
722
793
  exports[`Palmitoylethanolamide Integration Test generates valid code via toCode() 1`] = `
794
+ "export const v1 = Fragment('CCCCCCCCCCCCCCCCNCCO');
795
+ export const v2 = Linear(['O'], ['=']);
796
+ export const v3 = v1.attach(16, v2);"
797
+ `;
798
+
799
+ exports[`Palmitoylethanolamide Integration Test generates valid verbose code via toCode() 1`] = `
723
800
  "export const v1 = Linear(['C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'N', 'C', 'C', 'O']);
724
801
  export const v2 = Linear(['O'], ['=']);
725
802
  export const v3 = v1.attach(16, v2);"