From 6aaa5690faccddb948842e677508a882e70442eb Mon Sep 17 00:00:00 2001 From: mderamos Date: Wed, 14 Sep 2022 15:03:10 +0800 Subject: [PATCH 01/11] Add flapjack-bytes dependency IBP-5656 --- src/main/jhipster/package.json | 1 + src/main/jhipster/yarn.lock | 40 ++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/src/main/jhipster/package.json b/src/main/jhipster/package.json index 16558e1e10..2aaf2cb5d8 100644 --- a/src/main/jhipster/package.json +++ b/src/main/jhipster/package.json @@ -27,6 +27,7 @@ "core-js": "2.5.7", "d3": "^5.16.0", "d3-graphviz": "^2.6.1", + "flapjack-bytes": "git+https://github.com/cropgeeks/flapjack-bytes.git", "font-awesome": "4.7.0", "jquery": "3.2.1", "leaflet": "1.7.1", diff --git a/src/main/jhipster/yarn.lock b/src/main/jhipster/yarn.lock index 00fce889b1..a8298eefce 100644 --- a/src/main/jhipster/yarn.lock +++ b/src/main/jhipster/yarn.lock @@ -957,6 +957,13 @@ aws4@^1.2.1, aws4@^1.8.0: version "1.9.1" resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.9.1.tgz#7e33d8f7d449b3f673cd72deb9abdc552dbe528e" +axios@^0.19.0: + version "0.19.2" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.19.2.tgz#3ea36c5d8818d0d5f8a8a97a6d36b86cdc00cb27" + integrity sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA== + dependencies: + follow-redirects "1.5.10" + axios@^0.21.1: version "0.21.1" resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8" @@ -3453,6 +3460,13 @@ debug@2.6.8: dependencies: ms "2.0.0" +debug@=3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" + integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g== + dependencies: + ms "2.0.0" + debug@^3.0.0, debug@^3.1.0, debug@^3.1.1: version "3.2.6" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" @@ -4651,6 +4665,13 @@ first-chunk-stream@^2.0.0: dependencies: readable-stream "^2.0.2" +"flapjack-bytes@git+https://github.com/cropgeeks/flapjack-bytes.git": + version "0.1.0" + resolved "git+https://github.com/cropgeeks/flapjack-bytes.git#0f0283c6118b2a03c28309aeb5e91fda1215ee05" + dependencies: + axios "^0.19.0" + node-interval-tree "^1.3.3" + flatten@^1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.3.tgz#c1283ac9f27b368abc1e36d1ff7b04501a30356b" @@ -4667,6 +4688,13 @@ flush-write-stream@^1.0.0: inherits "^2.0.3" readable-stream "^2.3.6" +follow-redirects@1.5.10: + version "1.5.10" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.10.tgz#7b7a9f9aea2fdff36786a94ff643ed07f4ff5e2a" + integrity sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ== + dependencies: + debug "=3.1.0" + follow-redirects@^1.0.0: version "1.9.0" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.9.0.tgz#8d5bcdc65b7108fe1508649c79c12d732dcedb4f" @@ -7617,6 +7645,13 @@ node-forge@0.9.0: version "0.9.0" resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.9.0.tgz#d624050edbb44874adca12bb9a52ec63cb782579" +node-interval-tree@^1.3.3: + version "1.3.3" + resolved "https://registry.yarnpkg.com/node-interval-tree/-/node-interval-tree-1.3.3.tgz#15ffb904cde08270214acace8dc7653e89ae32b7" + integrity sha512-K9vk96HdTK5fEipJwxSvIIqwTqr4e3HRJeJrNxBSeVMNSC/JWARRaX7etOLOuTmrRMeOI/K5TCJu3aWIwZiNTw== + dependencies: + shallowequal "^1.0.2" + node-libs-browser@^2.0.0: version "2.2.1" resolved "https://registry.yarnpkg.com/node-libs-browser/-/node-libs-browser-2.2.1.tgz#b64f513d18338625f90346d27b0d235e631f6425" @@ -9911,6 +9946,11 @@ shallow-clone@^3.0.0: dependencies: kind-of "^6.0.2" +shallowequal@^1.0.2: + version "1.1.0" + resolved "https://registry.yarnpkg.com/shallowequal/-/shallowequal-1.1.0.tgz#188d521de95b9087404fd4dcb68b13df0ae4e7f8" + integrity sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ== + shebang-command@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" From eef856a377b34baf75f52c1d5c09f61c41c42906 Mon Sep 17 00:00:00 2001 From: mderamos Date: Wed, 14 Sep 2022 15:03:58 +0800 Subject: [PATCH 02/11] Integrate flapjack-bytes to show genotyping visualization IBP-5656 --- .../genotyping/genotyping-pane.component.html | 47 +------------------ .../genotyping/genotyping-pane.component.ts | 23 +++++---- src/main/web/yarn.lock | 6 +-- 3 files changed, 18 insertions(+), 58 deletions(-) diff --git a/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.html b/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.html index e23fce5945..d810612ae5 100644 --- a/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.html +++ b/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.html @@ -99,53 +99,10 @@
- -
- - - - - - - - - - - - - -
MarkerGenotype Call
{{item?.variantName}}{{item?.genotype?.values[0]}}
-
-
-
-
-
-
-
- -
-
-
-
-
-
+
+
- - - - - - - - - - - - -
-
diff --git a/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts b/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts index 2ed237087a..0444ea98bd 100644 --- a/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts +++ b/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts @@ -17,6 +17,7 @@ import { Sample } from '../../entities/sample'; import { SearchGermplasmRequest } from '../../shared/brapi/model/germplasm/search-germplasm-request'; import { JhiAlertService } from 'ng-jhipster'; import { SearchSamplesRequest } from '../../shared/brapi/model/samples/search-samples-request'; +const flapjack = require('flapjack-bytes/src/flapjack-bytes'); @Component({ selector: 'jhi-genotyping-pane', @@ -169,16 +170,18 @@ export class GenotypingPaneComponent implements OnInit { } selectVariantsetOnChange() { - this.genotypingBrapiService.searchCallsets({ - variantSetDbIds: [this.selectedVariantSet.variantSetDbId], - germplasmDbIds: [this.genotypingGermplasm.germplasmDbId] - }).subscribe((brapiResponse) => { - if (brapiResponse && brapiResponse.result.data.length) { - this.genotypingCallSet = brapiResponse.result.data[0]; - this.loadGenotypingCalls(); - } else { - this.alertService.error('genotyping.no.genotyping.callsets.found'); - } + const renderer = flapjack.default(); + renderer.renderGenotypesBrapi({ + domParent: "#flapjack-div", // Container to inject the canvas into + width: 750, // Genotype view width + height: 300, // Genotype view height + baseURL: this.cropGenotypingParameter.endpoint, // BrAPI base URL + matrixId: this.selectedVariantSet.variantSetDbId, + mapId: null, + authToken: this.genotypingBrapiService.accessToken, + overviewWidth: 750, // Overview width + overviewHeight: 50, // Overview height + saveSettings: false }); } diff --git a/src/main/web/yarn.lock b/src/main/web/yarn.lock index 70d46eb2a6..62b4a8cede 100644 --- a/src/main/web/yarn.lock +++ b/src/main/web/yarn.lock @@ -2599,9 +2599,9 @@ braces@~3.0.2: dependencies: fill-range "^7.0.1" -"brapi-sync@git+ssh://git@github.com/IntegratedBreedingPlatform/brapi-sync.git#semver:1.4.0": - version "1.4.0" - resolved "git+ssh://git@github.com/IntegratedBreedingPlatform/brapi-sync.git#c8f7344c25678c2d3207c5422cadb00e42eb96bb" +"brapi-sync@git+ssh://git@github.com/IntegratedBreedingPlatform/brapi-sync.git#semver:1.5.0": + version "1.5.0" + resolved "git+ssh://git@github.com/IntegratedBreedingPlatform/brapi-sync.git#662b33e223403df5459584612b7335903252163c" dependencies: "@angular/animations" "~11.2.4" "@angular/common" "~11.2.4" From 6391e190dc6383d6fe6be5a9eaa9b9d74215b41c Mon Sep 17 00:00:00 2001 From: mderamos Date: Wed, 14 Sep 2022 16:52:17 +0800 Subject: [PATCH 03/11] Fixed ts lint error IBP-5656 --- .../germplasm-details/genotyping/genotyping-pane.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts b/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts index 0444ea98bd..003d2d4f12 100644 --- a/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts +++ b/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts @@ -172,7 +172,7 @@ export class GenotypingPaneComponent implements OnInit { selectVariantsetOnChange() { const renderer = flapjack.default(); renderer.renderGenotypesBrapi({ - domParent: "#flapjack-div", // Container to inject the canvas into + domParent: '#flapjack-div', // Container to inject the canvas into width: 750, // Genotype view width height: 300, // Genotype view height baseURL: this.cropGenotypingParameter.endpoint, // BrAPI base URL From 01b6813242e613c894e645e008e548555a72e912 Mon Sep 17 00:00:00 2001 From: mderamos Date: Thu, 15 Sep 2022 13:31:27 +0800 Subject: [PATCH 04/11] Export Flapjack Request model IBP-5656 --- .../shared/brapi/model/export/export-flapjack-request.ts | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 src/main/jhipster/src/main/webapp/app/shared/brapi/model/export/export-flapjack-request.ts diff --git a/src/main/jhipster/src/main/webapp/app/shared/brapi/model/export/export-flapjack-request.ts b/src/main/jhipster/src/main/webapp/app/shared/brapi/model/export/export-flapjack-request.ts new file mode 100644 index 0000000000..4f41280292 --- /dev/null +++ b/src/main/jhipster/src/main/webapp/app/shared/brapi/model/export/export-flapjack-request.ts @@ -0,0 +1,8 @@ +export class ExportFlapjackRequest { + constructor( + public exportFormat: string, + public exportedIndividuals: string[], + public keepExportOnServer: boolean, // Must be true, so that we can load the files from the server in flapjack-bytes + public pageSize: number) { + } +}; From c19f908d95922e779250c16b417380d56ce95ad0 Mon Sep 17 00:00:00 2001 From: mderamos Date: Mon, 19 Sep 2022 15:30:46 +0800 Subject: [PATCH 05/11] Render genotypes using renderGenotypesUrl() instead of renderGenotypesBrapi() IBP-5656 --- .../genotyping/genotyping-pane.component.ts | 34 ++++++++++++------- .../model/export/export-flapjack-request.ts | 5 ++- .../brapi/service/genotyping-brapi.service.ts | 20 +++++++---- .../crop/model/crop-genotyping-parameter.ts | 3 +- 4 files changed, 40 insertions(+), 22 deletions(-) diff --git a/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts b/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts index 003d2d4f12..89b32c2d80 100644 --- a/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts +++ b/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts @@ -17,6 +17,7 @@ import { Sample } from '../../entities/sample'; import { SearchGermplasmRequest } from '../../shared/brapi/model/germplasm/search-germplasm-request'; import { JhiAlertService } from 'ng-jhipster'; import { SearchSamplesRequest } from '../../shared/brapi/model/samples/search-samples-request'; +import { ExportFlapjackRequest } from '../../shared/brapi/model/export/export-flapjack-request'; const flapjack = require('flapjack-bytes/src/flapjack-bytes'); @Component({ @@ -67,7 +68,8 @@ export class GenotypingPaneComponent implements OnInit { ngOnInit(): void { this.cropGenotypingParameterService.getByCropName(this.context.cropName).pipe(flatMap((result) => { this.cropGenotypingParameter = result; - this.genotypingBrapiService.baseUrl = this.cropGenotypingParameter.endpoint; + this.genotypingBrapiService.brapiEndpoint = this.cropGenotypingParameter.endpoint; + this.genotypingBrapiService.baseUrl = this.cropGenotypingParameter.baseUrl; return this.cropGenotypingParameterService.getToken(this.context.cropName); })).subscribe((accessToken) => { this.genotypingBrapiService.accessToken = accessToken; @@ -170,18 +172,24 @@ export class GenotypingPaneComponent implements OnInit { } selectVariantsetOnChange() { - const renderer = flapjack.default(); - renderer.renderGenotypesBrapi({ - domParent: '#flapjack-div', // Container to inject the canvas into - width: 750, // Genotype view width - height: 300, // Genotype view height - baseURL: this.cropGenotypingParameter.endpoint, // BrAPI base URL - matrixId: this.selectedVariantSet.variantSetDbId, - mapId: null, - authToken: this.genotypingBrapiService.accessToken, - overviewWidth: 750, // Overview width - overviewHeight: 50, // Overview height - saveSettings: false + const exportFlapjackRequest = new ExportFlapjackRequest([], [], 'FLAPJACK', [this.germplasmSearchValue], true, + 100, this.selectedVariantSet.referenceSetDbId); + this.genotypingBrapiService.exportFlapjack(exportFlapjackRequest).subscribe((response) => { + let file = response.replace('.fjzip', '').replace('/gigwaV2', ''); + file = this.cropGenotypingParameter.baseUrl + file; + + const renderer = flapjack.default(); + renderer.renderGenotypesUrl({ + domParent: "#flapjack-div", + width: 750, + height: 300, + mapFileURL: file + '.map', + genotypeFileURL: file + '.genotype', + phenotypeFileURL: file + '.phenotype', + overviewWidth: 750, + overviewHeight: 50, + dataSetId: this.cropGenotypingParameter.programId, + }); }); } diff --git a/src/main/jhipster/src/main/webapp/app/shared/brapi/model/export/export-flapjack-request.ts b/src/main/jhipster/src/main/webapp/app/shared/brapi/model/export/export-flapjack-request.ts index 4f41280292..d45948f173 100644 --- a/src/main/jhipster/src/main/webapp/app/shared/brapi/model/export/export-flapjack-request.ts +++ b/src/main/jhipster/src/main/webapp/app/shared/brapi/model/export/export-flapjack-request.ts @@ -1,8 +1,11 @@ export class ExportFlapjackRequest { constructor( + public callSetIds: string[], + public callSetIds2: string[], public exportFormat: string, public exportedIndividuals: string[], public keepExportOnServer: boolean, // Must be true, so that we can load the files from the server in flapjack-bytes - public pageSize: number) { + public pageSize: number, + public variantSetId: string) { } }; diff --git a/src/main/jhipster/src/main/webapp/app/shared/brapi/service/genotyping-brapi.service.ts b/src/main/jhipster/src/main/webapp/app/shared/brapi/service/genotyping-brapi.service.ts index c77260c732..4a978337c7 100644 --- a/src/main/jhipster/src/main/webapp/app/shared/brapi/service/genotyping-brapi.service.ts +++ b/src/main/jhipster/src/main/webapp/app/shared/brapi/service/genotyping-brapi.service.ts @@ -14,38 +14,44 @@ import { CallSet } from '../model/callsets/callset'; import { Call } from '../model/calls/call'; import { SearchSamplesRequest } from '../model/samples/search-samples-request'; import { Sample } from '../model/samples/sample'; +import { ExportFlapjackRequest } from '../model/export/export-flapjack-request'; @Injectable() export class GenotypingBrapiService { - baseUrl: string; + brapiEndpoint: string; accessToken: string; + baseUrl: string; constructor(private http: HttpClient) { } searchStudies(searchStudiesRequest: SearchStudiesRequest): Observable> { - return this.http.post>(`${this.baseUrl}/search/studies`, searchStudiesRequest, { headers: this.createHeader() }); + return this.http.post>(`${this.brapiEndpoint}/search/studies`, searchStudiesRequest, { headers: this.createHeader() }); } searchGermplasm(searchGermplasmRequest: SearchGermplasmRequest): Observable> { - return this.http.post>(`${this.baseUrl}/search/germplasm`, searchGermplasmRequest, { headers: this.createHeader() }); + return this.http.post>(`${this.brapiEndpoint}/search/germplasm`, searchGermplasmRequest, { headers: this.createHeader() }); } searchVariantsets(searchVariantsetRequest: SearchVariantsetRequest): Observable> { - return this.http.post>(`${this.baseUrl}/search/variantsets`, searchVariantsetRequest, { headers: this.createHeader() }); + return this.http.post>(`${this.brapiEndpoint}/search/variantsets`, searchVariantsetRequest, { headers: this.createHeader() }); } searchCallsets(searchCallsetRequest: SearchCallsetsRequest): Observable> { - return this.http.post>(`${this.baseUrl}/search/callsets`, searchCallsetRequest, { headers: this.createHeader() }); + return this.http.post>(`${this.brapiEndpoint}/search/callsets`, searchCallsetRequest, { headers: this.createHeader() }); } searchCalls(searchCallsRequest: SearchCallsRequest): Observable> { - return this.http.post>(`${this.baseUrl}/search/calls`, searchCallsRequest, { headers: this.createHeader() }); + return this.http.post>(`${this.brapiEndpoint}/search/calls`, searchCallsRequest, { headers: this.createHeader() }); } searchSamples(searchSamplesRequest: SearchSamplesRequest): Observable> { - return this.http.post>(`${this.baseUrl}/search/samples`, searchSamplesRequest, { headers: this.createHeader() }); + return this.http.post>(`${this.brapiEndpoint}/search/samples`, searchSamplesRequest, { headers: this.createHeader() }); + } + + exportFlapjack(exportRequest: ExportFlapjackRequest): Observable { + return this.http.post(`${this.baseUrl}/rest/gigwa/exportData`, exportRequest, {headers: this.createHeader(), responseType: 'text' as 'json'}); } // FIXME: Find a way to have a separate instance of HttpClient with its own HttpInterceptor diff --git a/src/main/jhipster/src/main/webapp/app/shared/crop/model/crop-genotyping-parameter.ts b/src/main/jhipster/src/main/webapp/app/shared/crop/model/crop-genotyping-parameter.ts index 5024fcf5ed..af85e0d900 100644 --- a/src/main/jhipster/src/main/webapp/app/shared/crop/model/crop-genotyping-parameter.ts +++ b/src/main/jhipster/src/main/webapp/app/shared/crop/model/crop-genotyping-parameter.ts @@ -5,7 +5,8 @@ export class CropGenotypingParameter { public tokenEndpoint: string, public userName: string, public password: string, - public programId: string + public programId: string, + public baseUrl: string ) { } } From 21d0984e6bae315cb19749dd2e2f57e0cb6764fe Mon Sep 17 00:00:00 2001 From: mderamos Date: Mon, 19 Sep 2022 16:21:40 +0800 Subject: [PATCH 06/11] Fixed ts lint error IBP-5656 --- .../germplasm-details/genotyping/genotyping-pane.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts b/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts index 89b32c2d80..ae11527cfa 100644 --- a/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts +++ b/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts @@ -180,7 +180,7 @@ export class GenotypingPaneComponent implements OnInit { const renderer = flapjack.default(); renderer.renderGenotypesUrl({ - domParent: "#flapjack-div", + domParent: '#flapjack-div', width: 750, height: 300, mapFileURL: file + '.map', From 206ee8964f39941f59a1f8f19cb8cbb860d1e856 Mon Sep 17 00:00:00 2001 From: mderamos Date: Tue, 20 Sep 2022 15:09:54 +0800 Subject: [PATCH 07/11] Addressed review comments IBP-5656 --- .../genotyping/genotyping-pane.component.html | 3 +- .../genotyping/genotyping-pane.component.ts | 39 ++++++++----------- 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.html b/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.html index d810612ae5..63cf949d40 100644 --- a/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.html +++ b/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.html @@ -98,7 +98,8 @@
-
+
+

diff --git a/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts b/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts index ae11527cfa..76bea4e28b 100644 --- a/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts +++ b/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts @@ -31,7 +31,7 @@ export class GenotypingPaneComponent implements OnInit { totalCount = 10; page = 1; pageSize = 10; - isGenotypingCallsLoading = false; + isExportingFlapjack = false; isStudyLoading = false; isVariantSetLoading = false; isSamplesLoading = false; @@ -83,7 +83,7 @@ export class GenotypingPaneComponent implements OnInit { isGenotypingParameterConfigured() { return this.cropGenotypingParameter && this.cropGenotypingParameter.cropName && this.cropGenotypingParameter.endpoint && this.cropGenotypingParameter.tokenEndpoint - && this.cropGenotypingParameter.userName && this.cropGenotypingParameter.password && this.cropGenotypingParameter.programId; + && this.cropGenotypingParameter.userName && this.cropGenotypingParameter.password && this.cropGenotypingParameter.programId && this.cropGenotypingParameter.baseUrl; } linkBySelectOnChange() { @@ -172,40 +172,33 @@ export class GenotypingPaneComponent implements OnInit { } selectVariantsetOnChange() { - const exportFlapjackRequest = new ExportFlapjackRequest([], [], 'FLAPJACK', [this.germplasmSearchValue], true, + this.isExportingFlapjack = true; + const exportFlapjackRequest = new ExportFlapjackRequest([], [], 'FLAPJACK', [this.genotypingGermplasm.germplasmName], true, 100, this.selectedVariantSet.referenceSetDbId); this.genotypingBrapiService.exportFlapjack(exportFlapjackRequest).subscribe((response) => { - let file = response.replace('.fjzip', '').replace('/gigwaV2', ''); - file = this.cropGenotypingParameter.baseUrl + file; + this.isExportingFlapjack = false; + let file = response.replace('.fjzip', ''); + file = this.extractHostName(this.cropGenotypingParameter.baseUrl) + file; + const flapjackDiv = '#flapjack-div'; const renderer = flapjack.default(); renderer.renderGenotypesUrl({ - domParent: '#flapjack-div', - width: 750, - height: 300, + domParent: flapjackDiv, + width: document.querySelector(flapjackDiv).getBoundingClientRect().width, + height: 250, mapFileURL: file + '.map', genotypeFileURL: file + '.genotype', phenotypeFileURL: file + '.phenotype', - overviewWidth: 750, - overviewHeight: 50, + overviewWidth: document.querySelector(flapjackDiv).getBoundingClientRect().width, + overviewHeight: 25, dataSetId: this.cropGenotypingParameter.programId, }); }); } - loadGenotypingCalls() { - if (this.genotypingCallSet) { - this.isGenotypingCallsLoading = true; - this.genotypingBrapiService.searchCalls({ - callSetDbIds: [this.genotypingCallSet.callSetDbId], - pageSize: this.pageSize, - pageToken: (this.page - 1).toString() - }).subscribe(((brapiResponse) => { - this.genotypingCalls = brapiResponse.result.data; - this.totalCount = brapiResponse.metadata.pagination.totalCount; - this.isGenotypingCallsLoading = false; - })); - } + extractHostName(baseUrl) { + const { hostname, protocol } = new URL(baseUrl); + return protocol + hostname; } resetForm() { From 4eb9c9362bb5c179220a1a1c0dc122c9912c6c8b Mon Sep 17 00:00:00 2001 From: mderamos Date: Tue, 20 Sep 2022 15:35:46 +0800 Subject: [PATCH 08/11] LOG returned host name --- .../germplasm-details/genotyping/genotyping-pane.component.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts b/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts index 76bea4e28b..1a40df5b61 100644 --- a/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts +++ b/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts @@ -198,6 +198,7 @@ export class GenotypingPaneComponent implements OnInit { extractHostName(baseUrl) { const { hostname, protocol } = new URL(baseUrl); + console.log(protocol + hostname); return protocol + hostname; } From 57bc37ca5f33ee95bdd5a3721fad660ff29a18de Mon Sep 17 00:00:00 2001 From: mderamos Date: Tue, 20 Sep 2022 15:58:09 +0800 Subject: [PATCH 09/11] Add // to Hostname IBP-5656 --- .../genotyping/genotyping-pane.component.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts b/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts index 1a40df5b61..2b611b3a69 100644 --- a/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts +++ b/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts @@ -179,7 +179,7 @@ export class GenotypingPaneComponent implements OnInit { this.isExportingFlapjack = false; let file = response.replace('.fjzip', ''); file = this.extractHostName(this.cropGenotypingParameter.baseUrl) + file; - + console.log(file); const flapjackDiv = '#flapjack-div'; const renderer = flapjack.default(); renderer.renderGenotypesUrl({ @@ -198,8 +198,7 @@ export class GenotypingPaneComponent implements OnInit { extractHostName(baseUrl) { const { hostname, protocol } = new URL(baseUrl); - console.log(protocol + hostname); - return protocol + hostname; + return protocol + '//' + hostname; } resetForm() { From ddce6191a7166aeb833bd141832579f69c51971d Mon Sep 17 00:00:00 2001 From: mderamos Date: Tue, 20 Sep 2022 16:12:46 +0800 Subject: [PATCH 10/11] Removed unnecessary log IBP-5656 --- .../germplasm-details/genotyping/genotyping-pane.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts b/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts index 2b611b3a69..fd49ed9ef3 100644 --- a/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts +++ b/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts @@ -179,7 +179,7 @@ export class GenotypingPaneComponent implements OnInit { this.isExportingFlapjack = false; let file = response.replace('.fjzip', ''); file = this.extractHostName(this.cropGenotypingParameter.baseUrl) + file; - console.log(file); + const flapjackDiv = '#flapjack-div'; const renderer = flapjack.default(); renderer.renderGenotypesUrl({ From dde15276a43ce7db783995241fc35374f7d14f4d Mon Sep 17 00:00:00 2001 From: mderamos Date: Tue, 20 Sep 2022 17:51:19 +0800 Subject: [PATCH 11/11] Check if user selected a variant set before exporting flapjack IBP-5656 --- .../genotyping/genotyping-pane.component.ts | 44 ++++++++++--------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts b/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts index fd49ed9ef3..5b0678b4ae 100644 --- a/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts +++ b/src/main/jhipster/src/main/webapp/app/germplasm-details/genotyping/genotyping-pane.component.ts @@ -172,28 +172,30 @@ export class GenotypingPaneComponent implements OnInit { } selectVariantsetOnChange() { - this.isExportingFlapjack = true; - const exportFlapjackRequest = new ExportFlapjackRequest([], [], 'FLAPJACK', [this.genotypingGermplasm.germplasmName], true, - 100, this.selectedVariantSet.referenceSetDbId); - this.genotypingBrapiService.exportFlapjack(exportFlapjackRequest).subscribe((response) => { - this.isExportingFlapjack = false; - let file = response.replace('.fjzip', ''); - file = this.extractHostName(this.cropGenotypingParameter.baseUrl) + file; - - const flapjackDiv = '#flapjack-div'; - const renderer = flapjack.default(); - renderer.renderGenotypesUrl({ - domParent: flapjackDiv, - width: document.querySelector(flapjackDiv).getBoundingClientRect().width, - height: 250, - mapFileURL: file + '.map', - genotypeFileURL: file + '.genotype', - phenotypeFileURL: file + '.phenotype', - overviewWidth: document.querySelector(flapjackDiv).getBoundingClientRect().width, - overviewHeight: 25, - dataSetId: this.cropGenotypingParameter.programId, + if (this.selectedVariantSet) { + this.isExportingFlapjack = true; + const exportFlapjackRequest = new ExportFlapjackRequest([], [], 'FLAPJACK', [this.genotypingGermplasm.germplasmName], true, + 100, this.selectedVariantSet.referenceSetDbId); + this.genotypingBrapiService.exportFlapjack(exportFlapjackRequest).subscribe((response) => { + this.isExportingFlapjack = false; + let file = response.replace('.fjzip', ''); + file = this.extractHostName(this.cropGenotypingParameter.baseUrl) + file; + + const flapjackDiv = '#flapjack-div'; + const renderer = flapjack.default(); + renderer.renderGenotypesUrl({ + domParent: flapjackDiv, + width: document.querySelector(flapjackDiv).getBoundingClientRect().width, + height: 250, + mapFileURL: file + '.map', + genotypeFileURL: file + '.genotype', + phenotypeFileURL: file + '.phenotype', + overviewWidth: document.querySelector(flapjackDiv).getBoundingClientRect().width, + overviewHeight: 25, + dataSetId: this.cropGenotypingParameter.programId, + }); }); - }); + } } extractHostName(baseUrl) {