Skip to content

Commit

Permalink
Updated Custom Data Enhancements for Plots Tab
Browse files Browse the repository at this point in the history
  • Loading branch information
Nelliney committed Sep 13, 2024
1 parent 6450eae commit 0836d7a
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 18 deletions.
4 changes: 1 addition & 3 deletions src/pages/resultsView/ResultsViewPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,7 @@ export default class ResultsViewPage extends React.Component<
sampleKeyToSample={store.sampleKeyToSample}
genes={store.genes}
clinicalAttributes={store.clinicalAttributes}
customAttributes={
store.clinicalAttributes_customCharts
}
customAttributes={store.customAttributes}
genesets={store.genesets}
genericAssayEntitiesGroupByMolecularProfileId={
store.genericAssayEntitiesGroupByMolecularProfileId
Expand Down
10 changes: 6 additions & 4 deletions src/pages/resultsView/ResultsViewPageStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1093,6 +1093,7 @@ export class ResultsViewPageStore extends AnalysisStore
this.studyIds,
this.clinicalAttributes_profiledIn,
this.clinicalAttributes_comparisonGroupMembership,
this.customAttributes,
this.samples,
this.patients,
],
Expand Down Expand Up @@ -1141,6 +1142,7 @@ export class ResultsViewPageStore extends AnalysisStore
...specialAttributes,
...this.clinicalAttributes_profiledIn.result!,
...this.clinicalAttributes_comparisonGroupMembership.result!,
...this.customAttributes.result!,
];
},
});
Expand Down Expand Up @@ -1185,7 +1187,7 @@ export class ResultsViewPageStore extends AnalysisStore
this.studyToDataQueryFilter,
this.clinicalAttributes_profiledIn,
this.clinicalAttributes_comparisonGroupMembership,
this.clinicalAttributes_customCharts,
this.customAttributes,
],
invoke: async () => {
let clinicalAttributeCountFilter: ClinicalAttributeCountFilter;
Expand Down Expand Up @@ -1268,7 +1270,7 @@ export class ResultsViewPageStore extends AnalysisStore
);
}
// add counts for custom chart clinical attributes
for (const attr of this.clinicalAttributes_customCharts.result!) {
for (const attr of this.customAttributes.result!) {
ret[attr.clinicalAttributeId] = attr.data!.filter(
d => d.value !== 'NA'
).length;
Expand Down Expand Up @@ -2721,7 +2723,7 @@ export class ResultsViewPageStore extends AnalysisStore
default: [],
});

readonly clinicalAttributes_customCharts = remoteData({
readonly customAttributes = remoteData({
await: () => [this.sampleMap],
invoke: async () => {
let ret: ExtendedClinicalAttribute[] = [];
Expand Down Expand Up @@ -5691,7 +5693,7 @@ export class ResultsViewPageStore extends AnalysisStore
this.coverageInformation,
this.filteredSampleKeyToSample,
this.filteredPatientKeyToPatient,
this.clinicalAttributes_customCharts
this.customAttributes
);

public mutationCache = new MobxPromiseCache<
Expand Down
4 changes: 2 additions & 2 deletions src/pages/resultsView/oncoprint/TracksMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export default class TracksMenu extends React.Component<IAddTrackProps, {}> {
await: () => [
this.props.store.clinicalAttributes,
this.clinicalAttributeIdToAvailableFrequency,
this.props.store.clinicalAttributes_customCharts,
this.props.store.customAttributes,
],
invoke: () => {
const uniqueAttributes = _.uniqBy(
Expand All @@ -167,7 +167,7 @@ export default class TracksMenu extends React.Component<IAddTrackProps, {}> {
};

const customChartClinicalAttributeIds = _.keyBy(
this.props.store.clinicalAttributes_customCharts.result!,
this.props.store.customAttributes.result!,
a => a.clinicalAttributeId
);

Expand Down
3 changes: 1 addition & 2 deletions src/pages/studyView/StudyViewPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -773,8 +773,7 @@ export default class StudyViewPage extends React.Component<
this.store.clinicalAttributes
}
customAttributes={
this.store
.clinicalAttributes_customCharts
this.store.customAttributes
}
genesets={this.store.genesets}
genericAssayEntitiesGroupByMolecularProfileId={
Expand Down
4 changes: 2 additions & 2 deletions src/pages/studyView/StudyViewPageStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11439,7 +11439,7 @@ export class StudyViewPageStore
),
});

readonly clinicalAttributes_customCharts = remoteData({
readonly customAttributes = remoteData({
await: () => [this.sampleMap],
invoke: async () => {
let ret: ExtendedClinicalAttribute[] = [];
Expand Down Expand Up @@ -11485,7 +11485,7 @@ export class StudyViewPageStore
this.coverageInformation,
this.filteredSampleKeyToSample,
this.filteredPatientKeyToPatient,
this.clinicalAttributes_customCharts
this.customAttributes
);

private _numericGeneMolecularDataCache = new MobxPromiseCache<
Expand Down
8 changes: 4 additions & 4 deletions src/shared/components/plots/PlotsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,7 @@ export default class PlotsTab extends React.Component<IPlotsTabProps, {}> {
(self.horzSelection.dataType === CLIN_ATTR_DATA_TYPE ||
self.horzSelection.dataType === CUSTOM_ATTR_DATA_TYPE)
) {
// if vertical gene set option is "same as horizontal", and horizontal is clinical, then use the actual
// if vertical gene set option is "same as horizontal", and horizontal is clinical or custom, then use the actual
// gene set option value instead of "Same gene" option value, because that would be slightly weird UX
return self.horzSelection.selectedGenesetOption;
} else {
Expand Down Expand Up @@ -1251,7 +1251,7 @@ export default class PlotsTab extends React.Component<IPlotsTabProps, {}> {
(self.horzSelection.dataType === CLIN_ATTR_DATA_TYPE ||
self.horzSelection.dataType === CUSTOM_ATTR_DATA_TYPE)
) {
// if vertical gene set option is "same as horizontal", and horizontal is clinical, then use the actual
// if vertical gene set option is "same as horizontal", and horizontal is clinical or custom, then use the actual
// gene set option value instead of "Same gene" option value, because that would be slightly weird UX
return self.horzSelection.selectedGenericAssayOption;
} else {
Expand Down Expand Up @@ -2585,7 +2585,7 @@ export default class PlotsTab extends React.Component<IPlotsTabProps, {}> {
dataTypeIds.push(CLIN_ATTR_DATA_TYPE);
}

if (this.customAttributeOptions.result!.length) {
if (!_.isEmpty(this.customAttributeOptions.result)) {
dataTypeIds.push(CUSTOM_ATTR_DATA_TYPE);
}

Expand Down Expand Up @@ -2699,7 +2699,7 @@ export default class PlotsTab extends React.Component<IPlotsTabProps, {}> {
] = this.clinicalAttributeOptions.result!;
}

if (this.customAttributeOptions.result!.length) {
if (!_.isEmpty(this.customAttributeOptions.result)) {
// add custom attributes
map[
CUSTOM_ATTR_DATA_TYPE
Expand Down
2 changes: 1 addition & 1 deletion src/shared/components/plots/PlotsTabUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1663,7 +1663,7 @@ export function getAxisDescription(
switch (selection.dataType) {
case CUSTOM_ATTR_DATA_TYPE:
const customAttr =
clinicalAttributeIdToClinicalAttribute[selection.dataSourceId!];
customAttributeIdToClinicalAttribute[selection.dataSourceId!];
if (customAttr) {
ret = customAttr.description;
}
Expand Down

0 comments on commit 0836d7a

Please sign in to comment.