Skip to content

Commit bbf0e6a

Browse files
authored
Merge pull request #126 from daisybio/125-visualize-sample-count-for-diseases-and-subptypes-in-browse-form
Add disease/subset sample count
2 parents f799bad + 4bcf023 commit bbf0e6a

File tree

5 files changed

+33
-6
lines changed

5 files changed

+33
-6
lines changed
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<mat-form-field appearance="outline" class="full-width" style="margin-top: 10px">
22
<mat-label>Disease</mat-label>
33
@let diseaseNames = diseaseNames$();
4+
@let diseaseSampleCounts = diseaseSampleCounts$();
45
<mat-select [(value)]="activeDisease$" [disabled]="diseaseNames.length < 2">
56
@for (disease of diseaseNames; track disease) {
6-
<mat-option [value]="disease">{{ capitalize(disease) }}</mat-option>
7+
<mat-option [value]="disease">{{ capitalize(disease) }} ({{ diseaseSampleCounts.get(disease) }})</mat-option>
78
}
89
</mat-select>
910
</mat-form-field>
@@ -12,7 +13,9 @@
1213
@let possibleSubtypes = possibleSubtypes$();
1314
<mat-select [(value)]="activeSubtype" [disabled]="possibleSubtypes.length < 2">
1415
@for (dataset of possibleSubtypes; track dataset.dataset_ID) {
15-
<mat-option [value]="dataset">{{ capitalize(dataset.disease_subtype || SUBTYPE_DEFAULT) }}</mat-option>
16+
<mat-option [value]="dataset">{{ capitalize(dataset.disease_subtype || SUBTYPE_DEFAULT) }} ({{ dataset.sample_count
17+
}})</mat-option>
1618
}
1719
</mat-select>
1820
</mat-form-field>
21+
<div class="note">Numbers in parentheses indicate the number of samples available for each disease/subtype.</div>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.note {
2+
font-size: 12px;
3+
color: rgba(0, 0, 0, 0.6);
4+
margin-top: -8px;
5+
margin-bottom: 10px;
6+
font-style: italic;
7+
}
8+
9+
.full-width {
10+
width: 100%;
11+
}

src/app/components/disease-selector/disease-selector.component.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,20 @@ export class DiseaseSelectorComponent implements OnDestroy {
5151
readonly possibleSubtypes$ = computed(
5252
() => this._diseaseSubtypeMap$().get(this.activeDisease$()) ?? []
5353
);
54+
55+
// Calculate sample counts for each disease by summing up all subtypes
56+
readonly diseaseSampleCounts$ = computed(() => {
57+
const counts = new Map<string, number>();
58+
this._diseaseSubtypeMap$().forEach((subtypes, diseaseName) => {
59+
const totalCount = subtypes.reduce(
60+
(sum, dataset) => sum + dataset.sample_count,
61+
0
62+
);
63+
counts.set(diseaseName, totalCount);
64+
});
65+
return counts;
66+
});
67+
5468
private readonly _updateOutput = effect(() =>
5569
this.selected.emit(this.activeSubtype())
5670
);

src/app/constants.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ export const SUBTYPE_DEFAULT = 'Unspecific';
33
export const API_BASE = 'https://exbio.wzw.tum.de/sponge-api';
44
// export const API_BASE = 'http://127.0.0.1:5555/sponge-api';
55

6-
76
export const AS_DESCRIPTIONS: { [key: string]: string } = {
87
SE: 'Skipping Exon',
98
A5: "Alternative 5' Splice Site",

src/app/interfaces.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export interface Dataset {
66
disease_type: string;
77
download_url: string;
88
sponge_db_version: number;
9+
sample_count: number;
910
}
1011

1112
export interface SpongeRun {
@@ -327,7 +328,7 @@ export interface SpongEffectsGeneModuleMembers {
327328
ensg_number: string;
328329
gene_symbol: string;
329330
};
330-
spongEffects_gene_module_ID: number
331+
spongEffects_gene_module_ID: number;
331332
spongEffects_gene_module_members_ID: number;
332333
}
333334

@@ -345,7 +346,7 @@ export interface SpongEffectsTranscriptModuleMembers {
345346
transcript: {
346347
enst_number: string;
347348
};
348-
spongEffects_gene_module_ID: number
349+
spongEffects_gene_module_ID: number;
349350
spongEffects_gene_module_members_ID: number;
350351
}
351352

@@ -364,7 +365,6 @@ export interface ModuleMember {
364365
spongEffects_run_ID: number;
365366
}
366367

367-
368368
export interface PredictCancerType {
369369
meta: {
370370
runtime: number;

0 commit comments

Comments
 (0)