Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix custom data not showing in study plots tab #4989

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/pages/studyView/StudyViewPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,11 @@ export default class StudyViewPage extends React.Component<
.result
}
patients={this.store.patients}
clinicalAttributes_customCharts={
this.store
.clinicalAttributes_customCharts
.result
}
/>
</MSKTab>

Expand Down
29 changes: 19 additions & 10 deletions src/shared/components/plots/PlotsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ export interface IPlotsTabProps {
sampleKeyToSample: MobxPromise<_.Dictionary<Sample>>;
genes: MobxPromise<Gene[]>;
clinicalAttributes: MobxPromise<ExtendedClinicalAttribute[]>;
clinicalAttributes_customCharts?: ExtendedClinicalAttribute[];
genesets: MobxPromise<Geneset[]>;
genericAssayEntitiesGroupByMolecularProfileId: MobxPromise<{
[profileId: string]: GenericAssayMeta[];
Expand Down Expand Up @@ -2063,10 +2064,20 @@ export default class PlotsTab extends React.Component<IPlotsTabProps, {}> {
},
});

readonly clinicalAttributes = remoteData<ExtendedClinicalAttribute[]>({
await: () => [this.props.clinicalAttributes],
invoke: () => {
return Promise.resolve([
...this.props.clinicalAttributes.result!,
...(this.props.clinicalAttributes_customCharts || []),
]);
},
});

readonly coloringMenuOmnibarOptions = remoteData<
(ColoringMenuOmnibarOption | ColoringMenuOmnibarGroup)[]
>({
await: () => [this.props.genes, this.props.clinicalAttributes],
await: () => [this.props.genes, this.clinicalAttributes],
invoke: () => {
const allOptions: (
| Omit<ColoringMenuOmnibarOption, 'value'>
Expand All @@ -2088,7 +2099,7 @@ export default class PlotsTab extends React.Component<IPlotsTabProps, {}> {

allOptions.push({
label: 'Clinical Attributes',
options: this.props.clinicalAttributes
options: this.clinicalAttributes
.result!.filter(a => {
return (
a.clinicalAttributeId !==
Expand Down Expand Up @@ -2408,12 +2419,12 @@ export default class PlotsTab extends React.Component<IPlotsTabProps, {}> {
readonly clinicalAttributeIdToClinicalAttribute = remoteData<{
[clinicalAttributeId: string]: ClinicalAttribute;
}>({
await: () => [this.props.clinicalAttributes, this.props.studyIds],
await: () => [this.props.studyIds, this.clinicalAttributes],
invoke: () => {
let _map: {
[clinicalAttributeId: string]: ClinicalAttribute;
} = _.keyBy(
this.props.clinicalAttributes.result,
this.clinicalAttributes.result!,
c => c.clinicalAttributeId
);
return Promise.resolve(_map);
Expand All @@ -2423,24 +2434,22 @@ export default class PlotsTab extends React.Component<IPlotsTabProps, {}> {
readonly clinicalAttributesGroupByclinicalAttributeId = remoteData<{
[clinicalAttributeId: string]: ClinicalAttribute[];
}>({
await: () => [this.props.clinicalAttributes],
await: () => [this.clinicalAttributes],
invoke: () => {
return Promise.resolve(
_.groupBy(
this.props.clinicalAttributes.result,
this.clinicalAttributes.result!,
c => c.clinicalAttributeId
)
);
},
});

readonly clinicalAttributeOptions = remoteData({
await: () => [this.props.clinicalAttributes],
await: () => [this.clinicalAttributes],
invoke: () =>
Promise.resolve(
makeClinicalAttributeOptions(
this.props.clinicalAttributes.result!
)
makeClinicalAttributeOptions(this.clinicalAttributes.result!)
),
});

Expand Down
Loading