From 138593a26fc181d449572a99ec0a114d084a14a1 Mon Sep 17 00:00:00 2001 From: David Randolph Phillips Date: Mon, 8 Jan 2024 10:53:51 -0500 Subject: [PATCH 1/2] [BI-2029] updated createObservationIndexMap() to avoid a array out of bounds error in cellClassIfExisting() --- src/views/import/ImportExperiment.vue | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/views/import/ImportExperiment.vue b/src/views/import/ImportExperiment.vue index dbfbf6a89..5c33d9eee 100644 --- a/src/views/import/ImportExperiment.vue +++ b/src/views/import/ImportExperiment.vue @@ -282,22 +282,18 @@ export default class ImportExperiment extends ProgramsBase { // Map phenotypeColumn indices to brapi observation indices for use in highlighting createObservationIndexMap() { let obs_index = 0; + // this assumes that any timestamp for an ontology immediately follows the ontology + let is_first_obs = true; for (let i=0; i < this.phenotypeColumns!.length; i++) { - if (this.phenotypeColumns![i].startsWith('TS:')) { - this.observationIndexMap.set(i, obs_index++); - } else { - if (i+1 < this.phenotypeColumns!.length) { - if (!this.phenotypeColumns![i+1].startsWith('TS:')) { - obs_index++; - } - } else { - if (obs_index > 0) { - obs_index++; - } + if (!this.phenotypeColumns![i].startsWith('TS:')) { + if( ! is_first_obs ){ + obs_index++; } - this.observationIndexMap.set(i, obs_index); + is_first_obs = false; } + this.observationIndexMap.set(i, obs_index); } + console.info(this.observationIndexMap); } statisticsLoaded(statistics: any) { @@ -323,8 +319,9 @@ export default class ImportExperiment extends ProgramsBase { cellClassIfExisting(row: any, column: any) { const index = column.meta.index - - if(row.data.observations[this.observationIndexMap.get(index)!].state === 'MUTATED') { + let i = this.observationIndexMap.get(index); + console.info('i = ' + i); + if(row.data.observations[i].state === 'MUTATED') { return {'class': 'db-filled'}; } return {}; From 43a274ee96684be66a1d65e9709f45c5722782f7 Mon Sep 17 00:00:00 2001 From: David Randolph Phillips Date: Mon, 8 Jan 2024 11:09:36 -0500 Subject: [PATCH 2/2] [BI-2029] removed debugging code --- src/views/import/ImportExperiment.vue | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/views/import/ImportExperiment.vue b/src/views/import/ImportExperiment.vue index 5c33d9eee..87957da46 100644 --- a/src/views/import/ImportExperiment.vue +++ b/src/views/import/ImportExperiment.vue @@ -293,7 +293,6 @@ export default class ImportExperiment extends ProgramsBase { } this.observationIndexMap.set(i, obs_index); } - console.info(this.observationIndexMap); } statisticsLoaded(statistics: any) { @@ -319,9 +318,8 @@ export default class ImportExperiment extends ProgramsBase { cellClassIfExisting(row: any, column: any) { const index = column.meta.index - let i = this.observationIndexMap.get(index); - console.info('i = ' + i); - if(row.data.observations[i].state === 'MUTATED') { + + if(row.data.observations[this.observationIndexMap.get(index)!].state === 'MUTATED') { return {'class': 'db-filled'}; } return {};