Skip to content

Commit 665a20a

Browse files
authored
feat: add filters for taxonomic levels to organisms list (#301) (#306)
1 parent 13c0bd0 commit 665a20a

File tree

13 files changed

+1118
-121
lines changed

13 files changed

+1118
-121
lines changed

app/apis/catalog/brc-analytics-catalog/common/entities.ts

+18-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ export interface BRCDataCatalogGenome {
2121
speciesTaxonomyId: string;
2222
strain: string | null;
2323
taxonomicGroup: string[];
24+
taxonomicLevelClass: string;
25+
taxonomicLevelFamily: string;
26+
taxonomicLevelGenus: string;
27+
taxonomicLevelKingdom: string;
28+
taxonomicLevelOrder: string;
29+
taxonomicLevelPhylum: string;
30+
taxonomicLevelSpecies: string;
31+
taxonomicLevelStrain: string;
32+
taxonomicLevelSuperkingdom: string;
2433
ucscBrowserUrl: string | null;
2534
}
2635

@@ -29,8 +38,16 @@ export interface BRCDataCatalogOrganism {
2938
assemblyTaxonomyIds: string[];
3039
genomes: BRCDataCatalogGenome[];
3140
ncbiTaxonomyId: string;
32-
species: string;
3341
taxonomicGroup: string[];
42+
taxonomicLevelClass: string;
43+
taxonomicLevelFamily: string;
44+
taxonomicLevelGenus: string;
45+
taxonomicLevelKingdom: string;
46+
taxonomicLevelOrder: string;
47+
taxonomicLevelPhylum: string;
48+
taxonomicLevelSpecies: string;
49+
taxonomicLevelStrain: string[];
50+
taxonomicLevelSuperkingdom: string;
3451
}
3552

3653
export interface EntitiesResponse<R> {

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

+109-4
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,20 @@ export const buildOrganismAssemblyTaxonomyIds = (
207207
};
208208
};
209209

210+
/**
211+
* Build props for the strain cell.
212+
* @param organism - Organism entity.
213+
* @returns Props to be used for the cell.
214+
*/
215+
export const buildOrganismTaxonomicLevelStrain = (
216+
organism: BRCDataCatalogOrganism
217+
): ComponentProps<typeof C.NTagCell> => {
218+
return {
219+
label: "strains",
220+
values: organism.taxonomicLevelStrain,
221+
};
222+
};
223+
210224
/**
211225
* Build props for the taxonomic group cell.
212226
* @param entity - Organism or genome entity.
@@ -221,20 +235,111 @@ export const buildTaxonomicGroup = (
221235
};
222236
};
223237

238+
/**
239+
* Build props for the class cell.
240+
* @param organism - Organism entity.
241+
* @returns Props to be used for the cell.
242+
*/
243+
export const buildTaxonomicLevelClass = (
244+
organism: BRCDataCatalogOrganism
245+
): ComponentProps<typeof C.BasicCell> => {
246+
return {
247+
value: organism.taxonomicLevelClass,
248+
};
249+
};
250+
251+
/**
252+
* Build props for the family cell.
253+
* @param organism - Organism entity.
254+
* @returns Props to be used for the cell.
255+
*/
256+
export const buildTaxonomicLevelFamily = (
257+
organism: BRCDataCatalogOrganism
258+
): ComponentProps<typeof C.BasicCell> => {
259+
return {
260+
value: organism.taxonomicLevelFamily,
261+
};
262+
};
263+
264+
/**
265+
* Build props for the genus cell.
266+
* @param organism - Organism entity.
267+
* @returns Props to be used for the cell.
268+
*/
269+
export const buildTaxonomicLevelGenus = (
270+
organism: BRCDataCatalogOrganism
271+
): ComponentProps<typeof C.BasicCell> => {
272+
return {
273+
value: organism.taxonomicLevelGenus,
274+
};
275+
};
276+
277+
/**
278+
* Build props for the kingdom cell.
279+
* @param organism - Organism entity.
280+
* @returns Props to be used for the cell.
281+
*/
282+
export const buildTaxonomicLevelKingdom = (
283+
organism: BRCDataCatalogOrganism
284+
): ComponentProps<typeof C.BasicCell> => {
285+
return {
286+
value: organism.taxonomicLevelKingdom,
287+
};
288+
};
289+
290+
/**
291+
* Build props for the order cell.
292+
* @param organism - Organism entity.
293+
* @returns Props to be used for the cell.
294+
*/
295+
export const buildTaxonomicLevelOrder = (
296+
organism: BRCDataCatalogOrganism
297+
): ComponentProps<typeof C.BasicCell> => {
298+
return {
299+
value: organism.taxonomicLevelOrder,
300+
};
301+
};
302+
303+
/**
304+
* Build props for the phylum cell.
305+
* @param organism - Organism entity.
306+
* @returns Props to be used for the cell.
307+
*/
308+
export const buildTaxonomicLevelPhylum = (
309+
organism: BRCDataCatalogOrganism
310+
): ComponentProps<typeof C.BasicCell> => {
311+
return {
312+
value: organism.taxonomicLevelPhylum,
313+
};
314+
};
315+
224316
/**
225317
* Build props for the species cell.
226318
* @param organism - Organism entity.
227319
* @returns Props to be used for the cell.
228320
*/
229-
export const buildOrganismSpecies = (
321+
export const buildTaxonomicLevelSpecies = (
230322
organism: BRCDataCatalogOrganism
231323
): ComponentProps<typeof C.Link> => {
232324
return {
233-
label: organism.species,
325+
label: organism.taxonomicLevelSpecies,
234326
url: `${ROUTES.ORGANISMS}/${encodeURIComponent(getOrganismId(organism))}`,
235327
};
236328
};
237329

330+
/**
331+
* Build props for the superkingdom cell.
332+
* @param organism - Organism entity.
333+
* @returns Props to be used for the cell.
334+
*/
335+
export const buildTaxonomicLevelSuperkingdom = (
336+
organism: BRCDataCatalogOrganism
337+
): ComponentProps<typeof C.BasicCell> => {
338+
return {
339+
value: organism.taxonomicLevelSuperkingdom,
340+
};
341+
};
342+
238343
/**
239344
* Build props for the scaffold count cell.
240345
* @param genome - Genome entity.
@@ -462,7 +567,7 @@ export const buildOrganismAssembliesHero = (
462567
): ComponentProps<typeof C.BackPageHero> => {
463568
return {
464569
breadcrumbs: getOrganismEntityAssembliesBreadcrumbs(organism),
465-
title: organism.species,
570+
title: organism.taxonomicLevelSpecies,
466571
};
467572
};
468573

@@ -593,7 +698,7 @@ function getOrganismEntityAssembliesBreadcrumbs(
593698
): Breadcrumb[] {
594699
return [
595700
{ path: ROUTES.ORGANISMS, text: "Organisms" },
596-
{ path: "", text: `${organism.species}` },
701+
{ path: "", text: `${organism.taxonomicLevelSpecies}` },
597702
{ path: "", text: "Assemblies" },
598703
];
599704
}

0 commit comments

Comments
 (0)