@teselagen/sequence-utils 0.3.42-beta.1 → 0.3.42-beta.2

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.
@@ -1,2 +1,2 @@
1
1
  import { Annotation } from './types';
2
- export default function adjustAnnotationsToInsert(annotationsToBeAdjusted: Record<string, Annotation> | Annotation[], insertStart: number, insertLength: number): boolean[];
2
+ export default function adjustAnnotationsToInsert(annotationsToBeAdjusted: Record<string, Annotation> | Annotation[], insertStart: number, insertLength: number): Annotation[];
package/index.cjs CHANGED
@@ -6977,7 +6977,7 @@ function addSizeIdName(frag, sequenceLength) {
6977
6977
  }
6978
6978
  __name(addSizeIdName, "addSizeIdName");
6979
6979
  function isEnzymeType2S(e) {
6980
- return e.site.length < e.topSnipOffset || e.site.length < e.bottomSnipOffset;
6980
+ return e.site.length < (e.topSnipOffset || 0) || e.site.length < (e.bottomSnipOffset || 0);
6981
6981
  }
6982
6982
  __name(isEnzymeType2S, "isEnzymeType2S");
6983
6983
  function insertGapsIntoRefSeq(refSeq, seqReads) {
@@ -7402,7 +7402,8 @@ function adjustAnnotationsToRotation(annotationsToBeAdjusted, positionToRotateTo
7402
7402
  }
7403
7403
  __name(adjustAnnotationsToRotation, "adjustAnnotationsToRotation");
7404
7404
  function adjustAnnotationsToInsert(annotationsToBeAdjusted, insertStart, insertLength) {
7405
- return map(annotationsToBeAdjusted, (annotation) => {
7405
+ const annotations = Array.isArray(annotationsToBeAdjusted) ? annotationsToBeAdjusted : Object.values(annotationsToBeAdjusted);
7406
+ return annotations.map((annotation) => {
7406
7407
  return __spreadValues(__spreadValues({}, adjustRangeToInsert(annotation, insertStart, insertLength)), annotation.locations && {
7407
7408
  locations: annotation.locations.map(
7408
7409
  (loc) => adjustRangeToInsert(loc, insertStart, insertLength)
package/index.js CHANGED
@@ -6975,7 +6975,7 @@ function addSizeIdName(frag, sequenceLength) {
6975
6975
  }
6976
6976
  __name(addSizeIdName, "addSizeIdName");
6977
6977
  function isEnzymeType2S(e) {
6978
- return e.site.length < e.topSnipOffset || e.site.length < e.bottomSnipOffset;
6978
+ return e.site.length < (e.topSnipOffset || 0) || e.site.length < (e.bottomSnipOffset || 0);
6979
6979
  }
6980
6980
  __name(isEnzymeType2S, "isEnzymeType2S");
6981
6981
  function insertGapsIntoRefSeq(refSeq, seqReads) {
@@ -7400,7 +7400,8 @@ function adjustAnnotationsToRotation(annotationsToBeAdjusted, positionToRotateTo
7400
7400
  }
7401
7401
  __name(adjustAnnotationsToRotation, "adjustAnnotationsToRotation");
7402
7402
  function adjustAnnotationsToInsert(annotationsToBeAdjusted, insertStart, insertLength) {
7403
- return map(annotationsToBeAdjusted, (annotation) => {
7403
+ const annotations = Array.isArray(annotationsToBeAdjusted) ? annotationsToBeAdjusted : Object.values(annotationsToBeAdjusted);
7404
+ return annotations.map((annotation) => {
7404
7405
  return __spreadValues(__spreadValues({}, adjustRangeToInsert(annotation, insertStart, insertLength)), annotation.locations && {
7405
7406
  locations: annotation.locations.map(
7406
7407
  (loc) => adjustRangeToInsert(loc, insertStart, insertLength)
package/index.umd.cjs CHANGED
@@ -6979,7 +6979,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
6979
6979
  }
6980
6980
  __name(addSizeIdName, "addSizeIdName");
6981
6981
  function isEnzymeType2S(e) {
6982
- return e.site.length < e.topSnipOffset || e.site.length < e.bottomSnipOffset;
6982
+ return e.site.length < (e.topSnipOffset || 0) || e.site.length < (e.bottomSnipOffset || 0);
6983
6983
  }
6984
6984
  __name(isEnzymeType2S, "isEnzymeType2S");
6985
6985
  function insertGapsIntoRefSeq(refSeq, seqReads) {
@@ -7404,7 +7404,8 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
7404
7404
  }
7405
7405
  __name(adjustAnnotationsToRotation, "adjustAnnotationsToRotation");
7406
7406
  function adjustAnnotationsToInsert(annotationsToBeAdjusted, insertStart, insertLength) {
7407
- return map(annotationsToBeAdjusted, (annotation) => {
7407
+ const annotations = Array.isArray(annotationsToBeAdjusted) ? annotationsToBeAdjusted : Object.values(annotationsToBeAdjusted);
7408
+ return annotations.map((annotation) => {
7408
7409
  return __spreadValues(__spreadValues({}, adjustRangeToInsert(annotation, insertStart, insertLength)), annotation.locations && {
7409
7410
  locations: annotation.locations.map(
7410
7411
  (loc) => adjustRangeToInsert(loc, insertStart, insertLength)
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@teselagen/sequence-utils",
3
- "version": "0.3.42-beta.1",
3
+ "version": "0.3.42-beta.2",
4
4
  "repository": "https://github.com/TeselaGen/tg-oss",
5
5
  "type": "module",
6
6
  "dependencies": {
7
- "@teselagen/range-utils": "0.3.20-beta.1",
7
+ "@teselagen/range-utils": "0.3.20-beta.2",
8
8
  "escape-string-regexp": "5.0.0",
9
9
  "jsondiffpatch": "0.7.3",
10
10
  "lodash-es": "^4.17.21",
@@ -1,13 +1,15 @@
1
1
  import { adjustRangeToInsert } from "@teselagen/range-utils";
2
- import { map } from "lodash-es";
3
2
  import { Annotation } from "./types";
4
3
 
5
4
  export default function adjustAnnotationsToInsert(
6
5
  annotationsToBeAdjusted: Record<string, Annotation> | Annotation[],
7
6
  insertStart: number,
8
7
  insertLength: number
9
- ) {
10
- return map(annotationsToBeAdjusted, (annotation: Annotation) => {
8
+ ): Annotation[] {
9
+ const annotations = Array.isArray(annotationsToBeAdjusted)
10
+ ? annotationsToBeAdjusted
11
+ : Object.values(annotationsToBeAdjusted);
12
+ return annotations.map((annotation: Annotation) => {
11
13
  return {
12
14
  ...adjustRangeToInsert(annotation, insertStart, insertLength),
13
15
  ...(annotation.locations && {
@@ -1,5 +1,8 @@
1
1
  import { RestrictionEnzyme } from "./types";
2
2
 
3
3
  export default function isEnzymeType2S(e: RestrictionEnzyme) {
4
- return e.site.length < e.topSnipOffset || e.site.length < e.bottomSnipOffset;
4
+ return (
5
+ e.site.length < (e.topSnipOffset || 0) ||
6
+ e.site.length < (e.bottomSnipOffset || 0)
7
+ );
5
8
  }
@@ -1,6 +1,6 @@
1
1
  import { modifiableTypes } from "./annotationTypes";
2
2
  import adjustAnnotationsToInsert from "./adjustAnnotationsToInsert";
3
- import { SequenceData } from "./types";
3
+ import { SequenceData, Annotation } from "./types";
4
4
 
5
5
  export default function shiftAnnotationsByLen({
6
6
  seqData,
@@ -15,7 +15,7 @@ export default function shiftAnnotationsByLen({
15
15
  const existingAnnotations = seqData[annotationType];
16
16
  if (existingAnnotations) {
17
17
  seqData[annotationType] = adjustAnnotationsToInsert(
18
- existingAnnotations,
18
+ existingAnnotations as Annotation[] | Record<string, Annotation>,
19
19
  caretPosition,
20
20
  insertLength
21
21
  );
package/src/types.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { Range } from "@teselagen/range-utils";
2
+ export type { Range };
2
3
 
3
4
  export interface Annotation extends Range {
4
5
  id?: string | number;
package/types.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Range } from '../../range-utils/src/index.ts';
2
+ export type { Range };
2
3
  export interface Annotation extends Range {
3
4
  id?: string | number;
4
5
  name?: string;