Skip to content

Commit

Permalink
Merge pull request #1030 from zhx828/fix-cancer-type-wording
Browse files Browse the repository at this point in the history
Use cancerType instead of tumorType in the actionable genes page URL
  • Loading branch information
zhx828 authored Oct 16, 2023
2 parents 23a8512 + a48027c commit 99bb047
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export default class ActionableGenesPage extends React.Component<
ActionableGenesPageProps,
any
> {
@observable relevantTumorTypeSearchKeyword = '';
@observable relevantCancerTypeSearchKeyword = '';
@observable drugSearchKeyword = '';
@observable geneSearchKeyword = '';
@observable refGenome = DEFAULT_REFERENCE_GENOME;
Expand Down Expand Up @@ -120,28 +120,6 @@ export default class ActionableGenesPage extends React.Component<
default: [],
});

readonly allTumorTypes = remoteData<string[]>({
await: () => [this.allMainTypes, this.evidencesByLevel],
invoke: async () => {
let allTumorTypes: string[] = _.uniq(
this.allMainTypes.result
.filter(mainType => !mainType.endsWith('NOS'))
.map(mainType => mainType)
);

this.allTreatments.forEach(treatment => {
allTumorTypes = allTumorTypes.concat(
treatment.cancerTypes.map(cancerType =>
getCancerTypeNameFromOncoTreeType(cancerType)
)
);
});

return Promise.resolve(_.uniq(allTumorTypes));
},
default: [],
});

readonly evidencesByLevel = remoteData<EvidencesByLevel>({
await: () => [],
async invoke() {
Expand Down Expand Up @@ -183,7 +161,10 @@ export default class ActionableGenesPage extends React.Component<
this.geneSearchKeyword = queryStrings.hugoSymbol;
}
if (queryStrings.tumorType) {
this.relevantTumorTypeSearchKeyword = queryStrings.tumorType;
this.relevantCancerTypeSearchKeyword = queryStrings.tumorType;
}
if (queryStrings.cancerType) {
this.relevantCancerTypeSearchKeyword = queryStrings.cancerType;
}
if (queryStrings.drug) {
this.drugSearchKeyword = queryStrings.drug;
Expand Down Expand Up @@ -325,8 +306,8 @@ export default class ActionableGenesPage extends React.Component<
if (this.geneSearchKeyword) {
queryString.hugoSymbol = this.geneSearchKeyword;
}
if (this.relevantTumorTypeSearchKeyword) {
queryString.tumorType = this.relevantTumorTypeSearchKeyword;
if (this.relevantCancerTypeSearchKeyword) {
queryString.cancerType = this.relevantCancerTypeSearchKeyword;
}
if (this.drugSearchKeyword) {
queryString.drug = this.drugSearchKeyword;
Expand Down Expand Up @@ -390,15 +371,15 @@ export default class ActionableGenesPage extends React.Component<
match = false;
}
if (
this.relevantTumorTypeSearchKeyword &&
this.relevantCancerTypeSearchKeyword &&
treatment.relevantCancerTypes.filter(rct => {
if (rct.code) {
return (
rct.code === this.relevantTumorTypeSearchKeyword ||
rct.subtype === this.relevantTumorTypeSearchKeyword
rct.code === this.relevantCancerTypeSearchKeyword ||
rct.subtype === this.relevantCancerTypeSearchKeyword
);
} else {
return rct.mainType === this.relevantTumorTypeSearchKeyword;
return rct.mainType === this.relevantCancerTypeSearchKeyword;
}
}).length === 0
) {
Expand Down Expand Up @@ -429,7 +410,7 @@ export default class ActionableGenesPage extends React.Component<
get secondLayerFilterEnabled() {
return (
!!this.geneSearchKeyword ||
!!this.relevantTumorTypeSearchKeyword ||
!!this.relevantCancerTypeSearchKeyword ||
!!this.drugSearchKeyword
);
}
Expand Down Expand Up @@ -530,10 +511,10 @@ export default class ActionableGenesPage extends React.Component<

@computed
get tumorTypeSelectValue() {
return this.relevantTumorTypeSearchKeyword
return this.relevantCancerTypeSearchKeyword
? {
label: this.relevantTumorTypeSearchKeyword,
value: this.relevantTumorTypeSearchKeyword,
label: this.relevantCancerTypeSearchKeyword,
value: this.relevantCancerTypeSearchKeyword,
}
: null;
}
Expand Down Expand Up @@ -574,7 +555,7 @@ export default class ActionableGenesPage extends React.Component<
@action
clearFilters() {
this.levelSelected = this.initLevelSelected();
this.relevantTumorTypeSearchKeyword = '';
this.relevantCancerTypeSearchKeyword = '';
this.drugSearchKeyword = '';
this.geneSearchKeyword = '';
}
Expand Down Expand Up @@ -938,9 +919,9 @@ export default class ActionableGenesPage extends React.Component<
xs={12}
>
<CancerTypeSelect
tumorType={this.relevantTumorTypeSearchKeyword}
cancerType={this.relevantCancerTypeSearchKeyword}
onChange={(selectedOption: any) =>
(this.relevantTumorTypeSearchKeyword = selectedOption
(this.relevantCancerTypeSearchKeyword = selectedOption
? selectedOption.value
: '')
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export default class AlterationView extends React.Component<
}),
menu: base => ({ ...base, zIndex: 10 }),
}}
tumorType={this.props.tumorType}
cancerType={this.props.tumorType}
onChange={(selectedOption: any) =>
this.updateTumorTypeQuery(selectedOption)
}
Expand Down
22 changes: 11 additions & 11 deletions src/main/webapp/app/shared/dropdown/CancerTypeSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import privateClient from 'app/shared/api/oncokbPrivateClientInstance';
import { remoteData } from 'cbioportal-frontend-commons';

interface ICancerTypeSelect extends SelectProps {
tumorType?: string;
cancerType?: string;
}

@observer
Expand All @@ -26,10 +26,10 @@ export default class CancerTypeSelect extends React.Component<

@computed
get tumorTypeSelectValue() {
if (this.props.tumorType) {
if (this.props.cancerType) {
const matchedSubtype = _.find(
this.allSubtypes,
tumorType => tumorType.code === this.props.tumorType
cancerType => cancerType.code === this.props.cancerType
);
if (matchedSubtype) {
return {
Expand All @@ -38,8 +38,8 @@ export default class CancerTypeSelect extends React.Component<
};
} else {
return {
label: this.props.tumorType,
value: this.props.tumorType,
label: this.props.cancerType,
value: this.props.cancerType,
};
}
} else {
Expand Down Expand Up @@ -78,19 +78,19 @@ export default class CancerTypeSelect extends React.Component<
label: 'Cancer Type',
options: _.uniq(cancerTypesGroup)
.sort()
.map(tumorType => {
.map(cancerType => {
return {
value: tumorType,
label: tumorType,
value: cancerType,
label: cancerType,
};
}),
},
{
label: 'Cancer Type Detailed',
options: _.sortBy(_.uniq(this.allSubtypes), 'name').map(tumorType => {
options: _.sortBy(_.uniq(this.allSubtypes), 'name').map(cancerType => {
return {
value: tumorType.code,
label: `${tumorType.subtype} (${tumorType.code})`,
value: cancerType.code,
label: `${cancerType.subtype} (${cancerType.code})`,
};
}),
},
Expand Down
1 change: 1 addition & 0 deletions src/main/webapp/app/shared/route/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export type ActionableGenesPageHashQueries = {
levels?: string[];
hugoSymbol?: string;
tumorType?: string;
cancerType?: string;
drug?: string;
refGenome?: REFERENCE_GENOME;
};
Expand Down

0 comments on commit 99bb047

Please sign in to comment.