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

Add discrete_long cna data type #4423

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
6 changes: 3 additions & 3 deletions src/pages/resultsView/ResultsViewPageStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ import {
AlterationTypeConstants,
CLINICAL_ATTRIBUTE_FIELD_ENUM,
CLINICAL_ATTRIBUTE_ID_ENUM,
CnaDataTypes,
DataTypeConstants,
GENETIC_PROFILE_FIELD_ENUM,
GENOME_NEXUS_ARG_FIELD_ENUM,
Expand Down Expand Up @@ -2694,7 +2695,7 @@ export class ResultsViewPageStore
profile =>
profile.molecularAlterationType ===
AlterationTypeConstants.COPY_NUMBER_ALTERATION &&
profile.datatype === DataTypeConstants.DISCRETE
CnaDataTypes.includes(profile.datatype)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this? Or maybe just keep
profile.molecularAlterationType === AlterationTypeConstants.COPY_NUMBER_ALTERATION
is enough?

);
},
onError: error => {},
Expand Down Expand Up @@ -4472,8 +4473,7 @@ export class ResultsViewPageStore
for (const molecularProfile of this.molecularProfilesInStudies
.result) {
if (
molecularProfile.datatype ===
DataTypeConstants.DISCRETE &&
CnaDataTypes.includes(molecularProfile.datatype) &&
molecularProfile.molecularAlterationType ===
AlterationTypeConstants.COPY_NUMBER_ALTERATION
) {
Expand Down
8 changes: 6 additions & 2 deletions src/pages/resultsView/enrichments/EnrichmentsUtil.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ import {
} from 'shared/model/EnrichmentRow';
import { formatLogOddsRatio, roundLogRatio } from 'shared/lib/FormatUtils';
import _ from 'lodash';
import { AlterationTypeConstants, DataTypeConstants } from 'shared/constants';
import {
AlterationTypeConstants,
CnaDataTypes,
DataTypeConstants,
} from 'shared/constants';
import { filterAndSortProfiles } from '../coExpression/CoExpressionTabUtils';
import { IMiniFrequencyScatterChartData } from './MiniFrequencyScatterChart';
import {
Expand Down Expand Up @@ -510,7 +514,7 @@ export function pickCopyNumberEnrichmentProfiles(profiles: MolecularProfile[]) {
(profile: MolecularProfile) =>
profile.molecularAlterationType ===
AlterationTypeConstants.COPY_NUMBER_ALTERATION &&
profile.datatype === 'DISCRETE'
CnaDataTypes.includes(profile.datatype)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

);
}

Expand Down
10 changes: 7 additions & 3 deletions src/pages/resultsView/plots/PlotsTabUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ import {
AnnotatedNumericGeneMolecularData,
CustomDriverNumericGeneMolecularData,
} from '../ResultsViewPageStore';
import { AlterationTypeConstants, DataTypeConstants } from 'shared/constants';
import {
AlterationTypeConstants,
CnaDataTypes,
DataTypeConstants,
} from 'shared/constants';

import numeral from 'numeral';
import GenesetMolecularDataCache from '../../../shared/cache/GenesetMolecularDataCache';
Expand Down Expand Up @@ -131,7 +135,7 @@ export function sortMolecularProfilesForDisplay(profiles: MolecularProfile[]) {
let sortBy: (p: MolecularProfile) => any;
switch (type) {
case AlterationTypeConstants.COPY_NUMBER_ALTERATION:
sortBy = p => (p.datatype === 'DISCRETE' ? 0 : 1);
sortBy = p => (CnaDataTypes.includes(p.datatype) ? 0 : 1);
break;
default:
sortBy = p => p.name;
Expand Down Expand Up @@ -1077,7 +1081,7 @@ function makeAxisDataPromise_Molecular(
profile =>
profile.molecularAlterationType ===
AlterationTypeConstants.COPY_NUMBER_ALTERATION &&
profile.datatype === 'DISCRETE'
CnaDataTypes.includes(profile.datatype)
);

const data: NumericGeneMolecularData[] = _.flatMap(
Expand Down
8 changes: 6 additions & 2 deletions src/pages/studyView/StudyViewPageStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,11 @@ import {
} from '../groupComparison/comparisonGroupManager/ComparisonGroupManagerUtils';
import { IStudyViewScatterPlotData } from './charts/scatterPlot/StudyViewScatterPlotUtils';
import { StudyViewPageTabKeyEnum } from 'pages/studyView/StudyViewPageTabs';
import { AlterationTypeConstants, DataTypeConstants } from 'shared/constants';
import {
AlterationTypeConstants,
CnaDataTypes,
DataTypeConstants,
} from 'shared/constants';
import {
createSurvivalAttributeIdsDict,
generateStudyViewSurvivalPlotTitle,
Expand Down Expand Up @@ -4829,7 +4833,7 @@ export class StudyViewPageStore
getFilteredMolecularProfilesByAlterationType(
this.studyIdToMolecularProfiles.result,
AlterationTypeConstants.COPY_NUMBER_ALTERATION,
[DataTypeConstants.DISCRETE]
CnaDataTypes
)
);
},
Expand Down
8 changes: 6 additions & 2 deletions src/pages/studyView/StudyViewUtils.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ import {
import { remoteData, toPromise } from 'cbioportal-frontend-commons';
import { autorun, observable, runInAction } from 'mobx';

import { AlterationTypeConstants, DataTypeConstants } from 'shared/constants';
import {
AlterationTypeConstants,
CnaDataTypes,
DataTypeConstants,
} from 'shared/constants';

describe('StudyViewUtils', () => {
const emptyStudyViewFilter: StudyViewFilter = {
Expand Down Expand Up @@ -4903,7 +4907,7 @@ describe('StudyViewUtils', () => {
getFilteredMolecularProfilesByAlterationType(
studyIdToMolecularProfiles,
AlterationTypeConstants.COPY_NUMBER_ALTERATION,
[DataTypeConstants.DISCRETE]
CnaDataTypes
),
result
);
Expand Down
6 changes: 6 additions & 0 deletions src/shared/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export const AlterationTypeConstants = {

export const DataTypeConstants = {
DISCRETE: 'DISCRETE',
DISCRETE_LONG: 'DISCRETE_LONG',
CONTINUOUS: 'CONTINUOUS',
ZSCORE: 'Z-SCORE',
MAF: 'MAF',
Expand All @@ -127,3 +128,8 @@ export const DataTypeConstants = {
BINARY: 'BINARY',
CATEGORICAL: 'CATEGORICAL',
};

export const CnaDataTypes = [
DataTypeConstants.DISCRETE,
DataTypeConstants.DISCRETE_LONG,
];
3 changes: 2 additions & 1 deletion src/shared/lib/StoreUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import { IGisticData } from 'shared/model/Gistic';
import { IMutSigData } from 'shared/model/MutSig';
import {
CLINICAL_ATTRIBUTE_ID_ENUM,
CnaDataTypes,
GENOME_NEXUS_ARG_FIELD_ENUM,
} from 'shared/constants';
import {
Expand Down Expand Up @@ -1028,7 +1029,7 @@ export function findDiscreteMolecularProfile(
}

return molecularProfilesInStudy.result.find((p: MolecularProfile) => {
return p.datatype === 'DISCRETE';
return CnaDataTypes.includes(p.datatype);
});
}

Expand Down
11 changes: 8 additions & 3 deletions src/shared/lib/comparison/ComparisonStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ import {
} from 'shared/lib/StoreUtils';
import MobxPromise from 'mobxpromise';
import { ResultsViewPageStore } from '../../../pages/resultsView/ResultsViewPageStore';
import { AlterationTypeConstants, DataTypeConstants } from 'shared/constants';
import {
AlterationTypeConstants,
CnaDataTypes,
DataTypeConstants,
} from 'shared/constants';
import { getSurvivalStatusBoolean } from 'pages/resultsView/survival/SurvivalUtil';
import { onMobxPromise } from 'cbioportal-frontend-commons';
import {
Expand Down Expand Up @@ -2211,8 +2215,9 @@ export default abstract class ComparisonStore
// discrete CNA's
(molecularProfile.molecularAlterationType ===
AlterationTypeConstants.COPY_NUMBER_ALTERATION &&
molecularProfile.datatype ===
DataTypeConstants.DISCRETE) ||
CnaDataTypes.includes(
molecularProfile.datatype
)) ||
// mutations
molecularProfile.molecularAlterationType ===
AlterationTypeConstants.MUTATION_EXTENDED ||
Expand Down