From 3b50ec251aaf368700feea04f5f2e40201ce3d98 Mon Sep 17 00:00:00 2001 From: asizemore Date: Fri, 8 Sep 2023 10:55:54 -0400 Subject: [PATCH 1/3] add constraints for diff abund --- .../plugins/differentialabundance.tsx | 23 ++++++++++++------- packages/libs/eda/src/lib/core/types/study.ts | 3 +++ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/packages/libs/eda/src/lib/core/components/computations/plugins/differentialabundance.tsx b/packages/libs/eda/src/lib/core/components/computations/plugins/differentialabundance.tsx index 43ca956c58..1fbc81e754 100644 --- a/packages/libs/eda/src/lib/core/components/computations/plugins/differentialabundance.tsx +++ b/packages/libs/eda/src/lib/core/components/computations/plugins/differentialabundance.tsx @@ -175,14 +175,21 @@ export function DifferentialAbundanceConfiguration( ); const collectionVarItems = useMemo(() => { - return collections.map((collectionVar) => ({ - value: { - variableId: collectionVar.id, - entityId: collectionVar.entityId, - }, - display: - collectionVar.entityDisplayName + ' > ' + collectionVar.displayName, - })); + return collections + .filter((collectionVar) => { + return ( + !collectionVar.isProportion && + collectionVar.normalizationMethod === 'NULL' + ); + }) + .map((collectionVar) => ({ + value: { + variableId: collectionVar.id, + entityId: collectionVar.entityId, + }, + display: + collectionVar.entityDisplayName + ' > ' + collectionVar.displayName, + })); }, [collections]); const selectedCollectionVar = useMemo(() => { diff --git a/packages/libs/eda/src/lib/core/types/study.ts b/packages/libs/eda/src/lib/core/types/study.ts index ea54f20561..fecdf8125c 100644 --- a/packages/libs/eda/src/lib/core/types/study.ts +++ b/packages/libs/eda/src/lib/core/types/study.ts @@ -220,6 +220,9 @@ export const CollectionVariableTreeNode = t.intersection([ units: t.string, entityId: t.string, entityDisplayName: t.string, + isCompositional: t.boolean, + isProportion: t.boolean, + normalizationMethod: t.string, }), ]); From db38cc302c8780b004975cc184fb6f9cfdf333e5 Mon Sep 17 00:00:00 2001 From: asizemore Date: Fri, 8 Sep 2023 13:30:49 -0400 Subject: [PATCH 2/3] add constraints to all apps --- .../computations/plugins/abundance.tsx | 20 +++++++++++-------- .../computations/plugins/alphaDiv.tsx | 20 +++++++++++-------- .../computations/plugins/betadiv.tsx | 20 +++++++++++-------- .../plugins/differentialabundance.tsx | 3 ++- 4 files changed, 38 insertions(+), 25 deletions(-) diff --git a/packages/libs/eda/src/lib/core/components/computations/plugins/abundance.tsx b/packages/libs/eda/src/lib/core/components/computations/plugins/abundance.tsx index 7fd36dfecb..71b19ad718 100644 --- a/packages/libs/eda/src/lib/core/components/computations/plugins/abundance.tsx +++ b/packages/libs/eda/src/lib/core/components/computations/plugins/abundance.tsx @@ -150,14 +150,18 @@ export function AbundanceConfiguration(props: ComputationConfigProps) { ); const collectionVarItems = useMemo(() => { - return collections.map((collectionVar) => ({ - value: { - variableId: collectionVar.id, - entityId: collectionVar.entityId, - }, - display: - collectionVar.entityDisplayName + ' > ' + collectionVar.displayName, - })); + return collections + .filter((collectionVar) => { + return collectionVar.normalizationMethod !== 'NULL'; + }) + .map((collectionVar) => ({ + value: { + variableId: collectionVar.id, + entityId: collectionVar.entityId, + }, + display: + collectionVar.entityDisplayName + ' > ' + collectionVar.displayName, + })); }, [collections]); const selectedCollectionVar = useMemo(() => { diff --git a/packages/libs/eda/src/lib/core/components/computations/plugins/alphaDiv.tsx b/packages/libs/eda/src/lib/core/components/computations/plugins/alphaDiv.tsx index 87d4cf74a0..f8cd577e19 100644 --- a/packages/libs/eda/src/lib/core/components/computations/plugins/alphaDiv.tsx +++ b/packages/libs/eda/src/lib/core/components/computations/plugins/alphaDiv.tsx @@ -133,14 +133,18 @@ export function AlphaDivConfiguration(props: ComputationConfigProps) { ); const collectionVarItems = useMemo(() => { - return collections.map((collectionVar) => ({ - value: { - variableId: collectionVar.id, - entityId: collectionVar.entityId, - }, - display: - collectionVar.entityDisplayName + ' > ' + collectionVar.displayName, - })); + return collections + .filter((collectionVar) => { + return collectionVar.normalizationMethod !== 'NULL'; + }) + .map((collectionVar) => ({ + value: { + variableId: collectionVar.id, + entityId: collectionVar.entityId, + }, + display: + collectionVar.entityDisplayName + ' > ' + collectionVar.displayName, + })); }, [collections]); const selectedCollectionVar = useMemo(() => { diff --git a/packages/libs/eda/src/lib/core/components/computations/plugins/betadiv.tsx b/packages/libs/eda/src/lib/core/components/computations/plugins/betadiv.tsx index 09051bbd23..c7b893e9ab 100644 --- a/packages/libs/eda/src/lib/core/components/computations/plugins/betadiv.tsx +++ b/packages/libs/eda/src/lib/core/components/computations/plugins/betadiv.tsx @@ -136,14 +136,18 @@ export function BetaDivConfiguration(props: ComputationConfigProps) { ); const collectionVarItems = useMemo(() => { - return collections.map((collectionVar) => ({ - value: { - variableId: collectionVar.id, - entityId: collectionVar.entityId, - }, - display: - collectionVar.entityDisplayName + ' > ' + collectionVar.displayName, - })); + return collections + .filter((collectionVar) => { + return collectionVar.normalizationMethod !== 'NULL'; + }) + .map((collectionVar) => ({ + value: { + variableId: collectionVar.id, + entityId: collectionVar.entityId, + }, + display: + collectionVar.entityDisplayName + ' > ' + collectionVar.displayName, + })); }, [collections]); const selectedCollectionVar = useMemo(() => { diff --git a/packages/libs/eda/src/lib/core/components/computations/plugins/differentialabundance.tsx b/packages/libs/eda/src/lib/core/components/computations/plugins/differentialabundance.tsx index 1fbc81e754..a7f3fbd3a4 100644 --- a/packages/libs/eda/src/lib/core/components/computations/plugins/differentialabundance.tsx +++ b/packages/libs/eda/src/lib/core/components/computations/plugins/differentialabundance.tsx @@ -179,7 +179,8 @@ export function DifferentialAbundanceConfiguration( .filter((collectionVar) => { return ( !collectionVar.isProportion && - collectionVar.normalizationMethod === 'NULL' + collectionVar.normalizationMethod === 'NULL' && + !collectionVar.displayName?.includes('pathway') ); }) .map((collectionVar) => ({ From 1e1b93bfdfa109d22a5b8332d5770430bbe9a0c7 Mon Sep 17 00:00:00 2001 From: asizemore Date: Mon, 11 Sep 2023 06:32:18 -0400 Subject: [PATCH 3/3] account for diy datasets --- .../core/components/computations/plugins/abundance.tsx | 4 +++- .../core/components/computations/plugins/alphaDiv.tsx | 4 +++- .../core/components/computations/plugins/betadiv.tsx | 4 +++- .../computations/plugins/differentialabundance.tsx | 10 +++++----- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/packages/libs/eda/src/lib/core/components/computations/plugins/abundance.tsx b/packages/libs/eda/src/lib/core/components/computations/plugins/abundance.tsx index 71b19ad718..e5ac58d28e 100644 --- a/packages/libs/eda/src/lib/core/components/computations/plugins/abundance.tsx +++ b/packages/libs/eda/src/lib/core/components/computations/plugins/abundance.tsx @@ -152,7 +152,9 @@ export function AbundanceConfiguration(props: ComputationConfigProps) { const collectionVarItems = useMemo(() => { return collections .filter((collectionVar) => { - return collectionVar.normalizationMethod !== 'NULL'; + return collectionVar.normalizationMethod + ? collectionVar.normalizationMethod !== 'NULL' + : true; }) .map((collectionVar) => ({ value: { diff --git a/packages/libs/eda/src/lib/core/components/computations/plugins/alphaDiv.tsx b/packages/libs/eda/src/lib/core/components/computations/plugins/alphaDiv.tsx index f8cd577e19..eac9b0c18d 100644 --- a/packages/libs/eda/src/lib/core/components/computations/plugins/alphaDiv.tsx +++ b/packages/libs/eda/src/lib/core/components/computations/plugins/alphaDiv.tsx @@ -135,7 +135,9 @@ export function AlphaDivConfiguration(props: ComputationConfigProps) { const collectionVarItems = useMemo(() => { return collections .filter((collectionVar) => { - return collectionVar.normalizationMethod !== 'NULL'; + return collectionVar.normalizationMethod + ? collectionVar.normalizationMethod !== 'NULL' + : true; }) .map((collectionVar) => ({ value: { diff --git a/packages/libs/eda/src/lib/core/components/computations/plugins/betadiv.tsx b/packages/libs/eda/src/lib/core/components/computations/plugins/betadiv.tsx index c7b893e9ab..67022b1381 100644 --- a/packages/libs/eda/src/lib/core/components/computations/plugins/betadiv.tsx +++ b/packages/libs/eda/src/lib/core/components/computations/plugins/betadiv.tsx @@ -138,7 +138,9 @@ export function BetaDivConfiguration(props: ComputationConfigProps) { const collectionVarItems = useMemo(() => { return collections .filter((collectionVar) => { - return collectionVar.normalizationMethod !== 'NULL'; + return collectionVar.normalizationMethod + ? collectionVar.normalizationMethod !== 'NULL' + : true; }) .map((collectionVar) => ({ value: { diff --git a/packages/libs/eda/src/lib/core/components/computations/plugins/differentialabundance.tsx b/packages/libs/eda/src/lib/core/components/computations/plugins/differentialabundance.tsx index a7f3fbd3a4..5bc1d7e7b5 100644 --- a/packages/libs/eda/src/lib/core/components/computations/plugins/differentialabundance.tsx +++ b/packages/libs/eda/src/lib/core/components/computations/plugins/differentialabundance.tsx @@ -177,11 +177,11 @@ export function DifferentialAbundanceConfiguration( const collectionVarItems = useMemo(() => { return collections .filter((collectionVar) => { - return ( - !collectionVar.isProportion && - collectionVar.normalizationMethod === 'NULL' && - !collectionVar.displayName?.includes('pathway') - ); + return collectionVar.normalizationMethod + ? !collectionVar.isProportion && + collectionVar.normalizationMethod === 'NULL' && + !collectionVar.displayName?.includes('pathway') + : true; }) .map((collectionVar) => ({ value: {