From b6c1aca059ee8fdbf02afba3a31ce524404b817b Mon Sep 17 00:00:00 2001 From: imedina Date: Sun, 3 Mar 2024 01:59:09 +0000 Subject: [PATCH 1/6] Add column BIALLELIC for genotype 1/2 --- src/core/bioinfo/bioinfo-utils.js | 19 +- .../commons/filters/sample-genotype-filter.js | 13 +- .../variant/family-genotype-filter.js | 220 ++++++------------ .../variant-interpreter-browser-rd.js | 12 +- 4 files changed, 105 insertions(+), 159 deletions(-) diff --git a/src/core/bioinfo/bioinfo-utils.js b/src/core/bioinfo/bioinfo-utils.js index 973ab3de84..39237a1dd8 100644 --- a/src/core/bioinfo/bioinfo-utils.js +++ b/src/core/bioinfo/bioinfo-utils.js @@ -34,6 +34,23 @@ export default class BioinfoUtils { }); } + static getIdName(id, name) { + let text = ""; + if (name) { + text = name; + } + + if (id) { + if (name) { + text += ` (${id})`; + } else { + text = id; + } + } + + return text; + } + // Generate Variant ID in Varsome format // https://varsome.com/how-do-i-create-link-varsome/ static getVariantInVarsomeFormat(variantId) { @@ -255,7 +272,7 @@ export default class BioinfoUtils { static getOboLink(ontologyId) { const ontologyShort = ontologyId.replace(":", "_"); - return `http://purl.obolibrary.org/obo/${ontologyShort}`; + return `https://purl.obolibrary.org/obo/${ontologyShort}`; } static getHpoLink(hpoTerm) { diff --git a/src/webcomponents/commons/filters/sample-genotype-filter.js b/src/webcomponents/commons/filters/sample-genotype-filter.js index b98e7f215a..618ba7c854 100644 --- a/src/webcomponents/commons/filters/sample-genotype-filter.js +++ b/src/webcomponents/commons/filters/sample-genotype-filter.js @@ -85,17 +85,20 @@ export default class SampleGenotypeFilter extends LitElement { id: "0/1", name: "HET" }, { - id: "1/1", name: "HOM ALT" + id: "1/1", name: "HOM_ALT" }, { separator: true }, { - id: "./.", name: "Missing" + id: "1/2", name: "BIALLELIC (1/2)" }, - { - id: "NA", name: "NA" - } + // { + // id: "./.", name: "Missing" + // }, + // { + // id: "NA", name: "NA" + // } ] }; } diff --git a/src/webcomponents/variant/family-genotype-filter.js b/src/webcomponents/variant/family-genotype-filter.js index 71e89532a1..fb1141ffab 100644 --- a/src/webcomponents/variant/family-genotype-filter.js +++ b/src/webcomponents/variant/family-genotype-filter.js @@ -14,8 +14,9 @@ * limitations under the License. */ -import {LitElement, html} from "lit"; +import {html, LitElement, nothing} from "lit"; import LitUtils from "../commons/utils/lit-utils.js"; +import BioinfoUtils from "../../core/bioinfo/bioinfo-utils.js"; import UtilsNew from "../../core/utils-new.js"; import "../commons/forms/select-field-filter.js"; @@ -54,16 +55,6 @@ export default class FamilyGenotypeFilter extends LitElement { this.modeOfInheritanceList = MODE_OF_INHERITANCE; this.modeSelectData = []; - this.depths = [ - {id: "5", name: "5x"}, // , selected: true - {id: "10", name: "10x"}, - {id: "15", name: "15x"}, - {id: "20", name: "20x"}, - {id: "30", name: "30x"}, - {id: "40", name: "40x"}, - {id: "50", name: "50x"} - ]; - this.showModeOfInheritance = true; this.mode = "CUSTOM"; @@ -80,7 +71,6 @@ export default class FamilyGenotypeFilter extends LitElement { if (changedProperties.has("genotype")) { this.genotypeObserver(); } - if (changedProperties.has("clinicalAnalysis")) { this.clinicalAnalysisObserver(); } @@ -90,7 +80,6 @@ export default class FamilyGenotypeFilter extends LitElement { ...this.config, }; } - super.update(changedProperties); } @@ -162,8 +151,6 @@ export default class FamilyGenotypeFilter extends LitElement { genotypeObserver() { this.state = {}; if (this.genotype) { - // TODO handle AND and OR. Comma is already used for GTs. - // this.logicalOperator = this.genotype.split(",") > this.genotype.split(";") ? "," : ";"; this.genotype.split(";").forEach(sample => { const [id, gt] = sample.split(":"); this.state[id] = { @@ -188,16 +175,11 @@ export default class FamilyGenotypeFilter extends LitElement { if (sample.genotypes.length) { _sample.push(id + ":" + sample.genotypes.join(",")); } - /* if (sample.dp) { - _sampleData.push(id + ":DP>=" + sample.dp); - }*/ }); } LitUtils.dispatchCustomEvent(this, "filterChange", null, { value: { sample: _sample.length ? _sample.join(";") : null, - // sampleData: _sampleData.length ? _sampleData.join() : null - // includeSample: this.includeSample, }, errorState: this.errorState, }); @@ -206,40 +188,42 @@ export default class FamilyGenotypeFilter extends LitElement { // Queries variant/family/genotypes to get the genotypes according to family pedigree // @param mode {String} Mode of inheritance onModeOfInheritance(mode) { - this.opencgaSession.opencgaClient.variants().genotypesFamily(mode, { - study: this.opencgaSession.study.fqn, - family: this.clinicalAnalysis.family.id, - disorder: this.clinicalAnalysis.disorder.id, - completePenetrance: true - }).then(response => { - const genotypeResultMap = response.getResult(0); - let countGenoypes = 0; - if (genotypeResultMap) { - const state = {}; - Object.keys(genotypeResultMap).forEach(individualId => { - this.tableData.forEach(sample => { - if (sample.individualId === individualId) { - state[sample.id] = { - id: sample.id, - genotypes: genotypeResultMap[individualId] - }; - countGenoypes += genotypeResultMap[individualId].length; - } + this.opencgaSession.opencgaClient.variants() + .genotypesFamily(mode, { + study: this.opencgaSession.study.fqn, + family: this.clinicalAnalysis.family.id, + disorder: this.clinicalAnalysis.disorder.id, + completePenetrance: true + }) + .then(response => { + const genotypeResultMap = response.getResult(0); + let countGenoypes = 0; + if (genotypeResultMap) { + const state = {}; + Object.keys(genotypeResultMap).forEach(individualId => { + this.tableData.forEach(sample => { + if (sample.individualId === individualId) { + state[sample.id] = { + id: sample.id, + genotypes: genotypeResultMap[individualId] + }; + countGenoypes += genotypeResultMap[individualId].length; + } + }); }); - }); - this.errorState = countGenoypes <= 0 ? "The selected Mode of Inheritance is not compatible with the family pedigree" : false; - // keeps the last legal state - if (!this.errorState) { - this.modeOfInheritance = mode; - this.state = {...state}; + this.errorState = countGenoypes <= 0 ? "The selected Mode of Inheritance is not compatible with the family pedigree" : false; + // keeps the last legal state + if (!this.errorState) { + this.modeOfInheritance = mode; + this.state = {...state}; + } + this.notifySampleFilterChange(); + this.requestUpdate(); } - this.notifySampleFilterChange(); - this.requestUpdate(); - } - - }).catch(function (response) { - console.error(response); - }); + }) + .catch(function (response) { + console.error(response); + }); } // Update state on genotype change @@ -307,72 +291,24 @@ export default class FamilyGenotypeFilter extends LitElement { // Return the default genotype values according the role defaultGenotype(sample) { - return sample.id === this.clinicalAnalysis.proband.samples[0].id ? ["0/1", "1/1"] : [...this._config.defaultGenotypes]; - } - - // Toggle depthAll flag - changeDepthAll() { - this.depthAll = !this.depthAll; - this.requestUpdate(); - } - - // Update state on depth Change - // @param e {Object} Event - // @param sampleId {String} Sample Id - async onSampleTableDepthChange(e, sampleId) { - e.preventDefault(); - - if (this.depthAll) { - Object.keys(this.state).forEach(id => { - this.state[id].dp = e.detail.value; - }); - } else { - this.state[sampleId].dp = e.detail.value; - } - this.state = {...this.state}; - this.notifySampleFilterChange(); - this.requestUpdate(); - } - - getSexIcon(sample) { - const value = sample.sex?.id || sample.sex || null; - return value ? this._config.sexIconMap[value] : ""; + return sample.id === this.clinicalAnalysis.proband.samples[0].id ? ["0/1", "1/1", "1/2"] : [...this._config.defaultGenotypes]; } render() { return html` - - -
+
- You can manually select sample genotypes or select a + You can manually select + Custom Genotypes + or select a Mode of Inheritance - such as RECESSIVE OR COMPOUND HETEROZYGOUS. + such as AUTOSOMAL RECESSIVE or COMPOUND HETEROZYGOUS.
-
+
-

- Select Sample Genoypes +

+ Select Sample Genotypes

@@ -392,27 +328,22 @@ export default class FamilyGenotypeFilter extends LitElement { - - - + + - - - + + + + - ${this.tableData && this.tableData.length ? this.tableData.map(sample => html` + ${this.tableData?.length > 0 ? this.tableData.map(sample => html` - - - - + ` } - - `) : null} + `) : nothing}
Individual Role Sex (karyotype)Affected (${this.clinicalAnalysis.disorder.id})GenotypesAffected
+ + ${BioinfoUtils.getIdName(this.clinicalAnalysis.disorder.id, this.clinicalAnalysis.disorder.name)} + +
Genotypes
HOM_REFHETHOM_ALTHOM_REF (0/0)HET (0/1)HOM_ALT (1/1)BIALLELIC (1/2)
@@ -424,20 +355,21 @@ export default class FamilyGenotypeFilter extends LitElement {
- ${sample.individualId} + + + ${sample.individualId} + + ${sample.role} + - ${sample.sex?.id || sample.sex || "Not specified"} (${sample.karyotypicSex || "Not specified"}) + ${sample.affected ? html` @@ -476,19 +408,18 @@ export default class FamilyGenotypeFilter extends LitElement { .checked="${this.state?.[sample.id]?.genotypes.includes("1/1")}" ?disabled="${this.mode !== "CUSTOM"}" @change="${this.onSampleTableChange}"> + +
@@ -516,12 +447,7 @@ export default class FamilyGenotypeFilter extends LitElement { getDefaultConfig() { return { - defaultGenotypes: ["0/0", "0/1", "1/1"], - sexIconMap: { - MALE: "fa-mars", - FEMALE: "fa-venus", - UNKNOWN: "fa-genderless" - } + defaultGenotypes: ["0/0", "0/1", "1/1", "1/2"], }; } diff --git a/src/webcomponents/variant/interpretation/variant-interpreter-browser-rd.js b/src/webcomponents/variant/interpretation/variant-interpreter-browser-rd.js index bfd91109a1..0e2c7c25be 100644 --- a/src/webcomponents/variant/interpretation/variant-interpreter-browser-rd.js +++ b/src/webcomponents/variant/interpretation/variant-interpreter-browser-rd.js @@ -341,20 +341,20 @@ class VariantInterpreterBrowserRd extends LitElement { params: { genotypes: [ { - id: "0/1", name: "HET" + id: "0/1", name: "HET (0/1)" }, { - id: "1/1", name: "HOM ALT" + id: "1/1", name: "HOM_ALT (1/1)" }, { separator: true }, { - id: "1/2", name: "BIALLELIC HET (Genotype 1/2)" + id: "1/2", name: "BIALLELIC (1/2)" }, - { - id: "1", name: "HEMI" - } + // { + // id: "1", name: "HEMI" + // } ] }, tooltip: tooltips.sample, From 7cb6047fa8f63fc1f2dd494ee0fe4ff30f2d3770 Mon Sep 17 00:00:00 2001 From: imedina Date: Tue, 5 Mar 2024 00:27:33 +0000 Subject: [PATCH 2/6] Add 1/2 to autosomal recessive mode --- src/webcomponents/variant/family-genotype-filter.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/webcomponents/variant/family-genotype-filter.js b/src/webcomponents/variant/family-genotype-filter.js index fb1141ffab..8a2cffb378 100644 --- a/src/webcomponents/variant/family-genotype-filter.js +++ b/src/webcomponents/variant/family-genotype-filter.js @@ -197,6 +197,12 @@ export default class FamilyGenotypeFilter extends LitElement { }) .then(response => { const genotypeResultMap = response.getResult(0); + // Nacho: Autosomal Recessive means two copies of an abnormal gene must be present in order for the disease or trait to develop. + // So we need to add 1/2 to the proband. + if (mode === "AUTOSOMAL_RECESSIVE") { + genotypeResultMap[this.clinicalAnalysis.proband.id].push("1/2"); + } + let countGenoypes = 0; if (genotypeResultMap) { const state = {}; From 877dd26cb1e72f1629a87a3d106f66769aefe881 Mon Sep 17 00:00:00 2001 From: imedina Date: Tue, 12 Mar 2024 03:00:27 +0000 Subject: [PATCH 3/6] Increase case search limit to make sure all cases are found --- src/webcomponents/family/family-grid.js | 11 ++++++++--- src/webcomponents/individual/individual-grid.js | 12 +++++++++--- src/webcomponents/sample/sample-grid.js | 10 +++++++--- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/webcomponents/family/family-grid.js b/src/webcomponents/family/family-grid.js index c86f671021..1fdacdef94 100644 --- a/src/webcomponents/family/family-grid.js +++ b/src/webcomponents/family/family-grid.js @@ -199,13 +199,18 @@ export default class FamilyGrid extends LitElement { .search(this.filters) .then(familyResponse => { // Fetch Clinical Analysis ID per Family in 1 single query - const familyIds = familyResponse.responses[0].results.map(family => family.id).join(","); + const familyIds = familyResponse.responses[0].results + .map(family => family.id) + .join(","); + if (familyIds) { - this.opencgaSession.opencgaClient.clinical() + this.opencgaSession.opencgaClient + .clinical() .search({ family: familyIds, study: this.opencgaSession.study.fqn, - include: "id,proband.id,family.members,family.id" + include: "id,proband.id,family.members,family.id", + limit: (this._config.pageSize || 10) * 10 }) .then(caseResponse => { familyResponse.getResults().forEach(family => { diff --git a/src/webcomponents/individual/individual-grid.js b/src/webcomponents/individual/individual-grid.js index 1e64b184c5..6e69b23053 100644 --- a/src/webcomponents/individual/individual-grid.js +++ b/src/webcomponents/individual/individual-grid.js @@ -203,13 +203,19 @@ export default class IndividualGrid extends LitElement { .search(this.filters) .then(individualResponse => { // Fetch Clinical Analysis ID per individual in 1 single query - const individualIds = individualResponse.getResults().map(individual => individual.id).filter(Boolean).join(","); + const individualIds = individualResponse.getResults() + .map(individual => individual.id) + .filter(Boolean) + .join(","); + if (individualIds) { - this.opencgaSession.opencgaClient.clinical() + this.opencgaSession.opencgaClient + .clinical() .search({ individual: individualIds, study: this.opencgaSession.study.fqn, - include: "id,proband.id,family.members" + include: "id,proband.id,family.members", + limit: (this._config.pageSize || 10) * 10 }) .then(caseResponse => { individualResponse.getResults().forEach(individual => { diff --git a/src/webcomponents/sample/sample-grid.js b/src/webcomponents/sample/sample-grid.js index 37e42f6601..d6d7cabe46 100644 --- a/src/webcomponents/sample/sample-grid.js +++ b/src/webcomponents/sample/sample-grid.js @@ -197,14 +197,18 @@ export default class SampleGrid extends LitElement { // Fetch clinical analysis to display the Case ID const individualIds = sampleResponse.getResults() .map(sample => sample.individualId) - .filter(Boolean).join(","); + .filter(Boolean) + .join(","); + if (individualIds) { - this.opencgaSession.opencgaClient.clinical() + this.opencgaSession.opencgaClient + .clinical() .search( { individual: individualIds, study: this.opencgaSession.study.fqn, - include: "id,proband.id,family.members" + include: "id,proband.id,family.members", + limit: (this._config.pageSize || 10) * 10 }) .then(caseResponse => { sampleResponse.getResults().forEach(sample => { From 14658f471835a27bce7f2cec980eda335d725f31 Mon Sep 17 00:00:00 2001 From: imedina Date: Wed, 13 Mar 2024 00:32:10 +0000 Subject: [PATCH 4/6] Fix actions column visibility configuration --- src/webcomponents/clinical/clinical-analysis-grid.js | 3 +-- src/webcomponents/cohort/cohort-grid.js | 2 +- src/webcomponents/disease-panel/disease-panel-grid.js | 2 +- src/webcomponents/family/family-grid.js | 3 +-- src/webcomponents/file/file-grid.js | 2 +- src/webcomponents/individual/individual-grid.js | 3 +-- src/webcomponents/job/job-grid.js | 2 +- src/webcomponents/sample/sample-grid.js | 3 +-- 8 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/webcomponents/clinical/clinical-analysis-grid.js b/src/webcomponents/clinical/clinical-analysis-grid.js index 2e9f9a37a2..e5698fb071 100644 --- a/src/webcomponents/clinical/clinical-analysis-grid.js +++ b/src/webcomponents/clinical/clinical-analysis-grid.js @@ -806,11 +806,10 @@ export default class ClinicalAnalysisGrid extends LitElement { events: { "click a": this.onActionClick.bind(this) }, - visible: !this._config.columns?.hidden?.includes("actions") + visible: this.gridCommons.isColumnVisible("actions") }); } - // _columns = UtilsNew.mergeTable(_columns, this._config.columns || this._config.hiddenColumns, !!this._config.hiddenColumns); this._columns = this.gridCommons.addColumnsFromExtensions(this._columns, this.COMPONENT_ID); return this._columns; } diff --git a/src/webcomponents/cohort/cohort-grid.js b/src/webcomponents/cohort/cohort-grid.js index a3e8231778..ac7e697efa 100644 --- a/src/webcomponents/cohort/cohort-grid.js +++ b/src/webcomponents/cohort/cohort-grid.js @@ -360,7 +360,7 @@ export default class CohortGrid extends LitElement { events: { "click a": this.onActionClick.bind(this) }, - visible: !this._config.columns?.hidden?.includes("actions") + visible: this.gridCommons.isColumnVisible("actions") }); } diff --git a/src/webcomponents/disease-panel/disease-panel-grid.js b/src/webcomponents/disease-panel/disease-panel-grid.js index bedfaafbfe..a44c5e54b2 100644 --- a/src/webcomponents/disease-panel/disease-panel-grid.js +++ b/src/webcomponents/disease-panel/disease-panel-grid.js @@ -502,7 +502,7 @@ export default class DiseasePanelGrid extends LitElement { events: { "click a": this.onActionClick.bind(this) }, - visible: !this._config.columns?.hidden?.includes("actions"), + visible: this.gridCommons.isColumnVisible("actions"), }); } diff --git a/src/webcomponents/family/family-grid.js b/src/webcomponents/family/family-grid.js index c86f671021..8613c90e41 100644 --- a/src/webcomponents/family/family-grid.js +++ b/src/webcomponents/family/family-grid.js @@ -548,11 +548,10 @@ export default class FamilyGrid extends LitElement { events: { "click a": this.onActionClick.bind(this) }, - visible: !this._config.columns?.hidden?.includes("actions") + visible: this.gridCommons.isColumnVisible("actions") }); } - // _columns = UtilsNew.mergeTable(_columns, this._config.columns || this._config.hiddenColumns, !!this._config.hiddenColumns); this._columns = this.gridCommons.addColumnsFromExtensions(this._columns, this.COMPONENT_ID); return this._columns; } diff --git a/src/webcomponents/file/file-grid.js b/src/webcomponents/file/file-grid.js index 4a29aece6e..e86c89e24c 100644 --- a/src/webcomponents/file/file-grid.js +++ b/src/webcomponents/file/file-grid.js @@ -449,7 +449,7 @@ export default class OpencgaFileGrid extends LitElement { events: { "click a": this.onActionClick.bind(this) }, - visible: !this._config.columns?.hidden?.includes("actions") + visible: this.gridCommons.isColumnVisible("actions") }); } diff --git a/src/webcomponents/individual/individual-grid.js b/src/webcomponents/individual/individual-grid.js index 1e64b184c5..c1cc8d0031 100644 --- a/src/webcomponents/individual/individual-grid.js +++ b/src/webcomponents/individual/individual-grid.js @@ -613,11 +613,10 @@ export default class IndividualGrid extends LitElement { events: { "click a": this.onActionClick.bind(this) }, - visible: !this._config.columns?.hidden?.includes("actions") + visible: this.gridCommons.isColumnVisible("actions") }); } - // _columns = UtilsNew.mergeTable(_columns, this._config.columns || this._config.hiddenColumns, !!this._config.hiddenColumns); this._columns = this.gridCommons.addColumnsFromExtensions(this._columns, this.COMPONENT_ID); return this._columns; } diff --git a/src/webcomponents/job/job-grid.js b/src/webcomponents/job/job-grid.js index bcca9d7928..7ef2a79185 100644 --- a/src/webcomponents/job/job-grid.js +++ b/src/webcomponents/job/job-grid.js @@ -583,7 +583,7 @@ export default class JobGrid extends LitElement { events: { "click a": this.onActionClick.bind(this) }, - visible: !this._config.columns?.hidden?.includes("actions") + visible: this.gridCommons.isColumnVisible("actions") }); } diff --git a/src/webcomponents/sample/sample-grid.js b/src/webcomponents/sample/sample-grid.js index 37e42f6601..9e67c56686 100644 --- a/src/webcomponents/sample/sample-grid.js +++ b/src/webcomponents/sample/sample-grid.js @@ -478,11 +478,10 @@ export default class SampleGrid extends LitElement { events: { "click a": this.onActionClick.bind(this) }, - visible: !this._config.columns?.hidden?.includes("actions") + visible: this.gridCommons.isColumnVisible("actions") }); } - // _columns = UtilsNew.mergeTable(_columns, this._config.columns || this._config.hiddenColumns, !!this._config.hiddenColumns); this._columns = this.gridCommons.addColumnsFromExtensions(this._columns, this.COMPONENT_ID); return this._columns; } From 632aa75ac95b9f41896589b766a25324c3b28b2a Mon Sep 17 00:00:00 2001 From: Josemi Date: Wed, 27 Mar 2024 16:54:13 +0100 Subject: [PATCH 5/6] wc: remove html tags from text element in variant-interpreter-grid-config #TASK-5946 --- .../variant/interpretation/variant-interpreter-grid-config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webcomponents/variant/interpretation/variant-interpreter-grid-config.js b/src/webcomponents/variant/interpretation/variant-interpreter-grid-config.js index 28c21ff2d2..f3e6d7cf24 100644 --- a/src/webcomponents/variant/interpretation/variant-interpreter-grid-config.js +++ b/src/webcomponents/variant/interpretation/variant-interpreter-grid-config.js @@ -253,7 +253,7 @@ export default class VariantInterpreterGridConfig extends LitElement { }, { type: "text", - text: "Select the columns to be displayed", + text: "Select the columns to be displayed", display: { containerStyle: "margin: 20px 5px 5px 0px", } From 1f0651a2a06e4cd71058fd4d478c1c5c7a8869d8 Mon Sep 17 00:00:00 2001 From: imedina Date: Mon, 1 Apr 2024 15:14:52 +0100 Subject: [PATCH 6/6] Fix cases limit --- src/webcomponents/family/family-grid.js | 5 ++++- src/webcomponents/individual/individual-grid.js | 5 ++++- src/webcomponents/sample/sample-grid.js | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/webcomponents/family/family-grid.js b/src/webcomponents/family/family-grid.js index 1fdacdef94..51576f7fef 100644 --- a/src/webcomponents/family/family-grid.js +++ b/src/webcomponents/family/family-grid.js @@ -193,6 +193,9 @@ export default class FamilyGrid extends LitElement { ...this.query }; + // Calculate the number of cases to fetch + const casesLimit = this.table?.bootstrapTable("getOptions")?.pageSize || this._config.pageSize || 10; + // Store the current filters this.lastFilters = {...this.filters}; this.opencgaSession.opencgaClient.families() @@ -210,7 +213,7 @@ export default class FamilyGrid extends LitElement { family: familyIds, study: this.opencgaSession.study.fqn, include: "id,proband.id,family.members,family.id", - limit: (this._config.pageSize || 10) * 10 + limit: casesLimit * 10 }) .then(caseResponse => { familyResponse.getResults().forEach(family => { diff --git a/src/webcomponents/individual/individual-grid.js b/src/webcomponents/individual/individual-grid.js index 6e69b23053..aef0bb4858 100644 --- a/src/webcomponents/individual/individual-grid.js +++ b/src/webcomponents/individual/individual-grid.js @@ -197,6 +197,9 @@ export default class IndividualGrid extends LitElement { ...this.query }; + // Calculate the number of cases to fetch + const casesLimit = this.table?.bootstrapTable("getOptions")?.pageSize || this._config.pageSize || 10; + // Store the current filters this.lastFilters = {...this.filters}; this.opencgaSession.opencgaClient.individuals() @@ -215,7 +218,7 @@ export default class IndividualGrid extends LitElement { individual: individualIds, study: this.opencgaSession.study.fqn, include: "id,proband.id,family.members", - limit: (this._config.pageSize || 10) * 10 + limit: casesLimit * 10 }) .then(caseResponse => { individualResponse.getResults().forEach(individual => { diff --git a/src/webcomponents/sample/sample-grid.js b/src/webcomponents/sample/sample-grid.js index d6d7cabe46..df2fc4e09f 100644 --- a/src/webcomponents/sample/sample-grid.js +++ b/src/webcomponents/sample/sample-grid.js @@ -189,6 +189,9 @@ export default class SampleGrid extends LitElement { ...this.query }; + // Calculate the number of cases to fetch + const casesLimit = this.table?.bootstrapTable("getOptions")?.pageSize || this._config.pageSize || 10; + // Store the current filters this.lastFilters = {...this.filters}; this.opencgaSession.opencgaClient.samples() @@ -208,7 +211,7 @@ export default class SampleGrid extends LitElement { individual: individualIds, study: this.opencgaSession.study.fqn, include: "id,proband.id,family.members", - limit: (this._config.pageSize || 10) * 10 + limit: casesLimit * 10 }) .then(caseResponse => { sampleResponse.getResults().forEach(sample => {