@teselagen/sequence-utils 0.3.13 → 0.3.14

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.js CHANGED
@@ -21356,10 +21356,13 @@ function getAminoAcidStringFromSequenceString(sequenceString) {
21356
21356
  );
21357
21357
  const aaArray = [];
21358
21358
  let aaString = "";
21359
- aminoAcidsPerBase.forEach((aa) => {
21359
+ aminoAcidsPerBase.forEach((aa, index) => {
21360
21360
  if (!aa.fullCodon) {
21361
21361
  return;
21362
21362
  }
21363
+ if (index === aminoAcidsPerBase.length - 1 && aa.aminoAcid.value === "*") {
21364
+ return;
21365
+ }
21363
21366
  aaArray[aa.aminoAcidIndex] = aa.aminoAcid.value;
21364
21367
  });
21365
21368
  aaString = aaArray.join("");
package/index.mjs CHANGED
@@ -21354,10 +21354,13 @@ function getAminoAcidStringFromSequenceString(sequenceString) {
21354
21354
  );
21355
21355
  const aaArray = [];
21356
21356
  let aaString = "";
21357
- aminoAcidsPerBase.forEach((aa) => {
21357
+ aminoAcidsPerBase.forEach((aa, index) => {
21358
21358
  if (!aa.fullCodon) {
21359
21359
  return;
21360
21360
  }
21361
+ if (index === aminoAcidsPerBase.length - 1 && aa.aminoAcid.value === "*") {
21362
+ return;
21363
+ }
21361
21364
  aaArray[aa.aminoAcidIndex] = aa.aminoAcid.value;
21362
21365
  });
21363
21366
  aaString = aaArray.join("");
package/index.umd.js CHANGED
@@ -21358,10 +21358,13 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
21358
21358
  );
21359
21359
  const aaArray = [];
21360
21360
  let aaString = "";
21361
- aminoAcidsPerBase.forEach((aa) => {
21361
+ aminoAcidsPerBase.forEach((aa, index) => {
21362
21362
  if (!aa.fullCodon) {
21363
21363
  return;
21364
21364
  }
21365
+ if (index === aminoAcidsPerBase.length - 1 && aa.aminoAcid.value === "*") {
21366
+ return;
21367
+ }
21365
21368
  aaArray[aa.aminoAcidIndex] = aa.aminoAcid.value;
21366
21369
  });
21367
21370
  aaString = aaArray.join("");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teselagen/sequence-utils",
3
- "version": "0.3.13",
3
+ "version": "0.3.14",
4
4
  "dependencies": {
5
5
  "@teselagen/range-utils": "0.3.7",
6
6
  "bson-objectid": "^2.0.4",
@@ -7,10 +7,14 @@ export default function getAminoAcidStringFromSequenceString(sequenceString) {
7
7
  );
8
8
  const aaArray = [];
9
9
  let aaString = "";
10
- aminoAcidsPerBase.forEach(aa => {
10
+ aminoAcidsPerBase.forEach((aa, index) => {
11
11
  if (!aa.fullCodon) {
12
12
  return;
13
13
  }
14
+ // Check if the current amino acid is the last in the sequence and is a stop codon
15
+ if (index === aminoAcidsPerBase.length - 1 && aa.aminoAcid.value === '*') {
16
+ return;
17
+ }
14
18
  aaArray[aa.aminoAcidIndex] = aa.aminoAcid.value;
15
19
  });
16
20
  aaString = aaArray.join("");
@@ -14,5 +14,6 @@ describe("getAminoAcidStringFromSequenceString", () => {
14
14
  assert.equal("MM", getAminoAcidStringFromSequenceString("atgatg"));
15
15
  assert.equal("M--", getAminoAcidStringFromSequenceString("atg------"));
16
16
  assert.equal("", getAminoAcidStringFromSequenceString("at"));
17
+ assert.equal("MTNYNQKNEN", getAminoAcidStringFromSequenceString("atgactaattataatcaaaaaaatgaaaattaa"));
17
18
  });
18
19
  });