Skip to content

Commit 15011e0

Browse files
NellineyBryan Lai
andauthored
Custom data Enhancements for Plots Tab (#4994)
* Add custom attribute type to the Plots tab * clean up plotClinicalAttributes to avoid code dupe --------- Co-authored-by: Bryan Lai <[email protected]>
1 parent fae19ee commit 15011e0

File tree

7 files changed

+236
-31
lines changed

7 files changed

+236
-31
lines changed

src/pages/resultsView/ResultsViewPage.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,10 @@ export default class ResultsViewPage extends React.Component<
265265
entrezGeneIdToGene={store.entrezGeneIdToGene}
266266
sampleKeyToSample={store.sampleKeyToSample}
267267
genes={store.genes}
268-
clinicalAttributes={store.clinicalAttributes}
268+
clinicalAttributes={
269+
store.plotClinicalAttributes
270+
}
271+
customAttributes={store.customAttributes}
269272
genesets={store.genesets}
270273
genericAssayEntitiesGroupByMolecularProfileId={
271274
store.genericAssayEntitiesGroupByMolecularProfileId

src/pages/resultsView/ResultsViewPageStore.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,7 @@ export class ResultsViewPageStore extends AnalysisStore
10931093
this.studyIds,
10941094
this.clinicalAttributes_profiledIn,
10951095
this.clinicalAttributes_comparisonGroupMembership,
1096-
this.clinicalAttributes_customCharts,
1096+
this.customAttributes,
10971097
this.samples,
10981098
this.patients,
10991099
],
@@ -1142,7 +1142,7 @@ export class ResultsViewPageStore extends AnalysisStore
11421142
...specialAttributes,
11431143
...this.clinicalAttributes_profiledIn.result!,
11441144
...this.clinicalAttributes_comparisonGroupMembership.result!,
1145-
...this.clinicalAttributes_customCharts.result!,
1145+
...this.customAttributes.result!,
11461146
];
11471147
},
11481148
});
@@ -1187,7 +1187,7 @@ export class ResultsViewPageStore extends AnalysisStore
11871187
this.studyToDataQueryFilter,
11881188
this.clinicalAttributes_profiledIn,
11891189
this.clinicalAttributes_comparisonGroupMembership,
1190-
this.clinicalAttributes_customCharts,
1190+
this.customAttributes,
11911191
],
11921192
invoke: async () => {
11931193
let clinicalAttributeCountFilter: ClinicalAttributeCountFilter;
@@ -1270,7 +1270,7 @@ export class ResultsViewPageStore extends AnalysisStore
12701270
);
12711271
}
12721272
// add counts for custom chart clinical attributes
1273-
for (const attr of this.clinicalAttributes_customCharts.result!) {
1273+
for (const attr of this.customAttributes.result!) {
12741274
ret[attr.clinicalAttributeId] = attr.data!.filter(
12751275
d => d.value !== 'NA'
12761276
).length;
@@ -2723,7 +2723,17 @@ export class ResultsViewPageStore extends AnalysisStore
27232723
default: [],
27242724
});
27252725

2726-
readonly clinicalAttributes_customCharts = remoteData({
2726+
readonly plotClinicalAttributes = remoteData<ExtendedClinicalAttribute[]>({
2727+
await: () => [this.clinicalAttributes, this.customAttributes],
2728+
invoke: async () => {
2729+
return _.filter(
2730+
this.clinicalAttributes.result!,
2731+
attr => !this.customAttributes.result!.includes(attr)
2732+
);
2733+
},
2734+
});
2735+
2736+
readonly customAttributes = remoteData({
27272737
await: () => [this.sampleMap],
27282738
invoke: async () => {
27292739
let ret: ExtendedClinicalAttribute[] = [];
@@ -5693,7 +5703,7 @@ export class ResultsViewPageStore extends AnalysisStore
56935703
this.coverageInformation,
56945704
this.filteredSampleKeyToSample,
56955705
this.filteredPatientKeyToPatient,
5696-
this.clinicalAttributes_customCharts
5706+
this.customAttributes
56975707
);
56985708

56995709
public mutationCache = new MobxPromiseCache<

src/pages/resultsView/oncoprint/TracksMenu.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ export default class TracksMenu extends React.Component<IAddTrackProps, {}> {
151151
await: () => [
152152
this.props.store.clinicalAttributes,
153153
this.clinicalAttributeIdToAvailableFrequency,
154-
this.props.store.clinicalAttributes_customCharts,
154+
this.props.store.customAttributes,
155155
],
156156
invoke: () => {
157157
const uniqueAttributes = _.uniqBy(
@@ -167,7 +167,7 @@ export default class TracksMenu extends React.Component<IAddTrackProps, {}> {
167167
};
168168

169169
const customChartClinicalAttributeIds = _.keyBy(
170-
this.props.store.clinicalAttributes_customCharts.result!,
170+
this.props.store.customAttributes.result!,
171171
a => a.clinicalAttributeId
172172
);
173173

src/pages/studyView/StudyViewPage.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,9 @@ export default class StudyViewPage extends React.Component<
769769
clinicalAttributes={
770770
this.store.clinicalAttributes
771771
}
772+
customAttributes={
773+
this.store.customAttributes
774+
}
772775
genesets={this.store.genesets}
773776
genericAssayEntitiesGroupByMolecularProfileId={
774777
this.store

src/pages/studyView/StudyViewPageStore.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11477,7 +11477,7 @@ export class StudyViewPageStore
1147711477
),
1147811478
});
1147911479

11480-
readonly clinicalAttributes_customCharts = remoteData({
11480+
readonly customAttributes = remoteData({
1148111481
await: () => [this.sampleMap],
1148211482
invoke: async () => {
1148311483
let ret: ExtendedClinicalAttribute[] = [];
@@ -11523,7 +11523,7 @@ export class StudyViewPageStore
1152311523
this.coverageInformation,
1152411524
this.filteredSampleKeyToSample,
1152511525
this.filteredPatientKeyToPatient,
11526-
this.clinicalAttributes_customCharts
11526+
this.customAttributes
1152711527
);
1152811528

1152911529
private _numericGeneMolecularDataCache = new MobxPromiseCache<

0 commit comments

Comments
 (0)