@teselagen/bio-parsers 0.4.17 → 0.4.19
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 +381 -116
- package/index.js +381 -116
- package/index.umd.cjs +381 -116
- package/package.json +3 -3
- package/src/genbankToJson.js +1 -0
- package/index.mjs +0 -32872
- package/index.umd.js +0 -32876
package/index.umd.cjs
CHANGED
|
@@ -1400,14 +1400,14 @@ var __async = (__this, __arguments, generator) => {
|
|
|
1400
1400
|
__name(baseIsSet, "baseIsSet");
|
|
1401
1401
|
var nodeIsSet = nodeUtil && nodeUtil.isSet;
|
|
1402
1402
|
var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
|
|
1403
|
-
var CLONE_DEEP_FLAG$2 = 1, CLONE_FLAT_FLAG$1 = 2, CLONE_SYMBOLS_FLAG$
|
|
1403
|
+
var CLONE_DEEP_FLAG$2 = 1, CLONE_FLAT_FLAG$1 = 2, CLONE_SYMBOLS_FLAG$3 = 4;
|
|
1404
1404
|
var argsTag$1 = "[object Arguments]", arrayTag$1 = "[object Array]", boolTag$1 = "[object Boolean]", dateTag$1 = "[object Date]", errorTag$1 = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag$1 = "[object Map]", numberTag$1 = "[object Number]", objectTag$1 = "[object Object]", regexpTag$1 = "[object RegExp]", setTag$1 = "[object Set]", stringTag$1 = "[object String]", symbolTag$1 = "[object Symbol]", weakMapTag = "[object WeakMap]";
|
|
1405
1405
|
var arrayBufferTag$1 = "[object ArrayBuffer]", dataViewTag$1 = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
|
|
1406
1406
|
var cloneableTags = {};
|
|
1407
1407
|
cloneableTags[argsTag$1] = cloneableTags[arrayTag$1] = cloneableTags[arrayBufferTag$1] = cloneableTags[dataViewTag$1] = cloneableTags[boolTag$1] = cloneableTags[dateTag$1] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag$1] = cloneableTags[numberTag$1] = cloneableTags[objectTag$1] = cloneableTags[regexpTag$1] = cloneableTags[setTag$1] = cloneableTags[stringTag$1] = cloneableTags[symbolTag$1] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
|
|
1408
1408
|
cloneableTags[errorTag$1] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
|
|
1409
1409
|
function baseClone(value, bitmask, customizer, key, object, stack) {
|
|
1410
|
-
var result, isDeep = bitmask & CLONE_DEEP_FLAG$2, isFlat = bitmask & CLONE_FLAT_FLAG$1, isFull = bitmask & CLONE_SYMBOLS_FLAG$
|
|
1410
|
+
var result, isDeep = bitmask & CLONE_DEEP_FLAG$2, isFlat = bitmask & CLONE_FLAT_FLAG$1, isFull = bitmask & CLONE_SYMBOLS_FLAG$3;
|
|
1411
1411
|
if (customizer) {
|
|
1412
1412
|
result = object ? customizer(value, key, object, stack) : customizer(value);
|
|
1413
1413
|
}
|
|
@@ -1467,6 +1467,11 @@ var __async = (__this, __arguments, generator) => {
|
|
|
1467
1467
|
return result;
|
|
1468
1468
|
}
|
|
1469
1469
|
__name(baseClone, "baseClone");
|
|
1470
|
+
var CLONE_SYMBOLS_FLAG$2 = 4;
|
|
1471
|
+
function clone(value) {
|
|
1472
|
+
return baseClone(value, CLONE_SYMBOLS_FLAG$2);
|
|
1473
|
+
}
|
|
1474
|
+
__name(clone, "clone");
|
|
1470
1475
|
var CLONE_DEEP_FLAG$1 = 1, CLONE_SYMBOLS_FLAG$1 = 4;
|
|
1471
1476
|
function cloneDeep(value) {
|
|
1472
1477
|
return baseClone(value, CLONE_DEEP_FLAG$1 | CLONE_SYMBOLS_FLAG$1);
|
|
@@ -2409,6 +2414,45 @@ var __async = (__this, __arguments, generator) => {
|
|
|
2409
2414
|
}
|
|
2410
2415
|
}
|
|
2411
2416
|
__name(trimRangeByAnotherRange, "trimRangeByAnotherRange");
|
|
2417
|
+
function provideInclusiveOptions(funToWrap) {
|
|
2418
|
+
return function() {
|
|
2419
|
+
const args = Array.prototype.slice.call(arguments);
|
|
2420
|
+
const options = args[args.length - 1];
|
|
2421
|
+
if (options && (options.inclusive1BasedEnd || options.inclusive1BasedStart)) {
|
|
2422
|
+
args.forEach(function(arg, index) {
|
|
2423
|
+
if (arg && arg.start > -1 && options.inclusive1BasedStart) {
|
|
2424
|
+
args[index] = assign(arg, { start: arg.start - 1 });
|
|
2425
|
+
}
|
|
2426
|
+
if (arg && arg.end > -1 && options.inclusive1BasedEnd) {
|
|
2427
|
+
args[index] = assign(arg, { end: arg.end - 1 });
|
|
2428
|
+
}
|
|
2429
|
+
});
|
|
2430
|
+
}
|
|
2431
|
+
let returnVal = funToWrap.apply(this, args);
|
|
2432
|
+
if (returnVal && returnVal.start > -1 && options && options.inclusive1BasedStart) {
|
|
2433
|
+
returnVal = assign(returnVal, { start: returnVal.start + 1 });
|
|
2434
|
+
}
|
|
2435
|
+
if (returnVal && returnVal.end > -1 && options && options.inclusive1BasedEnd) {
|
|
2436
|
+
returnVal = assign(returnVal, { end: returnVal.end + 1 });
|
|
2437
|
+
}
|
|
2438
|
+
return returnVal;
|
|
2439
|
+
};
|
|
2440
|
+
}
|
|
2441
|
+
__name(provideInclusiveOptions, "provideInclusiveOptions");
|
|
2442
|
+
const getRangeLength = provideInclusiveOptions(getRangeLength$1);
|
|
2443
|
+
function getRangeLength$1(range, rangeMax) {
|
|
2444
|
+
let toRet;
|
|
2445
|
+
if (range.end < range.start) {
|
|
2446
|
+
toRet = rangeMax - range.start + range.end + 1;
|
|
2447
|
+
} else {
|
|
2448
|
+
toRet = range.end - range.start + 1;
|
|
2449
|
+
}
|
|
2450
|
+
if (range.overlapsSelf && rangeMax) {
|
|
2451
|
+
toRet += rangeMax;
|
|
2452
|
+
}
|
|
2453
|
+
return toRet;
|
|
2454
|
+
}
|
|
2455
|
+
__name(getRangeLength$1, "getRangeLength$1");
|
|
2412
2456
|
function isRangeWithinRange(rangeToCheck, containingRange, maxLength) {
|
|
2413
2457
|
const ranges = trimRangeByAnotherRange(
|
|
2414
2458
|
rangeToCheck,
|
|
@@ -2420,6 +2464,22 @@ var __async = (__this, __arguments, generator) => {
|
|
|
2420
2464
|
return !ranges;
|
|
2421
2465
|
}
|
|
2422
2466
|
__name(isRangeWithinRange, "isRangeWithinRange");
|
|
2467
|
+
function isPositionWithinRange(position, range, sequenceLength, includeStartEdge, includeEndEdge) {
|
|
2468
|
+
const ranges = splitRangeIntoTwoPartsIfItIsCircular(range, sequenceLength);
|
|
2469
|
+
const positionFits = ranges.some(function(range2) {
|
|
2470
|
+
if (position < range2.start) {
|
|
2471
|
+
return false;
|
|
2472
|
+
} else {
|
|
2473
|
+
if (position <= range2.end) {
|
|
2474
|
+
return true;
|
|
2475
|
+
} else {
|
|
2476
|
+
return false;
|
|
2477
|
+
}
|
|
2478
|
+
}
|
|
2479
|
+
});
|
|
2480
|
+
return positionFits;
|
|
2481
|
+
}
|
|
2482
|
+
__name(isPositionWithinRange, "isPositionWithinRange");
|
|
2423
2483
|
function normalizePositionByRangeLength(pPosition, sequenceLength, isInBetweenPositions) {
|
|
2424
2484
|
let position = pPosition;
|
|
2425
2485
|
if (position < 0) {
|
|
@@ -2430,6 +2490,23 @@ var __async = (__this, __arguments, generator) => {
|
|
|
2430
2490
|
return position < 0 ? 0 : position > sequenceLength - 1 ? sequenceLength - 1 : position;
|
|
2431
2491
|
}
|
|
2432
2492
|
__name(normalizePositionByRangeLength, "normalizePositionByRangeLength");
|
|
2493
|
+
function normalizeRange(range, sequenceLength) {
|
|
2494
|
+
return assign({}, range, {
|
|
2495
|
+
start: normalizePositionByRangeLength(range.start, sequenceLength),
|
|
2496
|
+
end: normalizePositionByRangeLength(range.end, sequenceLength)
|
|
2497
|
+
});
|
|
2498
|
+
}
|
|
2499
|
+
__name(normalizeRange, "normalizeRange");
|
|
2500
|
+
function expandOrContractRangeByLength(range, shiftBy, shiftStart, sequenceLength) {
|
|
2501
|
+
const rangeToReturn = clone(range);
|
|
2502
|
+
if (shiftStart) {
|
|
2503
|
+
rangeToReturn.start -= shiftBy;
|
|
2504
|
+
} else {
|
|
2505
|
+
rangeToReturn.end += shiftBy;
|
|
2506
|
+
}
|
|
2507
|
+
return normalizeRange(rangeToReturn, sequenceLength);
|
|
2508
|
+
}
|
|
2509
|
+
__name(expandOrContractRangeByLength, "expandOrContractRangeByLength");
|
|
2433
2510
|
function translateRange(rangeToBeAdjusted, translateBy, rangeLength) {
|
|
2434
2511
|
return assign({}, rangeToBeAdjusted, {
|
|
2435
2512
|
start: normalizePositionByRangeLength(
|
|
@@ -2443,6 +2520,118 @@ var __async = (__this, __arguments, generator) => {
|
|
|
2443
2520
|
});
|
|
2444
2521
|
}
|
|
2445
2522
|
__name(translateRange, "translateRange");
|
|
2523
|
+
function flipRelativeRange(innerRange, outerRange, sequenceLength) {
|
|
2524
|
+
const isFullyContained = isRangeWithinRange(
|
|
2525
|
+
innerRange,
|
|
2526
|
+
outerRange,
|
|
2527
|
+
sequenceLength
|
|
2528
|
+
);
|
|
2529
|
+
if (isFullyContained) {
|
|
2530
|
+
return flipFullyContainedRange(innerRange, outerRange, sequenceLength);
|
|
2531
|
+
} else {
|
|
2532
|
+
return flipNonFullyContainedRange(innerRange, outerRange, sequenceLength);
|
|
2533
|
+
}
|
|
2534
|
+
}
|
|
2535
|
+
__name(flipRelativeRange, "flipRelativeRange");
|
|
2536
|
+
function flipNonFullyContainedRange(innerRange, outerRange, sequenceLength) {
|
|
2537
|
+
const outerFullyContained = isRangeWithinRange(
|
|
2538
|
+
outerRange,
|
|
2539
|
+
innerRange,
|
|
2540
|
+
sequenceLength
|
|
2541
|
+
);
|
|
2542
|
+
let flippedInnerRange;
|
|
2543
|
+
if (outerFullyContained) {
|
|
2544
|
+
const expandBy1 = getRangeLength(
|
|
2545
|
+
{
|
|
2546
|
+
start: innerRange.start,
|
|
2547
|
+
end: outerRange.start
|
|
2548
|
+
},
|
|
2549
|
+
sequenceLength
|
|
2550
|
+
) - 1;
|
|
2551
|
+
flippedInnerRange = expandOrContractRangeByLength(
|
|
2552
|
+
outerRange,
|
|
2553
|
+
expandBy1,
|
|
2554
|
+
false,
|
|
2555
|
+
sequenceLength
|
|
2556
|
+
);
|
|
2557
|
+
const expandBy2 = getRangeLength(
|
|
2558
|
+
{
|
|
2559
|
+
end: innerRange.end,
|
|
2560
|
+
start: outerRange.end
|
|
2561
|
+
},
|
|
2562
|
+
sequenceLength
|
|
2563
|
+
) - 1;
|
|
2564
|
+
flippedInnerRange = expandOrContractRangeByLength(
|
|
2565
|
+
flippedInnerRange,
|
|
2566
|
+
expandBy2,
|
|
2567
|
+
true,
|
|
2568
|
+
sequenceLength
|
|
2569
|
+
);
|
|
2570
|
+
} else {
|
|
2571
|
+
const overlaps = getOverlapsOfPotentiallyCircularRanges(
|
|
2572
|
+
innerRange,
|
|
2573
|
+
outerRange,
|
|
2574
|
+
sequenceLength
|
|
2575
|
+
);
|
|
2576
|
+
if (overlaps.length >= 1) {
|
|
2577
|
+
const firstOverlap = overlaps[0];
|
|
2578
|
+
const overlapExtendsForward = firstOverlap.start !== outerRange.start;
|
|
2579
|
+
const flippedTruncatedInner = flipFullyContainedRange(
|
|
2580
|
+
firstOverlap,
|
|
2581
|
+
outerRange,
|
|
2582
|
+
sequenceLength
|
|
2583
|
+
);
|
|
2584
|
+
const lengthToExtend = getRangeLength(innerRange, sequenceLength) - getRangeLength(flippedTruncatedInner, sequenceLength);
|
|
2585
|
+
flippedInnerRange = expandOrContractRangeByLength(
|
|
2586
|
+
flippedTruncatedInner,
|
|
2587
|
+
lengthToExtend,
|
|
2588
|
+
overlapExtendsForward,
|
|
2589
|
+
sequenceLength
|
|
2590
|
+
);
|
|
2591
|
+
} else {
|
|
2592
|
+
throw new Error(
|
|
2593
|
+
"This case (relative ranges that do not overlap) is unsupported! "
|
|
2594
|
+
);
|
|
2595
|
+
}
|
|
2596
|
+
}
|
|
2597
|
+
return flippedInnerRange;
|
|
2598
|
+
}
|
|
2599
|
+
__name(flipNonFullyContainedRange, "flipNonFullyContainedRange");
|
|
2600
|
+
function flipFullyContainedRange(innerRange, outerRange, sequenceLength) {
|
|
2601
|
+
const translateBy = -outerRange.start;
|
|
2602
|
+
const translatedOuterRange = translateRange(
|
|
2603
|
+
outerRange,
|
|
2604
|
+
translateBy,
|
|
2605
|
+
sequenceLength
|
|
2606
|
+
);
|
|
2607
|
+
const translatedInnerRange = translateRange(
|
|
2608
|
+
innerRange,
|
|
2609
|
+
translateBy,
|
|
2610
|
+
sequenceLength
|
|
2611
|
+
);
|
|
2612
|
+
const translatedFlippedInnerRange = flipNonOriginSpanningContainedRange(
|
|
2613
|
+
translatedInnerRange,
|
|
2614
|
+
translatedOuterRange,
|
|
2615
|
+
sequenceLength
|
|
2616
|
+
);
|
|
2617
|
+
const flippedInnerRange = translateRange(
|
|
2618
|
+
translatedFlippedInnerRange,
|
|
2619
|
+
-translateBy,
|
|
2620
|
+
sequenceLength
|
|
2621
|
+
);
|
|
2622
|
+
return flippedInnerRange;
|
|
2623
|
+
}
|
|
2624
|
+
__name(flipFullyContainedRange, "flipFullyContainedRange");
|
|
2625
|
+
function flipNonOriginSpanningContainedRange(innerRange, outerRange, sequenceLength) {
|
|
2626
|
+
const offsetFromStart = innerRange.start - outerRange.start;
|
|
2627
|
+
const newInnerEnd = outerRange.end - offsetFromStart;
|
|
2628
|
+
const innerRangeLength = getRangeLength(innerRange, sequenceLength);
|
|
2629
|
+
return {
|
|
2630
|
+
end: newInnerEnd,
|
|
2631
|
+
start: newInnerEnd - (innerRangeLength - 1)
|
|
2632
|
+
};
|
|
2633
|
+
}
|
|
2634
|
+
__name(flipNonOriginSpanningContainedRange, "flipNonOriginSpanningContainedRange");
|
|
2446
2635
|
function getSequenceWithinRange(range, sequence) {
|
|
2447
2636
|
if (range.start < 0 || range.end < 0)
|
|
2448
2637
|
return "";
|
|
@@ -3246,7 +3435,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
3246
3435
|
return new RegExp(regexMatch[1], regexMatch[2]);
|
|
3247
3436
|
}
|
|
3248
3437
|
__name(cloneRegExp2, "cloneRegExp");
|
|
3249
|
-
function
|
|
3438
|
+
function clone2(arg) {
|
|
3250
3439
|
if ((typeof arg === "undefined" ? "undefined" : _typeof(arg)) !== "object") {
|
|
3251
3440
|
return arg;
|
|
3252
3441
|
}
|
|
@@ -3254,7 +3443,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
3254
3443
|
return null;
|
|
3255
3444
|
}
|
|
3256
3445
|
if (isArray2(arg)) {
|
|
3257
|
-
return arg.map(
|
|
3446
|
+
return arg.map(clone2);
|
|
3258
3447
|
}
|
|
3259
3448
|
if (arg instanceof Date) {
|
|
3260
3449
|
return new Date(arg.getTime());
|
|
@@ -3265,12 +3454,12 @@ var __async = (__this, __arguments, generator) => {
|
|
|
3265
3454
|
var cloned = {};
|
|
3266
3455
|
for (var name2 in arg) {
|
|
3267
3456
|
if (Object.prototype.hasOwnProperty.call(arg, name2)) {
|
|
3268
|
-
cloned[name2] =
|
|
3457
|
+
cloned[name2] = clone2(arg[name2]);
|
|
3269
3458
|
}
|
|
3270
3459
|
}
|
|
3271
3460
|
return cloned;
|
|
3272
3461
|
}
|
|
3273
|
-
__name(
|
|
3462
|
+
__name(clone2, "clone");
|
|
3274
3463
|
var DiffContext = function(_Context) {
|
|
3275
3464
|
inherits2(DiffContext2, _Context);
|
|
3276
3465
|
function DiffContext2(left, right) {
|
|
@@ -3286,7 +3475,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
3286
3475
|
key: "setResult",
|
|
3287
3476
|
value: /* @__PURE__ */ __name(function setResult(result) {
|
|
3288
3477
|
if (this.options.cloneDiffValues && (typeof result === "undefined" ? "undefined" : _typeof(result)) === "object") {
|
|
3289
|
-
var clone$$1 = typeof this.options.cloneDiffValues === "function" ? this.options.cloneDiffValues :
|
|
3478
|
+
var clone$$1 = typeof this.options.cloneDiffValues === "function" ? this.options.cloneDiffValues : clone2;
|
|
3290
3479
|
if (_typeof(result[0]) === "object") {
|
|
3291
3480
|
result[0] = clone$$1(result[0]);
|
|
3292
3481
|
}
|
|
@@ -5598,7 +5787,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
5598
5787
|
}, {
|
|
5599
5788
|
key: "clone",
|
|
5600
5789
|
value: /* @__PURE__ */ __name(function clone$$1(value) {
|
|
5601
|
-
return
|
|
5790
|
+
return clone2(value);
|
|
5602
5791
|
}, "clone$$1")
|
|
5603
5792
|
}]);
|
|
5604
5793
|
return DiffPatcher2;
|
|
@@ -7122,123 +7311,167 @@ var __async = (__this, __arguments, generator) => {
|
|
|
7122
7311
|
return proteinAlphabet[letter.toUpperCase()];
|
|
7123
7312
|
}
|
|
7124
7313
|
__name(getAminoAcidFromSequenceTriplet, "getAminoAcidFromSequenceTriplet");
|
|
7125
|
-
function
|
|
7314
|
+
function getNextTriplet(index, sequenceString, exonRange) {
|
|
7315
|
+
let triplet = "";
|
|
7316
|
+
let internalIndex;
|
|
7317
|
+
const codonPositions = [];
|
|
7318
|
+
const isBaseInExon = /* @__PURE__ */ __name((baseIndex) => exonRange.some(
|
|
7319
|
+
(r) => isPositionWithinRange(baseIndex, r, sequenceString.length)
|
|
7320
|
+
), "isBaseInExon");
|
|
7321
|
+
for (internalIndex = index; internalIndex < sequenceString.length; internalIndex++) {
|
|
7322
|
+
if (triplet.length === 3) {
|
|
7323
|
+
break;
|
|
7324
|
+
}
|
|
7325
|
+
if (isBaseInExon(internalIndex)) {
|
|
7326
|
+
triplet += sequenceString[internalIndex];
|
|
7327
|
+
codonPositions.push(internalIndex);
|
|
7328
|
+
}
|
|
7329
|
+
}
|
|
7330
|
+
return { triplet, basesRead: internalIndex - index, codonPositions };
|
|
7331
|
+
}
|
|
7332
|
+
__name(getNextTriplet, "getNextTriplet");
|
|
7333
|
+
function getTranslatedSequenceProperties(originalSequenceString, forward, optionalSubrangeRange, isProteinSequence) {
|
|
7126
7334
|
const originalSequenceStringLength = isProteinSequence ? originalSequenceString.length * 3 : originalSequenceString.length;
|
|
7127
7335
|
let sequenceString = originalSequenceString;
|
|
7128
|
-
|
|
7336
|
+
const translationRange = { start: 0, end: originalSequenceStringLength - 1 };
|
|
7129
7337
|
if (optionalSubrangeRange) {
|
|
7130
7338
|
sequenceString = getSequenceWithinRange(
|
|
7131
7339
|
optionalSubrangeRange,
|
|
7132
7340
|
originalSequenceString
|
|
7133
7341
|
);
|
|
7134
|
-
|
|
7342
|
+
translationRange.start = optionalSubrangeRange.start;
|
|
7343
|
+
translationRange.end = optionalSubrangeRange.end;
|
|
7135
7344
|
}
|
|
7136
7345
|
const sequenceStringLength = isProteinSequence ? sequenceString.length * 3 : sequenceString.length;
|
|
7137
|
-
|
|
7138
|
-
|
|
7139
|
-
|
|
7140
|
-
|
|
7141
|
-
|
|
7142
|
-
|
|
7143
|
-
|
|
7144
|
-
|
|
7145
|
-
{
|
|
7146
|
-
start: 0,
|
|
7147
|
-
end: revCompGapLength - 1
|
|
7148
|
-
},
|
|
7149
|
-
startOffset,
|
|
7346
|
+
if (!isProteinSequence && !forward) {
|
|
7347
|
+
sequenceString = getReverseComplementSequenceString(sequenceString);
|
|
7348
|
+
}
|
|
7349
|
+
const absoluteExonRange = !isProteinSequence && optionalSubrangeRange && optionalSubrangeRange.locations ? optionalSubrangeRange.locations : [translationRange];
|
|
7350
|
+
const exonRange = absoluteExonRange.map((range) => {
|
|
7351
|
+
let outputRange = translateRange(
|
|
7352
|
+
range,
|
|
7353
|
+
-translationRange.start,
|
|
7150
7354
|
originalSequenceStringLength
|
|
7151
7355
|
);
|
|
7152
|
-
if (
|
|
7153
|
-
|
|
7154
|
-
|
|
7155
|
-
|
|
7156
|
-
|
|
7157
|
-
|
|
7158
|
-
aminoAcidIndex,
|
|
7159
|
-
sequenceIndex: codonRange.start + i2,
|
|
7160
|
-
codonRange,
|
|
7161
|
-
fullCodon: false
|
|
7162
|
-
});
|
|
7163
|
-
}
|
|
7164
|
-
aminoAcidIndex--;
|
|
7356
|
+
if (!forward) {
|
|
7357
|
+
outputRange = flipRelativeRange(
|
|
7358
|
+
outputRange,
|
|
7359
|
+
{ start: 0, end: sequenceStringLength - 1 },
|
|
7360
|
+
sequenceStringLength
|
|
7361
|
+
);
|
|
7165
7362
|
}
|
|
7363
|
+
return outputRange;
|
|
7364
|
+
});
|
|
7365
|
+
return {
|
|
7366
|
+
sequenceString,
|
|
7367
|
+
translationRange,
|
|
7368
|
+
sequenceStringLength,
|
|
7369
|
+
originalSequenceStringLength,
|
|
7370
|
+
exonRange
|
|
7371
|
+
};
|
|
7372
|
+
}
|
|
7373
|
+
__name(getTranslatedSequenceProperties, "getTranslatedSequenceProperties");
|
|
7374
|
+
function positionInCdsToPositionInMainSequence(index, forward, translationRange, mainSequenceLength) {
|
|
7375
|
+
let outputRange = translateRange(
|
|
7376
|
+
{ start: index, end: index },
|
|
7377
|
+
translationRange.start,
|
|
7378
|
+
mainSequenceLength
|
|
7379
|
+
);
|
|
7380
|
+
if (!forward) {
|
|
7381
|
+
outputRange = flipRelativeRange(
|
|
7382
|
+
outputRange,
|
|
7383
|
+
translationRange,
|
|
7384
|
+
mainSequenceLength
|
|
7385
|
+
);
|
|
7166
7386
|
}
|
|
7167
|
-
|
|
7387
|
+
return outputRange.start;
|
|
7388
|
+
}
|
|
7389
|
+
__name(positionInCdsToPositionInMainSequence, "positionInCdsToPositionInMainSequence");
|
|
7390
|
+
function getAminoAcidDataForEachBaseOfDna(originalSequenceString, forward, optionalSubrangeRange, isProteinSequence) {
|
|
7391
|
+
const {
|
|
7392
|
+
sequenceString,
|
|
7393
|
+
translationRange,
|
|
7394
|
+
sequenceStringLength,
|
|
7395
|
+
originalSequenceStringLength,
|
|
7396
|
+
exonRange
|
|
7397
|
+
} = getTranslatedSequenceProperties(
|
|
7398
|
+
originalSequenceString,
|
|
7399
|
+
forward,
|
|
7400
|
+
optionalSubrangeRange,
|
|
7401
|
+
isProteinSequence
|
|
7402
|
+
);
|
|
7403
|
+
const aminoAcidDataForEachBaseOfDNA = [];
|
|
7404
|
+
for (let index = 0; index < sequenceStringLength; index += 3) {
|
|
7168
7405
|
let aminoAcid;
|
|
7406
|
+
const aminoAcidIndex = index / 3;
|
|
7407
|
+
let codonPositionsInCDS;
|
|
7408
|
+
let basesRead;
|
|
7169
7409
|
if (isProteinSequence) {
|
|
7170
|
-
|
|
7410
|
+
codonPositionsInCDS = [0, 1, 2].map((i2) => index + i2);
|
|
7411
|
+
basesRead = 3;
|
|
7412
|
+
aminoAcid = proteinAlphabet[sequenceString[index / 3].toUpperCase()];
|
|
7171
7413
|
} else {
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
|
|
7177
|
-
|
|
7178
|
-
|
|
7179
|
-
|
|
7180
|
-
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
|
|
7184
|
-
|
|
7414
|
+
const {
|
|
7415
|
+
triplet,
|
|
7416
|
+
basesRead: _basesRead,
|
|
7417
|
+
codonPositions
|
|
7418
|
+
} = getNextTriplet(index, sequenceString, exonRange);
|
|
7419
|
+
basesRead = _basesRead;
|
|
7420
|
+
codonPositionsInCDS = codonPositions;
|
|
7421
|
+
aminoAcid = triplet.length === 3 ? getAminoAcidFromSequenceTriplet(triplet) : getAminoAcidFromSequenceTriplet("xxx");
|
|
7422
|
+
}
|
|
7423
|
+
const absoluteCodonPositions = codonPositionsInCDS.map(
|
|
7424
|
+
(i2) => positionInCdsToPositionInMainSequence(
|
|
7425
|
+
i2,
|
|
7426
|
+
forward,
|
|
7427
|
+
translationRange,
|
|
7428
|
+
originalSequenceStringLength
|
|
7429
|
+
)
|
|
7185
7430
|
);
|
|
7186
|
-
|
|
7187
|
-
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
|
|
7191
|
-
|
|
7192
|
-
|
|
7193
|
-
|
|
7194
|
-
|
|
7195
|
-
|
|
7196
|
-
|
|
7197
|
-
|
|
7198
|
-
|
|
7199
|
-
|
|
7200
|
-
|
|
7201
|
-
|
|
7202
|
-
|
|
7203
|
-
|
|
7204
|
-
|
|
7205
|
-
|
|
7206
|
-
|
|
7207
|
-
|
|
7208
|
-
|
|
7209
|
-
|
|
7210
|
-
|
|
7211
|
-
|
|
7212
|
-
|
|
7213
|
-
|
|
7214
|
-
|
|
7215
|
-
|
|
7216
|
-
|
|
7431
|
+
const codonRange = forward ? {
|
|
7432
|
+
start: absoluteCodonPositions[0],
|
|
7433
|
+
end: absoluteCodonPositions[codonPositionsInCDS.length - 1]
|
|
7434
|
+
} : {
|
|
7435
|
+
start: absoluteCodonPositions[codonPositionsInCDS.length - 1],
|
|
7436
|
+
end: absoluteCodonPositions[0]
|
|
7437
|
+
};
|
|
7438
|
+
let positionInCodon = 0;
|
|
7439
|
+
for (let i2 = 0; i2 < basesRead; i2++) {
|
|
7440
|
+
const posInCds = i2 + index;
|
|
7441
|
+
if (codonPositionsInCDS.includes(posInCds)) {
|
|
7442
|
+
aminoAcidDataForEachBaseOfDNA.push({
|
|
7443
|
+
aminoAcid,
|
|
7444
|
+
positionInCodon,
|
|
7445
|
+
aminoAcidIndex,
|
|
7446
|
+
sequenceIndex: absoluteCodonPositions[i2],
|
|
7447
|
+
codonRange,
|
|
7448
|
+
fullCodon: codonPositionsInCDS.length === 3
|
|
7449
|
+
});
|
|
7450
|
+
positionInCodon++;
|
|
7451
|
+
} else {
|
|
7452
|
+
aminoAcidDataForEachBaseOfDNA.push({
|
|
7453
|
+
aminoAcid: null,
|
|
7454
|
+
positionInCodon: null,
|
|
7455
|
+
aminoAcidIndex: null,
|
|
7456
|
+
sequenceIndex: positionInCdsToPositionInMainSequence(
|
|
7457
|
+
posInCds,
|
|
7458
|
+
forward,
|
|
7459
|
+
translationRange,
|
|
7460
|
+
originalSequenceStringLength
|
|
7461
|
+
),
|
|
7462
|
+
codonRange: null,
|
|
7463
|
+
fullCodon: null
|
|
7464
|
+
});
|
|
7465
|
+
}
|
|
7217
7466
|
}
|
|
7218
|
-
|
|
7219
|
-
const lengthOfEndBpsNotCoveredByAminoAcids = sequenceStringLength - aminoAcidDataForEachBaseOfDNA.length;
|
|
7220
|
-
codonRange = translateRange(
|
|
7221
|
-
{
|
|
7222
|
-
start: sequenceStringLength - lengthOfEndBpsNotCoveredByAminoAcids,
|
|
7223
|
-
end: sequenceStringLength - 1
|
|
7224
|
-
},
|
|
7225
|
-
startOffset,
|
|
7226
|
-
originalSequenceStringLength
|
|
7227
|
-
);
|
|
7228
|
-
for (let j = 0; j < lengthOfEndBpsNotCoveredByAminoAcids; j++) {
|
|
7229
|
-
aminoAcidDataForEachBaseOfDNA.push({
|
|
7230
|
-
aminoAcid: getAminoAcidFromSequenceTriplet("xxx"),
|
|
7231
|
-
//fake xxx triplet returns the gap amino acid
|
|
7232
|
-
positionInCodon: j,
|
|
7233
|
-
aminoAcidIndex,
|
|
7234
|
-
sequenceIndex: codonRange.start + j,
|
|
7235
|
-
fullCodon: false,
|
|
7236
|
-
codonRange
|
|
7237
|
-
});
|
|
7467
|
+
index += basesRead - codonPositionsInCDS.length;
|
|
7238
7468
|
}
|
|
7239
7469
|
if (sequenceStringLength !== aminoAcidDataForEachBaseOfDNA.length) {
|
|
7240
7470
|
throw new Error("something went wrong!");
|
|
7241
7471
|
}
|
|
7472
|
+
if (!forward) {
|
|
7473
|
+
aminoAcidDataForEachBaseOfDNA.reverse();
|
|
7474
|
+
}
|
|
7242
7475
|
return aminoAcidDataForEachBaseOfDNA;
|
|
7243
7476
|
}
|
|
7244
7477
|
__name(getAminoAcidDataForEachBaseOfDna, "getAminoAcidDataForEachBaseOfDna");
|
|
@@ -7684,9 +7917,9 @@ var __async = (__this, __arguments, generator) => {
|
|
|
7684
7917
|
// Helix initiation for deltaS
|
|
7685
7918
|
R: 1.987,
|
|
7686
7919
|
// Gas constant (cal/(K*mol)).
|
|
7687
|
-
|
|
7920
|
+
primerConc: 5e-7,
|
|
7688
7921
|
// Oligo concentration. 0.5uM is typical for PCR.
|
|
7689
|
-
|
|
7922
|
+
monovalentCationConc: 0.05,
|
|
7690
7923
|
// Monovalent salt concentration. 50mM is typical for PCR.
|
|
7691
7924
|
/**
|
|
7692
7925
|
* Calculates temperature for DNA sequence using a given algorithm.
|
|
@@ -7694,10 +7927,11 @@ var __async = (__this, __arguments, generator) => {
|
|
|
7694
7927
|
* type - Either Teselagen.bio.tools.TemperatureCalculator.TABLE_BRESLAUER, TABLE_SUGIMOTO, or TABLE_UNIFIED
|
|
7695
7928
|
* A - Helix initation for deltaS. Defaults to -10.8.
|
|
7696
7929
|
* R - The gas constant, in cal/(K*mol). Defaults to 0.5e-6M.
|
|
7697
|
-
*
|
|
7930
|
+
* monovalentCationConc - THe monovalent salt concentration. Defaults to 50e-3M.
|
|
7698
7931
|
* return - Temperature for the given sequence, in Celsius.
|
|
7699
7932
|
*/
|
|
7700
|
-
calculateTemperature: function(
|
|
7933
|
+
calculateTemperature: function(_sequence, { type, A, R, primerConc, monovalentCationConc } = {}) {
|
|
7934
|
+
const sequence = _sequence.toLowerCase();
|
|
7701
7935
|
if (typeof type === "undefined") {
|
|
7702
7936
|
type = this.TABLE_BRESLAUER;
|
|
7703
7937
|
} else if (type != this.TABLE_BRESLAUER && type != this.TABLE_UNIFIED && type != this.TABLE_SUGIMOTO) {
|
|
@@ -7709,11 +7943,11 @@ var __async = (__this, __arguments, generator) => {
|
|
|
7709
7943
|
if (!R) {
|
|
7710
7944
|
R = this.R;
|
|
7711
7945
|
}
|
|
7712
|
-
if (!
|
|
7713
|
-
|
|
7946
|
+
if (!primerConc) {
|
|
7947
|
+
primerConc = this.primerConc;
|
|
7714
7948
|
}
|
|
7715
|
-
if (!
|
|
7716
|
-
|
|
7949
|
+
if (!monovalentCationConc) {
|
|
7950
|
+
monovalentCationConc = this.monovalentCationConc;
|
|
7717
7951
|
}
|
|
7718
7952
|
const sequenceLength = sequence.length;
|
|
7719
7953
|
if (sequenceLength == 0) {
|
|
@@ -7744,11 +7978,8 @@ var __async = (__this, __arguments, generator) => {
|
|
|
7744
7978
|
sumDeltaH = sumDeltaH + neighbors[i2] * deltaHTable[i2];
|
|
7745
7979
|
sumDeltaS = sumDeltaS + neighbors[i2] * deltaSTable[i2];
|
|
7746
7980
|
}
|
|
7747
|
-
const temperature = -1e3 * sumDeltaH / (A + -sumDeltaS + R * Math.log(
|
|
7748
|
-
|
|
7749
|
-
return 0;
|
|
7750
|
-
}
|
|
7751
|
-
return temperature.toFixed(2);
|
|
7981
|
+
const temperature = -1e3 * sumDeltaH / (A + -sumDeltaS + R * Math.log(primerConc / 4)) - 273.15 + 16.6 * Math.LOG10E * Math.log(monovalentCationConc);
|
|
7982
|
+
return temperature;
|
|
7752
7983
|
},
|
|
7753
7984
|
/**
|
|
7754
7985
|
* @private
|
|
@@ -7818,6 +8049,39 @@ var __async = (__this, __arguments, generator) => {
|
|
|
7818
8049
|
return null;
|
|
7819
8050
|
}
|
|
7820
8051
|
},
|
|
8052
|
+
// "AA/TT": -7.9, 7.9
|
|
8053
|
+
// "AT/TA": -7.2, 7.2
|
|
8054
|
+
// "AC/TG": -8.4, 8.4
|
|
8055
|
+
// "AG/TC": -7.8, 7.8
|
|
8056
|
+
// "TT/AA": -7.9, 7.9
|
|
8057
|
+
// "TA/AT": -7.2, 7.2
|
|
8058
|
+
// "TG/AC": -8.5, 8.2
|
|
8059
|
+
// "TC/AG": -8.2, 8.5
|
|
8060
|
+
// "CC/GG": -8.0, 8.0
|
|
8061
|
+
// "CA/GT": -8.5, 8.5
|
|
8062
|
+
// "CT/GA": -7.8, 7.8
|
|
8063
|
+
// "CG/GC": -10.6, 10.6
|
|
8064
|
+
// "GG/CC": -8.0, 8.0
|
|
8065
|
+
// "GA/CT": -8.2, 8.2,
|
|
8066
|
+
// "GT/CA": -8.4, 8.4
|
|
8067
|
+
// "GC/CG": -9.8, 9.8
|
|
8068
|
+
// aa, at, ac, ag, tt, ta, tc, tg, cc, ca, ct, cg, gg, ga, gt, gc
|
|
8069
|
+
// "AA/TT": -22.2,22.2,
|
|
8070
|
+
// "AT/TA": -20.4,20.4,
|
|
8071
|
+
// "AC/TG": -22.4,22.4,
|
|
8072
|
+
// "AG/TC": -21.0,21.0,
|
|
8073
|
+
// "TT/AA": -22.2,22.2,
|
|
8074
|
+
// "TA/AT": -21.3,21.3,
|
|
8075
|
+
// "TC/AG": -22.2,22.2,
|
|
8076
|
+
// "TG/AC": -22.7,22.7,
|
|
8077
|
+
// "CC/GG": -19.9,19.9,
|
|
8078
|
+
// "CA/GT": -22.7,22.7,
|
|
8079
|
+
// "CT/GA": -21.0,21.0,
|
|
8080
|
+
// "CG/GC": -27.2,27.2,
|
|
8081
|
+
// "GG/CC": -19.9,19.9,
|
|
8082
|
+
// "GT/CA": -22.4,22.2,
|
|
8083
|
+
// "GA/CT": -22.2,22.4,
|
|
8084
|
+
// "GC/CG": -24.4,24.4
|
|
7821
8085
|
/**
|
|
7822
8086
|
* @private
|
|
7823
8087
|
* Function to return deltaS table for given algorithm.
|
|
@@ -16208,6 +16472,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
16208
16472
|
const feat = getCurrentFeature();
|
|
16209
16473
|
feat.type = key;
|
|
16210
16474
|
feat.strand = strand;
|
|
16475
|
+
feat.forward = strand === 1;
|
|
16211
16476
|
feat.locations = feat.locations.concat(
|
|
16212
16477
|
parseFeatureLocation(
|
|
16213
16478
|
val2,
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teselagen/bio-parsers",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.19",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@teselagen/sequence-utils": "0.3.
|
|
5
|
+
"@teselagen/sequence-utils": "0.3.25",
|
|
6
6
|
"@teselagen/range-utils": "0.3.7",
|
|
7
7
|
"@gmod/gff": "^1.2.1",
|
|
8
8
|
"buffer": "^6.0.3",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"color": "^4.2.3",
|
|
11
11
|
"fast-xml-parser": "^4.2.5",
|
|
12
12
|
"fflate": "^0.8.0",
|
|
13
|
-
"lodash": "^4.17.21",
|
|
13
|
+
"lodash-es": "^4.17.21",
|
|
14
14
|
"string_decoder": "^1.3.0",
|
|
15
15
|
"validate.io-nonnegative-integer-array": "^1.0.1"
|
|
16
16
|
},
|
package/src/genbankToJson.js
CHANGED