From e5e0f6d49aa617032c09a7667bfb26572e34121e Mon Sep 17 00:00:00 2001 From: Thomas Rich Date: Thu, 23 Sep 2021 14:53:40 -0700 Subject: [PATCH] updating deps; removing validate.io-nonnegative-integer-array --- package.json | 6 ++-- src/getOrfsFromSequence.js | 1 - src/mapAnnotationsToRows.js | 19 +------------ src/tidyUpAnnotation.js | 13 +++++++-- src/tidyUpSequenceData.js | 3 +- src/tidyUpSequenceData.test.js | 2 +- yarn.lock | 51 +++------------------------------- 7 files changed, 19 insertions(+), 76 deletions(-) diff --git a/package.json b/package.json index 894d4b7..08de517 100644 --- a/package.json +++ b/package.json @@ -39,8 +39,7 @@ "bson-objectid": "^1.1.1", "escape-string-regexp": "^1.0.5", "jsondiffpatch": "^0.3.11", - "string-splice": "^1.3.0", - "validate.io-nonnegative-integer-array": "^1.0.1" + "string-splice": "^1.3.0" }, "devDependencies": { "@types/jest": "^23.3.11", @@ -59,7 +58,6 @@ "npm-check": "^5.0.1", "nwb": "^0.23.0", "prettier": "^1.15.3", - "ve-range-utils": "2.5.5", - "ve-sequence-utils": "^3.3.16" + "ve-range-utils": "2.6.3" } } diff --git a/src/getOrfsFromSequence.js b/src/getOrfsFromSequence.js index 9888e78..438e465 100644 --- a/src/getOrfsFromSequence.js +++ b/src/getOrfsFromSequence.js @@ -1,4 +1,3 @@ -// const areNonNegativeIntegers = require('validate.io-nonnegative-integer-array'); const ObjectId = require("bson-objectid"); const getReverseComplementSequenceString = require("./getReverseComplementSequenceString"); // const ac = require('ve-api-check'); diff --git a/src/mapAnnotationsToRows.js b/src/mapAnnotationsToRows.js index 257d6c9..3a3cc71 100644 --- a/src/mapAnnotationsToRows.js +++ b/src/mapAnnotationsToRows.js @@ -1,13 +1,4 @@ -// const ac = require('ve-api-check'); -// ac.throw([ac.string,ac.bool],arguments); -const { - each, - forEach, - startsWith, - filter - // some, sortBy, uniq -} = require("lodash"); -// const areNonNegativeIntegers = require('validate.io-nonnegative-integer-array'); +const { each, forEach, startsWith, filter } = require("lodash"); const { getYOffsetForPotentiallyCircularRange, splitRangeIntoTwoPartsIfItIsCircular @@ -18,14 +9,6 @@ module.exports = function mapAnnotationsToRows( sequenceLength, bpsPerRow ) { - // ac.throw(ac.arrayOf(ac.shape({ - // start: ac.posInt, - // end: ac.posInt, - // // id: ac.oneOfType([ac.object, ac.string]) - // })), annotations); - // ac.throw(ac.posInt, sequenceLength); - // ac.throw(ac.posInt, bpsPerRow); - const annotationsToRowsMap = {}; const yOffsetLevelMap = {}; const wrappedAnnotations = {}; diff --git a/src/tidyUpAnnotation.js b/src/tidyUpAnnotation.js index 3297422..da098fd 100644 --- a/src/tidyUpAnnotation.js +++ b/src/tidyUpAnnotation.js @@ -1,7 +1,6 @@ const { cloneDeep } = require("lodash"); const FeatureTypes = require("./FeatureTypes.js"); const featureColors = require("./featureColors"); -const areNonNegativeIntegers = require("validate.io-nonnegative-integer-array"); const bsonObjectid = require("bson-objectid"); module.exports = function tidyUpAnnotation( @@ -124,7 +123,11 @@ function coerceLocation({ location.start = location.start * 3; location.end = location.end * 3 + 2; } - if (!areNonNegativeIntegers([location.start]) || location.start > size - 1) { + if ( + location.start < 0 || + !(location.start <= size - 1) || + location.start > size - 1 + ) { messages.push( "Invalid annotation start: " + location.start + @@ -135,7 +138,11 @@ function coerceLocation({ ); //setting it to 0 internally, but users will see it as 1 location.start = size - (isProtein ? 3 : 1); } - if (!areNonNegativeIntegers([location.end]) || location.end > size - 1) { + if ( + location.end < 0 || + !(location.end <= size - 1) || + location.end > size - 1 + ) { messages.push( "Invalid annotation end: " + location.end + diff --git a/src/tidyUpSequenceData.js b/src/tidyUpSequenceData.js index 7a1e6d5..420c111 100644 --- a/src/tidyUpSequenceData.js +++ b/src/tidyUpSequenceData.js @@ -2,7 +2,6 @@ const bsonObjectid = require("bson-objectid"); const getAminoAcidDataForEachBaseOfDna = require("./getAminoAcidDataForEachBaseOfDna"); const { cloneDeep } = require("lodash"); -const areNonNegativeIntegers = require("validate.io-nonnegative-integer-array"); const annotationTypes = require("./annotationTypes"); const filterSequenceString = require("./filterSequenceString"); const tidyUpAnnotation = require("./tidyUpAnnotation"); @@ -140,7 +139,7 @@ module.exports = function tidyUpSequenceData(pSeqData, options = {}) { annotationTypes.forEach(function(name) { seqData[name] = seqData[name].reduce(function(acc, item) { let itemId; - if (areNonNegativeIntegers(item.id) || item.id) { + if (item.id || item.id === 0) { itemId = item.id; } else { itemId = bsonObjectid().str; diff --git a/src/tidyUpSequenceData.test.js b/src/tidyUpSequenceData.test.js index 30426b3..ab7ccf6 100644 --- a/src/tidyUpSequenceData.test.js +++ b/src/tidyUpSequenceData.test.js @@ -14,7 +14,7 @@ describe("tidyUpSequenceData", function() { end: 20, locations: [ { - start: 3, + start: "3", //this should be converted to an int :) end: 5 }, { diff --git a/yarn.lock b/yarn.lock index 90e659d..1d09861 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11004,60 +11004,17 @@ validate-npm-package-license@^3.0.1: spdx-correct "^3.0.0" spdx-expression-parse "^3.0.0" -validate.io-array@^1.0.3: - version "1.0.6" - resolved "https://registry.yarnpkg.com/validate.io-array/-/validate.io-array-1.0.6.tgz#5b5a2cafd8f8b85abb2f886ba153f2d93a27774d" - integrity sha1-W1osr9j4uFq7L4hroVPy2Tond00= - -validate.io-integer@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/validate.io-integer/-/validate.io-integer-1.0.5.tgz#168496480b95be2247ec443f2233de4f89878068" - integrity sha1-FoSWSAuVviJH7EQ/IjPeT4mHgGg= - dependencies: - validate.io-number "^1.0.3" - -validate.io-nonnegative-integer-array@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/validate.io-nonnegative-integer-array/-/validate.io-nonnegative-integer-array-1.0.1.tgz#66330a665f5598b96f25f69081f81f632ea4db4f" - integrity sha1-ZjMKZl9VmLlvJfaQgfgfYy6k208= - dependencies: - validate.io-array "^1.0.3" - validate.io-nonnegative-integer "^1.0.0" - -validate.io-nonnegative-integer@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/validate.io-nonnegative-integer/-/validate.io-nonnegative-integer-1.0.0.tgz#8069243a08c5f98e95413c929dfd7b18f3f6f29f" - integrity sha1-gGkkOgjF+Y6VQTySnf17GPP28p8= - dependencies: - validate.io-integer "^1.0.5" - -validate.io-number@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/validate.io-number/-/validate.io-number-1.0.3.tgz#f63ffeda248bf28a67a8d48e0e3b461a1665baf8" - integrity sha1-9j/+2iSL8opnqNSODjtGGhZluvg= - vary@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw= -ve-range-utils@2.5.5: - version "2.5.5" - resolved "https://registry.yarnpkg.com/ve-range-utils/-/ve-range-utils-2.5.5.tgz#54d8bb442666b10b4cfe9bfef457c3f6cbd7a1a0" - integrity sha512-rxdps7rO3WO0btj5zrR34aPTolYxSHxAPNkX+AyuufaaiggAoinRcsu9Xx1sTmVa7uwQuLeTKr8U7j9VhZAPZw== +ve-range-utils@2.6.3: + version "2.6.3" + resolved "https://registry.yarnpkg.com/ve-range-utils/-/ve-range-utils-2.6.3.tgz#ef7e36efcfba563860f6ff89350ad8f6ae28f244" + integrity sha512-HiUuyaiqKRirrc1/5P4/XpnFOvb1Z+lpcwyHn+mc1LecXipNViBIVfCQU8LIxbScFXuvTzgClS1ywdJRvs6HWA== dependencies: lodash "^4.17.4" - validate.io-nonnegative-integer-array "^1.0.1" - -ve-sequence-utils@^3.3.16: - version "3.3.16" - resolved "https://registry.yarnpkg.com/ve-sequence-utils/-/ve-sequence-utils-3.3.16.tgz#ac1a7bdf4187953b0990b16b3154decd07066a1b" - integrity sha512-JTARqUoYZECY2OpMZFhG6P3+YtpovgNbju36hWeYFaxfMXB8LE7L33BJ4TvIyI+OKP5UCf/gRMZMmTzZUa+9AA== - dependencies: - bson-objectid "^1.1.1" - escape-string-regexp "^1.0.5" - string-splice "^1.3.0" - validate.io-nonnegative-integer-array "^1.0.1" verror@1.10.0: version "1.10.0"