@opencloning/utils 1.4.11 → 1.5.1

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @opencloning/utils
2
2
 
3
+ ## 1.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#651](https://github.com/manulera/OpenCloning_frontend/pull/651) [`b5c89e2`](https://github.com/manulera/OpenCloning_frontend/commit/b5c89e23aa1065319cb07a9ac48a26693dd0a21a) Thanks [@manulera](https://github.com/manulera)! - Allow primer design of Gibson and similar assembly methods to include fragments that are not amplified. Similar to what the NEBuilder planner does, where not all products are amplified. Perhaps in the future it would be useful to also allow the option to restore the restriction sites on the edge.
8
+
9
+ - Updated dependencies [[`b5c89e2`](https://github.com/manulera/OpenCloning_frontend/commit/b5c89e23aa1065319cb07a9ac48a26693dd0a21a)]:
10
+ - @opencloning/store@1.5.1
11
+
12
+ ## 1.5.0
13
+
14
+ ### Minor Changes
15
+
16
+ - [#648](https://github.com/manulera/OpenCloning_frontend/pull/648) [`800ebcd`](https://github.com/manulera/OpenCloning_frontend/commit/800ebcd4ed610ad89d538e1d59314977aae40583) Thanks [@manulera](https://github.com/manulera)! - Multiple enzymes can be used in the Assembler
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies []:
21
+ - @opencloning/store@1.5.0
22
+
3
23
  ## 1.4.11
4
24
 
5
25
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencloning/utils",
3
- "version": "1.4.11",
3
+ "version": "1.5.1",
4
4
  "type": "module",
5
5
  "main": "./src/utils/index.js",
6
6
  "exports": {
@@ -19,7 +19,8 @@
19
19
  "./ncbiRequests": "./src/utils/ncbiRequests.js",
20
20
  "./other": "./src/utils/other.js",
21
21
  "./transformCoords": "./src/utils/transformCoords.js",
22
- "./selectedRegionUtils": "./src/utils/selectedRegionUtils.js"
22
+ "./selectedRegionUtils": "./src/utils/selectedRegionUtils.js",
23
+ "./normalizeSyntax": "./src/utils/normalizeSyntax.js"
23
24
  },
24
25
  "repository": {
25
26
  "type": "git",
@@ -27,7 +28,7 @@
27
28
  "directory": "packages/utils"
28
29
  },
29
30
  "dependencies": {
30
- "@opencloning/store": "1.4.11",
31
+ "@opencloning/store": "1.5.1",
31
32
  "@teselagen/bio-parsers": "^0.4.34",
32
33
  "@teselagen/sequence-utils": "^0.3.42",
33
34
  "@zip.js/zip.js": "^2.7.62",
@@ -16,3 +16,4 @@ export * from './ncbiRequests.js';
16
16
  export * from './other.js';
17
17
  export { default as getTransformCoords } from './transformCoords.js';
18
18
  export * from './selectedRegionUtils.js';
19
+ export * from './normalizeSyntax.js';
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Normalizes syntax data for assembly enzymes. Handles legacy assemblyEnzyme (string).
3
+ * @param {Object} syntax - Raw syntax object from JSON
4
+ * @returns {Object} syntax with assemblyEnzymes: string[]
5
+ */
6
+ export function normalizeSyntaxEnzymes(syntax) {
7
+ if (!syntax) return syntax;
8
+ const enzymes = syntax.assemblyEnzymes ??
9
+ (syntax.assemblyEnzyme != null ? [syntax.assemblyEnzyme] : ['BsaI']);
10
+ return { ...syntax, assemblyEnzymes: Array.isArray(enzymes) ? enzymes : [enzymes] };
11
+ }
@@ -36,22 +36,43 @@ export function joinSequencesIntoSingleSequence(sequences, locations, orientatio
36
36
  }
37
37
  }
38
38
 
39
+ const isSpacer = [];
39
40
  for (let i = 0; i < sequences.length; i++) {
40
41
  sequences2join.push(sequences[i]);
42
+ isSpacer.push(false);
41
43
  locations2join.push(locations[i]);
42
44
  orientations2join.push(orientations[i]);
43
45
  if (spacerSequences[i]) {
44
46
  sequences2join.push(spacerSequences[i]);
47
+ isSpacer.push(true);
45
48
  locations2join.push({ start: 0, end: spacerSequences[i].sequence.length - 1 });
46
49
  orientations2join.push('forward');
47
50
  }
48
51
  }
49
52
 
53
+ let partIndex = 1;
50
54
  const fragments = sequences2join.map((sequence, index) => {
51
- const seq = getSequenceDataBetweenRange(sequence, locations2join[index]);
55
+ let seq = getSequenceDataBetweenRange(sequence, locations2join[index]);
52
56
  if (orientations2join[index] === 'reverse') {
53
- return getReverseComplementSequenceAndAnnotations(seq);
57
+ seq = getReverseComplementSequenceAndAnnotations(seq);
54
58
  }
59
+ let partName = `Part ${partIndex}`;
60
+ if (isSpacer[index]) {
61
+ partName = `Spacer`;
62
+ } else {
63
+ partIndex++;
64
+ }
65
+
66
+ const part = {
67
+ start: 0,
68
+ end: seq.sequence.length,
69
+ name: partName,
70
+ id: index,
71
+ forward: true,
72
+ strand: 1,
73
+ type: "misc_feature",
74
+ }
75
+ seq.parts.push(part);
55
76
  return seq;
56
77
  });
57
78
  // Concatenate all fragments