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

Fix issue with sv tab sending large list of mutations for annotation #4885

Merged
merged 1 commit into from
Apr 5, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -154,17 +154,14 @@ export default class AnnotationColumnFormatter {
uniqueSampleKeyToTumorType?: { [sampleId: string]: string },
studyIdToStudy?: { [studyId: string]: CancerStudy }
): IndicatorQueryResp | undefined {
if (
uniqueSampleKeyToTumorType === null ||
oncoKbData.indicatorMap === null
) {
if (!uniqueSampleKeyToTumorType || !oncoKbData.indicatorMap) {
return undefined;
}

const id = generateQueryStructuralVariantId(
structuralVariantData[0].site1EntrezGeneId,
structuralVariantData[0].site2EntrezGeneId,
uniqueSampleKeyToTumorType![
uniqueSampleKeyToTumorType[
structuralVariantData[0].uniqueSampleKey
],
deriveStructuralVariantType(structuralVariantData[0])
Expand Down
57 changes: 38 additions & 19 deletions src/pages/resultsView/ResultsViewPageStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3440,25 +3440,25 @@ export class ResultsViewPageStore extends AnalysisStore
},
});

readonly structuralVariantsByGene = remoteData({
readonly structuralVariantsByEntrezGeneId = remoteData({
await: () => [this.structuralVariants],
invoke: async () => {
const svByGene: Record<string, StructuralVariant[]> = {};
const svByGene: Record<number, StructuralVariant[]> = {};
this.structuralVariants.result!.forEach(sv => {
if (sv.site1HugoSymbol) {
svByGene[sv.site1HugoSymbol] =
svByGene[sv.site1HugoSymbol] || [];
svByGene[sv.site1HugoSymbol].push(sv);
if (sv.site1EntrezGeneId) {
svByGene[sv.site1EntrezGeneId] =
svByGene[sv.site1EntrezGeneId] || [];
svByGene[sv.site1EntrezGeneId].push(sv);
}

if (sv.site2HugoSymbol) {
if (sv.site2EntrezGeneId) {
if (
!sv.site1HugoSymbol ||
sv.site2HugoSymbol !== sv.site1HugoSymbol
!sv.site1EntrezGeneId ||
sv.site2EntrezGeneId !== sv.site1EntrezGeneId
) {
svByGene[sv.site2HugoSymbol] =
svByGene[sv.site2HugoSymbol] || [];
svByGene[sv.site2HugoSymbol].push(sv);
svByGene[sv.site2EntrezGeneId] =
svByGene[sv.site2EntrezGeneId] || [];
svByGene[sv.site2EntrezGeneId].push(sv);
}
}
});
Expand Down Expand Up @@ -5021,13 +5021,17 @@ export class ResultsViewPageStore extends AnalysisStore
{
await: () => [
this.genes,
this.structuralVariantsByGene,
this.structuralVariantsByEntrezGeneId,
this.studyIdToStudy,
this.molecularProfileIdToMolecularProfile,
this.samples,
this.uniqueSampleKeyToTumorType,
],
invoke: () => {
if (this.genes.result && this.structuralVariantsByGene.result) {
if (
this.genes.result &&
this.structuralVariantsByEntrezGeneId.result
) {
return Promise.resolve(
this.genes.result.reduce(
(
Expand All @@ -5042,9 +5046,8 @@ export class ResultsViewPageStore extends AnalysisStore
gene,
this.studyIdToStudy,
this.molecularProfileIdToMolecularProfile,
this.structuralVariantsByGene.result![
gene.hugoGeneSymbol
] || [],
this.structuralVariantsByEntrezGeneId
.result![gene.entrezGeneId] || [],
this.uniqueSampleKeyToTumorType.result!,
this.structuralVariantOncoKbData,
this.oncoKbCancerGenes,
Expand Down Expand Up @@ -5840,10 +5843,25 @@ export class ResultsViewPageStore extends AnalysisStore
default: [],
});

readonly oncoKbAnnotatedGenesForStructuralVariants = remoteData<{
[entrezGeneId: number]: boolean;
}>({
await: () => [
this.oncoKbAnnotatedGenes,
this.structuralVariantsByEntrezGeneId,
],
invoke: async () => {
const entrezGeneIds = Object.keys(
this.structuralVariantsByEntrezGeneId.result!
).map(Number);
return _.pick(this.oncoKbAnnotatedGenes.result, entrezGeneIds);
},
});

readonly structuralVariantOncoKbData = remoteData<IOncoKbData>(
{
await: () => [
this.oncoKbAnnotatedGenes,
this.oncoKbAnnotatedGenesForStructuralVariants,
this.structuralVariantData,
this.clinicalDataForSamples,
this.studies,
Expand All @@ -5853,7 +5871,8 @@ export class ResultsViewPageStore extends AnalysisStore
if (getServerConfig().show_oncokb) {
return fetchStructuralVariantOncoKbData(
this.uniqueSampleKeyToTumorType.result!,
this.oncoKbAnnotatedGenes.result || {},
this.oncoKbAnnotatedGenesForStructuralVariants.result ||
{},
this.structuralVariantData
);
} else {
Expand Down
Loading