Skip to content

Commit 2e69b61

Browse files
frano-mFran McDade
andauthored
feat: update assembly page title and side column for selecting a workflow (#444) (#445)
* feat: assembly details on side column is rendered before resources (#444) * feat: updated assembly page top configuration (#444) * feat: removed fields from assembly details (#444) * feat: do not display an undefined strain (#444) --------- Co-authored-by: Fran McDade <[email protected]>
1 parent 744644a commit 2e69b61

File tree

10 files changed

+82
-167
lines changed

10 files changed

+82
-167
lines changed

app/components/Entity/components/AnalysisMethods/analysisMethods.styles.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

app/components/Entity/components/AnalysisMethods/analysisMethods.tsx

Lines changed: 0 additions & 15 deletions
This file was deleted.

app/components/Entity/components/AnalysisMethods/constants.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

app/components/Entity/components/AnalysisMethods/types.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

app/components/Entity/components/AnalysisMethodsCatalog/analysisMethodsCatalog.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
import { AnalysisMethods } from "../AnalysisMethods/analysisMethods";
21
import workflows from "../../../../../catalog/output/workflows.json";
32
import { AnalysisMethod } from "../AnalysisMethod/analysisMethod";
43
import { Props } from "./types";
54
import { workflowIsCompatibleWithAssembly } from "./utils";
65
import { useFeatureFlag } from "@databiosphere/findable-ui/lib/hooks/useFeatureFlag/useFeatureFlag";
76
import { useRouter } from "next/router";
7+
import { Fragment } from "react";
88

99
export const AnalysisMethodsCatalog = ({ assembly }: Props): JSX.Element => {
1010
const isFeatureEnabled = useFeatureFlag("workflow");
1111
const {
1212
query: { entityId },
1313
} = useRouter();
1414
return (
15-
<AnalysisMethods>
15+
<Fragment>
1616
{workflows.map((workflowCategory) => {
1717
const compatibleWorkflows = workflowCategory.workflows.filter(
1818
(workflow) => workflowIsCompatibleWithAssembly(workflow, assembly)
@@ -29,6 +29,6 @@ export const AnalysisMethodsCatalog = ({ assembly }: Props): JSX.Element => {
2929
/>
3030
);
3131
})}
32-
</AnalysisMethods>
32+
</Fragment>
3333
);
3434
};

app/components/Entity/components/ConfigureWorkflowInputs/components/SideColumn/sideColumn.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { CollapsableSection } from "@databiosphere/findable-ui/lib/components/co
66
import { KeyValuePairs } from "@databiosphere/findable-ui/lib/components/common/KeyValuePairs/keyValuePairs";
77
import { Props } from "./types";
88
import {
9-
buildGenomeDetails,
9+
buildAssemblyDetails,
1010
buildWorkflowDetails,
1111
} from "../../../../../../viewModelBuilders/catalog/brc-analytics-catalog/common/viewModelBuilders";
1212

@@ -19,7 +19,7 @@ export const SideColumn = ({ genome, workflow }: Props): JSX.Element => {
1919
<KeyValuePairs {...buildWorkflowDetails(workflow)} />
2020
</CollapsableSection>
2121
<CollapsableSection title="Assembly Details">
22-
<KeyValuePairs {...buildGenomeDetails(genome)} />
22+
<KeyValuePairs {...buildAssemblyDetails(genome)} />
2323
</CollapsableSection>
2424
</GridPaper>
2525
</FluidPaper>

app/components/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ export { BasicCell } from "@databiosphere/findable-ui/lib/components/Table/compo
2929
export { NTagCell } from "@databiosphere/findable-ui/lib/components/Table/components/TableCell/components/NTagCell/nTagCell";
3030
export { CopyText } from "./common/CopyText/copyText";
3131
export { AnalysisMethod } from "./Entity/components/AnalysisMethod/analysisMethod";
32-
export { AnalysisMethods } from "./Entity/components/AnalysisMethods/analysisMethods";
3332
export { AnalysisMethodsCatalog } from "./Entity/components/AnalysisMethodsCatalog/analysisMethodsCatalog";
3433
export { AnalysisMethodsTitle } from "./Entity/components/AnalysisMethodsTitle/analysisMethodsTitle";
3534
export { AnalysisPortals } from "./Entity/components/AnalysisPortals/analysisPortals";

app/viewModelBuilders/catalog/brc-analytics-catalog/common/viewModelBuilders.ts

Lines changed: 57 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ import {
2828
getOrganismId,
2929
} from "../../../../apis/catalog/brc-analytics-catalog/common/utils";
3030
import { COLUMN_IDENTIFIER } from "@databiosphere/findable-ui/lib/components/Table/common/columnIdentifier";
31-
import { LABEL } from "@databiosphere/findable-ui/lib/apis/azul/common/entities";
32-
import { TEXT_BODY_SMALL_400 } from "@databiosphere/findable-ui/lib/theme/common/typography";
3331

3432
/**
3533
* Build props for the accession cell.
@@ -89,6 +87,58 @@ export const buildAnnotationStatus = (
8987
};
9088
};
9189

90+
/**
91+
* Build props for the assembly BackPageHero component.
92+
* @param assembly - Assembly entity.
93+
* @returns Props to be used for the BackPageHero component.
94+
*/
95+
export const buildAssemblyBackPageHero = (
96+
assembly: BRCDataCatalogGenome
97+
): ComponentProps<typeof C.BackPageHero> => {
98+
return {
99+
breadcrumbs: getAssemblyBreadcrumbs(assembly),
100+
title: "Select a Workflow",
101+
};
102+
};
103+
104+
/**
105+
* Build props for the assembly details KeyValuePairs component.
106+
* @param assembly - Assembly entity.
107+
* @returns Props to be used for the KeyValuePairs component.
108+
*/
109+
export const buildAssemblyDetails = (
110+
assembly: BRCDataCatalogGenome
111+
): ComponentProps<typeof C.KeyValuePairs> => {
112+
const keyValuePairs = new Map<Key, Value>();
113+
keyValuePairs.set(
114+
BRC_DATA_CATALOG_CATEGORY_LABEL.TAXONOMIC_LEVEL_SPECIES,
115+
C.Link({
116+
label: assembly.taxonomicLevelSpecies,
117+
url: `${ROUTES.ORGANISMS}/${encodeURIComponent(getGenomeOrganismId(assembly))}`,
118+
})
119+
);
120+
const strain = getGenomeStrainText(assembly);
121+
if (strain) {
122+
keyValuePairs.set(
123+
BRC_DATA_CATALOG_CATEGORY_LABEL.TAXONOMIC_LEVEL_STRAIN,
124+
strain
125+
);
126+
}
127+
keyValuePairs.set(
128+
BRC_DATA_CATALOG_CATEGORY_LABEL.ACCESSION,
129+
C.CopyText({
130+
children: assembly.accession,
131+
value: assembly.accession,
132+
})
133+
);
134+
return {
135+
KeyElType: C.KeyElType,
136+
KeyValuesElType: (props) => C.Stack({ ...props, gap: 4 }),
137+
ValueElType: C.ValueElType,
138+
keyValuePairs,
139+
};
140+
};
141+
92142
/**
93143
* Build props for the assemblies cell.
94144
* @param organism - Genome entity.
@@ -479,96 +529,6 @@ export const buildGenomeAnalysisPortals = (
479529
};
480530
};
481531

482-
/**
483-
* Build props for the genome DetailViewHero component.
484-
* @param genome - Genome entity.
485-
* @returns Props to be used for the DetailViewHero component.
486-
*/
487-
export const buildGenomeChooseAnalysisMethodDetailViewHero = (
488-
genome: BRCDataCatalogGenome
489-
): ComponentProps<typeof C.BackPageHero> => {
490-
return {
491-
breadcrumbs: getGenomeEntityChooseAnalysisMethodBreadcrumbs(genome),
492-
subTitle: C.Link({
493-
TypographyProps: { color: "ink.light", variant: TEXT_BODY_SMALL_400 },
494-
label: `Species: ${genome.taxonomicLevelSpecies}`,
495-
underline: "hover",
496-
url: `${ROUTES.ORGANISMS}/${encodeURIComponent(getGenomeOrganismId(genome))}`,
497-
}),
498-
title: `Analyze in Galaxy - ${genome.accession}`,
499-
};
500-
};
501-
502-
/**
503-
* Build props for the genome detail KeyValuePairs component.
504-
* @param genome - Genome entity.
505-
* @returns Props to be used for the KeyValuePairs component.
506-
*/
507-
export const buildGenomeDetails = (
508-
genome: BRCDataCatalogGenome
509-
): ComponentProps<typeof C.KeyValuePairs> => {
510-
const keyValuePairs = new Map<Key, Value>();
511-
keyValuePairs.set(
512-
BRC_DATA_CATALOG_CATEGORY_LABEL.TAXONOMIC_LEVEL_SPECIES,
513-
C.Link({
514-
label: genome.taxonomicLevelSpecies,
515-
url: `${ROUTES.ORGANISMS}/${encodeURIComponent(getGenomeOrganismId(genome))}`,
516-
})
517-
);
518-
keyValuePairs.set(
519-
BRC_DATA_CATALOG_CATEGORY_LABEL.TAXONOMIC_LEVEL_STRAIN,
520-
getGenomeStrainText(genome, LABEL.UNSPECIFIED)
521-
);
522-
keyValuePairs.set(
523-
BRC_DATA_CATALOG_CATEGORY_LABEL.TAXONOMY_ID,
524-
genome.ncbiTaxonomyId
525-
);
526-
keyValuePairs.set(
527-
BRC_DATA_CATALOG_CATEGORY_LABEL.ACCESSION,
528-
C.CopyText({
529-
children: genome.accession,
530-
value: genome.accession,
531-
})
532-
);
533-
keyValuePairs.set(
534-
BRC_DATA_CATALOG_CATEGORY_LABEL.CHROMOSOMES,
535-
genome.chromosomes ?? LABEL.UNSPECIFIED
536-
);
537-
keyValuePairs.set(BRC_DATA_CATALOG_CATEGORY_LABEL.IS_REF, genome.isRef);
538-
keyValuePairs.set(BRC_DATA_CATALOG_CATEGORY_LABEL.LEVEL, genome.level);
539-
keyValuePairs.set(BRC_DATA_CATALOG_CATEGORY_LABEL.LENGTH, genome.length);
540-
keyValuePairs.set(
541-
BRC_DATA_CATALOG_CATEGORY_LABEL.SCAFFOLD_COUNT,
542-
genome.scaffoldCount
543-
);
544-
keyValuePairs.set(
545-
BRC_DATA_CATALOG_CATEGORY_LABEL.SCAFFOLD_N50,
546-
genome.scaffoldN50
547-
);
548-
keyValuePairs.set(
549-
BRC_DATA_CATALOG_CATEGORY_LABEL.SCAFFOLD_L50,
550-
genome.scaffoldL50
551-
);
552-
keyValuePairs.set(
553-
BRC_DATA_CATALOG_CATEGORY_LABEL.COVERAGE,
554-
genome.coverage ?? LABEL.UNSPECIFIED
555-
);
556-
keyValuePairs.set(
557-
BRC_DATA_CATALOG_CATEGORY_LABEL.GC_PERCENT,
558-
genome.gcPercent
559-
);
560-
keyValuePairs.set(
561-
BRC_DATA_CATALOG_CATEGORY_LABEL.ANNOTATION_STATUS,
562-
genome.annotationStatus ?? LABEL.UNSPECIFIED
563-
);
564-
return {
565-
KeyElType: C.KeyElType,
566-
KeyValuesElType: (props) => C.Stack({ ...props, gap: 4 }),
567-
ValueElType: C.ValueElType,
568-
keyValuePairs,
569-
};
570-
};
571-
572532
/**
573533
* Build props for the organism BackPageHero component.
574534
* @param organism - Organism entity.
@@ -706,17 +666,15 @@ export const buildWorkflowDetails = (
706666
};
707667

708668
/**
709-
* Get the genome entity breadcrumbs.
710-
* @param genome - Genome entity.
669+
* Get the assembly breadcrumbs.
670+
* @param assembly - Assembly entity.
711671
* @returns Breadcrumbs.
712672
*/
713-
function getGenomeEntityChooseAnalysisMethodBreadcrumbs(
714-
genome: BRCDataCatalogGenome
715-
): Breadcrumb[] {
673+
function getAssemblyBreadcrumbs(assembly: BRCDataCatalogGenome): Breadcrumb[] {
716674
return [
717675
{ path: ROUTES.GENOMES, text: "Assemblies" },
718-
{ path: "", text: genome.accession },
719-
{ path: "", text: "Analyze" },
676+
{ path: "", text: assembly.accession },
677+
{ path: "", text: "Select a Workflow" },
720678
];
721679
}
722680

site-config/brc-analytics/local/entity/genome/analysisMethodsSideColumn.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,6 @@ export const sideColumn: ComponentsConfig = [
1313
children: [
1414
{
1515
children: [
16-
{
17-
children: [
18-
{
19-
component: C.SectionTitle,
20-
props: {
21-
title: "Resources",
22-
},
23-
} as ComponentConfig<typeof C.SectionTitle>,
24-
{
25-
component: C.AnalysisPortals,
26-
viewBuilder: V.buildGenomeAnalysisPortals,
27-
} as ComponentConfig<
28-
typeof C.AnalysisPortals,
29-
BRCDataCatalogGenome
30-
>,
31-
],
32-
component: C.GridPaperSection,
33-
},
3416
{
3517
children: [
3618
{
@@ -43,7 +25,7 @@ export const sideColumn: ComponentsConfig = [
4325
} as ComponentConfig<typeof C.SectionTitle>,
4426
{
4527
component: C.KeyValuePairs,
46-
viewBuilder: V.buildGenomeDetails,
28+
viewBuilder: V.buildAssemblyDetails,
4729
} as ComponentConfig<
4830
typeof C.KeyValuePairs,
4931
BRCDataCatalogGenome
@@ -57,6 +39,24 @@ export const sideColumn: ComponentsConfig = [
5739
],
5840
component: C.GridPaperSection,
5941
},
42+
{
43+
children: [
44+
{
45+
component: C.SectionTitle,
46+
props: {
47+
title: "Resources",
48+
},
49+
} as ComponentConfig<typeof C.SectionTitle>,
50+
{
51+
component: C.AnalysisPortals,
52+
viewBuilder: V.buildGenomeAnalysisPortals,
53+
} as ComponentConfig<
54+
typeof C.AnalysisPortals,
55+
BRCDataCatalogGenome
56+
>,
57+
],
58+
component: C.GridPaperSection,
59+
},
6060
],
6161
component: C.GridPaper,
6262
},

site-config/brc-analytics/local/entity/genome/analysisMethodsTop.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ import * as V from "../../../../../app/viewModelBuilders/catalog/brc-analytics-c
99
export const top: ComponentsConfig = [
1010
{
1111
component: C.BackPageHero,
12-
viewBuilder: V.buildGenomeChooseAnalysisMethodDetailViewHero,
12+
viewBuilder: V.buildAssemblyBackPageHero,
1313
} as ComponentConfig<typeof C.BackPageHero, BRCDataCatalogGenome>,
1414
];

0 commit comments

Comments
 (0)