Skip to content

Commit 713725f

Browse files
committed
feat: add columns to catalog (#5)
1 parent ee025a4 commit 713725f

File tree

3 files changed

+156
-0
lines changed

3 files changed

+156
-0
lines changed

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

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,45 @@
11
import { BRCDataCatalogGenome } from "../../../../apis/catalog/brc-analytics-catalog/common/entities";
22
import * as C from "../../../../components/index";
33

4+
/**
5+
* Build props for the chromosomes cell.
6+
* @param genome - Genome entity.
7+
* @returns Props to be used for the cell.
8+
*/
9+
export const buildChromosomes = (
10+
genome: BRCDataCatalogGenome
11+
): React.ComponentProps<typeof C.BasicCell> => {
12+
return {
13+
value: genome.chromosomes,
14+
};
15+
};
16+
17+
/**
18+
* Build props for the contigs cell.
19+
* @param genome - Genome entity.
20+
* @returns Props to be used for the cell.
21+
*/
22+
export const buildContigs = (
23+
genome: BRCDataCatalogGenome
24+
): React.ComponentProps<typeof C.BasicCell> => {
25+
return {
26+
value: genome.contigs,
27+
};
28+
};
29+
30+
/**
31+
* Build props for the genome version/assembly ID cell.
32+
* @param genome - Genome entity.
33+
* @returns Props to be used for the cell.
34+
*/
35+
export const buildGenomeVersionAssemblyId = (
36+
genome: BRCDataCatalogGenome
37+
): React.ComponentProps<typeof C.BasicCell> => {
38+
return {
39+
value: genome.genomeVersionAssemblyId,
40+
};
41+
};
42+
443
/**
544
* Build props for the species cell.
645
* @param genome - Genome entity.
@@ -13,3 +52,42 @@ export const buildSpecies = (
1352
value: genome.species,
1453
};
1554
};
55+
56+
/**
57+
* Build props for the strain cell.
58+
* @param genome - Genome entity.
59+
* @returns Props to be used for the cell.
60+
*/
61+
export const buildStrain = (
62+
genome: BRCDataCatalogGenome
63+
): React.ComponentProps<typeof C.BasicCell> => {
64+
return {
65+
value: genome.strain,
66+
};
67+
};
68+
69+
/**
70+
* Build props for the supercontigs cell.
71+
* @param genome - Genome entity.
72+
* @returns Props to be used for the cell.
73+
*/
74+
export const buildSupercontigs = (
75+
genome: BRCDataCatalogGenome
76+
): React.ComponentProps<typeof C.BasicCell> => {
77+
return {
78+
value: genome.supercontigs,
79+
};
80+
};
81+
82+
/**
83+
* Build props for the VEuPathDB project cell.
84+
* @param genome - Genome entity.
85+
* @returns Props to be used for the cell.
86+
*/
87+
export const buildVEuPathDbProject = (
88+
genome: BRCDataCatalogGenome
89+
): React.ComponentProps<typeof C.BasicCell> => {
90+
return {
91+
value: genome.vEuPathDbProject,
92+
};
93+
};
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
export const BRC_DATA_CATALOG_CATEGORY_KEY = {
2+
CHROMOSOMES: "chromosomes",
3+
CONTIGS: "contigs",
4+
GENOME_VERSION_ASSEMBLY_ID: "genomeVersionAssemblyId",
25
SPECIES: "species",
6+
STRAIN: "strain",
7+
SUPERCONTIGS: "supercontigs",
8+
VEUPATHDB_PROJECT: "vEuPathDbProject",
39
};
410

511
export const BRC_DATA_CATALOG_CATEGORY_LABEL = {
12+
CHROMOSOMES: "Chromosomes",
13+
CONTIGS: "Contigs",
14+
GENOME_VERSION_ASSEMBLY_ID: "Genome Version/Assembly ID",
615
SPECIES: "Species",
16+
STRAIN: "Strain",
17+
SUPERCONTIGS: "Supercontigs",
18+
VEUPATHDB_PROJECT: "VEuPathDB Project",
719
};

data-catalog/site-config/brc-analytics-catalog/local/index/genomeEntityConfig.ts

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,18 @@ export const genomeEntityConfig: EntityConfig<BRCDataCatalogGenome> = {
2626
key: BRC_DATA_CATALOG_CATEGORY_KEY.SPECIES,
2727
label: BRC_DATA_CATALOG_CATEGORY_LABEL.SPECIES,
2828
},
29+
{
30+
key: BRC_DATA_CATALOG_CATEGORY_KEY.STRAIN,
31+
label: BRC_DATA_CATALOG_CATEGORY_LABEL.STRAIN,
32+
},
33+
{
34+
key: BRC_DATA_CATALOG_CATEGORY_KEY.GENOME_VERSION_ASSEMBLY_ID,
35+
label: BRC_DATA_CATALOG_CATEGORY_LABEL.GENOME_VERSION_ASSEMBLY_ID,
36+
},
37+
{
38+
key: BRC_DATA_CATALOG_CATEGORY_KEY.VEUPATHDB_PROJECT,
39+
label: BRC_DATA_CATALOG_CATEGORY_LABEL.VEUPATHDB_PROJECT,
40+
},
2941
],
3042
},
3143
],
@@ -52,6 +64,60 @@ export const genomeEntityConfig: EntityConfig<BRCDataCatalogGenome> = {
5264
id: BRC_DATA_CATALOG_CATEGORY_KEY.SPECIES,
5365
width: { max: "1.5fr", min: "212px" },
5466
},
67+
{
68+
componentConfig: {
69+
component: C.BasicCell,
70+
viewBuilder: V.buildStrain,
71+
} as ComponentConfig<typeof C.BasicCell, BRCDataCatalogGenome>,
72+
header: BRC_DATA_CATALOG_CATEGORY_LABEL.STRAIN,
73+
id: BRC_DATA_CATALOG_CATEGORY_KEY.STRAIN,
74+
width: { max: "1fr", min: "160px" },
75+
},
76+
{
77+
componentConfig: {
78+
component: C.BasicCell,
79+
viewBuilder: V.buildGenomeVersionAssemblyId,
80+
} as ComponentConfig<typeof C.BasicCell, BRCDataCatalogGenome>,
81+
header: BRC_DATA_CATALOG_CATEGORY_LABEL.GENOME_VERSION_ASSEMBLY_ID,
82+
id: BRC_DATA_CATALOG_CATEGORY_KEY.GENOME_VERSION_ASSEMBLY_ID,
83+
width: { max: "1fr", min: "160px" },
84+
},
85+
{
86+
componentConfig: {
87+
component: C.BasicCell,
88+
viewBuilder: V.buildVEuPathDbProject,
89+
} as ComponentConfig<typeof C.BasicCell, BRCDataCatalogGenome>,
90+
header: BRC_DATA_CATALOG_CATEGORY_LABEL.VEUPATHDB_PROJECT,
91+
id: BRC_DATA_CATALOG_CATEGORY_KEY.VEUPATHDB_PROJECT,
92+
width: { max: "1fr", min: "160px" },
93+
},
94+
{
95+
componentConfig: {
96+
component: C.BasicCell,
97+
viewBuilder: V.buildContigs,
98+
} as ComponentConfig<typeof C.BasicCell, BRCDataCatalogGenome>,
99+
header: BRC_DATA_CATALOG_CATEGORY_LABEL.CONTIGS,
100+
id: BRC_DATA_CATALOG_CATEGORY_KEY.CONTIGS,
101+
width: { max: "0.5fr", min: "112px" },
102+
},
103+
{
104+
componentConfig: {
105+
component: C.BasicCell,
106+
viewBuilder: V.buildSupercontigs,
107+
} as ComponentConfig<typeof C.BasicCell, BRCDataCatalogGenome>,
108+
header: BRC_DATA_CATALOG_CATEGORY_LABEL.SUPERCONTIGS,
109+
id: BRC_DATA_CATALOG_CATEGORY_KEY.SUPERCONTIGS,
110+
width: { max: "0.5fr", min: "112px" },
111+
},
112+
{
113+
componentConfig: {
114+
component: C.BasicCell,
115+
viewBuilder: V.buildChromosomes,
116+
} as ComponentConfig<typeof C.BasicCell, BRCDataCatalogGenome>,
117+
header: BRC_DATA_CATALOG_CATEGORY_LABEL.CHROMOSOMES,
118+
id: BRC_DATA_CATALOG_CATEGORY_KEY.CHROMOSOMES,
119+
width: { max: "0.5fr", min: "112px" },
120+
},
55121
],
56122
defaultSort: {
57123
desc: SORT_DIRECTION.ASCENDING,

0 commit comments

Comments
 (0)