@teselagen/range-utils 0.3.14-beta.3 → 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.
Potentially problematic release.
This version of @teselagen/range-utils might be problematic. Click here for more details.
- package/adjustRangeToDeletionOfAnotherRange.d.ts +1 -2
- package/adjustRangeToInsert.d.ts +1 -2
- package/adjustRangeToRotation.d.ts +1 -5
- package/bundle.js +2 -0
- package/checkIfNonCircularRangesOverlap.d.ts +1 -2
- package/checkIfPotentiallyCircularRangesOverlap.d.ts +1 -2
- package/collapseOverlapsGeneratedFromRangeComparisonIfPossible.d.ts +1 -2
- package/convertRangeIndices.d.ts +1 -10
- package/convertRangeTo0Based.d.ts +1 -5
- package/convertRangeTo1Based.d.ts +1 -5
- package/doesRangeSpanEntireSequence.d.ts +1 -2
- package/doesRangeSpanOrigin.d.ts +1 -2
- package/expandOrContractCircularRangeToPosition.d.ts +2 -3
- package/expandOrContractNonCircularRangeToPosition.d.ts +2 -3
- package/expandOrContractRangeByLength.d.ts +1 -5
- package/expandOrContractRangeToPosition.d.ts +2 -3
- package/flipContainedRange.d.ts +1 -5
- package/generateRandomRange.d.ts +3 -3
- package/getAnnotationRangeType.d.ts +1 -2
- package/getEachPositionInRangeAsArray.d.ts +1 -2
- package/getLengthOfOverlappingRegionsBetweenTwoRanges.d.ts +1 -2
- package/getMiddleOfRange.d.ts +1 -2
- package/getOverlapOfNonCircularRanges.d.ts +4 -5
- package/getOverlapsOfPotentiallyCircularRanges.d.ts +1 -2
- package/getPositionFromAngle.d.ts +1 -1
- package/getRangeAngles.d.ts +7 -3
- package/getRangeLength.d.ts +1 -5
- package/getRangesBetweenTwoRanges.d.ts +1 -2
- package/getSequenceWithinRange.d.ts +1 -2
- package/getShortestDistanceBetweenTwoPositions.d.ts +1 -1
- package/getYOffsetForPotentiallyCircularRange.d.ts +1 -2
- package/getYOffsetsForPotentiallyCircularRanges.d.ts +2 -3
- package/getZeroedRangeOverlaps.d.ts +1 -2
- package/index.cjs +88 -87
- package/index.d.ts +0 -1
- package/index.js +88 -87
- package/index.umd.cjs +88 -87
- package/invertRange.d.ts +1 -5
- package/isPositionCloserToRangeStartThanRangeEnd.d.ts +1 -2
- package/isPositionWithinRange.d.ts +2 -3
- package/isRangeOrPositionWithinRange.d.ts +1 -2
- package/isRangeWithinRange.d.ts +1 -2
- package/loopEachPositionInRange.d.ts +1 -2
- package/modulatePositionByRange.d.ts +1 -2
- package/modulateRangeBySequenceLength.d.ts +1 -8
- package/normalizePositionByRangeLength.d.ts +1 -1
- package/normalizePositionByRangeLength1Based.d.ts +1 -1
- package/normalizeRange.d.ts +1 -5
- package/package.json +5 -10
- package/provideInclusiveOptions.d.ts +1 -6
- package/reversePositionInRange.d.ts +1 -1
- package/splitRangeIntoTwoPartsIfItIsCircular.d.ts +3 -4
- package/src/adjustRangeToDeletionOfAnotherRange.js +30 -33
- package/src/convertRangeIndices.test.js +1 -1
- package/src/expandOrContractRangeByLength.test.js +1 -1
- package/src/flipContainedRange.test.js +1 -1
- package/src/generateRandomRange.test.js +1 -1
- package/src/getAnnotationRangeType.test.js +1 -1
- package/src/invertRange.test.js +1 -1
- package/translateRange.d.ts +1 -5
- package/trimAnnStartEndToFitSeqLength.d.ts +1 -1
- package/trimNonCicularRangeByAnotherNonCircularRange.d.ts +4 -2
- package/trimNumberToFitWithin0ToAnotherNumber.d.ts +1 -1
- package/trimRangeByAnotherRange.d.ts +1 -2
- package/zeroSubrangeByContainerRange.d.ts +1 -2
- package/RangeAngles.d.ts +0 -7
- package/src/RangeAngles.ts +0 -9
- package/src/adjustRangeToDeletionOfAnotherRange.ts +0 -57
- package/src/adjustRangeToInsert.ts +0 -32
- package/src/adjustRangeToRotation.ts +0 -23
- package/src/checkIfNonCircularRangesOverlap.ts +0 -35
- package/src/checkIfPotentiallyCircularRangesOverlap.ts +0 -28
- package/src/collapseOverlapsGeneratedFromRangeComparisonIfPossible.ts +0 -81
- package/src/convertRangeIndices.ts +0 -34
- package/src/convertRangeTo0Based.ts +0 -9
- package/src/convertRangeTo1Based.ts +0 -10
- package/src/doesRangeSpanEntireSequence.ts +0 -12
- package/src/doesRangeSpanOrigin.ts +0 -5
- package/src/expandOrContractCircularRangeToPosition.ts +0 -50
- package/src/expandOrContractNonCircularRangeToPosition.ts +0 -30
- package/src/expandOrContractRangeByLength.ts +0 -18
- package/src/expandOrContractRangeToPosition.ts +0 -16
- package/src/flipContainedRange.ts +0 -156
- package/src/generateRandomRange.ts +0 -26
- package/src/getAnnotationRangeType.ts +0 -30
- package/src/getEachPositionInRangeAsArray.ts +0 -19
- package/src/getLengthOfOverlappingRegionsBetweenTwoRanges.ts +0 -18
- package/src/getMiddleOfRange.ts +0 -11
- package/src/getOverlapOfNonCircularRanges.ts +0 -41
- package/src/getOverlapsOfPotentiallyCircularRanges.ts +0 -60
- package/src/getPositionFromAngle.ts +0 -12
- package/src/getRangeAngles.ts +0 -38
- package/src/getRangeLength.test.ts +0 -30
- package/src/getRangeLength.ts +0 -17
- package/src/getRangesBetweenTwoRanges.ts +0 -42
- package/src/getSequenceWithinRange.test.ts +0 -47
- package/src/getSequenceWithinRange.ts +0 -24
- package/src/getShortestDistanceBetweenTwoPositions.test.ts +0 -12
- package/src/getShortestDistanceBetweenTwoPositions.ts +0 -16
- package/src/getYOffsetForPotentiallyCircularRange.ts +0 -37
- package/src/getYOffsetsForPotentiallyCircularRanges.test.ts +0 -17
- package/src/getYOffsetsForPotentiallyCircularRanges.ts +0 -28
- package/src/getZeroedRangeOverlaps.test.ts +0 -65
- package/src/getZeroedRangeOverlaps.ts +0 -33
- package/src/index.test.ts +0 -39
- package/src/index.ts +0 -53
- package/src/invertRange.ts +0 -25
- package/src/isPositionCloserToRangeStartThanRangeEnd.ts +0 -22
- package/src/isPositionWithinRange.ts +0 -40
- package/src/isRangeOrPositionWithinRange.ts +0 -40
- package/src/isRangeWithinRange.ts +0 -18
- package/src/loopEachPositionInRange.ts +0 -11
- package/src/modulatePositionByRange.ts +0 -15
- package/src/modulateRangeBySequenceLength.ts +0 -13
- package/src/normalizePositionByRangeLength.ts +0 -24
- package/src/normalizePositionByRangeLength1Based.ts +0 -9
- package/src/normalizeRange.ts +0 -12
- package/src/provideInclusiveOptions.ts +0 -79
- package/src/reversePositionInRange.ts +0 -17
- package/src/splitRangeIntoTwoPartsIfItIsCircular.ts +0 -36
- package/src/translateRange.ts +0 -21
- package/src/trimAnnStartEndToFitSeqLength.ts +0 -9
- package/src/trimNonCicularRangeByAnotherNonCircularRange.ts +0 -63
- package/src/trimNumberToFitWithin0ToAnotherNumber.ts +0 -15
- package/src/trimRangeByAnotherRange.ts +0 -103
- package/src/types.ts +0 -12
- package/src/zeroSubrangeByContainerRange.ts +0 -49
- package/types.d.ts +0 -12
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function checkIfNonCircularRangesOverlap(range: Range, comparisonRange: Range): boolean;
|
|
1
|
+
export default function checkIfNonCircularRangesOverlap(range: any, comparisonRange: any): boolean;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function checkIfPotentiallyCircularRangesOverlap(range: Range, comparisonRange: Range): boolean;
|
|
1
|
+
export default function checkIfPotentiallyCircularRangesOverlap(range: any, comparisonRange: any): boolean;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function collapseOverlapsGeneratedFromRangeComparisonIfPossible(overlaps: Range[], sequenceLength: number, optionalOriginalRange?: Range): Range[];
|
|
1
|
+
export default function collapseOverlapsGeneratedFromRangeComparisonIfPossible(overlaps: any, sequenceLength: any, optionalOriginalRange: any): any;
|
package/convertRangeIndices.d.ts
CHANGED
|
@@ -1,10 +1 @@
|
|
|
1
|
-
|
|
2
|
-
interface RangeIndicesOptions {
|
|
3
|
-
inclusive1BasedStart?: boolean;
|
|
4
|
-
inclusive1BasedEnd?: boolean;
|
|
5
|
-
}
|
|
6
|
-
export default function convertRangeIndices(range: Range, inputType?: RangeIndicesOptions, outputType?: RangeIndicesOptions): Range & {
|
|
7
|
-
start: number;
|
|
8
|
-
end: number;
|
|
9
|
-
};
|
|
10
|
-
export {};
|
|
1
|
+
export default function convertRangeIndices(range: any, inputType: any, outputType: any): any;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function doesRangeSpanEntireSequence(range: Range, sequenceLength: number): boolean;
|
|
1
|
+
export default function doesRangeSpanEntireSequence(range: any, sequenceLength: any): true | undefined;
|
package/doesRangeSpanOrigin.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function doesRangeSpanOrigin(range: Range): boolean;
|
|
1
|
+
export default function doesRangeSpanOrigin(range: any): boolean;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
newRange: Range;
|
|
1
|
+
export default function expandOrContractCircularRangeToPosition(range: any, position: any, maxLength: any): {
|
|
2
|
+
newRange: any;
|
|
4
3
|
endMoved: boolean;
|
|
5
4
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
newRange: Range;
|
|
1
|
+
export default function expandOrContractNonCircularRangeToPosition(range: any, position: any): {
|
|
2
|
+
newRange: any;
|
|
4
3
|
endMoved: boolean;
|
|
5
4
|
};
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function expandOrContractRangeByLength(range: Range, shiftBy: number, shiftStart: boolean, sequenceLength: number): Range & {
|
|
3
|
-
start: number;
|
|
4
|
-
end: number;
|
|
5
|
-
};
|
|
1
|
+
export default function expandOrContractRangeByLength(range: any, shiftBy: any, shiftStart: any, sequenceLength: any): any;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
newRange: Range;
|
|
1
|
+
export default function expandOrContractRangeToPosition(range: any, position: any, maxLength: any): {
|
|
2
|
+
newRange: any;
|
|
4
3
|
endMoved: boolean;
|
|
5
4
|
};
|
package/flipContainedRange.d.ts
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function flipRelativeRange(innerRange: Range, outerRange: Range, sequenceLength: number): Range & {
|
|
3
|
-
start: number;
|
|
4
|
-
end: number;
|
|
5
|
-
};
|
|
1
|
+
export default function flipRelativeRange(innerRange: any, outerRange: any, sequenceLength: any): any;
|
package/generateRandomRange.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export default function generateRandomRange(minStart:
|
|
2
|
-
start:
|
|
3
|
-
end:
|
|
1
|
+
export default function generateRandomRange(minStart: any, maxEnd: any, maxLength: any): {
|
|
2
|
+
start: any;
|
|
3
|
+
end: any;
|
|
4
4
|
};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function getAnnotationRangeType(annotationRange: Range, enclosingRangeType: Range, forward: boolean): "end" | "beginningAndEnd" | "start" | "middle";
|
|
1
|
+
export default function getAnnotationRangeType(annotationRange: any, enclosingRangeType: any, forward: any): "end" | "beginningAndEnd" | "start" | "middle";
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function getEachPositionInRangeAsArray(range: Range, rangeMax: number): number[];
|
|
1
|
+
export default function getEachPositionInRangeAsArray(range: any, rangeMax: any): any[];
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function getLengthOfOverlappingRegionsBetweenTwoRanges(rangeA: Range, rangeB: Range, maxLength: number): number;
|
|
1
|
+
export default function getLengthOfOverlappingRegionsBetweenTwoRanges(rangeA: any, rangeB: any, maxLength: any): any;
|
package/getMiddleOfRange.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function getMiddleOfRange(range: Range, rangeMax: number): number;
|
|
1
|
+
export default function getMiddleOfRange(range: any, rangeMax: any): any;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} | null;
|
|
1
|
+
export default function getOverlapOfNonCircularRanges(rangeA: any, rangeB: any): {
|
|
2
|
+
start: any;
|
|
3
|
+
end: any;
|
|
4
|
+
} | undefined;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function getOverlapsOfPotentiallyCircularRanges(rangeA: Range, rangeB: Range, maxRangeLength: number, joinIfPossible?: boolean): Range[];
|
|
1
|
+
export default function getOverlapsOfPotentiallyCircularRanges(rangeA: any, rangeB: any, maxRangeLength: any, joinIfPossible: any): any[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function getPositionFromAngle(angle:
|
|
1
|
+
export default function getPositionFromAngle(angle: any, rangeMax: any, isInBetweenPositions: any): number;
|
package/getRangeAngles.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export default function getRangeAngles(range: any, rangeMax: any): {
|
|
2
|
+
startAngle: number;
|
|
3
|
+
totalAngle: number;
|
|
4
|
+
endAngle: number;
|
|
5
|
+
centerAngle: number;
|
|
6
|
+
locationAngles: any;
|
|
7
|
+
};
|
package/getRangeLength.d.ts
CHANGED
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
declare const _default: (range: Range, rangeMax: number, options?: {
|
|
3
|
-
inclusive1BasedEnd?: boolean;
|
|
4
|
-
inclusive1BasedStart?: boolean;
|
|
5
|
-
} | undefined) => number;
|
|
1
|
+
declare const _default: (...args: any[]) => any;
|
|
6
2
|
export default _default;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function getRangesBetweenTwoRanges(range1: Range, range2: Range): Range[];
|
|
1
|
+
export default function getRangesBetweenTwoRanges(range1: any, range2: any): any[];
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function getSequenceWithinRange<T>(range: Range, sequence: string | T[]): string | T[];
|
|
1
|
+
export default function getSequenceWithinRange(range: any, sequence: any): any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function getShortestDistanceBetweenTwoPositions(position1:
|
|
1
|
+
export default function getShortestDistanceBetweenTwoPositions(position1: any, position2: any, sequenceLength: any): number;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function getYOffsetForPotentiallyCircularRange(range: Range, YOffsetLevelsWithRanges: Range[][], assignYOffsetToRange: boolean): number;
|
|
1
|
+
export default function getYOffsetForPotentiallyCircularRange(range: any, YOffsetLevelsWithRanges: any, assignYOffsetToRange: any): any;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
yOffsets: number[];
|
|
1
|
+
export default function getYOffsetsForPotentiallyCircularRanges(ranges: any, assignYOffsetToRange: any): {
|
|
2
|
+
yOffsets: any[];
|
|
4
3
|
maxYOffset: number;
|
|
5
4
|
};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function getZeroedRangeOverlaps(annotation: Range, selection: Range, sequenceLength: number): Range[];
|
|
1
|
+
export default function getZeroedRangeOverlaps(annotation: any, selection: any, sequenceLength: any): any;
|
package/index.cjs
CHANGED
|
@@ -87,6 +87,7 @@ function arrayMap(array, iteratee) {
|
|
|
87
87
|
}
|
|
88
88
|
__name(arrayMap, "arrayMap");
|
|
89
89
|
var isArray = Array.isArray;
|
|
90
|
+
var INFINITY$1 = 1 / 0;
|
|
90
91
|
var symbolProto$2 = Symbol$1 ? Symbol$1.prototype : void 0, symbolToString = symbolProto$2 ? symbolProto$2.toString : void 0;
|
|
91
92
|
function baseToString(value) {
|
|
92
93
|
if (typeof value == "string") {
|
|
@@ -99,7 +100,7 @@ function baseToString(value) {
|
|
|
99
100
|
return symbolToString ? symbolToString.call(value) : "";
|
|
100
101
|
}
|
|
101
102
|
var result = value + "";
|
|
102
|
-
return result == "0" && 1 / value == -
|
|
103
|
+
return result == "0" && 1 / value == -INFINITY$1 ? "-0" : result;
|
|
103
104
|
}
|
|
104
105
|
__name(baseToString, "baseToString");
|
|
105
106
|
function isObject(value) {
|
|
@@ -772,12 +773,13 @@ function castPath(value, object) {
|
|
|
772
773
|
return isKey(value, object) ? [value] : stringToPath(toString(value));
|
|
773
774
|
}
|
|
774
775
|
__name(castPath, "castPath");
|
|
776
|
+
var INFINITY = 1 / 0;
|
|
775
777
|
function toKey(value) {
|
|
776
778
|
if (typeof value == "string" || isSymbol(value)) {
|
|
777
779
|
return value;
|
|
778
780
|
}
|
|
779
781
|
var result = value + "";
|
|
780
|
-
return result == "0" && 1 / value == -
|
|
782
|
+
return result == "0" && 1 / value == -INFINITY ? "-0" : result;
|
|
781
783
|
}
|
|
782
784
|
__name(toKey, "toKey");
|
|
783
785
|
function baseGet(object, path) {
|
|
@@ -1536,7 +1538,8 @@ function flatMap(collection, iteratee) {
|
|
|
1536
1538
|
__name(flatMap, "flatMap");
|
|
1537
1539
|
function getOverlapOfNonCircularRanges(rangeA, rangeB) {
|
|
1538
1540
|
if (rangeA.start < rangeB.start) {
|
|
1539
|
-
if (rangeA.end < rangeB.start)
|
|
1541
|
+
if (rangeA.end < rangeB.start)
|
|
1542
|
+
;
|
|
1540
1543
|
else {
|
|
1541
1544
|
if (rangeA.end < rangeB.end) {
|
|
1542
1545
|
return {
|
|
@@ -1551,7 +1554,8 @@ function getOverlapOfNonCircularRanges(rangeA, rangeB) {
|
|
|
1551
1554
|
}
|
|
1552
1555
|
}
|
|
1553
1556
|
} else {
|
|
1554
|
-
if (rangeA.start > rangeB.end)
|
|
1557
|
+
if (rangeA.start > rangeB.end)
|
|
1558
|
+
;
|
|
1555
1559
|
else {
|
|
1556
1560
|
if (rangeA.end < rangeB.end) {
|
|
1557
1561
|
return {
|
|
@@ -1566,10 +1570,9 @@ function getOverlapOfNonCircularRanges(rangeA, rangeB) {
|
|
|
1566
1570
|
}
|
|
1567
1571
|
}
|
|
1568
1572
|
}
|
|
1569
|
-
return null;
|
|
1570
1573
|
}
|
|
1571
1574
|
__name(getOverlapOfNonCircularRanges, "getOverlapOfNonCircularRanges");
|
|
1572
|
-
function getOverlapsOfPotentiallyCircularRanges(rangeA, rangeB, maxRangeLength, joinIfPossible
|
|
1575
|
+
function getOverlapsOfPotentiallyCircularRanges(rangeA, rangeB, maxRangeLength, joinIfPossible) {
|
|
1573
1576
|
const normalizedRangeA = splitRangeIntoTwoPartsIfItIsCircular(
|
|
1574
1577
|
rangeA,
|
|
1575
1578
|
maxRangeLength
|
|
@@ -1600,11 +1603,8 @@ function getOverlapsOfPotentiallyCircularRanges(rangeA, rangeB, maxRangeLength,
|
|
|
1600
1603
|
joinedOverlap.start = o.start;
|
|
1601
1604
|
return [];
|
|
1602
1605
|
}
|
|
1603
|
-
return [o];
|
|
1604
1606
|
});
|
|
1605
|
-
|
|
1606
|
-
overlaps.push(joinedOverlap);
|
|
1607
|
-
}
|
|
1607
|
+
overlaps.push(joinedOverlap);
|
|
1608
1608
|
}
|
|
1609
1609
|
return overlaps;
|
|
1610
1610
|
}
|
|
@@ -1634,7 +1634,8 @@ function trimNonCicularRangeByAnotherNonCircularRange(rangeToBeTrimmed, trimming
|
|
|
1634
1634
|
}
|
|
1635
1635
|
}
|
|
1636
1636
|
} else {
|
|
1637
|
-
if (rangeToBeTrimmed.end <= trimmingRange.end)
|
|
1637
|
+
if (rangeToBeTrimmed.end <= trimmingRange.end)
|
|
1638
|
+
;
|
|
1638
1639
|
else {
|
|
1639
1640
|
if (rangeToBeTrimmed.start > trimmingRange.end) {
|
|
1640
1641
|
outputTrimmedRange = {
|
|
@@ -1677,7 +1678,10 @@ function trimRangeByAnotherRange(rangeToBeTrimmed, trimmingRange, sequenceLength
|
|
|
1677
1678
|
if (!overlaps.length) {
|
|
1678
1679
|
return rangeToBeTrimmed;
|
|
1679
1680
|
}
|
|
1680
|
-
const splitRangesToBeTrimmed = splitRangeIntoTwoPartsIfItIsCircular(
|
|
1681
|
+
const splitRangesToBeTrimmed = splitRangeIntoTwoPartsIfItIsCircular(
|
|
1682
|
+
rangeToBeTrimmed,
|
|
1683
|
+
sequenceLength
|
|
1684
|
+
);
|
|
1681
1685
|
splitRangesToBeTrimmed.forEach(function(nonCircularRangeToBeTrimmed, index) {
|
|
1682
1686
|
overlaps.forEach(function(overlap) {
|
|
1683
1687
|
if (nonCircularRangeToBeTrimmed) {
|
|
@@ -1698,7 +1702,8 @@ function trimRangeByAnotherRange(rangeToBeTrimmed, trimmingRange, sequenceLength
|
|
|
1698
1702
|
}
|
|
1699
1703
|
);
|
|
1700
1704
|
let outputTrimmedRange;
|
|
1701
|
-
if (outputSplitRanges.length < 0)
|
|
1705
|
+
if (outputSplitRanges.length < 0)
|
|
1706
|
+
;
|
|
1702
1707
|
else if (outputSplitRanges.length === 1) {
|
|
1703
1708
|
outputTrimmedRange = outputSplitRanges[0];
|
|
1704
1709
|
} else if (outputSplitRanges.length === 2) {
|
|
@@ -1720,7 +1725,6 @@ function trimRangeByAnotherRange(rangeToBeTrimmed, trimmingRange, sequenceLength
|
|
|
1720
1725
|
end: outputTrimmedRange.end
|
|
1721
1726
|
});
|
|
1722
1727
|
}
|
|
1723
|
-
return void 0;
|
|
1724
1728
|
}
|
|
1725
1729
|
__name(trimRangeByAnotherRange, "trimRangeByAnotherRange");
|
|
1726
1730
|
function adjustRangeToDeletionOfAnotherRange(rangeToBeAdjusted, anotherRange, maxLength) {
|
|
@@ -1729,31 +1733,32 @@ function adjustRangeToDeletionOfAnotherRange(rangeToBeAdjusted, anotherRange, ma
|
|
|
1729
1733
|
anotherRange,
|
|
1730
1734
|
maxLength
|
|
1731
1735
|
);
|
|
1732
|
-
if (
|
|
1733
|
-
|
|
1736
|
+
if (trimmedRange) {
|
|
1737
|
+
const nonCircularDeletionRanges = splitRangeIntoTwoPartsIfItIsCircular(
|
|
1738
|
+
anotherRange,
|
|
1739
|
+
maxLength
|
|
1740
|
+
);
|
|
1741
|
+
nonCircularDeletionRanges.forEach(function(nonCircularDeletionRange) {
|
|
1742
|
+
const deletionLength = nonCircularDeletionRange.end - nonCircularDeletionRange.start + 1;
|
|
1743
|
+
if (trimmedRange.start > trimmedRange.end) {
|
|
1744
|
+
if (nonCircularDeletionRange.start < trimmedRange.end) {
|
|
1745
|
+
trimmedRange.start -= deletionLength;
|
|
1746
|
+
trimmedRange.end -= deletionLength;
|
|
1747
|
+
} else if (nonCircularDeletionRange.start < trimmedRange.start) {
|
|
1748
|
+
trimmedRange.start -= deletionLength;
|
|
1749
|
+
} else
|
|
1750
|
+
;
|
|
1751
|
+
} else {
|
|
1752
|
+
if (nonCircularDeletionRange.start < trimmedRange.start) {
|
|
1753
|
+
trimmedRange.start -= deletionLength;
|
|
1754
|
+
trimmedRange.end -= deletionLength;
|
|
1755
|
+
} else if (nonCircularDeletionRange.start < trimmedRange.end) {
|
|
1756
|
+
trimmedRange.end -= deletionLength;
|
|
1757
|
+
} else
|
|
1758
|
+
;
|
|
1759
|
+
}
|
|
1760
|
+
});
|
|
1734
1761
|
}
|
|
1735
|
-
const nonCircularDeletionRanges = splitRangeIntoTwoPartsIfItIsCircular(
|
|
1736
|
-
anotherRange,
|
|
1737
|
-
maxLength
|
|
1738
|
-
);
|
|
1739
|
-
nonCircularDeletionRanges.forEach(function(nonCircularDeletionRange) {
|
|
1740
|
-
const deletionLength = nonCircularDeletionRange.end - nonCircularDeletionRange.start + 1;
|
|
1741
|
-
if (trimmedRange.start > trimmedRange.end) {
|
|
1742
|
-
if (nonCircularDeletionRange.start < trimmedRange.end) {
|
|
1743
|
-
trimmedRange.start -= deletionLength;
|
|
1744
|
-
trimmedRange.end -= deletionLength;
|
|
1745
|
-
} else if (nonCircularDeletionRange.start < trimmedRange.start) {
|
|
1746
|
-
trimmedRange.start -= deletionLength;
|
|
1747
|
-
} else ;
|
|
1748
|
-
} else {
|
|
1749
|
-
if (nonCircularDeletionRange.start < trimmedRange.start) {
|
|
1750
|
-
trimmedRange.start -= deletionLength;
|
|
1751
|
-
trimmedRange.end -= deletionLength;
|
|
1752
|
-
} else if (nonCircularDeletionRange.start < trimmedRange.end) {
|
|
1753
|
-
trimmedRange.end -= deletionLength;
|
|
1754
|
-
} else ;
|
|
1755
|
-
}
|
|
1756
|
-
});
|
|
1757
1762
|
return trimmedRange;
|
|
1758
1763
|
}
|
|
1759
1764
|
__name(adjustRangeToDeletionOfAnotherRange, "adjustRangeToDeletionOfAnotherRange");
|
|
@@ -1867,10 +1872,11 @@ function collapseOverlapsGeneratedFromRangeComparisonIfPossible(overlaps, sequen
|
|
|
1867
1872
|
}
|
|
1868
1873
|
}
|
|
1869
1874
|
}
|
|
1870
|
-
return overlaps;
|
|
1871
1875
|
}
|
|
1872
1876
|
__name(collapseOverlapsGeneratedFromRangeComparisonIfPossible, "collapseOverlapsGeneratedFromRangeComparisonIfPossible");
|
|
1873
|
-
function convertRangeIndices(range, inputType
|
|
1877
|
+
function convertRangeIndices(range, inputType, outputType) {
|
|
1878
|
+
inputType = inputType || {};
|
|
1879
|
+
outputType = outputType || {};
|
|
1874
1880
|
return assign({}, range, {
|
|
1875
1881
|
start: Number(range.start) + (inputType.inclusive1BasedStart ? outputType.inclusive1BasedStart ? 0 : -1 : outputType.inclusive1BasedStart ? 1 : 0),
|
|
1876
1882
|
end: Number(range.end) + (inputType.inclusive1BasedEnd ? outputType.inclusive1BasedEnd ? 0 : -1 : outputType.inclusive1BasedEnd ? 1 : 0)
|
|
@@ -1893,32 +1899,25 @@ function convertRangeTo1Based(range) {
|
|
|
1893
1899
|
}
|
|
1894
1900
|
__name(convertRangeTo1Based, "convertRangeTo1Based");
|
|
1895
1901
|
function provideInclusiveOptions(funToWrap) {
|
|
1896
|
-
return function(
|
|
1902
|
+
return function() {
|
|
1903
|
+
const args = Array.prototype.slice.call(arguments);
|
|
1897
1904
|
const options = args[args.length - 1];
|
|
1898
1905
|
if (options && (options.inclusive1BasedEnd || options.inclusive1BasedStart)) {
|
|
1899
1906
|
args.forEach(function(arg, index) {
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
args[index] = assign(potentialRange, {
|
|
1903
|
-
start: potentialRange.start - 1
|
|
1904
|
-
});
|
|
1907
|
+
if (arg && arg.start > -1 && options.inclusive1BasedStart) {
|
|
1908
|
+
args[index] = assign(arg, { start: arg.start - 1 });
|
|
1905
1909
|
}
|
|
1906
|
-
if (
|
|
1907
|
-
args[index] = assign(
|
|
1908
|
-
end: potentialRange.end - 1
|
|
1909
|
-
});
|
|
1910
|
+
if (arg && arg.end > -1 && options.inclusive1BasedEnd) {
|
|
1911
|
+
args[index] = assign(arg, { end: arg.end - 1 });
|
|
1910
1912
|
}
|
|
1911
1913
|
});
|
|
1912
1914
|
}
|
|
1913
1915
|
let returnVal = funToWrap.apply(this, args);
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
returnVal = assign(potentialReturn, {
|
|
1917
|
-
start: potentialReturn.start + 1
|
|
1918
|
-
});
|
|
1916
|
+
if (returnVal && returnVal.start > -1 && options && options.inclusive1BasedStart) {
|
|
1917
|
+
returnVal = assign(returnVal, { start: returnVal.start + 1 });
|
|
1919
1918
|
}
|
|
1920
|
-
if (
|
|
1921
|
-
returnVal = assign(
|
|
1919
|
+
if (returnVal && returnVal.end > -1 && options && options.inclusive1BasedEnd) {
|
|
1920
|
+
returnVal = assign(returnVal, { end: returnVal.end + 1 });
|
|
1922
1921
|
}
|
|
1923
1922
|
return returnVal;
|
|
1924
1923
|
};
|
|
@@ -1939,10 +1938,9 @@ function getRangeLength$1(range, rangeMax) {
|
|
|
1939
1938
|
}
|
|
1940
1939
|
__name(getRangeLength$1, "getRangeLength$1");
|
|
1941
1940
|
function doesRangeSpanEntireSequence(range, sequenceLength) {
|
|
1942
|
-
if (getRangeLength(range
|
|
1941
|
+
if (getRangeLength(range) === sequenceLength) {
|
|
1943
1942
|
return true;
|
|
1944
1943
|
}
|
|
1945
|
-
return false;
|
|
1946
1944
|
}
|
|
1947
1945
|
__name(doesRangeSpanEntireSequence, "doesRangeSpanEntireSequence");
|
|
1948
1946
|
function isRangeWithinRange(rangeToCheck, containingRange, maxLength) {
|
|
@@ -1951,7 +1949,8 @@ function isRangeWithinRange(rangeToCheck, containingRange, maxLength) {
|
|
|
1951
1949
|
containingRange,
|
|
1952
1950
|
maxLength
|
|
1953
1951
|
);
|
|
1954
|
-
if (ranges === null)
|
|
1952
|
+
if (ranges === null)
|
|
1953
|
+
return false;
|
|
1955
1954
|
return !ranges;
|
|
1956
1955
|
}
|
|
1957
1956
|
__name(isRangeWithinRange, "isRangeWithinRange");
|
|
@@ -1976,9 +1975,6 @@ function isRangeOrPositionWithinRange(rangeOrPositionToCheck, containingRange, m
|
|
|
1976
1975
|
return false;
|
|
1977
1976
|
}
|
|
1978
1977
|
if (isObject(rangeOrPositionToCheck)) {
|
|
1979
|
-
if (typeof rangeOrPositionToCheck.start !== "number") {
|
|
1980
|
-
return false;
|
|
1981
|
-
}
|
|
1982
1978
|
return isRangeWithinRange(
|
|
1983
1979
|
rangeOrPositionToCheck,
|
|
1984
1980
|
containingRange,
|
|
@@ -1999,7 +1995,7 @@ function doesRangeSpanOrigin(range) {
|
|
|
1999
1995
|
return range.start > range.end;
|
|
2000
1996
|
}
|
|
2001
1997
|
__name(doesRangeSpanOrigin, "doesRangeSpanOrigin");
|
|
2002
|
-
function normalizePositionByRangeLength(pPosition, sequenceLength, isInBetweenPositions
|
|
1998
|
+
function normalizePositionByRangeLength(pPosition, sequenceLength, isInBetweenPositions) {
|
|
2003
1999
|
let position = pPosition;
|
|
2004
2000
|
if (position < 0) {
|
|
2005
2001
|
position += sequenceLength;
|
|
@@ -2091,7 +2087,10 @@ function expandOrContractRangeToPosition(range, position, maxLength) {
|
|
|
2091
2087
|
if (range.start > range.end) {
|
|
2092
2088
|
return expandOrContractCircularRangeToPosition(range, position, maxLength);
|
|
2093
2089
|
} else {
|
|
2094
|
-
return expandOrContractNonCircularRangeToPosition(
|
|
2090
|
+
return expandOrContractNonCircularRangeToPosition(
|
|
2091
|
+
range,
|
|
2092
|
+
position
|
|
2093
|
+
);
|
|
2095
2094
|
}
|
|
2096
2095
|
}
|
|
2097
2096
|
__name(expandOrContractRangeToPosition, "expandOrContractRangeToPosition");
|
|
@@ -2349,15 +2348,14 @@ function getRangesBetweenTwoRanges(range1, range2) {
|
|
|
2349
2348
|
}
|
|
2350
2349
|
__name(getRangesBetweenTwoRanges, "getRangesBetweenTwoRanges");
|
|
2351
2350
|
function getSequenceWithinRange(range, sequence) {
|
|
2352
|
-
if (range.start < 0 || range.end < 0)
|
|
2351
|
+
if (range.start < 0 || range.end < 0)
|
|
2352
|
+
return "";
|
|
2353
2353
|
if (range.start > range.end) {
|
|
2354
2354
|
let subSequence = sequence.slice(range.start, sequence.length);
|
|
2355
2355
|
if (typeof subSequence === "string") {
|
|
2356
2356
|
subSequence += sequence.slice(0, range.end + 1);
|
|
2357
2357
|
} else {
|
|
2358
|
-
subSequence = subSequence.concat(
|
|
2359
|
-
sequence.slice(0, range.end + 1)
|
|
2360
|
-
);
|
|
2358
|
+
subSequence = subSequence.concat(sequence.slice(0, range.end + 1));
|
|
2361
2359
|
}
|
|
2362
2360
|
return subSequence;
|
|
2363
2361
|
} else {
|
|
@@ -2377,7 +2375,7 @@ function getShortestDistanceBetweenTwoPositions(position1, position2, sequenceLe
|
|
|
2377
2375
|
}
|
|
2378
2376
|
__name(getShortestDistanceBetweenTwoPositions, "getShortestDistanceBetweenTwoPositions");
|
|
2379
2377
|
function getYOffsetForPotentiallyCircularRange(range, YOffsetLevelsWithRanges, assignYOffsetToRange) {
|
|
2380
|
-
let yOffset =
|
|
2378
|
+
let yOffset = [];
|
|
2381
2379
|
const openYOffsetFound = YOffsetLevelsWithRanges.some(
|
|
2382
2380
|
function(rangesAlreadyAddedToYOffset, index) {
|
|
2383
2381
|
const rangeBlocked = rangesAlreadyAddedToYOffset.some(
|
|
@@ -2390,7 +2388,8 @@ function getYOffsetForPotentiallyCircularRange(range, YOffsetLevelsWithRanges, a
|
|
|
2390
2388
|
);
|
|
2391
2389
|
if (!rangeBlocked) {
|
|
2392
2390
|
yOffset = index;
|
|
2393
|
-
if (assignYOffsetToRange)
|
|
2391
|
+
if (assignYOffsetToRange)
|
|
2392
|
+
range.yOffset = index;
|
|
2394
2393
|
rangesAlreadyAddedToYOffset.push(range);
|
|
2395
2394
|
return true;
|
|
2396
2395
|
}
|
|
@@ -2399,7 +2398,8 @@ function getYOffsetForPotentiallyCircularRange(range, YOffsetLevelsWithRanges, a
|
|
|
2399
2398
|
);
|
|
2400
2399
|
if (!openYOffsetFound) {
|
|
2401
2400
|
yOffset = YOffsetLevelsWithRanges.length;
|
|
2402
|
-
if (assignYOffsetToRange)
|
|
2401
|
+
if (assignYOffsetToRange)
|
|
2402
|
+
range.yOffset = YOffsetLevelsWithRanges.length;
|
|
2403
2403
|
}
|
|
2404
2404
|
return yOffset;
|
|
2405
2405
|
}
|
|
@@ -2419,7 +2419,8 @@ function getYOffsetsForPotentiallyCircularRanges(ranges, assignYOffsetToRange) {
|
|
|
2419
2419
|
maxYOffset = yOffset;
|
|
2420
2420
|
}
|
|
2421
2421
|
range.yOffset = yOffset;
|
|
2422
|
-
if (!yOffsetLevels[yOffset])
|
|
2422
|
+
if (!yOffsetLevels[yOffset])
|
|
2423
|
+
yOffsetLevels[yOffset] = [];
|
|
2423
2424
|
yOffsetLevels[yOffset].push(range);
|
|
2424
2425
|
});
|
|
2425
2426
|
return { yOffsets, maxYOffset };
|
|
@@ -2427,20 +2428,21 @@ function getYOffsetsForPotentiallyCircularRanges(ranges, assignYOffsetToRange) {
|
|
|
2427
2428
|
__name(getYOffsetsForPotentiallyCircularRanges, "getYOffsetsForPotentiallyCircularRanges");
|
|
2428
2429
|
const invertRange = provideInclusiveOptions(invertRange$1);
|
|
2429
2430
|
function invertRange$1(rangeOrCaret, rangeMax) {
|
|
2430
|
-
if (
|
|
2431
|
+
if (rangeOrCaret.start > -1) {
|
|
2431
2432
|
const start = rangeOrCaret.end + 1;
|
|
2432
2433
|
const end = rangeOrCaret.start - 1;
|
|
2433
2434
|
return {
|
|
2434
2435
|
start: normalizePositionByRangeLength(start, rangeMax, false),
|
|
2435
2436
|
end: normalizePositionByRangeLength(end, rangeMax, false)
|
|
2436
2437
|
};
|
|
2437
|
-
} else
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2438
|
+
} else {
|
|
2439
|
+
if (rangeOrCaret > -1) {
|
|
2440
|
+
return {
|
|
2441
|
+
start: normalizePositionByRangeLength(rangeOrCaret, rangeMax, false),
|
|
2442
|
+
end: normalizePositionByRangeLength(rangeOrCaret - 1, rangeMax, false)
|
|
2443
|
+
};
|
|
2444
|
+
}
|
|
2442
2445
|
}
|
|
2443
|
-
return void 0;
|
|
2444
2446
|
}
|
|
2445
2447
|
__name(invertRange$1, "invertRange$1");
|
|
2446
2448
|
function isPositionCloserToRangeStartThanRangeEnd(position, range, maxLength) {
|
|
@@ -2508,10 +2510,9 @@ function zeroSubrangeByContainerRange(subRange, containerRange, sequenceLength)
|
|
|
2508
2510
|
"subRange must be fully contained by containerRange! Otherwise this function does not make sense"
|
|
2509
2511
|
);
|
|
2510
2512
|
}
|
|
2511
|
-
const newSubrange = {
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
};
|
|
2513
|
+
const newSubrange = {};
|
|
2514
|
+
newSubrange.start = subRange.start - containerRange.start;
|
|
2515
|
+
newSubrange.end = subRange.end - containerRange.start;
|
|
2515
2516
|
if (newSubrange.start < 0) {
|
|
2516
2517
|
newSubrange.start += sequenceLength;
|
|
2517
2518
|
}
|
|
@@ -2522,10 +2523,10 @@ function zeroSubrangeByContainerRange(subRange, containerRange, sequenceLength)
|
|
|
2522
2523
|
}
|
|
2523
2524
|
__name(zeroSubrangeByContainerRange, "zeroSubrangeByContainerRange");
|
|
2524
2525
|
function adjustRangeToRotation(rangeToBeAdjusted, rotateTo = 0, rangeLength) {
|
|
2525
|
-
const mod =
|
|
2526
|
+
const mod = rangeLength ? modulo : identity;
|
|
2526
2527
|
const newRange = assign({}, rangeToBeAdjusted, {
|
|
2527
|
-
start: mod(rangeToBeAdjusted.start - (rotateTo || 0)),
|
|
2528
|
-
end: mod(rangeToBeAdjusted.end - (rotateTo || 0))
|
|
2528
|
+
start: mod(rangeToBeAdjusted.start - (rotateTo || 0), rangeLength),
|
|
2529
|
+
end: mod(rangeToBeAdjusted.end - (rotateTo || 0), rangeLength)
|
|
2529
2530
|
});
|
|
2530
2531
|
return newRange;
|
|
2531
2532
|
}
|
package/index.d.ts
CHANGED
|
@@ -50,4 +50,3 @@ export { default as zeroSubrangeByContainerRange } from './zeroSubrangeByContain
|
|
|
50
50
|
export { default as adjustRangeToRotation } from './adjustRangeToRotation';
|
|
51
51
|
export { default as getZeroedRangeOverlaps } from './getZeroedRangeOverlaps';
|
|
52
52
|
export { default as trimAnnStartEndToFitSeqLength } from './trimAnnStartEndToFitSeqLength';
|
|
53
|
-
export * from './types';
|