From 4cafa8f41eb76fe1133f1db15fad0342ab248e53 Mon Sep 17 00:00:00 2001 From: Pieter Verschaffelt Date: Fri, 10 Feb 2023 13:39:15 +0100 Subject: [PATCH] Lower the batch size when missed cleavage handling is enabled --- package.json | 1 + src/logic/Utils.ts | 25 +++---------------- src/logic/application/BootstrapApplication.ts | 5 +++- .../analysis/CachedOnlineAnalysisSource.ts | 16 ++++++------ yarn.lock | 5 ++++ 5 files changed, 22 insertions(+), 30 deletions(-) diff --git a/package.json b/package.json index 6840041f..cbb16a57 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "better-sqlite3": "^8.0.1", "check-disk-space": "^3.3.1", "chokidar": "^3.5.3", + "compare-versions": "^6.0.0-rc.1", "core-js": "^3.25.0", "dockerode": "^3.3.4", "electron": "^21.3.3", diff --git a/src/logic/Utils.ts b/src/logic/Utils.ts index 2bc1fbbb..d96a586b 100644 --- a/src/logic/Utils.ts +++ b/src/logic/Utils.ts @@ -1,3 +1,5 @@ +import { compareVersions } from "compare-versions"; + export default class Utils { static isWindows(): boolean { return process.platform === "win32"; @@ -19,28 +21,7 @@ export default class Utils { * @return True if firstVersion is larger than secondVersion */ static isVersionLargerThan(firstVersion: string, secondVersion: string): boolean { - const firstSplitted = firstVersion.split(".").map(x => parseInt(x)); - const secondSplitted = secondVersion.split(".").map(x => parseInt(x)); - - if (firstSplitted.length < secondSplitted.length) { - for (let i = 0; i < secondSplitted.length - firstSplitted.length; i++) { - firstSplitted.push(0); - } - } else if (secondSplitted.length < firstSplitted.length) { - for (let i = 0; i < firstSplitted.length - secondSplitted.length; i++) { - secondSplitted.push(0); - } - } - - for (let part = 0; part < firstSplitted.length; part++) { - if (firstSplitted[part] > secondSplitted[part]) { - return true; - } else if (firstSplitted[part] < secondSplitted[part]) { - return false; - } - } - - return false; + return compareVersions(firstVersion, secondVersion) === 1; } static compareAssays(a: T[], b: T[]): boolean { diff --git a/src/logic/application/BootstrapApplication.ts b/src/logic/application/BootstrapApplication.ts index 29a82848..f25dd5c9 100644 --- a/src/logic/application/BootstrapApplication.ts +++ b/src/logic/application/BootstrapApplication.ts @@ -1,6 +1,6 @@ import ConfigurationManager from "@/logic/configuration/ConfigurationManager"; import Configuration from "@/logic/configuration/Configuration"; -import { NetworkConfiguration, QueueManager } from "unipept-web-components"; +import { NetworkConfiguration, Pept2DataCommunicator, QueueManager } from "unipept-web-components"; import DockerCommunicator from "@/logic/communication/docker/DockerCommunicator"; import { Store } from "vuex"; import ApplicationMigrator from "@/logic/application/ApplicationMigrator"; @@ -20,6 +20,9 @@ export default class BootstrapApplication { * Start and load the different components required for the application to function properly. */ public async loadApplicationComponents(): Promise { + // Hack to lower the amount of peptides sent at the same time to the server + Pept2DataCommunicator.MISSED_CLEAVAGE_BATCH = 5; + await this.runApplicationMigrations(); const config = await this.initializeConfiguration(); this.initializeApi(config); diff --git a/src/logic/communication/analysis/CachedOnlineAnalysisSource.ts b/src/logic/communication/analysis/CachedOnlineAnalysisSource.ts index fdba3f23..7b06288c 100644 --- a/src/logic/communication/analysis/CachedOnlineAnalysisSource.ts +++ b/src/logic/communication/analysis/CachedOnlineAnalysisSource.ts @@ -29,14 +29,16 @@ export default class CachedOnlineAnalysisSource implements AnalysisSource { } public getCommunicationSource() { + const pept2DataCommunicator = new CachedPept2DataCommunicator( + this.assay, + new Pept2DataCommunicator(this.endpoint), + this.dbManager, + this.projectLocation, + this.store + ); + return new ConfigureableCommunicationSource( - new CachedPept2DataCommunicator( - this.assay, - new Pept2DataCommunicator(this.endpoint), - this.dbManager, - this.projectLocation, - this.store - ), + pept2DataCommunicator, new CachedGoResponseCommunicator(), new CachedEcResponseCommunicator(), new CachedInterproResponseCommunicator(), diff --git a/yarn.lock b/yarn.lock index 33204a81..6fc344c2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3215,6 +3215,11 @@ compare-version@^0.1.2: resolved "https://registry.yarnpkg.com/compare-version/-/compare-version-0.1.2.tgz#0162ec2d9351f5ddd59a9202cba935366a725080" integrity sha512-pJDh5/4wrEnXX/VWRZvruAGHkzKdr46z11OlTPN+VrATlWWhSKewNCJ1futCO5C7eJB3nPMFZA1LeYtcFboZ2A== +compare-versions@^6.0.0-rc.1: + version "6.0.0-rc.1" + resolved "https://registry.yarnpkg.com/compare-versions/-/compare-versions-6.0.0-rc.1.tgz#93e6beb8767c2375333ee168fa64c28b75ace2c6" + integrity sha512-cFhkjbGY1jLFWIV7KegECbfuyYPxSGvgGkdkfM+ibboQDoPwg2FRHm5BSNTOApiauRBzJIQH7qvOJs2sW5ueKQ== + compressible@~2.0.16: version "2.0.18" resolved "https://registry.yarnpkg.com/compressible/-/compressible-2.0.18.tgz#af53cca6b070d4c3c0750fbd77286a6d7cc46fba"