Skip to content

Commit 178b6ef

Browse files
MillenniumFalconMechanicNoopDog
authored andcommitted
Added prepared matrix functionality for mouse. Resolves #967. (#982)
* Added prepared matrix downloads for mouse. Resolves #967. * Minor UI updates. Resolves #967.
1 parent 5307f7c commit 178b6ef

13 files changed

+655
-499
lines changed

spa/src/app/config/config.service.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,12 @@ export class ConfigService {
129129
/**
130130
* Returns the complete URL for the download of the prepared matrix for the specified project.
131131
*
132-
* @param {string} projectId
133-
* @param {string} matrixFormat
132+
* @param {string} fileName
134133
* @returns {string}
135134
*/
136-
public getProjectPreparedMatrixDownloadURL(projectId: string, matrixFormat: string): string {
135+
public getProjectPreparedMatrixDownloadURL(fileName: string): string {
137136

138-
return `${this.getProjectMetaURL()}/project-assets/project-matrices/${projectId}.${matrixFormat}`;
137+
return `${this.getProjectMetaURL()}/project-assets/project-matrices/${fileName}`;
139138
}
140139

141140
/**

spa/src/app/files/hca-project/hca-project.component.html

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -118,23 +118,22 @@ <h4 class="fontsize-m semi-bold">Project Downloads</h4>
118118
[tooltipPosition]="'above'">Expression Matrix
119119
</hca-tooltip>
120120
</p>
121-
<ng-container
122-
[ngSwitch]="state.projectMatrixUrls && state.projectMatrixUrls.isAnyProjectMatrixUrlAvailable()">
123-
<ng-container *ngSwitchCase="true">
124-
<p class="fontsize-xs rhs downloads">
125-
<span *ngIf="state.projectMatrixUrls.isProjectMatrixCSVAvailable()"><a
126-
[href]="state.projectMatrixUrls.csvUrl"><img
127-
src="assets/images/icon/hca-download-primary.png"/><span>csv</span></a></span>
128-
<span *ngIf="state.projectMatrixUrls.isProjectMatrixLoomAvailable()"><a
129-
[href]="state.projectMatrixUrls.loomUrl"><img
130-
src="assets/images/icon/hca-download-primary.png"/><span>loom</span></a></span>
131-
<span *ngIf="state.projectMatrixUrls.isProjectMatrixMtxAvailable()"><a
132-
[href]="state.projectMatrixUrls.mtxUrl"><img
133-
src="assets/images/icon/hca-download-primary.png"/><span>mtx</span></a></span>
134-
</p>
135-
</ng-container>
136-
<p class="fontsize-xs rhs" *ngSwitchDefault>No expression matrix available</p>
137-
</ng-container>
121+
<p class="fontsize-xs rhs" *ngIf="state.projectMatrixUrls && !state.projectMatrixUrls.isAnyProjectMatrixUrlAvailable()">No expression matrix available</p>
122+
</div>
123+
<div *ngFor="let species of state.projectMatrixUrls.listSpeciesWithMatrixUrls()"
124+
class="species-matrix-url">
125+
<p class="fontsize-xs semi-bold subhead lhs">
126+
<hca-tooltip [tooltipClass]="'hca-tooltip narrow'"
127+
[tooltipContent]="'Download expression matrix'"
128+
[tooltipDisabled]="false"
129+
[tooltipPosition]="'above'">{{species}}
130+
</hca-tooltip>
131+
</p>
132+
<p class="fontsize-xs rhs downloads">
133+
<span *ngFor="let matrixUrl of state.projectMatrixUrls.listMatrixUrlsBySpecies(species)"><a
134+
[href]="matrixUrl.url"><img
135+
src="assets/images/icon/hca-download-primary.png"/><span>{{matrixUrl.fileType}}</span></a></span>
136+
</p>
138137
</div>
139138
</div>
140139
<div class="project-integrations">

spa/src/app/files/hca-project/hca-project.component.scss

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,15 @@
6161
p.downloads {
6262

6363
a {
64-
align-items: center;
64+
align-items: flex-start;
6565
color: $hca-black;
6666
display: flex;
6767
}
6868

6969
/* Icon */
7070
img {
7171
cursor: pointer;
72-
height: 20px;
72+
height: 16px;
7373
}
7474

7575
/* Container */
@@ -227,14 +227,27 @@
227227
/* LHS container */
228228
.lhs {
229229
box-sizing: border-box;
230+
display: flex;
231+
flex-direction: column;
232+
align-items: flex-start;
230233
width: 100%;
234+
&.subhead {
235+
color: #666666;
236+
}
231237
}
232238

233239
/* RHS container */
234240
.rhs {
235241
box-sizing: border-box;
236242
width: 100%;
237243
}
244+
245+
.species-matrix-url {
246+
transition: background-color 400ms cubic-bezier(0.25, 0.8, 0.25, 1);
247+
&:hover {
248+
background-color: rgba(0, 0, 0, 0.03);
249+
}
250+
}
238251
}
239252

240253
/**

spa/src/app/files/hca-project/hca-project.component.spec.ts

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ import {
3434
PROJECT_DETAIL_SINGLE_VALUES, PROJECT_DETAIL_SPECIFIC_VALUES,
3535
PROJECT_DETAIL_UNSPECIFIED_VALUES, PROJECT_PORTAL_SINGLE_VALUE_SINGLE_INTEGRATION_OBJECT
3636
} from "./hca-project-mapper.mock";
37+
import { GenusSpecies } from "../shared/genus-species.model";
38+
import { SpeciesMatrixUrls } from "../shared/species-matrix-urls.model";
3739

3840
describe("HCAProjectComponent", () => {
3941

@@ -64,7 +66,15 @@ describe("HCAProjectComponent", () => {
6466
const HEADING_EXTERNAL_RESOURCES = "External Resources";
6567

6668
// Project matrix urls
67-
const PROJECT_DETAIL_PROJECT_MATRIX_URLS = new ProjectMatrixUrls("2cd14cf5-f8e0-4c97-91a2-9e8957f41ea8", "https://dev.data.humancellatlas.org/project-assets/project-matrices/537f5501-a964-4ade-91c8-7bd4a23b049d.csv.zip", "https://dev.data.humancellatlas.org/project-assets/project-matrices/537f5501-a964-4ade-91c8-7bd4a23b049d.loom", "https://dev.data.humancellatlas.org/project-assets/project-matrices/537f5501-a964-4ade-91c8-7bd4a23b049d.mtx.zip");
69+
const SPECIES_URLS_HOMO_SAPIENS = new SpeciesMatrixUrls(
70+
"1234",
71+
"https://test.com/1234.homo_sapiens.csv.zip",
72+
"https://test.com/1234.homo_sapiens.loom",
73+
"https://test.com/1234.homo_sapiens.mtx.zip"
74+
);
75+
const PROJECT_MATRIX_URLS_SINGLE_SPECIES = new ProjectMatrixUrls("1234", new Map([
76+
[GenusSpecies.HOMO_SAPIENS, SPECIES_URLS_HOMO_SAPIENS]
77+
]));
6878

6979
// Project details
7080
const PROJECT_LABEL_DONOR_COUNT = "Donor Count";
@@ -188,7 +198,7 @@ describe("HCAProjectComponent", () => {
188198
testStore.pipe
189199
.and.returnValues(
190200
of(PROJECT_DETAIL_SINGLE_VALUES), // selected project detail
191-
of(PROJECT_DETAIL_PROJECT_MATRIX_URLS), // project matrix URLs
201+
of(PROJECT_MATRIX_URLS_SINGLE_SPECIES), // project matrix URLs
192202
of([]), // project ids
193203
of([]) // integrations
194204
);
@@ -207,7 +217,7 @@ describe("HCAProjectComponent", () => {
207217
testStore.pipe
208218
.and.returnValues(
209219
of(PROJECT_DETAIL_SINGLE_VALUES), // selected project detail
210-
of(PROJECT_DETAIL_PROJECT_MATRIX_URLS), // project matrix URLs
220+
of(PROJECT_MATRIX_URLS_SINGLE_SPECIES), // project matrix URLs
211221
of([]), // project ids
212222
of([]) // integrations
213223
);
@@ -226,7 +236,7 @@ describe("HCAProjectComponent", () => {
226236
testStore.pipe
227237
.and.returnValues(
228238
of(PROJECT_DETAIL_SINGLE_VALUES), // selected project detail
229-
of(PROJECT_DETAIL_PROJECT_MATRIX_URLS), // project matrix URLs
239+
of(PROJECT_MATRIX_URLS_SINGLE_SPECIES), // project matrix URLs
230240
of([]), // project ids
231241
of([]) // integrations
232242
);
@@ -245,7 +255,7 @@ describe("HCAProjectComponent", () => {
245255
testStore.pipe
246256
.and.returnValues(
247257
of(PROJECT_DETAIL_SINGLE_VALUES), // selected project detail
248-
of(PROJECT_DETAIL_PROJECT_MATRIX_URLS), // project matrix URLs
258+
of(PROJECT_MATRIX_URLS_SINGLE_SPECIES), // project matrix URLs
249259
of([]), // project ids
250260
of([]) // integrations
251261
);
@@ -266,7 +276,7 @@ describe("HCAProjectComponent", () => {
266276
testStore.pipe
267277
.and.returnValues(
268278
of(PROJECT_DETAIL_SINGLE_VALUES), // selected project detail
269-
of(PROJECT_DETAIL_PROJECT_MATRIX_URLS), // project matrix URLs
279+
of(PROJECT_MATRIX_URLS_SINGLE_SPECIES), // project matrix URLs
270280
of([]), // project ids
271281
of([]) // integrations
272282
);
@@ -285,7 +295,7 @@ describe("HCAProjectComponent", () => {
285295
testStore.pipe
286296
.and.returnValues(
287297
of(PROJECT_DETAIL_EMPTY_VALUES), // selected project detail
288-
of(PROJECT_DETAIL_PROJECT_MATRIX_URLS), // project matrix URLs
298+
of(PROJECT_MATRIX_URLS_SINGLE_SPECIES), // project matrix URLs
289299
of([]), // project ids
290300
of([]) // integrations
291301
);
@@ -304,7 +314,7 @@ describe("HCAProjectComponent", () => {
304314
testStore.pipe
305315
.and.returnValues(
306316
of(PROJECT_DETAIL_UNSPECIFIED_VALUES), // selected project detail
307-
of(PROJECT_DETAIL_PROJECT_MATRIX_URLS), // project matrix URLs
317+
of(PROJECT_MATRIX_URLS_SINGLE_SPECIES), // project matrix URLs
308318
of([]), // project ids
309319
of([]) // integrations
310320
);
@@ -323,7 +333,7 @@ describe("HCAProjectComponent", () => {
323333
testStore.pipe
324334
.and.returnValues(
325335
of(PROJECT_DETAIL_SINGLE_VALUES), // selected project detail
326-
of(PROJECT_DETAIL_PROJECT_MATRIX_URLS), // project matrix URLs
336+
of(PROJECT_MATRIX_URLS_SINGLE_SPECIES), // project matrix URLs
327337
of([]), // project ids
328338
of([]) // integrations
329339
);
@@ -342,7 +352,7 @@ describe("HCAProjectComponent", () => {
342352
testStore.pipe
343353
.and.returnValues(
344354
of(PROJECT_DETAIL_MULTIPLE_VALUES), // selected project detail
345-
of(PROJECT_DETAIL_PROJECT_MATRIX_URLS), // project matrix URLs
355+
of(PROJECT_MATRIX_URLS_SINGLE_SPECIES), // project matrix URLs
346356
of([]), // project ids
347357
of([]) // integrations
348358
);
@@ -361,7 +371,7 @@ describe("HCAProjectComponent", () => {
361371
testStore.pipe
362372
.and.returnValues(
363373
of(PROJECT_DETAIL_SINGLE_VALUES), // selected project detail
364-
of(PROJECT_DETAIL_PROJECT_MATRIX_URLS), // project matrix URLs
374+
of(PROJECT_MATRIX_URLS_SINGLE_SPECIES), // project matrix URLs
365375
of([]), // project ids
366376
of([]) // integrations
367377
);
@@ -380,7 +390,7 @@ describe("HCAProjectComponent", () => {
380390
testStore.pipe
381391
.and.returnValues(
382392
of(PROJECT_DETAIL_SPECIFIC_VALUES), // selected project detail
383-
of(PROJECT_DETAIL_PROJECT_MATRIX_URLS), // project matrix URLs
393+
of(PROJECT_MATRIX_URLS_SINGLE_SPECIES), // project matrix URLs
384394
of([]), // project ids
385395
of([]) // integrations
386396
);
@@ -399,7 +409,7 @@ describe("HCAProjectComponent", () => {
399409
testStore.pipe
400410
.and.returnValues(
401411
of(PROJECT_DETAIL_EMPTY_VALUES), // selected project detail
402-
of(PROJECT_DETAIL_PROJECT_MATRIX_URLS), // project matrix URLs
412+
of(PROJECT_MATRIX_URLS_SINGLE_SPECIES), // project matrix URLs
403413
of([]), // project ids
404414
of([]) // integrations
405415
);
@@ -418,7 +428,7 @@ describe("HCAProjectComponent", () => {
418428
testStore.pipe
419429
.and.returnValues(
420430
of(PROJECT_DETAIL_UNSPECIFIED_VALUES), // selected project detail
421-
of(PROJECT_DETAIL_PROJECT_MATRIX_URLS), // project matrix URLs
431+
of(PROJECT_MATRIX_URLS_SINGLE_SPECIES), // project matrix URLs
422432
of([]), // project ids
423433
of([]) // integrations
424434
);
@@ -437,7 +447,7 @@ describe("HCAProjectComponent", () => {
437447
testStore.pipe
438448
.and.returnValues(
439449
of(PROJECT_DETAIL_SINGLE_VALUES), // selected project detail
440-
of(PROJECT_DETAIL_PROJECT_MATRIX_URLS), // project matrix URLs
450+
of(PROJECT_MATRIX_URLS_SINGLE_SPECIES), // project matrix URLs
441451
of([]), // project ids
442452
of([]) // integrations
443453
);
@@ -455,7 +465,7 @@ describe("HCAProjectComponent", () => {
455465
testStore.pipe
456466
.and.returnValues(
457467
of(PROJECT_DETAIL_MULTIPLE_VALUES), // selected project detail
458-
of(PROJECT_DETAIL_PROJECT_MATRIX_URLS), // project matrix URLs
468+
of(PROJECT_MATRIX_URLS_SINGLE_SPECIES), // project matrix URLs
459469
of([]), // project ids
460470
of([]) // integrations
461471
);
@@ -474,7 +484,7 @@ describe("HCAProjectComponent", () => {
474484
testStore.pipe
475485
.and.returnValues(
476486
of(PROJECT_DETAIL_SINGLE_VALUES), // selected project detail
477-
of(PROJECT_DETAIL_PROJECT_MATRIX_URLS), // project matrix URLs
487+
of(PROJECT_MATRIX_URLS_SINGLE_SPECIES), // project matrix URLs
478488
of([]), // project ids
479489
of([]) // integrations
480490
);
@@ -493,7 +503,7 @@ describe("HCAProjectComponent", () => {
493503
testStore.pipe
494504
.and.returnValues(
495505
of(PROJECT_DETAIL_UNSPECIFIED_VALUES), // selected project detail
496-
of(PROJECT_DETAIL_PROJECT_MATRIX_URLS), // project matrix URLs
506+
of(PROJECT_MATRIX_URLS_SINGLE_SPECIES), // project matrix URLs
497507
of([]), // project ids
498508
of([]) // integrations
499509
);
@@ -512,7 +522,7 @@ describe("HCAProjectComponent", () => {
512522
testStore.pipe
513523
.and.returnValues(
514524
of(PROJECT_DETAIL_SINGLE_VALUES), // selected project detail
515-
of(PROJECT_DETAIL_PROJECT_MATRIX_URLS), // project matrix URLs
525+
of(PROJECT_MATRIX_URLS_SINGLE_SPECIES), // project matrix URLs
516526
of([]), // project ids
517527
of([]) // integrations
518528
);
@@ -533,7 +543,7 @@ describe("HCAProjectComponent", () => {
533543
testStore.pipe
534544
.and.returnValues(
535545
of(PROJECT_DETAIL_SINGLE_VALUES), // selected project detail
536-
of(PROJECT_DETAIL_PROJECT_MATRIX_URLS), // project matrix URLs
546+
of(PROJECT_MATRIX_URLS_SINGLE_SPECIES), // project matrix URLs
537547
of([]), // project ids
538548
of([]) // integrations
539549
);
@@ -552,7 +562,7 @@ describe("HCAProjectComponent", () => {
552562
testStore.pipe
553563
.and.returnValues(
554564
of(PROJECT_DETAIL_SINGLE_VALUES), // selected project detail
555-
of(PROJECT_DETAIL_PROJECT_MATRIX_URLS), // project matrix URLs
565+
of(PROJECT_MATRIX_URLS_SINGLE_SPECIES), // project matrix URLs
556566
of([]), // project ids
557567
of(PROJECT_PORTAL_SINGLE_VALUE_SINGLE_INTEGRATION_OBJECT) // integrations
558568
);
@@ -573,7 +583,7 @@ describe("HCAProjectComponent", () => {
573583
testStore.pipe
574584
.and.returnValues(
575585
of(PROJECT_DETAIL_SINGLE_VALUES), // selected project detail
576-
of(PROJECT_DETAIL_PROJECT_MATRIX_URLS), // project matrix URLs
586+
of(PROJECT_MATRIX_URLS_SINGLE_SPECIES), // project matrix URLs
577587
of([]), // project ids
578588
of([]) // integrations
579589
);

spa/src/app/files/hca-project/hca-project.component.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,7 @@ export class HCAProjectComponent implements OnDestroy, OnInit {
174174
`<a href=${publication.publicationUrl} target="_blank" rel="noopener noreferrer">${publication.publicationTitle}</a>` :
175175
publication.publicationTitle;
176176
}
177-
178-
177+
179178
/**
180179
* Returns true if at least one data curator has been specified for this project.
181180
*
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* Human Cell Atlas
3+
* https://www.humancellatlas.org/
4+
*
5+
* View model of a prepared Matrix URL, containing file type and the actual URL.
6+
*/
7+
8+
export interface MatrixUrl {
9+
10+
fileType: string;
11+
url: string;
12+
}

spa/src/app/files/project-prepared-matrix-downloads/project-prepared-matrix-downloads.component.html

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,16 @@
44
<h3 class="fontsize-l">Download Expression Matrix</h3>
55
<h4 class="project-title fontsize-m">{{projectTitle}}</h4>
66
<div class="file-format fontsize-s">
7-
<div *ngIf="projectURLs.isProjectMatrixMtxAvailable()">
8-
<a [href]="projectURLs.mtxUrl">
9-
<img src="assets/images/icon/hca-download-primary.png">
10-
<span>mtx</span>
11-
</a>
12-
<copy-to-clipboard [copyToClipboardLink]="projectURLs.mtxUrl"></copy-to-clipboard>
13-
</div>
14-
<div *ngIf="projectURLs.isProjectMatrixCSVAvailable()">
15-
<a [href]="projectURLs.csvUrl">
16-
<img src="assets/images/icon/hca-download-primary.png">
17-
<span>csv</span>
18-
</a>
19-
<copy-to-clipboard [copyToClipboardLink]="projectURLs.csvUrl"></copy-to-clipboard>
20-
</div>
21-
<div *ngIf="projectURLs.isProjectMatrixLoomAvailable()">
22-
<a [href]="projectURLs.loomUrl">
23-
<img src="assets/images/icon/hca-download-primary.png">
24-
<span>loom</span>
25-
</a>
26-
<copy-to-clipboard [copyToClipboardLink]="projectURLs.loomUrl"></copy-to-clipboard>
27-
</div>
7+
<ng-container *ngFor="let species of projectURLs.listSpeciesWithMatrixUrls()">
8+
<h5>{{species}}</h5>
9+
<div *ngFor="let matrixUrl of projectURLs.listMatrixUrlsBySpecies(species)">
10+
<a [href]="matrixUrl.url">
11+
<img src="assets/images/icon/hca-download-primary.png">
12+
<span>{{matrixUrl.fileType}}</span>
13+
</a>
14+
<copy-to-clipboard [copyToClipboardLink]="matrixUrl.url"></copy-to-clipboard>
15+
</div>
16+
</ng-container>
2817
</div>
2918
</div>
3019
<!--<span class="fontsize-xs">For instructions on how to use the expression matrix see the expression matrix userguide.</span>-->

0 commit comments

Comments
 (0)