Skip to content

Commit

Permalink
Update Mutational Signature plot render based on condition count Data
Browse files Browse the repository at this point in the history
Show table when only contribution data is present
Merged with the hackathon improvements

fix merge error

update url and description
  • Loading branch information
TJMKuijpers committed Jun 28, 2024
1 parent fa4a480 commit 9003235
Show file tree
Hide file tree
Showing 9 changed files with 153 additions and 163 deletions.
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 @@ -99,6 +99,7 @@ describe('ClinicalInformationMutationalSignatureTable', () => {
confidence: 0.8,
},
},
description: 'test signature 1',
url: 'COSMIC/FakeMutationalSignature1',
},
{
Expand All @@ -113,6 +114,7 @@ describe('ClinicalInformationMutationalSignatureTable', () => {
confidence: 0.01,
},
},
description: 'test 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 9003235

Please sign in to comment.