diff --git a/app/components/Entity/components/AnalysisMethod/components/CustomWorkflow/types.ts b/app/components/Entity/components/AnalysisMethod/components/CustomWorkflow/types.ts deleted file mode 100644 index c69c3a20f..000000000 --- a/app/components/Entity/components/AnalysisMethod/components/CustomWorkflow/types.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface Props { - entityId: string; -} diff --git a/app/components/Entity/components/AnalysisMethod/components/DifferentialExpressionAnalysis/constants.ts b/app/components/Entity/components/AnalysisMethod/components/DifferentialExpressionAnalysis/constants.ts new file mode 100644 index 000000000..5527c803e --- /dev/null +++ b/app/components/Entity/components/AnalysisMethod/components/DifferentialExpressionAnalysis/constants.ts @@ -0,0 +1,13 @@ +import { WORKFLOW_PLOIDY } from "../../../../../../apis/catalog/brc-analytics-catalog/common/schema-entities"; +import { Workflow } from "../../../../../../apis/catalog/brc-analytics-catalog/common/entities"; + +export const DIFFERENTIAL_EXPRESSION_ANALYSIS: Workflow = { + iwcId: "", + parameters: [], + ploidy: WORKFLOW_PLOIDY.ANY, + taxonomyId: null, + trsId: "differential-expression-analysis", + workflowDescription: + "Analyze differential gene expression from raw reads to DE results.", + workflowName: "Differential Expression Analysis", +}; diff --git a/app/components/Entity/components/AnalysisMethod/components/WorkflowAccordion/types.ts b/app/components/Entity/components/AnalysisMethod/components/WorkflowAccordion/types.ts new file mode 100644 index 000000000..f34ce9d22 --- /dev/null +++ b/app/components/Entity/components/AnalysisMethod/components/WorkflowAccordion/types.ts @@ -0,0 +1,7 @@ +import { Workflow } from "../../../../../../apis/catalog/brc-analytics-catalog/common/entities"; + +export interface Props { + buttonText?: string; + entityId: string; + workflow: Workflow; +} diff --git a/app/components/Entity/components/AnalysisMethod/components/CustomWorkflow/customWorkflow.styles.ts b/app/components/Entity/components/AnalysisMethod/components/WorkflowAccordion/workflowAccordion.styles.ts similarity index 100% rename from app/components/Entity/components/AnalysisMethod/components/CustomWorkflow/customWorkflow.styles.ts rename to app/components/Entity/components/AnalysisMethod/components/WorkflowAccordion/workflowAccordion.styles.ts diff --git a/app/components/Entity/components/AnalysisMethod/components/CustomWorkflow/customWorkflow.tsx b/app/components/Entity/components/AnalysisMethod/components/WorkflowAccordion/workflowAccordion.tsx similarity index 86% rename from app/components/Entity/components/AnalysisMethod/components/CustomWorkflow/customWorkflow.tsx rename to app/components/Entity/components/AnalysisMethod/components/WorkflowAccordion/workflowAccordion.tsx index 28757d07b..1a265c912 100644 --- a/app/components/Entity/components/AnalysisMethod/components/CustomWorkflow/customWorkflow.tsx +++ b/app/components/Entity/components/AnalysisMethod/components/WorkflowAccordion/workflowAccordion.tsx @@ -17,12 +17,15 @@ import { ROUTES } from "../../../../../../../routes/constants"; import { replaceParameters } from "@databiosphere/findable-ui/lib/utils/replaceParameters"; import { TYPOGRAPHY_PROPS } from "@databiosphere/findable-ui/lib/styles/common/mui/typography"; import { FluidPaper } from "@databiosphere/findable-ui/lib/components/common/Paper/components/FluidPaper/fluidPaper"; -import { CUSTOM_WORKFLOW } from "./constants"; -import { StyledAccordion } from "./customWorkflow.styles"; +import { StyledAccordion } from "./workflowAccordion.styles"; import { ChevronRightRounded } from "@mui/icons-material"; -export const CustomWorkflow = ({ entityId }: Props): JSX.Element => { - const { trsId, workflowDescription, workflowName } = CUSTOM_WORKFLOW; +export const WorkflowAccordion = ({ + buttonText = "Select Data", + entityId, + workflow, +}: Props): JSX.Element => { + const { trsId, workflowDescription, workflowName } = workflow; return ( { })} rel={REL_ATTRIBUTE.NO_OPENER} > - Select Data + {buttonText} diff --git a/app/components/Entity/components/AnalysisMethodsCatalog/analysisMethodsCatalog.tsx b/app/components/Entity/components/AnalysisMethodsCatalog/analysisMethodsCatalog.tsx index ed427807b..a58ae2ac9 100644 --- a/app/components/Entity/components/AnalysisMethodsCatalog/analysisMethodsCatalog.tsx +++ b/app/components/Entity/components/AnalysisMethodsCatalog/analysisMethodsCatalog.tsx @@ -2,11 +2,14 @@ import { AnalysisMethod } from "../AnalysisMethod/analysisMethod"; import { Props } from "./types"; import { useRouter } from "next/router"; import { Fragment } from "react"; -import { CustomWorkflow } from "../AnalysisMethod/components/CustomWorkflow/customWorkflow"; +import { WorkflowAccordion } from "../AnalysisMethod/components/WorkflowAccordion/workflowAccordion"; +import { CUSTOM_WORKFLOW } from "../AnalysisMethod/components/CustomWorkflow/constants"; +import { DIFFERENTIAL_EXPRESSION_ANALYSIS } from "../AnalysisMethod/components/DifferentialExpressionAnalysis/constants"; import { AnalysisTypeHeader } from "./components/AnalysisTypeHeader/analysisTypeHeader"; import { Stack } from "@mui/material"; import { buildAssemblyWorkflows } from "./utils"; import WORKFLOW_CATEGORIES from "../../../../../catalog/output/workflows.json"; +import { useFeatureFlag } from "@databiosphere/findable-ui/lib/hooks/useFeatureFlag/useFeatureFlag"; export const AnalysisMethodsCatalog = ({ assembly }: Props): JSX.Element => { const workflowCategories = buildAssemblyWorkflows( @@ -18,6 +21,8 @@ export const AnalysisMethodsCatalog = ({ assembly }: Props): JSX.Element => { query: { entityId }, } = useRouter(); + const isDEEnabled = useFeatureFlag("de"); + return ( {/* Custom Analysis */} @@ -26,7 +31,10 @@ export const AnalysisMethodsCatalog = ({ assembly }: Props): JSX.Element => { description="Prefer to explore the data without a predefined workflow?" title="Custom Analysis" /> - + {/* Workflow Analysis */} @@ -49,6 +57,13 @@ export const AnalysisMethodsCatalog = ({ assembly }: Props): JSX.Element => { } title="Select a Workflow" /> + {isDEEnabled && ( + + )} {workflowCategories.map((workflowCategory) => { return ( param.variable) diff --git a/app/services/workflows/loader.ts b/app/services/workflows/loader.ts index 4df537827..8d11eb2b6 100644 --- a/app/services/workflows/loader.ts +++ b/app/services/workflows/loader.ts @@ -8,6 +8,7 @@ import { } from "../../apis/catalog/brc-analytics-catalog/common/entities"; import { formatTrsId } from "../../components/Entity/components/AnalysisMethodsCatalog/utils"; import { CUSTOM_WORKFLOW } from "../../components/Entity/components/AnalysisMethod/components/CustomWorkflow/constants"; +import { DIFFERENTIAL_EXPRESSION_ANALYSIS } from "../../components/Entity/components/AnalysisMethod/components/DifferentialExpressionAnalysis/constants"; /** * Fetches entities from the API. @@ -81,6 +82,12 @@ export async function loadWorkflows(): Promise { // Add custom workflow. workflowById.set(CUSTOM_WORKFLOW.trsId, CUSTOM_WORKFLOW); + // Add differential expression analysis. + workflowById.set( + DIFFERENTIAL_EXPRESSION_ANALYSIS.trsId, + DIFFERENTIAL_EXPRESSION_ANALYSIS + ); + setEntitiesById("workflows", workflowById); setEntitiesByType("workflows", workflowCategories); } diff --git a/app/views/WorkflowInputsView/workflowInputsView.tsx b/app/views/WorkflowInputsView/workflowInputsView.tsx index f680f4523..8346f8f7e 100644 --- a/app/views/WorkflowInputsView/workflowInputsView.tsx +++ b/app/views/WorkflowInputsView/workflowInputsView.tsx @@ -9,6 +9,9 @@ import { augmentConfiguredSteps } from "../../components/Entity/components/Confi import { SEQUENCING_STEPS } from "../../components/Entity/components/ConfigureWorkflowInputs/components/Main/components/Stepper/steps/constants"; import { getAssembly } from "../../services/workflows/entities"; import { getWorkflow } from "../../services/workflows/entities"; +import { useFeatureFlag } from "@databiosphere/findable-ui/lib/hooks/useFeatureFlag/useFeatureFlag"; +import Error from "next/error"; +import { DIFFERENTIAL_EXPRESSION_ANALYSIS } from "../../components/Entity/components/AnalysisMethod/components/DifferentialExpressionAnalysis/constants"; export const WorkflowInputsView = ({ entityId, trsId }: Props): JSX.Element => { const genome = getAssembly(entityId); @@ -17,6 +20,11 @@ export const WorkflowInputsView = ({ entityId, trsId }: Props): JSX.Element => { const { configuredInput, onConfigure } = useConfigureInputs(); const { configuredSteps } = useConfiguredSteps(workflow); + const isDEEnabled = useFeatureFlag("de"); + + if (!isDEEnabled && workflow.trsId === DIFFERENTIAL_EXPRESSION_ANALYSIS.trsId) + return ; + return ( { // Format the trsId for URL use