@@ -145,15 +145,28 @@ export const buildGcPercent = (
145
145
* @param genome - Genome entity.
146
146
* @returns Props to be used for the cell.
147
147
*/
148
- export const buildGenomeSpecies = (
148
+ export const buildGenomeTaxonomicLevelSpecies = (
149
149
genome : BRCDataCatalogGenome
150
150
) : ComponentProps < typeof C . Link > => {
151
151
return {
152
- label : genome . species ,
152
+ label : genome . taxonomicLevelSpecies ,
153
153
url : `${ ROUTES . ORGANISMS } /${ encodeURIComponent ( getGenomeOrganismId ( genome ) ) } ` ,
154
154
} ;
155
155
} ;
156
156
157
+ /**
158
+ * Build props for the strain cell.
159
+ * @param genome - Genome entity.
160
+ * @returns Props to be used for the cell.
161
+ */
162
+ export const buildGenomeTaxonomicLevelStrain = (
163
+ genome : BRCDataCatalogGenome
164
+ ) : ComponentProps < typeof C . BasicCell > => {
165
+ return {
166
+ value : getGenomeStrainText ( genome ) ,
167
+ } ;
168
+ } ;
169
+
157
170
/**
158
171
* Build props for the "is ref" cell.
159
172
* @param genome - Genome entity.
@@ -207,6 +220,20 @@ export const buildOrganismAssemblyTaxonomyIds = (
207
220
} ;
208
221
} ;
209
222
223
+ /**
224
+ * Build props for the species cell.
225
+ * @param organism - Organism entity.
226
+ * @returns Props to be used for the cell.
227
+ */
228
+ export const buildOrganismTaxonomicLevelSpecies = (
229
+ organism : BRCDataCatalogOrganism
230
+ ) : ComponentProps < typeof C . Link > => {
231
+ return {
232
+ label : organism . taxonomicLevelSpecies ,
233
+ url : `${ ROUTES . ORGANISMS } /${ encodeURIComponent ( getOrganismId ( organism ) ) } ` ,
234
+ } ;
235
+ } ;
236
+
210
237
/**
211
238
* Build props for the strain cell.
212
239
* @param organism - Organism entity.
@@ -237,106 +264,92 @@ export const buildTaxonomicGroup = (
237
264
238
265
/**
239
266
* Build props for the class cell.
240
- * @param organism - Organism entity.
267
+ * @param entity - Organism or genome entity.
241
268
* @returns Props to be used for the cell.
242
269
*/
243
270
export const buildTaxonomicLevelClass = (
244
- organism : BRCDataCatalogOrganism
271
+ entity : BRCDataCatalogOrganism | BRCDataCatalogGenome
245
272
) : ComponentProps < typeof C . BasicCell > => {
246
273
return {
247
- value : organism . taxonomicLevelClass ,
274
+ value : entity . taxonomicLevelClass ,
248
275
} ;
249
276
} ;
250
277
251
278
/**
252
279
* Build props for the family cell.
253
- * @param organism - Organism entity.
280
+ * @param entity - Organism or genome entity.
254
281
* @returns Props to be used for the cell.
255
282
*/
256
283
export const buildTaxonomicLevelFamily = (
257
- organism : BRCDataCatalogOrganism
284
+ entity : BRCDataCatalogOrganism | BRCDataCatalogGenome
258
285
) : ComponentProps < typeof C . BasicCell > => {
259
286
return {
260
- value : organism . taxonomicLevelFamily ,
287
+ value : entity . taxonomicLevelFamily ,
261
288
} ;
262
289
} ;
263
290
264
291
/**
265
292
* Build props for the genus cell.
266
- * @param organism - Organism entity.
293
+ * @param entity - Organism or genome entity.
267
294
* @returns Props to be used for the cell.
268
295
*/
269
296
export const buildTaxonomicLevelGenus = (
270
- organism : BRCDataCatalogOrganism
297
+ entity : BRCDataCatalogOrganism | BRCDataCatalogGenome
271
298
) : ComponentProps < typeof C . BasicCell > => {
272
299
return {
273
- value : organism . taxonomicLevelGenus ,
300
+ value : entity . taxonomicLevelGenus ,
274
301
} ;
275
302
} ;
276
303
277
304
/**
278
305
* Build props for the kingdom cell.
279
- * @param organism - Organism entity.
306
+ * @param entity - Organism or genome entity.
280
307
* @returns Props to be used for the cell.
281
308
*/
282
309
export const buildTaxonomicLevelKingdom = (
283
- organism : BRCDataCatalogOrganism
310
+ entity : BRCDataCatalogOrganism | BRCDataCatalogGenome
284
311
) : ComponentProps < typeof C . BasicCell > => {
285
312
return {
286
- value : organism . taxonomicLevelKingdom ,
313
+ value : entity . taxonomicLevelKingdom ,
287
314
} ;
288
315
} ;
289
316
290
317
/**
291
318
* Build props for the order cell.
292
- * @param organism - Organism entity.
319
+ * @param entity - Organism or genome entity.
293
320
* @returns Props to be used for the cell.
294
321
*/
295
322
export const buildTaxonomicLevelOrder = (
296
- organism : BRCDataCatalogOrganism
323
+ entity : BRCDataCatalogOrganism | BRCDataCatalogGenome
297
324
) : ComponentProps < typeof C . BasicCell > => {
298
325
return {
299
- value : organism . taxonomicLevelOrder ,
326
+ value : entity . taxonomicLevelOrder ,
300
327
} ;
301
328
} ;
302
329
303
330
/**
304
331
* Build props for the phylum cell.
305
- * @param organism - Organism entity.
332
+ * @param entity - Organism or genome entity.
306
333
* @returns Props to be used for the cell.
307
334
*/
308
335
export const buildTaxonomicLevelPhylum = (
309
- organism : BRCDataCatalogOrganism
336
+ entity : BRCDataCatalogOrganism | BRCDataCatalogGenome
310
337
) : ComponentProps < typeof C . BasicCell > => {
311
338
return {
312
- value : organism . taxonomicLevelPhylum ,
313
- } ;
314
- } ;
315
-
316
- /**
317
- * Build props for the species cell.
318
- * @param organism - Organism entity.
319
- * @returns Props to be used for the cell.
320
- */
321
- export const buildTaxonomicLevelSpecies = (
322
- organism : BRCDataCatalogOrganism
323
- ) : ComponentProps < typeof C . Link > => {
324
- return {
325
- label : organism . taxonomicLevelSpecies ,
326
- url : `${ ROUTES . ORGANISMS } /${ encodeURIComponent ( getOrganismId ( organism ) ) } ` ,
339
+ value : entity . taxonomicLevelPhylum ,
327
340
} ;
328
341
} ;
329
342
330
343
/**
331
344
* Build props for the superkingdom cell.
332
- * @param organism - Organism entity.
345
+ * @param entity - Organism or genome entity.
333
346
* @returns Props to be used for the cell.
334
347
*/
335
348
export const buildTaxonomicLevelSuperkingdom = (
336
- organism : BRCDataCatalogOrganism
349
+ entity : BRCDataCatalogOrganism | BRCDataCatalogGenome
337
350
) : ComponentProps < typeof C . BasicCell > => {
338
351
return {
339
- value : organism . taxonomicLevelSuperkingdom ,
352
+ value : entity . taxonomicLevelSuperkingdom ,
340
353
} ;
341
354
} ;
342
355
@@ -379,19 +392,6 @@ export const buildScaffoldN50 = (
379
392
} ;
380
393
} ;
381
394
382
- /**
383
- * Build props for the strain cell.
384
- * @param genome - Genome entity.
385
- * @returns Props to be used for the cell.
386
- */
387
- export const buildStrain = (
388
- genome : BRCDataCatalogGenome
389
- ) : ComponentProps < typeof C . BasicCell > => {
390
- return {
391
- value : genome . strain ,
392
- } ;
393
- } ;
394
-
395
395
/**
396
396
* Build props for the taxonomy ID cell.
397
397
* @param genome - Genome entity.
@@ -479,7 +479,7 @@ export const buildGenomeChooseAnalysisMethodDetailViewHero = (
479
479
breadcrumbs : getGenomeEntityChooseAnalysisMethodBreadcrumbs ( genome ) ,
480
480
subTitle : C . Link ( {
481
481
TypographyProps : { color : "ink.light" , variant : TEXT_BODY_SMALL_400 } ,
482
- label : `Species: ${ genome . species } ` ,
482
+ label : `Species: ${ genome . taxonomicLevelSpecies } ` ,
483
483
underline : "hover" ,
484
484
url : `${ ROUTES . ORGANISMS } /${ encodeURIComponent ( getGenomeOrganismId ( genome ) ) } ` ,
485
485
} ) ,
@@ -497,15 +497,15 @@ export const buildGenomeDetails = (
497
497
) : ComponentProps < typeof C . KeyValuePairs > => {
498
498
const keyValuePairs = new Map < Key , Value > ( ) ;
499
499
keyValuePairs . set (
500
- BRC_DATA_CATALOG_CATEGORY_LABEL . SPECIES ,
500
+ BRC_DATA_CATALOG_CATEGORY_LABEL . TAXONOMIC_LEVEL_SPECIES ,
501
501
C . Link ( {
502
- label : genome . species ,
502
+ label : genome . taxonomicLevelSpecies ,
503
503
url : `${ ROUTES . ORGANISMS } /${ encodeURIComponent ( getGenomeOrganismId ( genome ) ) } ` ,
504
504
} )
505
505
) ;
506
506
keyValuePairs . set (
507
- BRC_DATA_CATALOG_CATEGORY_LABEL . STRAIN ,
508
- genome . strain ?? LABEL . UNSPECIFIED
507
+ BRC_DATA_CATALOG_CATEGORY_LABEL . TAXONOMIC_LEVEL_STRAIN ,
508
+ getGenomeStrainText ( genome , LABEL . UNSPECIFIED )
509
509
) ;
510
510
keyValuePairs . set (
511
511
BRC_DATA_CATALOG_CATEGORY_LABEL . TAXONOMY_ID ,
@@ -611,9 +611,10 @@ function buildOrganismGenomesTableColumns(): ColumnDef<BRCDataCatalogGenome>[] {
611
611
header : BRC_DATA_CATALOG_CATEGORY_LABEL . ACCESSION ,
612
612
} ,
613
613
{
614
- accessorKey : BRC_DATA_CATALOG_CATEGORY_KEY . STRAIN ,
615
- cell : ( { row } ) => C . BasicCell ( buildStrain ( row . original ) ) ,
616
- header : BRC_DATA_CATALOG_CATEGORY_LABEL . STRAIN ,
614
+ accessorKey : BRC_DATA_CATALOG_CATEGORY_KEY . TAXONOMIC_LEVEL_STRAIN ,
615
+ cell : ( { row } ) =>
616
+ C . BasicCell ( buildGenomeTaxonomicLevelStrain ( row . original ) ) ,
617
+ header : BRC_DATA_CATALOG_CATEGORY_LABEL . TAXONOMIC_LEVEL_STRAIN ,
617
618
} ,
618
619
{
619
620
accessorKey : BRC_DATA_CATALOG_CATEGORY_KEY . TAXONOMY_ID ,
@@ -688,6 +689,22 @@ function getGenomeEntityChooseAnalysisMethodBreadcrumbs(
688
689
] ;
689
690
}
690
691
692
+ /**
693
+ * Get text for genome strain, consisting of, from highest to lowest priority, either: strain-only name; strain name including species; or the specified default value.
694
+ * @param genome - Genome entity.
695
+ * @param defaultValue - Default value to use if there's no strain.
696
+ * @returns strain text.
697
+ */
698
+ function getGenomeStrainText (
699
+ genome : BRCDataCatalogGenome ,
700
+ defaultValue = ""
701
+ ) : string {
702
+ if ( genome . strainName ) return genome . strainName ;
703
+ if ( genome . taxonomicLevelStrain !== "None" )
704
+ return genome . taxonomicLevelStrain ;
705
+ return defaultValue ;
706
+ }
707
+
691
708
/**
692
709
* Get the organism entity breadcrumbs.
693
710
* @param organism - Organism entity.
0 commit comments