Skip to content

Commit

Permalink
Fix mutational sig bug when no count data is present
Browse files Browse the repository at this point in the history
Fix cBioPortal/cbioportal#10538. This is a fix for studies when only mutational signatures contribution and p-values are loaded (and no mutational signatures count data)
  • Loading branch information
TJMKuijpers authored Jul 3, 2024
1 parent 126167e commit 0ab0f9b
Show file tree
Hide file tree
Showing 19 changed files with 155 additions and 165 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.
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.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
101 changes: 52 additions & 49 deletions src/pages/patientView/PatientViewPageTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -645,58 +645,61 @@ export function tabs(
</MSKTab>
);

tabs.push(
<MSKTab
key={8}
id="mutationalSignatures"
linkText="Mutational Signatures"
hide={
pageComponent.patientViewPageStore
.mutationalSignatureMolecularProfiles.isPending ||
pageComponent.patientViewPageStore
.initialMutationalSignatureVersion.isPending ||
_.isEmpty(
pageComponent.patientViewPageStore
.mutationalSignatureDataGroupByVersion.result
)
}
>
<MutationalSignaturesContainer
data={
pageComponent.patientViewPageStore
.mutationalSignatureDataGroupByVersion.result
}
profiles={
pageComponent.patientViewPageStore
.mutationalSignatureMolecularProfiles.result
}
onVersionChange={
pageComponent.onMutationalSignatureVersionChange
}
version={
pageComponent.patientViewPageStore
.selectedMutationalSignatureVersion
}
dataCount={
pageComponent.patientViewPageStore
.mutationalSignatureCountDataGroupedByVersion.result
}
sample={
pageComponent.patientViewPageStore
.selectedSampleMutationalSignatureData
}
samples={
pageComponent.patientViewPageStore.hasMutationalSignatureData.result &&
pageComponent.patientViewPageStore.initialMutationalSignatureVersion
.isComplete &&
tabs.push(
<MSKTab
key={8}
id="mutationalSignatures"
linkText="Mutational Signatures"
hide={
pageComponent.patientViewPageStore
.samplesWithCountDataAvailable
}
samplesNotProfiled={
.mutationalSignatureMolecularProfiles.isPending ||
pageComponent.patientViewPageStore
.samplesNotProfiledForMutationalSignatures
.initialMutationalSignatureVersion.isPending ||
_.isEmpty(
pageComponent.patientViewPageStore
.mutationalSignatureDataGroupByVersion.result
)
}
onSampleChange={pageComponent.onSampleIdChange}
/>
</MSKTab>
);
>
<MutationalSignaturesContainer
data={
pageComponent.patientViewPageStore
.mutationalSignatureDataGroupByVersion.result
}
profiles={
pageComponent.patientViewPageStore
.mutationalSignatureMolecularProfiles.result
}
onVersionChange={
pageComponent.onMutationalSignatureVersionChange
}
version={
pageComponent.patientViewPageStore
.selectedMutationalSignatureVersion
}
dataCount={
pageComponent.patientViewPageStore
.mutationalSignatureCountDataGroupedByVersion.result
}
sample={
pageComponent.patientViewPageStore
.selectedSampleMutationalSignatureData
}
samples={
pageComponent.patientViewPageStore
.samplesWithDataAvailable
}
samplesNotProfiled={
pageComponent.patientViewPageStore
.samplesNotProfiledForMutationalSignatures
}
onSampleChange={pageComponent.onSampleIdChange}
/>
</MSKTab>
);

pageComponent.resourceTabs.component &&
/* @ts-ignore */
Expand Down
5 changes: 1 addition & 4 deletions src/pages/patientView/PatientViewPageUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ import {
IMutationalSignatureMeta,
IMutationalCounts,
} from 'shared/model/MutationalSignature';
import {
getGenericAssayMetaPropertyOrDefault,
getGenericAssayCategoryFromName,
} from 'shared/lib/GenericAssayUtils/GenericAssayCommonUtils';
import { getGenericAssayMetaPropertyOrDefault } from 'shared/lib/GenericAssayUtils/GenericAssayCommonUtils';
import {
MutationalSignatureLabelMap,
MutationalSignatureCount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const sampleMutationalSignatureMeta = [
{
mutationalSignatureId: 'firstMutationalSignature',
name: 'Mutational Signature 1',
description: 'Mutational Signature 1',
description: 'Description Signature 1',
url: 'COSMIC/FakeMutationalSignature1',
category: 'category 1',
confidenceStatement:
Expand All @@ -17,7 +17,7 @@ const sampleMutationalSignatureMeta = [
{
mutationalSignatureId: 'secondMutationalSignature',
name: 'Mutational Signature 2',
description: 'Mutational Signature 2',
description: 'Description Signature 2',
url: 'COSMIC/FakeMutationalSignature2',
category: 'category 2',
confidenceStatement:
Expand Down Expand Up @@ -99,6 +99,7 @@ describe('ClinicalInformationMutationalSignatureTable', () => {
confidence: 0.8,
},
},
description: 'Description Signature 1',
url: 'COSMIC/FakeMutationalSignature1',
},
{
Expand All @@ -113,6 +114,7 @@ describe('ClinicalInformationMutationalSignatureTable', () => {
confidence: 0.01,
},
},
description: 'Description Signature 2',
url: 'COSMIC/FakeMutationalSignature2',
},
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export interface IMutationalSignatureRow {
confidence: number;
};
};
description: string;
url: string;
}

Expand Down Expand Up @@ -74,15 +75,29 @@ export default class ClinicalInformationMutationalSignatureTable extends React.C
<b>Signature: </b>
{this.props.signature}
</h5>
<p style={{ fontSize: '12px' }}>
<b>Description: </b>
{this.props.description}
</p>
<p style={{ fontSize: '12px' }}>
<a href={this.props.url} target="_blank">
External link to signature (opens new tab)
</a>
</p>
{this.props.description != '' && (
<p style={{ fontSize: '12px' }}>
<b>Description: </b>
{this.props.description}
</p>
)}
{this.props.description == '' && (
<p style={{ fontSize: '12px' }}>
No description annnotated in data
</p>
)}
{this.props.url != '' && (
<p style={{ fontSize: '12px' }}>
<a href={this.props.url} target="_blank">
External link to signature (opens new tab)
</a>
</p>
)}
{this.props.url == '' && (
<p style={{ fontSize: '12px' }}>
No url annnotated in data
</p>
)}
</div>
</div>
);
Expand Down
17 changes: 11 additions & 6 deletions src/pages/patientView/clinicalInformation/PatientViewPageStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -902,12 +902,17 @@ export class PatientViewPageStore {
.filter(item => item.sampleId === sampleToFilter)
.map(item => item.uniqueSampleKey);
}
@computed get samplesWithCountDataAvailable(): string[] {

@computed get samplesWithDataAvailable(): string[] {
return this.fetchAllMutationalSignatureData.result
.filter(data =>
data.molecularProfileId.includes(
MutationalSignatureStableIdKeyWord.MutationalSignatureCountKeyWord
)
.filter(
data =>
data.molecularProfileId.includes(
MutationalSignatureStableIdKeyWord.MutationalSignatureCountKeyWord
) ||
data.molecularProfileId.includes(
MutationalSignatureStableIdKeyWord.MutationalSignatureContributionKeyWord
)
)
.map(sample => sample.sampleId)
.filter((value, index, self) => self.indexOf(value) === index);
Expand All @@ -918,7 +923,7 @@ export class PatientViewPageStore {
sample => sample.sampleId
);
return allSamples.filter(
element => !this.samplesWithCountDataAvailable.includes(element)
element => !this.samplesWithDataAvailable.includes(element)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -547,17 +547,21 @@ export function prepareMutationalSignatureDataForTable(
.map((mutationalSignatureSampleData, name) => ({
name,
samples: mutationalSignatureSampleData,
description: mutationalSignatureSampleData[0].meta.description,
url: mutationalSignatureSampleData[0].meta.url,
}))
.value();
for (const mutationalSignature of sampleInvertedDataByMutationalSignature) {
let mutationalSignatureRowForTable: IMutationalSignatureRow = {
name: '',
sampleValues: {},
description: '',
url: '',
};

mutationalSignatureRowForTable.name = mutationalSignature.name;
mutationalSignatureRowForTable.description =
mutationalSignature.description;
mutationalSignatureRowForTable.url = mutationalSignature.url;
if (
Object.keys(mutationalSignature.samples).length ===
Expand Down
Loading

0 comments on commit 0ab0f9b

Please sign in to comment.