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
@@ -125,6 +125,21 @@ exports[`Morphine Integration Test parses morphine 1`] = `
125
125
  `;
126
126
 
127
127
  exports[`Morphine Integration Test generates valid code via toCode() 1`] = `
128
+ "export const v1 = Fragment('C');
129
+ export const v2 = Fragment('C1CCCCC1');
130
+ export const v3 = Fragment('N1CCCCC1');
131
+ export const v4 = Fragment('C2CCCC=C2');
132
+ export const v5 = Fragment('C3CCCCCC3');
133
+ export const v6 = Fragment('C3CCCCOC3');
134
+ export const v7 = Fragment('C4CCCCCC(C=C4)');
135
+ export const v8 = Fragment('C4CCCOCC(C=C4)');
136
+ export const v9 = Fragment('C5=CC(=C(C=C5))');
137
+ export const v10 = FusedRing({ metadata: { rings: [{ ring: v3, start: 1, end: 6, atoms: [{ position: 1, depth: 0, value: 'N', rings: [1, 1] }, { position: 2, depth: 0, value: 'C', rings: [1] }, { position: 3, depth: 0, value: 'C', rings: [1] }, { position: 4, depth: 0, value: 'C', rings: [2, 3, 1, 2, 3] }, { position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }] }, { ring: v4, start: 4, end: 9, atoms: [{ position: 4, depth: 0, value: 'C', rings: [2, 3, 1, 2, 3] }, { position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }, { position: 7, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 9, depth: 0, value: 'C', bond: '=', rings: [2, 5] }] }, { ring: v6, start: 4, end: 16, atoms: [{ position: 4, depth: 0, value: 'C', rings: [2, 3, 1, 2, 3] }, { position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }, { position: 7, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 15, depth: 0, value: 'O', rings: [3, 4] }, { position: 16, depth: 0, value: 'C', rings: [3, 4] }] }, { ring: v8, start: 5, end: 19, atoms: [{ position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }, { position: 7, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 15, depth: 0, value: 'O', rings: [3, 4] }, { position: 16, depth: 0, value: 'C', rings: [3, 4] }, { position: 17, depth: 0, value: 'C', rings: [4] }, { position: 18, depth: 1, value: 'C', rings: [4], branchId: 34 }, { position: 19, depth: 1, value: 'C', bond: '=', rings: [4], branchId: 34 }] }, { ring: v9, start: 8, end: 13, atoms: [{ position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 9, depth: 0, value: 'C', bond: '=', rings: [2, 5] }, { position: 10, depth: 0, value: 'C', rings: [5] }, { position: 11, depth: 1, value: 'C', bond: '=', rings: [5], branchId: 19 }, { position: 12, depth: 2, value: 'C', rings: [5], branchId: 22 }, { position: 13, depth: 2, value: 'C', bond: '=', rings: [5], branchId: 22 }] }], atoms: [{ position: 14, depth: 1, value: 'O', branchId: 19 }] } });
138
+ export const v11 = Fragment('O');
139
+ export const v12 = Molecule([v1, v10, v11]);"
140
+ `;
141
+
142
+ exports[`Morphine Integration Test generates valid verbose code via toCode() 1`] = `
128
143
  "export const v1 = Linear(['C']);
129
144
  export const v2 = Ring({ atoms: 'C', size: 6 });
130
145
  export const v3 = v2.substitute(1, 'N');
@@ -134,7 +149,7 @@ export const v6 = v5.substitute(6, 'O');
134
149
  export const v7 = Ring({ atoms: 'C', size: 9, ringNumber: 4, offset: 4, bonds: [null, null, null, null, null, null, null, '=', null], branchDepths: [0, 0, 0, 0, 0, 0, 0, 1, 1] });
135
150
  export const v8 = v7.substitute(5, 'O');
136
151
  export const v9 = Ring({ atoms: 'C', size: 6, ringNumber: 5, bonds: ['=', null, '=', null, '=', null], branchDepths: [0, 0, 0, 1, 2, 2] });
137
- export const v10 = FusedRing({ metadata: { rings: [{ ring: v3, start: 1, end: 6, atoms: [{ position: 1, depth: 0, value: 'N', rings: [1, 1] }, { position: 2, depth: 0, value: 'C', rings: [1] }, { position: 3, depth: 0, value: 'C', rings: [1] }, { position: 4, depth: 0, value: 'C', rings: [2, 3, 1, 2, 3] }, { position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }] }, { ring: v4, start: 4, end: 9, atoms: [{ position: 4, depth: 0, value: 'C', rings: [2, 3, 1, 2, 3] }, { position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }, { position: 7, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 9, depth: 0, value: 'C', bond: '=', rings: [2, 5] }] }, { ring: v6, start: 4, end: 16, atoms: [{ position: 4, depth: 0, value: 'C', rings: [2, 3, 1, 2, 3] }, { position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }, { position: 7, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 15, depth: 0, value: 'O', rings: [3, 4] }, { position: 16, depth: 0, value: 'C', rings: [3, 4] }] }, { ring: v8, start: 5, end: 19, atoms: [{ position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }, { position: 7, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 15, depth: 0, value: 'O', rings: [3, 4] }, { position: 16, depth: 0, value: 'C', rings: [3, 4] }, { position: 17, depth: 0, value: 'C', rings: [4] }, { position: 18, depth: 1, value: 'C', rings: [4] }, { position: 19, depth: 1, value: 'C', bond: '=', rings: [4] }] }, { ring: v9, start: 8, end: 13, atoms: [{ position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 9, depth: 0, value: 'C', bond: '=', rings: [2, 5] }, { position: 10, depth: 0, value: 'C', rings: [5] }, { position: 11, depth: 1, value: 'C', bond: '=', rings: [5] }, { position: 12, depth: 2, value: 'C', rings: [5] }, { position: 13, depth: 2, value: 'C', bond: '=', rings: [5] }] }], atoms: [{ position: 14, depth: 1, value: 'O' }] } });
152
+ export const v10 = FusedRing({ metadata: { rings: [{ ring: v3, start: 1, end: 6, atoms: [{ position: 1, depth: 0, value: 'N', rings: [1, 1] }, { position: 2, depth: 0, value: 'C', rings: [1] }, { position: 3, depth: 0, value: 'C', rings: [1] }, { position: 4, depth: 0, value: 'C', rings: [2, 3, 1, 2, 3] }, { position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }] }, { ring: v4, start: 4, end: 9, atoms: [{ position: 4, depth: 0, value: 'C', rings: [2, 3, 1, 2, 3] }, { position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }, { position: 7, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 9, depth: 0, value: 'C', bond: '=', rings: [2, 5] }] }, { ring: v6, start: 4, end: 16, atoms: [{ position: 4, depth: 0, value: 'C', rings: [2, 3, 1, 2, 3] }, { position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }, { position: 7, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 15, depth: 0, value: 'O', rings: [3, 4] }, { position: 16, depth: 0, value: 'C', rings: [3, 4] }] }, { ring: v8, start: 5, end: 19, atoms: [{ position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }, { position: 7, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 15, depth: 0, value: 'O', rings: [3, 4] }, { position: 16, depth: 0, value: 'C', rings: [3, 4] }, { position: 17, depth: 0, value: 'C', rings: [4] }, { position: 18, depth: 1, value: 'C', rings: [4], branchId: 34 }, { position: 19, depth: 1, value: 'C', bond: '=', rings: [4], branchId: 34 }] }, { ring: v9, start: 8, end: 13, atoms: [{ position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 9, depth: 0, value: 'C', bond: '=', rings: [2, 5] }, { position: 10, depth: 0, value: 'C', rings: [5] }, { position: 11, depth: 1, value: 'C', bond: '=', rings: [5], branchId: 19 }, { position: 12, depth: 2, value: 'C', rings: [5], branchId: 22 }, { position: 13, depth: 2, value: 'C', bond: '=', rings: [5], branchId: 22 }] }], atoms: [{ position: 14, depth: 1, value: 'O', branchId: 19 }] } });
138
153
  export const v11 = Linear(['O']);
139
154
  export const v12 = Molecule([v1, v10, v11]);"
140
155
  `;
@@ -264,6 +279,21 @@ exports[`Codeine Integration Test parses codeine 1`] = `
264
279
  `;
265
280
 
266
281
  exports[`Codeine Integration Test generates valid code via toCode() 1`] = `
282
+ "export const v1 = Fragment('C');
283
+ export const v2 = Fragment('C1CCCCC1');
284
+ export const v3 = Fragment('N1CCCCC1');
285
+ export const v4 = Fragment('C2CCCC=C2');
286
+ export const v5 = Fragment('C3CCCCCC3');
287
+ export const v6 = Fragment('C3CCCCOC3');
288
+ export const v7 = Fragment('C4CCCCCC(C=C4)');
289
+ export const v8 = Fragment('C4CCCOCC(C=C4)');
290
+ export const v9 = Fragment('C5=CC(=C(C=C5))');
291
+ export const v10 = FusedRing({ metadata: { rings: [{ ring: v3, start: 1, end: 6, atoms: [{ position: 1, depth: 0, value: 'N', rings: [1, 1] }, { position: 2, depth: 0, value: 'C', rings: [1] }, { position: 3, depth: 0, value: 'C', rings: [1] }, { position: 4, depth: 0, value: 'C', rings: [2, 3, 1, 2, 3] }, { position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }] }, { ring: v4, start: 4, end: 9, atoms: [{ position: 4, depth: 0, value: 'C', rings: [2, 3, 1, 2, 3] }, { position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }, { position: 7, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 9, depth: 0, value: 'C', bond: '=', rings: [2, 5] }] }, { ring: v6, start: 4, end: 17, atoms: [{ position: 4, depth: 0, value: 'C', rings: [2, 3, 1, 2, 3] }, { position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }, { position: 7, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 16, depth: 0, value: 'O', rings: [3, 4] }, { position: 17, depth: 0, value: 'C', rings: [3, 4] }] }, { ring: v8, start: 5, end: 20, atoms: [{ position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }, { position: 7, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 16, depth: 0, value: 'O', rings: [3, 4] }, { position: 17, depth: 0, value: 'C', rings: [3, 4] }, { position: 18, depth: 0, value: 'C', rings: [4] }, { position: 19, depth: 1, value: 'C', rings: [4], branchId: 35 }, { position: 20, depth: 1, value: 'C', bond: '=', rings: [4], branchId: 35 }] }, { ring: v9, start: 8, end: 13, atoms: [{ position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 9, depth: 0, value: 'C', bond: '=', rings: [2, 5] }, { position: 10, depth: 0, value: 'C', rings: [5] }, { position: 11, depth: 1, value: 'C', bond: '=', rings: [5], branchId: 19 }, { position: 12, depth: 2, value: 'C', rings: [5], branchId: 22 }, { position: 13, depth: 2, value: 'C', bond: '=', rings: [5], branchId: 22 }] }], atoms: [{ position: 14, depth: 1, value: 'O', branchId: 19 }, { position: 15, depth: 1, value: 'C', branchId: 19 }] } });
292
+ export const v11 = Fragment('O');
293
+ export const v12 = Molecule([v1, v10, v11]);"
294
+ `;
295
+
296
+ exports[`Codeine Integration Test generates valid verbose code via toCode() 1`] = `
267
297
  "export const v1 = Linear(['C']);
268
298
  export const v2 = Ring({ atoms: 'C', size: 6 });
269
299
  export const v3 = v2.substitute(1, 'N');
@@ -273,7 +303,7 @@ export const v6 = v5.substitute(6, 'O');
273
303
  export const v7 = Ring({ atoms: 'C', size: 9, ringNumber: 4, offset: 4, bonds: [null, null, null, null, null, null, null, '=', null], branchDepths: [0, 0, 0, 0, 0, 0, 0, 1, 1] });
274
304
  export const v8 = v7.substitute(5, 'O');
275
305
  export const v9 = Ring({ atoms: 'C', size: 6, ringNumber: 5, bonds: ['=', null, '=', null, '=', null], branchDepths: [0, 0, 0, 1, 2, 2] });
276
- export const v10 = FusedRing({ metadata: { rings: [{ ring: v3, start: 1, end: 6, atoms: [{ position: 1, depth: 0, value: 'N', rings: [1, 1] }, { position: 2, depth: 0, value: 'C', rings: [1] }, { position: 3, depth: 0, value: 'C', rings: [1] }, { position: 4, depth: 0, value: 'C', rings: [2, 3, 1, 2, 3] }, { position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }] }, { ring: v4, start: 4, end: 9, atoms: [{ position: 4, depth: 0, value: 'C', rings: [2, 3, 1, 2, 3] }, { position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }, { position: 7, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 9, depth: 0, value: 'C', bond: '=', rings: [2, 5] }] }, { ring: v6, start: 4, end: 17, atoms: [{ position: 4, depth: 0, value: 'C', rings: [2, 3, 1, 2, 3] }, { position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }, { position: 7, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 16, depth: 0, value: 'O', rings: [3, 4] }, { position: 17, depth: 0, value: 'C', rings: [3, 4] }] }, { ring: v8, start: 5, end: 20, atoms: [{ position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }, { position: 7, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 16, depth: 0, value: 'O', rings: [3, 4] }, { position: 17, depth: 0, value: 'C', rings: [3, 4] }, { position: 18, depth: 0, value: 'C', rings: [4] }, { position: 19, depth: 1, value: 'C', rings: [4] }, { position: 20, depth: 1, value: 'C', bond: '=', rings: [4] }] }, { ring: v9, start: 8, end: 13, atoms: [{ position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 9, depth: 0, value: 'C', bond: '=', rings: [2, 5] }, { position: 10, depth: 0, value: 'C', rings: [5] }, { position: 11, depth: 1, value: 'C', bond: '=', rings: [5] }, { position: 12, depth: 2, value: 'C', rings: [5] }, { position: 13, depth: 2, value: 'C', bond: '=', rings: [5] }] }], atoms: [{ position: 14, depth: 1, value: 'O' }, { position: 15, depth: 1, value: 'C' }] } });
306
+ export const v10 = FusedRing({ metadata: { rings: [{ ring: v3, start: 1, end: 6, atoms: [{ position: 1, depth: 0, value: 'N', rings: [1, 1] }, { position: 2, depth: 0, value: 'C', rings: [1] }, { position: 3, depth: 0, value: 'C', rings: [1] }, { position: 4, depth: 0, value: 'C', rings: [2, 3, 1, 2, 3] }, { position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }] }, { ring: v4, start: 4, end: 9, atoms: [{ position: 4, depth: 0, value: 'C', rings: [2, 3, 1, 2, 3] }, { position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }, { position: 7, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 9, depth: 0, value: 'C', bond: '=', rings: [2, 5] }] }, { ring: v6, start: 4, end: 17, atoms: [{ position: 4, depth: 0, value: 'C', rings: [2, 3, 1, 2, 3] }, { position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }, { position: 7, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 16, depth: 0, value: 'O', rings: [3, 4] }, { position: 17, depth: 0, value: 'C', rings: [3, 4] }] }, { ring: v8, start: 5, end: 20, atoms: [{ position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }, { position: 7, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 16, depth: 0, value: 'O', rings: [3, 4] }, { position: 17, depth: 0, value: 'C', rings: [3, 4] }, { position: 18, depth: 0, value: 'C', rings: [4] }, { position: 19, depth: 1, value: 'C', rings: [4], branchId: 35 }, { position: 20, depth: 1, value: 'C', bond: '=', rings: [4], branchId: 35 }] }, { ring: v9, start: 8, end: 13, atoms: [{ position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 9, depth: 0, value: 'C', bond: '=', rings: [2, 5] }, { position: 10, depth: 0, value: 'C', rings: [5] }, { position: 11, depth: 1, value: 'C', bond: '=', rings: [5], branchId: 19 }, { position: 12, depth: 2, value: 'C', rings: [5], branchId: 22 }, { position: 13, depth: 2, value: 'C', bond: '=', rings: [5], branchId: 22 }] }], atoms: [{ position: 14, depth: 1, value: 'O', branchId: 19 }, { position: 15, depth: 1, value: 'C', branchId: 19 }] } });
277
307
  export const v11 = Linear(['O']);
278
308
  export const v12 = Molecule([v1, v10, v11]);"
279
309
  `;
@@ -445,6 +475,26 @@ exports[`Oxycodone Integration Test parses oxycodone 1`] = `
445
475
  `;
446
476
 
447
477
  exports[`Oxycodone Integration Test generates valid code via toCode() 1`] = `
478
+ "export const v1 = Fragment('C');
479
+ export const v2 = Fragment('C1CCCC(C1)');
480
+ export const v3 = Fragment('N1CCCC(C1)');
481
+ export const v4 = Fragment('C2CCCCC2');
482
+ export const v5 = Linear(['O'], ['=']);
483
+ export const v6 = v4.attach(3, v5);
484
+ export const v7 = Fragment('C3CCCCC(CCC=C3)');
485
+ export const v8 = Linear(['O'], ['=']);
486
+ export const v9 = v7.attach(3, v8, { sibling: true });
487
+ export const v10 = Fragment('C4CCCC(CCC=CCC4)');
488
+ export const v11 = Fragment('C4CCCC(CCC=CCO4)');
489
+ export const v12 = Linear(['O'], ['=']);
490
+ export const v13 = v11.attach(2, v12, { sibling: true });
491
+ export const v14 = Fragment('C5=CC(=C(C=C5))');
492
+ export const v15 = FusedRing({ metadata: { rings: [{ ring: v3, start: 1, end: 11, atoms: [{ position: 1, depth: 0, value: 'N', rings: [1, 1] }, { position: 2, depth: 0, value: 'C', rings: [1] }, { position: 3, depth: 0, value: 'C', rings: [1] }, { position: 4, depth: 0, value: 'C', rings: [2, 3, 2, 1, 3] }, { position: 10, depth: 0, value: 'C', rings: [2, 1, 3, 4] }, { position: 11, depth: 1, value: 'C', rings: [1, 3, 4], branchId: 19 }] }, { ring: v6, start: 4, end: 10, atoms: [{ position: 4, depth: 0, value: 'C', rings: [2, 3, 2, 1, 3] }, { position: 5, depth: 0, value: 'C', rings: [4, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 9, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 10, depth: 0, value: 'C', rings: [2, 1, 3, 4] }] }, { ring: v9, start: 4, end: 14, atoms: [{ position: 4, depth: 0, value: 'C', rings: [2, 3, 2, 1, 3] }, { position: 5, depth: 0, value: 'C', rings: [4, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 9, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 10, depth: 0, value: 'C', rings: [2, 1, 3, 4] }, { position: 11, depth: 1, value: 'C', rings: [1, 3, 4], branchId: 19 }, { position: 12, depth: 1, value: 'C', rings: [3, 4], branchId: 19 }, { position: 13, depth: 1, value: 'C', rings: [5, 3, 5, 4], branchId: 19 }, { position: 14, depth: 1, value: 'C', bond: '=', rings: [3, 5, 4], branchId: 19 }] }, { ring: v13, start: 5, end: 21, atoms: [{ position: 5, depth: 0, value: 'C', rings: [4, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 9, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 10, depth: 0, value: 'C', rings: [2, 1, 3, 4] }, { position: 11, depth: 1, value: 'C', rings: [1, 3, 4], branchId: 19 }, { position: 12, depth: 1, value: 'C', rings: [3, 4], branchId: 19 }, { position: 13, depth: 1, value: 'C', rings: [5, 3, 5, 4], branchId: 19 }, { position: 14, depth: 1, value: 'C', bond: '=', rings: [3, 5, 4], branchId: 19 }, { position: 15, depth: 1, value: 'C', rings: [5, 4], branchId: 19 }, { position: 21, depth: 1, value: 'O', rings: [4], branchId: 19 }] }, { ring: v14, start: 13, end: 18, atoms: [{ position: 13, depth: 1, value: 'C', rings: [5, 3, 5, 4], branchId: 19 }, { position: 14, depth: 1, value: 'C', bond: '=', rings: [3, 5, 4], branchId: 19 }, { position: 15, depth: 1, value: 'C', rings: [5, 4], branchId: 19 }, { position: 16, depth: 2, value: 'C', bond: '=', rings: [5], branchId: 29 }, { position: 17, depth: 3, value: 'C', rings: [5], branchId: 32 }, { position: 18, depth: 3, value: 'C', bond: '=', rings: [5], branchId: 32 }] }], atoms: [{ position: 19, depth: 2, value: 'O', branchId: 29 }, { position: 20, depth: 2, value: 'C', branchId: 29 }] } });
493
+ export const v16 = Fragment('O');
494
+ export const v17 = Molecule([v1, v15, v16]);"
495
+ `;
496
+
497
+ exports[`Oxycodone Integration Test generates valid verbose code via toCode() 1`] = `
448
498
  "export const v1 = Linear(['C']);
449
499
  export const v2 = Ring({ atoms: 'C', size: 6, branchDepths: [0, 0, 0, 0, 0, 1] });
450
500
  export const v3 = v2.substitute(1, 'N');
@@ -459,7 +509,7 @@ export const v11 = v10.substitute(11, 'O');
459
509
  export const v12 = Linear(['O'], ['=']);
460
510
  export const v13 = v11.attach(2, v12, { sibling: true });
461
511
  export const v14 = Ring({ atoms: 'C', size: 6, ringNumber: 5, bonds: ['=', null, '=', null, '=', null], branchDepths: [1, 1, 1, 2, 3, 3] });
462
- export const v15 = FusedRing({ metadata: { rings: [{ ring: v3, start: 1, end: 11, atoms: [{ position: 1, depth: 0, value: 'N', rings: [1, 1] }, { position: 2, depth: 0, value: 'C', rings: [1] }, { position: 3, depth: 0, value: 'C', rings: [1] }, { position: 4, depth: 0, value: 'C', rings: [2, 3, 2, 1, 3] }, { position: 10, depth: 0, value: 'C', rings: [2, 1, 3, 4] }, { position: 11, depth: 1, value: 'C', rings: [1, 3, 4] }] }, { ring: v6, start: 4, end: 10, atoms: [{ position: 4, depth: 0, value: 'C', rings: [2, 3, 2, 1, 3] }, { position: 5, depth: 0, value: 'C', rings: [4, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 9, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 10, depth: 0, value: 'C', rings: [2, 1, 3, 4] }] }, { ring: v9, start: 4, end: 14, atoms: [{ position: 4, depth: 0, value: 'C', rings: [2, 3, 2, 1, 3] }, { position: 5, depth: 0, value: 'C', rings: [4, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 9, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 10, depth: 0, value: 'C', rings: [2, 1, 3, 4] }, { position: 11, depth: 1, value: 'C', rings: [1, 3, 4] }, { position: 12, depth: 1, value: 'C', rings: [3, 4] }, { position: 13, depth: 1, value: 'C', rings: [5, 3, 5, 4] }, { position: 14, depth: 1, value: 'C', bond: '=', rings: [3, 5, 4] }] }, { ring: v13, start: 5, end: 21, atoms: [{ position: 5, depth: 0, value: 'C', rings: [4, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 9, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 10, depth: 0, value: 'C', rings: [2, 1, 3, 4] }, { position: 11, depth: 1, value: 'C', rings: [1, 3, 4] }, { position: 12, depth: 1, value: 'C', rings: [3, 4] }, { position: 13, depth: 1, value: 'C', rings: [5, 3, 5, 4] }, { position: 14, depth: 1, value: 'C', bond: '=', rings: [3, 5, 4] }, { position: 15, depth: 1, value: 'C', rings: [5, 4] }, { position: 21, depth: 1, value: 'O', rings: [4] }] }, { ring: v14, start: 13, end: 18, atoms: [{ position: 13, depth: 1, value: 'C', rings: [5, 3, 5, 4] }, { position: 14, depth: 1, value: 'C', bond: '=', rings: [3, 5, 4] }, { position: 15, depth: 1, value: 'C', rings: [5, 4] }, { position: 16, depth: 2, value: 'C', bond: '=', rings: [5] }, { position: 17, depth: 3, value: 'C', rings: [5] }, { position: 18, depth: 3, value: 'C', bond: '=', rings: [5] }] }], atoms: [{ position: 19, depth: 2, value: 'O' }, { position: 20, depth: 2, value: 'C' }] } });
512
+ export const v15 = FusedRing({ metadata: { rings: [{ ring: v3, start: 1, end: 11, atoms: [{ position: 1, depth: 0, value: 'N', rings: [1, 1] }, { position: 2, depth: 0, value: 'C', rings: [1] }, { position: 3, depth: 0, value: 'C', rings: [1] }, { position: 4, depth: 0, value: 'C', rings: [2, 3, 2, 1, 3] }, { position: 10, depth: 0, value: 'C', rings: [2, 1, 3, 4] }, { position: 11, depth: 1, value: 'C', rings: [1, 3, 4], branchId: 19 }] }, { ring: v6, start: 4, end: 10, atoms: [{ position: 4, depth: 0, value: 'C', rings: [2, 3, 2, 1, 3] }, { position: 5, depth: 0, value: 'C', rings: [4, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 9, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 10, depth: 0, value: 'C', rings: [2, 1, 3, 4] }] }, { ring: v9, start: 4, end: 14, atoms: [{ position: 4, depth: 0, value: 'C', rings: [2, 3, 2, 1, 3] }, { position: 5, depth: 0, value: 'C', rings: [4, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 9, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 10, depth: 0, value: 'C', rings: [2, 1, 3, 4] }, { position: 11, depth: 1, value: 'C', rings: [1, 3, 4], branchId: 19 }, { position: 12, depth: 1, value: 'C', rings: [3, 4], branchId: 19 }, { position: 13, depth: 1, value: 'C', rings: [5, 3, 5, 4], branchId: 19 }, { position: 14, depth: 1, value: 'C', bond: '=', rings: [3, 5, 4], branchId: 19 }] }, { ring: v13, start: 5, end: 21, atoms: [{ position: 5, depth: 0, value: 'C', rings: [4, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 9, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 10, depth: 0, value: 'C', rings: [2, 1, 3, 4] }, { position: 11, depth: 1, value: 'C', rings: [1, 3, 4], branchId: 19 }, { position: 12, depth: 1, value: 'C', rings: [3, 4], branchId: 19 }, { position: 13, depth: 1, value: 'C', rings: [5, 3, 5, 4], branchId: 19 }, { position: 14, depth: 1, value: 'C', bond: '=', rings: [3, 5, 4], branchId: 19 }, { position: 15, depth: 1, value: 'C', rings: [5, 4], branchId: 19 }, { position: 21, depth: 1, value: 'O', rings: [4], branchId: 19 }] }, { ring: v14, start: 13, end: 18, atoms: [{ position: 13, depth: 1, value: 'C', rings: [5, 3, 5, 4], branchId: 19 }, { position: 14, depth: 1, value: 'C', bond: '=', rings: [3, 5, 4], branchId: 19 }, { position: 15, depth: 1, value: 'C', rings: [5, 4], branchId: 19 }, { position: 16, depth: 2, value: 'C', bond: '=', rings: [5], branchId: 29 }, { position: 17, depth: 3, value: 'C', rings: [5], branchId: 32 }, { position: 18, depth: 3, value: 'C', bond: '=', rings: [5], branchId: 32 }] }], atoms: [{ position: 19, depth: 2, value: 'O', branchId: 29 }, { position: 20, depth: 2, value: 'C', branchId: 29 }] } });
463
513
  export const v16 = Linear(['O']);
464
514
  export const v17 = Molecule([v1, v15, v16]);"
465
515
  `;
@@ -594,6 +644,22 @@ exports[`Hydrocodone Integration Test parses hydrocodone 1`] = `
594
644
  `;
595
645
 
596
646
  exports[`Hydrocodone Integration Test generates valid code via toCode() 1`] = `
647
+ "export const v1 = Fragment('C');
648
+ export const v2 = Fragment('C1CCCCC1');
649
+ export const v3 = Fragment('N1CCCCC1');
650
+ export const v4 = Fragment('C2CCCC=C2');
651
+ export const v5 = Fragment('C3CCCCCC3');
652
+ export const v6 = Fragment('C3CCCCOC3');
653
+ export const v7 = Fragment('C4CCCCCCCC4');
654
+ export const v8 = Fragment('C4CCCOCCCC4');
655
+ export const v9 = Linear(['O'], ['=']);
656
+ export const v10 = v8.attach(7, v9);
657
+ export const v11 = Fragment('C5=CC(=C(C=C5))');
658
+ export const v12 = FusedRing({ metadata: { rings: [{ ring: v3, start: 1, end: 6, atoms: [{ position: 1, depth: 0, value: 'N', rings: [1, 1] }, { position: 2, depth: 0, value: 'C', rings: [1] }, { position: 3, depth: 0, value: 'C', rings: [1] }, { position: 4, depth: 0, value: 'C', rings: [2, 3, 1, 2, 3] }, { position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }] }, { ring: v4, start: 4, end: 9, atoms: [{ position: 4, depth: 0, value: 'C', rings: [2, 3, 1, 2, 3] }, { position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }, { position: 7, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 9, depth: 0, value: 'C', bond: '=', rings: [2, 5] }] }, { ring: v6, start: 4, end: 17, atoms: [{ position: 4, depth: 0, value: 'C', rings: [2, 3, 1, 2, 3] }, { position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }, { position: 7, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 16, depth: 0, value: 'O', rings: [3, 4] }, { position: 17, depth: 0, value: 'C', rings: [3, 4] }] }, { ring: v10, start: 5, end: 21, atoms: [{ position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }, { position: 7, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 16, depth: 0, value: 'O', rings: [3, 4] }, { position: 17, depth: 0, value: 'C', rings: [3, 4] }, { position: 18, depth: 0, value: 'C', rings: [4] }, { position: 20, depth: 0, value: 'C', rings: [4] }, { position: 21, depth: 0, value: 'C', rings: [4] }] }, { ring: v11, start: 8, end: 13, atoms: [{ position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 9, depth: 0, value: 'C', bond: '=', rings: [2, 5] }, { position: 10, depth: 0, value: 'C', rings: [5] }, { position: 11, depth: 1, value: 'C', bond: '=', rings: [5], branchId: 19 }, { position: 12, depth: 2, value: 'C', rings: [5], branchId: 22 }, { position: 13, depth: 2, value: 'C', bond: '=', rings: [5], branchId: 22 }] }], atoms: [{ position: 14, depth: 1, value: 'O', branchId: 19 }, { position: 15, depth: 1, value: 'C', branchId: 19 }] } });
659
+ export const v13 = Molecule([v1, v12]);"
660
+ `;
661
+
662
+ exports[`Hydrocodone Integration Test generates valid verbose code via toCode() 1`] = `
597
663
  "export const v1 = Linear(['C']);
598
664
  export const v2 = Ring({ atoms: 'C', size: 6 });
599
665
  export const v3 = v2.substitute(1, 'N');
@@ -605,7 +671,7 @@ export const v8 = v7.substitute(5, 'O');
605
671
  export const v9 = Linear(['O'], ['=']);
606
672
  export const v10 = v8.attach(7, v9);
607
673
  export const v11 = Ring({ atoms: 'C', size: 6, ringNumber: 5, bonds: ['=', null, '=', null, '=', null], branchDepths: [0, 0, 0, 1, 2, 2] });
608
- export const v12 = FusedRing({ metadata: { rings: [{ ring: v3, start: 1, end: 6, atoms: [{ position: 1, depth: 0, value: 'N', rings: [1, 1] }, { position: 2, depth: 0, value: 'C', rings: [1] }, { position: 3, depth: 0, value: 'C', rings: [1] }, { position: 4, depth: 0, value: 'C', rings: [2, 3, 1, 2, 3] }, { position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }] }, { ring: v4, start: 4, end: 9, atoms: [{ position: 4, depth: 0, value: 'C', rings: [2, 3, 1, 2, 3] }, { position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }, { position: 7, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 9, depth: 0, value: 'C', bond: '=', rings: [2, 5] }] }, { ring: v6, start: 4, end: 17, atoms: [{ position: 4, depth: 0, value: 'C', rings: [2, 3, 1, 2, 3] }, { position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }, { position: 7, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 16, depth: 0, value: 'O', rings: [3, 4] }, { position: 17, depth: 0, value: 'C', rings: [3, 4] }] }, { ring: v10, start: 5, end: 21, atoms: [{ position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }, { position: 7, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 16, depth: 0, value: 'O', rings: [3, 4] }, { position: 17, depth: 0, value: 'C', rings: [3, 4] }, { position: 18, depth: 0, value: 'C', rings: [4] }, { position: 20, depth: 0, value: 'C', rings: [4] }, { position: 21, depth: 0, value: 'C', rings: [4] }] }, { ring: v11, start: 8, end: 13, atoms: [{ position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 9, depth: 0, value: 'C', bond: '=', rings: [2, 5] }, { position: 10, depth: 0, value: 'C', rings: [5] }, { position: 11, depth: 1, value: 'C', bond: '=', rings: [5] }, { position: 12, depth: 2, value: 'C', rings: [5] }, { position: 13, depth: 2, value: 'C', bond: '=', rings: [5] }] }], atoms: [{ position: 14, depth: 1, value: 'O' }, { position: 15, depth: 1, value: 'C' }] } });
674
+ export const v12 = FusedRing({ metadata: { rings: [{ ring: v3, start: 1, end: 6, atoms: [{ position: 1, depth: 0, value: 'N', rings: [1, 1] }, { position: 2, depth: 0, value: 'C', rings: [1] }, { position: 3, depth: 0, value: 'C', rings: [1] }, { position: 4, depth: 0, value: 'C', rings: [2, 3, 1, 2, 3] }, { position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }] }, { ring: v4, start: 4, end: 9, atoms: [{ position: 4, depth: 0, value: 'C', rings: [2, 3, 1, 2, 3] }, { position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }, { position: 7, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 9, depth: 0, value: 'C', bond: '=', rings: [2, 5] }] }, { ring: v6, start: 4, end: 17, atoms: [{ position: 4, depth: 0, value: 'C', rings: [2, 3, 1, 2, 3] }, { position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }, { position: 7, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 16, depth: 0, value: 'O', rings: [3, 4] }, { position: 17, depth: 0, value: 'C', rings: [3, 4] }] }, { ring: v10, start: 5, end: 21, atoms: [{ position: 5, depth: 0, value: 'C', rings: [4, 1, 2, 3, 4] }, { position: 6, depth: 0, value: 'C', rings: [1, 2, 3, 4] }, { position: 7, depth: 0, value: 'C', rings: [2, 3, 4] }, { position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 16, depth: 0, value: 'O', rings: [3, 4] }, { position: 17, depth: 0, value: 'C', rings: [3, 4] }, { position: 18, depth: 0, value: 'C', rings: [4] }, { position: 20, depth: 0, value: 'C', rings: [4] }, { position: 21, depth: 0, value: 'C', rings: [4] }] }, { ring: v11, start: 8, end: 13, atoms: [{ position: 8, depth: 0, value: 'C', rings: [5, 2, 5, 3, 4] }, { position: 9, depth: 0, value: 'C', bond: '=', rings: [2, 5] }, { position: 10, depth: 0, value: 'C', rings: [5] }, { position: 11, depth: 1, value: 'C', bond: '=', rings: [5], branchId: 19 }, { position: 12, depth: 2, value: 'C', rings: [5], branchId: 22 }, { position: 13, depth: 2, value: 'C', bond: '=', rings: [5], branchId: 22 }] }], atoms: [{ position: 14, depth: 1, value: 'O', branchId: 19 }, { position: 15, depth: 1, value: 'C', branchId: 19 }] } });
609
675
  export const v13 = Molecule([v1, v12]);"
610
676
  `;
611
677
 
@@ -717,6 +783,20 @@ exports[`Fentanyl Integration Test parses fentanyl 1`] = `
717
783
  `;
718
784
 
719
785
  exports[`Fentanyl Integration Test generates valid code via toCode() 1`] = `
786
+ "export const v1 = Fragment('CCCN');
787
+ export const v2 = Linear(['O'], ['=']);
788
+ export const v3 = v1.attach(3, v2);
789
+ export const v4 = Fragment('C1CCC(CC1)');
790
+ export const v5 = Fragment('C1CCN(CC1)');
791
+ export const v6 = Fragment('CC');
792
+ export const v7 = Fragment('C2=CC=CC=C2');
793
+ export const v8 = Molecule([v5, v6, v7]);
794
+ export const v9 = v3.attach(4, v8);
795
+ export const v10 = Fragment('C3=CC=CC=C3');
796
+ export const v11 = Molecule([v9, v10]);"
797
+ `;
798
+
799
+ exports[`Fentanyl Integration Test generates valid verbose code via toCode() 1`] = `
720
800
  "export const v1 = Linear(['C', 'C', 'C', 'N']);
721
801
  export const v2 = Linear(['O'], ['=']);
722
802
  export const v3 = v1.attach(3, v2);
@@ -826,6 +906,19 @@ exports[`Tramadol Integration Test parses tramadol 1`] = `
826
906
  `;
827
907
 
828
908
  exports[`Tramadol Integration Test generates valid code via toCode() 1`] = `
909
+ "export const v1 = Fragment('CNC');
910
+ export const v2 = Fragment('C');
911
+ export const v3 = v1.attach(2, v2);
912
+ export const v4 = Fragment('C1CCCCC1');
913
+ export const v5 = Fragment('C2=CC(=CC=C2)');
914
+ export const v6 = Fragment('OC');
915
+ export const v7 = Molecule([v5, v6]);
916
+ export const v8 = v4.attach(6, v7);
917
+ export const v9 = Fragment('O');
918
+ export const v10 = Molecule([v3, v8, v9]);"
919
+ `;
920
+
921
+ exports[`Tramadol Integration Test generates valid verbose code via toCode() 1`] = `
829
922
  "export const v1 = Linear(['C', 'N', 'C']);
830
923
  export const v2 = Linear(['C']);
831
924
  export const v3 = v1.attach(2, v2);
@@ -952,6 +1045,22 @@ exports[`Methadone Integration Test parses methadone 1`] = `
952
1045
  `;
953
1046
 
954
1047
  exports[`Methadone Integration Test generates valid code via toCode() 1`] = `
1048
+ "export const v1 = Fragment('CCCC');
1049
+ export const v2 = Linear(['O'], ['=']);
1050
+ export const v3 = v1.attach(3, v2);
1051
+ export const v4 = Fragment('CCNC');
1052
+ export const v5 = Fragment('C');
1053
+ export const v6 = v4.attach(2, v5);
1054
+ export const v7 = Fragment('C');
1055
+ export const v8 = v6.attach(3, v7);
1056
+ export const v9 = v3.attach(4, v8);
1057
+ export const v10 = Fragment('C1=CC=CC=C1');
1058
+ export const v11 = v9.attach(4, v10);
1059
+ export const v12 = Fragment('C2=CC=CC=C2');
1060
+ export const v13 = Molecule([v11, v12]);"
1061
+ `;
1062
+
1063
+ exports[`Methadone Integration Test generates valid verbose code via toCode() 1`] = `
955
1064
  "export const v1 = Linear(['C', 'C', 'C', 'C']);
956
1065
  export const v2 = Linear(['O'], ['=']);
957
1066
  export const v3 = v1.attach(3, v2);