Skip to content

Commit bfac991

Browse files
frano-mMillenniumFalconMechanic
authored andcommitted
Add Organ and Organ Part to selected data summary on get data flows. Resolves #990. (#996)
1 parent 662bee4 commit bfac991

File tree

8 files changed

+109
-21
lines changed

8 files changed

+109
-21
lines changed

spa/src/app/files/hca-get-data/hca-get-data-file-summary/hca-get-data-file-summary.component.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ <h3 class="fontsize-l terms">{{displayTerms(selectedGenusSpecies)}}</h3>
1515
<h3 class="fontsize-l terms">{{displayTerms(selectedLibraryConstructionApproaches)}}</h3>
1616
<span class="fontsize-xxs label">Library Construction Method</span>
1717
</div>
18+
<div class="summary">
19+
<h3 class="fontsize-l terms">{{displayTerms(selectedOrgans)}}</h3>
20+
<span class="fontsize-xxs label">Organ</span>
21+
</div>
22+
<div class="summary">
23+
<h3 class="fontsize-l terms">{{displayTerms(selectedOrganParts)}}</h3>
24+
<span class="fontsize-xxs label">Organ Part</span>
25+
</div>
1826
<div class="summary">
1927
<h3 class="fontsize-l terms">{{displayTerms(selectedPairedEnds)}}</h3>
2028
<span class="fontsize-xxs label">Paired End</span>

spa/src/app/files/hca-get-data/hca-get-data-file-summary/hca-get-data-file-summary.component.spec.ts

Lines changed: 69 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,20 @@ describe("HCAGetDataFileSummaryComponent", () => {
2626
let component: HCAGetDataFileSummaryComponent;
2727
let fixture: ComponentFixture<HCAGetDataFileSummaryComponent>;
2828

29-
const SUMMARY_DISPLAY_ORDER = ["Projects", "Species", "Library Construction Method", "Paired End", "Donors", "Specimens", "Estimated Cells", "Files", "File Size"];
29+
const SUMMARY_DISPLAY_ORDER = ["Projects", "Species", "Library Construction Method", "Organ", "Organ Part", "Paired End", "Donors", "Specimens", "Estimated Cells", "Files", "File Size"];
3030

3131
// Summary order by index
32-
const PROJECT_COUNT_INDEX = 0;
33-
const SPECIES_COUNT_INDEX = 1;
34-
const LIBRARY_CONSTRUCTION_METHOD_COUNT_INDEX = 2;
35-
const PAIRED_END_COUNT_INDEX = 3;
36-
const DONORS_COUNT_INDEX = 4;
37-
const SPECIMENS_COUNT_INDEX = 5;
38-
const ESTIMATED_CELLS_COUNT_INDEX = 6;
39-
const FILES_COUNT_INDEX = 7;
40-
const FILE_SIZE_COUNT_INDEX = 8;
32+
const INDEX_PROJECT_COUNT = 0;
33+
const INDEX_GENUS_SPECIES = 1;
34+
const INDEX_LIBRARY_CONSTRUCTION_METHOD = 2;
35+
const INDEX_ORGAN = 3;
36+
const INDEX_ORGAN_PART = 4;
37+
const INDEX_PAIRED_END = 5;
38+
const INDEX_DONORS_COUNT = 6;
39+
const INDEX_SPECIMENS_COUNT = 7;
40+
const INDEX_ESTIMATED_CELLS_COUNT = 8;
41+
const INDEX_FILES_COUNT = 9;
42+
const INDEX_FILE_SIZE_COUNT = 10;
4143

4244
beforeEach(async(() => {
4345

@@ -216,8 +218,8 @@ describe("HCAGetDataFileSummaryComponent", () => {
216218
// labels "Files" and "File Size".
217219
getSummaryEls().forEach((el, index) => {
218220
expect(getSummaryLabelInnerHTML(el)).toEqual((SUMMARY_DISPLAY_ORDER[index]));
219-
expect(getSummaryLabelInnerHTML(el)).not.toEqual(SUMMARY_DISPLAY_ORDER[FILES_COUNT_INDEX]);
220-
expect(getSummaryLabelInnerHTML(el)).not.toEqual(SUMMARY_DISPLAY_ORDER[FILE_SIZE_COUNT_INDEX]);
221+
expect(getSummaryLabelInnerHTML(el)).not.toEqual(SUMMARY_DISPLAY_ORDER[INDEX_FILES_COUNT]);
222+
expect(getSummaryLabelInnerHTML(el)).not.toEqual(SUMMARY_DISPLAY_ORDER[INDEX_FILE_SIZE_COUNT]);
221223
});
222224
});
223225

@@ -235,7 +237,7 @@ describe("HCAGetDataFileSummaryComponent", () => {
235237
// Confirm project count value is displayed, when view mode is "NONE" - first execute a query
236238
// to find the element with the class "count" where the element with the class "label" is "Projects"
237239
// and confirm the value is equal to project count.
238-
expect(getCountInnerHTML(PROJECT_COUNT_INDEX)).toEqual(component.summary.projectCount.toLocaleString());
240+
expect(getCountInnerHTML(INDEX_PROJECT_COUNT)).toEqual(component.summary.projectCount.toLocaleString());
239241
});
240242

241243
/**
@@ -252,7 +254,7 @@ describe("HCAGetDataFileSummaryComponent", () => {
252254
// Confirm donor count value is displayed, when view mode is "NONE" - first execute a query
253255
// to find the element with the class "count" where the element with the class "label" is "Donors"
254256
// and confirm the value is equal to donor count.
255-
expect(getCountInnerHTML(DONORS_COUNT_INDEX)).toEqual(new CountSizePipe().transform(component.summary.donorCount));
257+
expect(getCountInnerHTML(INDEX_DONORS_COUNT)).toEqual(new CountSizePipe().transform(component.summary.donorCount));
256258
});
257259

258260
/**
@@ -269,7 +271,7 @@ describe("HCAGetDataFileSummaryComponent", () => {
269271
// Confirm specimen count value is displayed, when view mode is "NONE" - first execute a query
270272
// to find the element with the class "count" where the element with the class "label" is "Specimens"
271273
// and confirm the value is equal to specimen count.
272-
expect(getCountInnerHTML(SPECIMENS_COUNT_INDEX)).toEqual(new CountSizePipe().transform(component.summary.specimenCount));
274+
expect(getCountInnerHTML(INDEX_SPECIMENS_COUNT)).toEqual(new CountSizePipe().transform(component.summary.specimenCount));
273275
});
274276

275277
/**
@@ -286,7 +288,7 @@ describe("HCAGetDataFileSummaryComponent", () => {
286288
// Confirm total cell count value is displayed, when view mode is "NONE" - first execute a query
287289
// to find the element with the class "count" where the element with the class "label" is "Estimated Cells"
288290
// and confirm the value is equal to total cell count.
289-
expect(getCountInnerHTML(ESTIMATED_CELLS_COUNT_INDEX)).toEqual(new CountSizePipe().transform(component.summary.totalCellCount));
291+
expect(getCountInnerHTML(INDEX_ESTIMATED_CELLS_COUNT)).toEqual(new CountSizePipe().transform(component.summary.totalCellCount));
290292
});
291293

292294
/**
@@ -303,7 +305,7 @@ describe("HCAGetDataFileSummaryComponent", () => {
303305
// Confirm file count value is displayed, when view mode is "NONE" - first execute a query
304306
// to find the element with the class "count" where the element with the class "label" is "Files"
305307
// and confirm the value is equal to file count.
306-
expect(getCountInnerHTML(FILES_COUNT_INDEX)).toEqual(new CountSizePipe().transform(component.summary.fileCount));
308+
expect(getCountInnerHTML(INDEX_FILES_COUNT)).toEqual(new CountSizePipe().transform(component.summary.fileCount));
307309
});
308310

309311
/**
@@ -320,7 +322,7 @@ describe("HCAGetDataFileSummaryComponent", () => {
320322
// Confirm file size count value is displayed, when view mode is "NONE" - first execute a query
321323
// to find the element with the class "count" where the element with the class "label" is "File Size"
322324
// and confirm the value is equal to file size count.
323-
expect(getCountInnerHTML(FILE_SIZE_COUNT_INDEX)).toEqual(new FileSizePipe().transform(component.summary.totalFileSize));
325+
expect(getCountInnerHTML(INDEX_FILE_SIZE_COUNT)).toEqual(new FileSizePipe().transform(component.summary.totalFileSize));
324326
});
325327

326328
/**
@@ -343,7 +345,7 @@ describe("HCAGetDataFileSummaryComponent", () => {
343345
// Confirm selected genus species is displayed, when view mode is "NONE" - first execute a query
344346
// to find the element with the class "terms" where the element with the class "label" is "Species"
345347
// and confirm the value is equal to the concatenated term names.
346-
expect(getTermInnerHTML(SPECIES_COUNT_INDEX)).toEqual(component.displayTerms(selectedTerms));
348+
expect(getTermInnerHTML(INDEX_GENUS_SPECIES)).toEqual(component.displayTerms(selectedTerms));
347349
});
348350

349351
/**
@@ -367,7 +369,53 @@ describe("HCAGetDataFileSummaryComponent", () => {
367369
// Confirm selected library construction approaches is displayed, when view mode is "NONE" - first execute a query
368370
// to find the element with the class "terms" where the element with the class "label" is "Library Construction Method"
369371
// and confirm the value is equal to the concatenated term names.
370-
expect(getTermInnerHTML(LIBRARY_CONSTRUCTION_METHOD_COUNT_INDEX)).toEqual(component.displayTerms(selectedTerms));
372+
expect(getTermInnerHTML(INDEX_LIBRARY_CONSTRUCTION_METHOD)).toEqual(component.displayTerms(selectedTerms));
373+
});
374+
375+
/**
376+
* Confirm selected organs is displayed, when view mode is "NONE".
377+
*/
378+
it(`should display selected organs when view mode is "NONE"`, () => {
379+
380+
const selectedTerms = [
381+
new Term("blood", 22, true),
382+
new Term("lung", 22, true)
383+
];
384+
385+
// Set up initial component state
386+
component.viewState = DownloadViewState.NONE;
387+
component.selectedOrgans = selectedTerms;
388+
389+
// Trigger change detection so template updates accordingly
390+
fixture.detectChanges();
391+
392+
// Confirm selected organs is displayed, when view mode is "NONE" - first execute a query
393+
// to find the element with the class "terms" where the element with the class "label" is "Organ"
394+
// and confirm the value is equal to the concatenated term names.
395+
expect(getTermInnerHTML(INDEX_ORGAN)).toEqual(component.displayTerms(selectedTerms));
396+
});
397+
398+
/**
399+
* Confirm selected organ parts is displayed, when view mode is "NONE".
400+
*/
401+
it(`should display selected organ parts when view mode is "NONE"`, () => {
402+
403+
const selectedTerms = [
404+
new Term("amygdala", 22, true),
405+
new Term("islet of Langerhans", 22, true)
406+
];
407+
408+
// Set up initial component state
409+
component.viewState = DownloadViewState.NONE;
410+
component.selectedOrganParts = selectedTerms;
411+
412+
// Trigger change detection so template updates accordingly
413+
fixture.detectChanges();
414+
415+
// Confirm selected organ parts is displayed, when view mode is "NONE" - first execute a query
416+
// to find the element with the class "terms" where the element with the class "label" is "Organ Parts"
417+
// and confirm the value is equal to the concatenated term names.
418+
expect(getTermInnerHTML(INDEX_ORGAN_PART)).toEqual(component.displayTerms(selectedTerms));
371419
});
372420

373421
/**
@@ -389,7 +437,7 @@ describe("HCAGetDataFileSummaryComponent", () => {
389437
// Confirm selected paired Ends is displayed, when view mode is "NONE" - first execute a query
390438
// to find the element with the class "terms" where the element with the class "label" is "Paired End"
391439
// and confirm the value is equal to the concatenated term names.
392-
expect(getTermInnerHTML(PAIRED_END_COUNT_INDEX)).toEqual(component.displayTerms(selectedTerms));
440+
expect(getTermInnerHTML(INDEX_PAIRED_END)).toEqual(component.displayTerms(selectedTerms));
393441
});
394442

395443
/**

spa/src/app/files/hca-get-data/hca-get-data-file-summary/hca-get-data-file-summary.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ export class HCAGetDataFileSummaryComponent {
3131
// Inputs
3232
@Input() selectedGenusSpecies: Term[];
3333
@Input() selectedLibraryConstructionApproaches: Term[];
34+
@Input() selectedOrgans: Term[];
35+
@Input() selectedOrganParts: Term[];
3436
@Input() selectedPairedEnds: Term[];
3537
@Input() summary: FileSummary;
3638
@Input() viewState: DownloadViewState;

spa/src/app/files/hca-get-data/hca-get-data-summary/hca-get-data-summary.component.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ <h4 class="fontsize-m semi-bold">Query</h4>
1010
<h4 class="fontsize-m semi-bold">Selected Data Summary</h4>
1111
<hca-get-data-file-summary [selectedGenusSpecies]="selectedGenusSpecies"
1212
[selectedLibraryConstructionApproaches]="selectedLibraryConstructionApproaches"
13+
[selectedOrgans]="selectedOrgans"
14+
[selectedOrganParts]="selectedOrganParts"
1315
[selectedPairedEnds]="selectedPairedEnds"
1416
[summary]="selectFileSummary$ | async"
1517
[viewState]="viewState"></hca-get-data-file-summary>

spa/src/app/files/hca-get-data/hca-get-data-summary/hca-get-data-summary.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ export class HCAGetDataSummaryComponent implements OnInit {
3131
// Inputs
3232
@Input() selectedGenusSpecies: Term[];
3333
@Input() selectedLibraryConstructionApproaches: Term[];
34+
@Input() selectedOrgans: Term[];
35+
@Input() selectedOrganParts: Term[];
3436
@Input() selectedPairedEnds: Term[];
3537
@Input() viewState: DownloadViewState;
3638

spa/src/app/files/hca-get-data/hca-get-data.component.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
</div>
3131
<hca-get-data-summary [selectedGenusSpecies]="listSelectedGenusSpecies(state.fileFacets)"
3232
[selectedLibraryConstructionApproaches]="listSelectedLibraryConstructionApproaches(state.fileFacets)"
33+
[selectedOrgans]="listSelectedOrgans(state.fileFacets)"
34+
[selectedOrganParts]="listSelectedOrganParts(state.fileFacets)"
3335
[selectedPairedEnds]="listSelectedPairedEnds(state.fileFacets)"
3436
[viewState]="viewState"></hca-get-data-summary>
3537
</div>

spa/src/app/files/hca-get-data/hca-get-data.component.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,28 @@ export class HCAGetDataComponent implements OnInit {
139139
return this.listSelectedTermsOfFacet(fileFacets, FileFacetName.LIBRARY_CONSTRUCTION_APPROACH);
140140
}
141141

142+
/**
143+
* Returns the effective terms for the organ facet.
144+
*
145+
* @param {FileFacet[]} fileFacets
146+
* @returns {Term[]}
147+
*/
148+
public listSelectedOrgans(fileFacets: FileFacet[]): Term[] {
149+
150+
return this.listSelectedTermsOfFacet(fileFacets, FileFacetName.ORGAN)
151+
}
152+
153+
/**
154+
* Returns the effective terms for the organ part facet.
155+
*
156+
* @param {FileFacet[]} fileFacets
157+
* @returns {Term[]}
158+
*/
159+
public listSelectedOrganParts(fileFacets: FileFacet[]): Term[] {
160+
161+
return this.listSelectedTermsOfFacet(fileFacets, FileFacetName.ORGAN_PART)
162+
}
163+
142164
/**
143165
* Returns the effective terms for the paired end facet.
144166
*

spa/src/app/files/shared/file-facet-name.model.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ export enum FileFacetName {
99
"FILE_FORMAT" = "fileFormat",
1010
"GENUS_SPECIES" = "genusSpecies",
1111
"LIBRARY_CONSTRUCTION_APPROACH" = "libraryConstructionApproach",
12+
"ORGAN" = "organ",
13+
"ORGAN_PART" = "organPart",
1214
"ORGANISM_AGE" = "organismAge",
1315
"ORGANISM_AGE_UNIT" = "organismAgeUnit",
1416
"PAIRED_END" = "pairedEnd",

0 commit comments

Comments
 (0)