@@ -92,6 +92,7 @@ import {
92
92
makeGetOncoKbCnaAnnotationForOncoprint ,
93
93
mapSampleIdToClinicalData ,
94
94
ONCOKB_DEFAULT ,
95
+ fetchOncoKbInfo ,
95
96
} from 'shared/lib/StoreUtils' ;
96
97
import {
97
98
CoverageInformation ,
@@ -186,6 +187,7 @@ import {
186
187
FGA_VS_MUTATION_COUNT_KEY ,
187
188
getChartMetaDataType ,
188
189
getDefaultPriorityByUniqueKey ,
190
+ getFilteredMolecularProfilesByAlterationType ,
189
191
getFilteredStudiesWithSamples ,
190
192
getPriorityByClinicalAttribute ,
191
193
getUniqueKey ,
@@ -297,7 +299,11 @@ import { ExtendedAlteration } from 'shared/model/ExtendedAlteration';
297
299
import { IQueriedCaseData } from 'shared/model/IQueriedCaseData' ;
298
300
import { GeneticEntity } from 'shared/model/GeneticEntity' ;
299
301
import { IQueriedMergedTrackCaseData } from 'shared/model/IQueriedMergedTrackCaseData' ;
300
- import { ResultViewFusionMapperStore } from 'pages/resultsView/fusion/ResultViewFusionMapperStore' ;
302
+ import { ResultsViewStructuralVariantMapperStore } from 'pages/resultsView/structuralVariant/ResultsViewStructuralVariantMapperStore' ;
303
+ import {
304
+ ONCOKB_DEFAULT_INFO ,
305
+ USE_DEFAULT_PUBLIC_INSTANCE_FOR_ONCOKB ,
306
+ } from 'react-mutation-mapper' ;
301
307
302
308
type Optional < T > =
303
309
| { isApplicable : true ; value : T }
@@ -3373,13 +3379,13 @@ export class ResultsViewPageStore extends AnalysisStore
3373
3379
invoke : async ( ) => {
3374
3380
const svByGene : Record < string , StructuralVariant [ ] > = { } ;
3375
3381
this . structuralVariants . result ! . forEach ( sv => {
3376
- if ( sv . site1HugoSymbol ?. length ) {
3382
+ if ( sv . site1HugoSymbol ) {
3377
3383
svByGene [ sv . site1HugoSymbol ] =
3378
3384
svByGene [ sv . site1HugoSymbol ] || [ ] ;
3379
3385
svByGene [ sv . site1HugoSymbol ] . push ( sv ) ;
3380
3386
}
3381
3387
3382
- if ( sv . site2HugoSymbol ?. length ) {
3388
+ if ( sv . site2HugoSymbol ) {
3383
3389
svByGene [ sv . site2HugoSymbol ] =
3384
3390
svByGene [ sv . site2HugoSymbol ] || [ ] ;
3385
3391
svByGene [ sv . site2HugoSymbol ] . push ( sv ) ;
@@ -5006,8 +5012,8 @@ export class ResultsViewPageStore extends AnalysisStore
5006
5012
} ,
5007
5013
} ) ;
5008
5014
5009
- readonly fusionMapperStores = remoteData < {
5010
- [ hugoGeneSymbol : string ] : ResultViewFusionMapperStore ;
5015
+ readonly structuralVariantMapperStores = remoteData < {
5016
+ [ hugoGeneSymbol : string ] : ResultsViewStructuralVariantMapperStore ;
5011
5017
} > (
5012
5018
{
5013
5019
await : ( ) => [
@@ -5023,20 +5029,23 @@ export class ResultsViewPageStore extends AnalysisStore
5023
5029
this . genes . result . reduce (
5024
5030
(
5025
5031
map : {
5026
- [ hugoGeneSymbol : string ] : ResultViewFusionMapperStore ;
5032
+ [ hugoGeneSymbol : string ] : ResultsViewStructuralVariantMapperStore ;
5027
5033
} ,
5028
5034
gene : Gene
5029
5035
) => {
5030
5036
map [
5031
5037
gene . hugoGeneSymbol
5032
- ] = new ResultViewFusionMapperStore (
5038
+ ] = new ResultsViewStructuralVariantMapperStore (
5033
5039
gene ,
5034
5040
this . studyIdToStudy ,
5035
5041
this . molecularProfileIdToMolecularProfile ,
5036
- this . samples ,
5037
5042
this . structuralVariantsByGene . result ! [
5038
5043
gene . hugoGeneSymbol
5039
- ] || [ ]
5044
+ ] || [ ] ,
5045
+ this . uniqueSampleKeyToTumorType . result ! ,
5046
+ this . structuralVariantOncoKbData ,
5047
+ this . oncoKbCancerGenes ,
5048
+ this . usingPublicOncoKbInstance
5040
5049
) ;
5041
5050
return map ;
5042
5051
} ,
@@ -5764,4 +5773,87 @@ export class ResultsViewPageStore extends AnalysisStore
5764
5773
? ( m : AnnotatedMutation ) => m . putativeDriver
5765
5774
: undefined ;
5766
5775
}
5776
+
5777
+ readonly structuralVariantProfile = remoteData ( {
5778
+ await : ( ) => [ this . studyToMolecularProfiles ] ,
5779
+ invoke : async ( ) => {
5780
+ const structuralVariantProfiles = getFilteredMolecularProfilesByAlterationType (
5781
+ this . studyToMolecularProfiles . result ! ,
5782
+ AlterationTypeConstants . STRUCTURAL_VARIANT ,
5783
+ [ DataTypeConstants . FUSION , DataTypeConstants . SV ]
5784
+ ) ;
5785
+ if ( structuralVariantProfiles . length > 0 ) {
5786
+ return structuralVariantProfiles [ 0 ] ;
5787
+ }
5788
+ return undefined ;
5789
+ } ,
5790
+ } ) ;
5791
+
5792
+ readonly structuralVariantData = remoteData ( {
5793
+ await : ( ) => [ this . samples , this . structuralVariantProfile ] ,
5794
+ invoke : async ( ) => {
5795
+ if ( this . structuralVariantProfile . result ) {
5796
+ const structuralVariantFilter = {
5797
+ sampleMolecularIdentifiers : this . sampleIds . map ( sampleId => {
5798
+ return {
5799
+ molecularProfileId : this . structuralVariantProfile
5800
+ . result ! . molecularProfileId ,
5801
+ sampleId,
5802
+ } ;
5803
+ } ) ,
5804
+ } as StructuralVariantFilter ;
5805
+
5806
+ return internalClient . fetchStructuralVariantsUsingPOST ( {
5807
+ structuralVariantFilter,
5808
+ } ) ;
5809
+ }
5810
+ return [ ] ;
5811
+ } ,
5812
+ default : [ ] ,
5813
+ } ) ;
5814
+
5815
+ readonly structuralVariantOncoKbData = remoteData < IOncoKbData > (
5816
+ {
5817
+ await : ( ) => [
5818
+ this . oncoKbAnnotatedGenes ,
5819
+ this . structuralVariantData ,
5820
+ this . clinicalDataForSamples ,
5821
+ this . studies ,
5822
+ ] ,
5823
+ invoke : async ( ) => {
5824
+ if ( getServerConfig ( ) . show_oncokb ) {
5825
+ return fetchStructuralVariantOncoKbData (
5826
+ this . uniqueSampleKeyToTumorType . result ! ,
5827
+ this . oncoKbAnnotatedGenes . result || { } ,
5828
+ this . structuralVariantData
5829
+ ) ;
5830
+ } else {
5831
+ return ONCOKB_DEFAULT ;
5832
+ }
5833
+ } ,
5834
+ onError : ( err : Error ) => {
5835
+ // fail silently, leave the error handling responsibility to the data consumer
5836
+ } ,
5837
+ } ,
5838
+ ONCOKB_DEFAULT
5839
+ ) ;
5840
+
5841
+ readonly oncoKbInfo = remoteData (
5842
+ {
5843
+ invoke : ( ) => {
5844
+ if ( getServerConfig ( ) . show_oncokb ) {
5845
+ return fetchOncoKbInfo ( ) ;
5846
+ } else {
5847
+ return Promise . resolve ( ONCOKB_DEFAULT_INFO ) ;
5848
+ }
5849
+ } ,
5850
+ } ,
5851
+ ONCOKB_DEFAULT_INFO
5852
+ ) ;
5853
+
5854
+ @computed get usingPublicOncoKbInstance ( ) {
5855
+ return this . oncoKbInfo . result
5856
+ ? this . oncoKbInfo . result . publicInstance
5857
+ : USE_DEFAULT_PUBLIC_INSTANCE_FOR_ONCOKB ;
5858
+ }
5767
5859
}
0 commit comments