Skip to content

Commit

Permalink
add new endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
Djokovic0311 committed Sep 8, 2023
1 parent 922376f commit b080149
Show file tree
Hide file tree
Showing 21 changed files with 3,675 additions and 31 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/cbioportal-ts-api-client/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ export {
GenericAssayDataBinFilter,
GenericAssayDataCountFilter,
GenericAssayDataCountItem,
GenericAssayCountSummary,
GenericAssayBinaryEnrichment,
GenericAssayCategoricalEnrichment,
GenericAssayEnrichment,
Geneset,
GenesetCorrelation,
Expand Down
258 changes: 258 additions & 0 deletions src/pages/groupComparison/GenericAssayEnrichmentCollections.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,258 @@
import * as React from 'react';
import { observer } from 'mobx-react';
import autobind from 'autobind-decorator';
import { MolecularProfile } from 'cbioportal-ts-api-client';
import { MakeMobxView } from '../../shared/components/MobxView';
import Loader from '../../shared/components/loadingIndicator/LoadingIndicator';
import ErrorMessage from '../../shared/components/ErrorMessage';
import { MakeEnrichmentsTabUI } from './GroupComparisonUtils';
import _ from 'lodash';
import ComparisonStore from '../../shared/lib/comparison/ComparisonStore';
import GenericAssayBinaryEnrichmentsContainer from 'pages/resultsView/enrichments/GenericAssayBinaryEnrichmentsContainer';
import EnrichmentsDataSetDropdown from 'pages/resultsView/enrichments/EnrichmentsDataSetDropdown';
import { observable } from 'mobx';
import GenericAssayEnrichmentsContainer from 'pages/resultsView/enrichments/GenericAssayEnrichmentsContainer';
import GenericAssayCategoricalEnrichmentsContainer from 'pages/resultsView/enrichments/GenericAssayCategoricalEnrichmentsContainer';

export interface IGenericAssayEnrichmentCollectionsProps {
store: ComparisonStore;
genericAssayType: string;
resultsViewMode?: boolean;
}

@observer
export default class GenericAssayEnrichmentCollections extends React.Component<
IGenericAssayEnrichmentCollectionsProps,
{}
> {
@observable isBinary: boolean | undefined = false;
@observable isCategorical: boolean | undefined = false;
@observable isNumerical: boolean | undefined = false;

@autobind
private onChangeProfile(profileMap: {
[studyId: string]: MolecularProfile;
}) {
const type = Object.values(profileMap)[0].datatype;
this.props.store.setAllGenericAssayEnrichmentProfileMap(
profileMap,
this.props.genericAssayType
);
if (type === 'BINARY') {
this.isBinary = true;
this.isCategorical = false;
this.isNumerical = false;
} else if (type === 'CATEGORICAL') {
this.isBinary = false;
this.isCategorical = true;
this.isNumerical = false;
} else {
this.isBinary = false;
this.isCategorical = false;
this.isNumerical = true;
}
}

readonly tabUI = MakeEnrichmentsTabUI(
() => this.props.store,
() => this.enrichmentsUI,
this.props.genericAssayType,
true,
true,
false
);

readonly enrichmentsUI = MakeMobxView({
await: () => {
const ret: any[] = [
this.props.store.gaBinaryEnrichmentDataByAssayType,
this.props.store
.selectedAllGenericAssayEnrichmentProfileMapGroupedByGenericAssayType,
this.props.store.gaBinaryEnrichmentGroupsByAssayType,
this.props.store.gaCategoricalEnrichmentDataByAssayType,
this.props.store.gaCategoricalEnrichmentGroupsByAssayType,
this.props.store.gaEnrichmentDataByAssayType,
this.props.store.gaEnrichmentGroupsByAssayType,
this.props.store.studies,
];
if (
this.props.store.gaBinaryEnrichmentDataByAssayType.isComplete &&
this.props.store.gaBinaryEnrichmentDataByAssayType.result![
this.props.genericAssayType
]
) {
ret.push(
this.props.store.gaBinaryEnrichmentDataByAssayType.result![
this.props.genericAssayType
]
);
}

if (
this.props.store.gaCategoricalEnrichmentDataByAssayType
.isComplete &&
this.props.store.gaCategoricalEnrichmentDataByAssayType.result![
this.props.genericAssayType
]
) {
ret.push(
this.props.store.gaCategoricalEnrichmentDataByAssayType
.result![this.props.genericAssayType]
);
}
if (
this.props.store.gaEnrichmentDataByAssayType.isComplete &&
this.props.store.gaEnrichmentDataByAssayType.result![
this.props.genericAssayType
]
) {
ret.push(
this.props.store.gaEnrichmentDataByAssayType.result![
this.props.genericAssayType
]
);
}
return ret;
},
render: () => {
// since generic assay enrichments tab is enabled only for one study, selectedGenericAssayEnrichmentProfileMap
// would contain only one key.
const studyId = Object.keys(
this.props.store
.selectedAllGenericAssayEnrichmentProfileMapGroupedByGenericAssayType
.result![this.props.genericAssayType]
)[0];

// select the first found profile in the study as the default selection for selected genericAssayType
const selectedProfile = this.props.store
.selectedAllGenericAssayEnrichmentProfileMapGroupedByGenericAssayType
.result![this.props.genericAssayType][studyId];

let profileList: MolecularProfile[] = [];
const genericAssayBinaryEnrichmentProfiles = this.props.store
.genericAssayBinaryEnrichmentProfilesGroupedByGenericAssayType
.result![this.props.genericAssayType];
const genericAssayCategoricalEnrichmentProfiles = this.props.store
.genericAssayCategoricalEnrichmentProfilesGroupedByGenericAssayType
.result![this.props.genericAssayType];
const genericAssayEnrichmentProfiles = this.props.store
.genericAssayEnrichmentProfilesGroupedByGenericAssayType
.result![this.props.genericAssayType];

if (genericAssayBinaryEnrichmentProfiles !== undefined) {
profileList = profileList.concat(
genericAssayBinaryEnrichmentProfiles
);
}
if (genericAssayCategoricalEnrichmentProfiles !== undefined) {
profileList = profileList.concat(
genericAssayCategoricalEnrichmentProfiles
);
}
if (genericAssayEnrichmentProfiles !== undefined) {
profileList = profileList.concat(
genericAssayEnrichmentProfiles
);
}

if (selectedProfile.datatype == 'BINARY') {
this.isBinary = true;
this.isCategorical = false;
this.isNumerical = false;
} else if (selectedProfile.datatype == 'CATEGORICAL') {
this.isBinary = false;
this.isCategorical = true;
this.isNumerical = false;
} else {
this.isBinary = false;
this.isCategorical = false;
this.isNumerical = true;
}

return (
<div data-test="GroupComparisonGenericAssayEnrichments">
<EnrichmentsDataSetDropdown
dataSets={profileList}
onChange={this.onChangeProfile}
selectedProfileByStudyId={
this.props.store
.selectedAllGenericAssayEnrichmentProfileMapGroupedByGenericAssayType
.result![this.props.genericAssayType]
}
alwaysShow={true}
studies={this.props.store.studies.result!}
showDescription={true}
/>
{this.isBinary && (
<GenericAssayBinaryEnrichmentsContainer
data={
this.props.store
.gaBinaryEnrichmentDataByAssayType.result![
this.props.genericAssayType
].result
}
groups={
this.props.store
.gaBinaryEnrichmentGroupsByAssayType
.result![this.props.genericAssayType]
}
selectedProfile={selectedProfile}
alteredVsUnalteredMode={false}
sampleKeyToSample={
this.props.store.sampleKeyToSample.result!
}
genericAssayType={this.props.genericAssayType}
/>
)}
{this.isCategorical && (
<GenericAssayCategoricalEnrichmentsContainer
data={
this.props.store
.gaCategoricalEnrichmentDataByAssayType
.result![this.props.genericAssayType].result
}
groups={
this.props.store
.gaCategoricalEnrichmentGroupsByAssayType
.result![this.props.genericAssayType]
}
selectedProfile={selectedProfile}
alteredVsUnalteredMode={false}
sampleKeyToSample={
this.props.store.sampleKeyToSample.result!
}
genericAssayType={this.props.genericAssayType}
dataStore={this.props.store}
/>
)}
{this.isNumerical && (
<GenericAssayEnrichmentsContainer
data={
this.props.store.gaEnrichmentDataByAssayType
.result![this.props.genericAssayType].result
}
groups={
this.props.store.gaEnrichmentGroupsByAssayType
.result![this.props.genericAssayType]
}
selectedProfile={selectedProfile}
alteredVsUnalteredMode={false}
sampleKeyToSample={
this.props.store.sampleKeyToSample.result!
}
genericAssayType={this.props.genericAssayType}
/>
)}
</div>
);
},
renderPending: () => (
<Loader center={true} isLoading={true} size={'big'} />
),
renderError: () => <ErrorMessage />,
});

render() {
return this.tabUI.component;
}
}
29 changes: 18 additions & 11 deletions src/pages/groupComparison/GroupComparisonPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import styles from './styles.module.scss';
import { OverlapStrategy } from '../../shared/lib/comparison/ComparisonStore';
import { buildCBioPortalPageUrl } from 'shared/api/urls';
import MethylationEnrichments from './MethylationEnrichments';
import GenericAssayEnrichments from './GenericAssayEnrichments';
import _ from 'lodash';
import AlterationEnrichments from './AlterationEnrichments';
import AlterationEnrichmentTypeSelector from '../../shared/lib/comparison/AlterationEnrichmentTypeSelector';
Expand All @@ -46,12 +45,13 @@ import {
buildCustomTabs,
prepareCustomTabConfigurations,
} from 'shared/lib/customTabs/customTabHelpers';
import { getSortedGenericAssayTabSpecs } from 'shared/lib/GenericAssayUtils/GenericAssayCommonUtils';
import { getSortedGenericAssayAllTabSpecs } from 'shared/lib/GenericAssayUtils/GenericAssayCommonUtils';
import { HelpWidget } from 'shared/components/HelpWidget/HelpWidget';
import GroupComparisonPathwayMapper from './pathwayMapper/GroupComparisonPathwayMapper';
import GroupComparisonMutationsTab from './GroupComparisonMutationsTab';
import GroupComparisonPathwayMapperUserSelectionStore from './pathwayMapper/GroupComparisonPathwayMapperUserSelectionStore';
import { Tour } from 'tours';
import GenericAssayEnrichmentCollections from './GenericAssayEnrichmentCollections';

export interface IGroupComparisonPageProps {
routing: any;
Expand Down Expand Up @@ -135,6 +135,8 @@ export default class GroupComparisonPage extends React.Component<
this.store.methylationEnrichmentProfiles,
this.store.survivalClinicalDataExists,
this.store.genericAssayEnrichmentProfilesGroupedByGenericAssayType,
this.store
.genericAssayBinaryEnrichmentProfilesGroupedByGenericAssayType,
this.store.alterationsEnrichmentData,
this.store.alterationsEnrichmentAnalysisGroups,
this.store.genesSortedByMutationFrequency,
Expand Down Expand Up @@ -313,34 +315,39 @@ export default class GroupComparisonPage extends React.Component<
<MethylationEnrichments store={this.store} />
</MSKTab>
)}
{this.store.showGenericAssayTab &&
getSortedGenericAssayTabSpecs(
{(this.store.showGenericAssayCategoricalTab ||
this.store.showGenericAssayBinaryTab ||
this.store.showGenericAssayTab) &&
getSortedGenericAssayAllTabSpecs(
this.store
.genericAssayEnrichmentProfilesGroupedByGenericAssayType
.genericAssayAllEnrichmentProfilesGroupedByGenericAssayType
.result
).map(genericAssayTabSpecs => {
).map(genericAssayAllTabSpecs => {
return (
<MSKTab
id={`${
GroupComparisonTab.GENERIC_ASSAY_PREFIX
}_${genericAssayTabSpecs.genericAssayType.toLowerCase()}`}
linkText={genericAssayTabSpecs.linkText}
}_${genericAssayAllTabSpecs.genericAssayType.toLowerCase()}`}
linkText={genericAssayAllTabSpecs.linkText}
anchorClassName={
this.store
.genericAssayCategoricalTabUnavailable &&
this.store
.genericAssayBinaryTabUnavailable &&
this.store.genericAssayTabUnavailable
? 'greyedOut'
: ''
}
>
<GenericAssayEnrichments
<GenericAssayEnrichmentCollections
store={this.store}
genericAssayType={
genericAssayTabSpecs.genericAssayType
genericAssayAllTabSpecs.genericAssayType
}
/>
</MSKTab>
);
})}

{buildCustomTabs(this.customTabs)}
</MSKTabs>
);
Expand Down
2 changes: 2 additions & 0 deletions src/pages/groupComparison/GroupComparisonTabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export enum GroupComparisonTab {
DNAMETHYLATION = 'dna_methylation',
ALTERATIONS = 'alterations',
GENERIC_ASSAY_PREFIX = 'generic_assay',
GENERIC_ASSAY_BINARY_PREFIX = 'generic_assay_binary',
GENERIC_ASSAY_CATEGORICAL_PREFIX = 'generic_assay_categorical',
MUTATIONS = 'mutations',
PATHWAYS = 'pathways',
}
Expand Down
Loading

0 comments on commit b080149

Please sign in to comment.