@teselagen/sequence-utils 0.3.25 → 0.3.26

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/index.cjs CHANGED
@@ -18359,12 +18359,19 @@ function getReverseComplementAminoAcidStringFromSequenceString(sequenceString) {
18359
18359
  }
18360
18360
  __name(getReverseComplementAminoAcidStringFromSequenceString, "getReverseComplementAminoAcidStringFromSequenceString");
18361
18361
  function getReverseComplementAnnotation(annotation, sequenceLength) {
18362
- return Object.assign({}, annotation, {
18362
+ return Object.assign({}, annotation, __spreadValues({
18363
18363
  start: sequenceLength - (annotation.end + 1),
18364
18364
  end: sequenceLength - (annotation.start + 1),
18365
18365
  forward: !annotation.forward,
18366
18366
  strand: annotation.strand === 1 ? -1 : 1
18367
- });
18367
+ }, annotation.locations && {
18368
+ locations: annotation.locations.map((location) => {
18369
+ return {
18370
+ start: sequenceLength - (location.end + 1),
18371
+ end: sequenceLength - (location.start + 1)
18372
+ };
18373
+ })
18374
+ }));
18368
18375
  }
18369
18376
  __name(getReverseComplementAnnotation, "getReverseComplementAnnotation");
18370
18377
  function getReverseComplementSequenceAndAnnoations(pSeqObj, options = {}) {
package/index.js CHANGED
@@ -18357,12 +18357,19 @@ function getReverseComplementAminoAcidStringFromSequenceString(sequenceString) {
18357
18357
  }
18358
18358
  __name(getReverseComplementAminoAcidStringFromSequenceString, "getReverseComplementAminoAcidStringFromSequenceString");
18359
18359
  function getReverseComplementAnnotation(annotation, sequenceLength) {
18360
- return Object.assign({}, annotation, {
18360
+ return Object.assign({}, annotation, __spreadValues({
18361
18361
  start: sequenceLength - (annotation.end + 1),
18362
18362
  end: sequenceLength - (annotation.start + 1),
18363
18363
  forward: !annotation.forward,
18364
18364
  strand: annotation.strand === 1 ? -1 : 1
18365
- });
18365
+ }, annotation.locations && {
18366
+ locations: annotation.locations.map((location) => {
18367
+ return {
18368
+ start: sequenceLength - (location.end + 1),
18369
+ end: sequenceLength - (location.start + 1)
18370
+ };
18371
+ })
18372
+ }));
18366
18373
  }
18367
18374
  __name(getReverseComplementAnnotation, "getReverseComplementAnnotation");
18368
18375
  function getReverseComplementSequenceAndAnnoations(pSeqObj, options = {}) {
package/index.umd.cjs CHANGED
@@ -18361,12 +18361,19 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
18361
18361
  }
18362
18362
  __name(getReverseComplementAminoAcidStringFromSequenceString, "getReverseComplementAminoAcidStringFromSequenceString");
18363
18363
  function getReverseComplementAnnotation(annotation, sequenceLength) {
18364
- return Object.assign({}, annotation, {
18364
+ return Object.assign({}, annotation, __spreadValues({
18365
18365
  start: sequenceLength - (annotation.end + 1),
18366
18366
  end: sequenceLength - (annotation.start + 1),
18367
18367
  forward: !annotation.forward,
18368
18368
  strand: annotation.strand === 1 ? -1 : 1
18369
- });
18369
+ }, annotation.locations && {
18370
+ locations: annotation.locations.map((location) => {
18371
+ return {
18372
+ start: sequenceLength - (location.end + 1),
18373
+ end: sequenceLength - (location.start + 1)
18374
+ };
18375
+ })
18376
+ }));
18370
18377
  }
18371
18378
  __name(getReverseComplementAnnotation, "getReverseComplementAnnotation");
18372
18379
  function getReverseComplementSequenceAndAnnoations(pSeqObj, options = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teselagen/sequence-utils",
3
- "version": "0.3.25",
3
+ "version": "0.3.26",
4
4
  "dependencies": {
5
5
  "@teselagen/range-utils": "0.3.7",
6
6
  "bson-objectid": "^2.0.4",
@@ -8,7 +8,6 @@ describe("calculate Tm based on SantaLucia 1998 & Owczarzy 2004", () => {
8
8
  // 50 mM KCl in Q5 protocol
9
9
  monovalentCationConc: 0.05,
10
10
  primerConc: 0.0000005
11
-
12
11
  };
13
12
  // console.log(`calculateNebTm("AGCGGATAACAATTTCACACAGGA", options),:`,calculateNebTm("AGCGGATAACAATTTCACACAGGA", options),)
14
13
  // console.log(`calculateTm("AGCGGATAACAATTTCACACAGGA", options),:`,calculateTm("AGCGGATAACAATTTCACACAGGA", options),)
@@ -18,6 +18,14 @@ export default function getReverseComplementAnnotation(
18
18
  start: sequenceLength - (annotation.end + 1),
19
19
  end: sequenceLength - (annotation.start + 1),
20
20
  forward: !annotation.forward,
21
- strand: annotation.strand === 1 ? -1 : 1
21
+ strand: annotation.strand === 1 ? -1 : 1,
22
+ ...(annotation.locations && {
23
+ locations: annotation.locations.map(location => {
24
+ return {
25
+ start: sequenceLength - (location.end + 1),
26
+ end: sequenceLength - (location.start + 1)
27
+ };
28
+ })
29
+ })
22
30
  });
23
31
  }
@@ -89,6 +89,57 @@ describe("getReverseComplementSequenceAndAnnotations", () => {
89
89
  ]
90
90
  });
91
91
  });
92
+ it("handles reverse complementing a feature with locations correctly", () => {
93
+ const newSeq = getReverseComplementSequenceAndAnnotations(
94
+ {
95
+ sequence: "aaatttcccgttttttt",
96
+ // 01234567890123456
97
+ // fffffff
98
+ // lll ll
99
+ // after:
100
+ // 65432109876543210
101
+ // fffffff
102
+ // ll lll
103
+ circular: true,
104
+ features: [
105
+ {
106
+ start: 1,
107
+ end: 7,
108
+ locations: [
109
+ {
110
+ start: 1,
111
+ end: 3
112
+ },
113
+ {
114
+ start: 6,
115
+ end: 7
116
+ }
117
+ ]
118
+ }
119
+ ]
120
+ },
121
+ );
122
+ newSeq.should.containSubset({
123
+ // sequence: "tttaaacggg",
124
+ features: [
125
+ {
126
+ start: 9,
127
+ end: 15,
128
+ forward: true,
129
+ locations: [
130
+ {
131
+ start: 9,
132
+ end: 10
133
+ },
134
+ {
135
+ start: 13,
136
+ end: 15
137
+ }
138
+ ]
139
+ }
140
+ ]
141
+ });
142
+ });
92
143
  it("handles a range option correctly and reverse complements a subset of the sequence across the origin ", () => {
93
144
  const newSeq = getReverseComplementSequenceAndAnnotations(
94
145
  {