Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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",
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Workflow } from "../../../../../../apis/catalog/brc-analytics-catalog/common/entities";

export interface Props {
buttonText?: string;
entityId: string;
workflow: Workflow;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<StyledAccordion component={FluidPaper}>
<AccordionSummary
Expand Down Expand Up @@ -50,7 +53,7 @@ export const CustomWorkflow = ({ entityId }: Props): JSX.Element => {
})}
rel={REL_ATTRIBUTE.NO_OPENER}
>
Select Data
{buttonText}
</Button>
</AccordionDetails>
</StyledAccordion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -18,6 +21,8 @@ export const AnalysisMethodsCatalog = ({ assembly }: Props): JSX.Element => {
query: { entityId },
} = useRouter();

const isDEEnabled = useFeatureFlag("de");

return (
<Stack gap={8} useFlexGap>
{/* Custom Analysis */}
Expand All @@ -26,7 +31,10 @@ export const AnalysisMethodsCatalog = ({ assembly }: Props): JSX.Element => {
description="Prefer to explore the data without a predefined workflow?"
title="Custom Analysis"
/>
<CustomWorkflow entityId={entityId as string} />
<WorkflowAccordion
entityId={entityId as string}
workflow={CUSTOM_WORKFLOW}
/>
</Stack>
<Stack gap={4} useFlexGap>
{/* Workflow Analysis */}
Expand All @@ -49,6 +57,13 @@ export const AnalysisMethodsCatalog = ({ assembly }: Props): JSX.Element => {
}
title="Select a Workflow"
/>
{isDEEnabled && (
<WorkflowAccordion
buttonText="Configure Inputs"
entityId={entityId as string}
workflow={DIFFERENTIAL_EXPRESSION_ANALYSIS}
/>
)}
{workflowCategories.map((workflowCategory) => {
return (
<AnalysisMethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { StepConfig } from "../components/Step/types";
import { STEP } from "./constants";
import { CUSTOM_WORKFLOW } from "../../../../../../../../../components/Entity/components/AnalysisMethod/components/CustomWorkflow/constants";
import { ConfiguredInput } from "../../../../../../../../../views/WorkflowInputsView/hooks/UseConfigureInputs/types";
import { DIFFERENTIAL_EXPRESSION_ANALYSIS } from "../../../../../../AnalysisMethod/components/DifferentialExpressionAnalysis/constants";

/**
* Augment the configured steps with two additional sequencing steps "READ_RUNS_PAIRED" and "READ_RUNS_SINGLE".
Expand Down Expand Up @@ -42,6 +43,11 @@ export function buildSteps(workflow: Workflow): StepConfig[] {
);
}

// Return steps for differential expression analysis
if (workflow.trsId === DIFFERENTIAL_EXPRESSION_ANALYSIS.trsId) {
return [STEP.ASSEMBLY_ID, STEP.GENE_MODEL_URL].filter(isStepConfigured);
}

// Get workflow variables from the workflow.
const variables = workflow.parameters
.map((param) => param.variable)
Expand Down
7 changes: 7 additions & 0 deletions app/services/workflows/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -81,6 +82,12 @@ export async function loadWorkflows(): Promise<void> {
// 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);
}
8 changes: 8 additions & 0 deletions app/views/WorkflowInputsView/workflowInputsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<Assembly>(entityId);
Expand All @@ -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 <Error statusCode={404} />;

return (
<Detail
mainColumn={
Expand Down
3 changes: 3 additions & 0 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { GoogleSignInAuthenticationProvider } from "@databiosphere/findable-ui/l
import { ServicesProvider } from "@databiosphere/findable-ui/lib/providers/services/provider";
import "../app/styles/fonts/fonts.css";
import { useEntities } from "../app/services/workflows/hooks/UseEntities/hook";
import { setFeatureFlags } from "@databiosphere/findable-ui/lib/hooks/useFeatureFlag/common/utils";

const DEFAULT_ENTITY_LIST_TYPE = "organisms";

Expand All @@ -40,6 +41,8 @@ export type AppPropsWithComponent = AppProps & {
pageProps: PageProps;
};

setFeatureFlags(["de"]);

function MyApp({ Component, pageProps }: AppPropsWithComponent): JSX.Element {
// Set up the site configuration, layout and theme.
const appConfig = config();
Expand Down
10 changes: 10 additions & 0 deletions pages/data/[entityListType]/[entityId]/[trsId]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
import { WorkflowInputsView } from "../../../../../app/views/WorkflowInputsView/workflowInputsView";
import { GA2AssemblyEntity } from "../../../../../app/apis/catalog/ga2/entities";
import { CUSTOM_WORKFLOW } from "../../../../../app/components/Entity/components/AnalysisMethod/components/CustomWorkflow/constants";
import { DIFFERENTIAL_EXPRESSION_ANALYSIS } from "../../../../../app/components/Entity/components/AnalysisMethod/components/DifferentialExpressionAnalysis/constants";

interface StaticPath {
params: PageUrlParams;
Expand Down Expand Up @@ -110,6 +111,15 @@ function processEntityPaths(
},
});

// Create differential expression analysis path.
paths.push({
params: {
entityId,
entityListType,
trsId: DIFFERENTIAL_EXPRESSION_ANALYSIS.trsId,
},
});

// Create paths for each compatible workflow.
compatibleWorkflows.forEach((workflow) => {
// Format the trsId for URL use
Expand Down
Loading