@@ -213,8 +213,9 @@ import { SiteError } from 'shared/model/appMisc';
213213import { AnnotatedExtendedAlteration } from 'shared/model/AnnotatedExtendedAlteration' ;
214214import { CustomDriverNumericGeneMolecularData } from 'shared/model/CustomDriverNumericGeneMolecularData' ;
215215import {
216+ ExtendedClinicalAttribute ,
216217 fetchPatients ,
217- isRNASeqProfile ,
218+ getExtendsClinicalAttributesFromCustomData ,
218219 parseGenericAssayGroups ,
219220} from 'pages/resultsView/ResultsViewPageStoreUtils' ;
220221import { getSuffixOfMolecularProfile } from 'shared/lib/molecularProfileUtils' ;
@@ -231,6 +232,9 @@ import ClinicalDataCache from 'shared/cache/ClinicalDataCache';
231232import GenesetMolecularDataCache from 'shared/cache/GenesetMolecularDataCache' ;
232233import GenericAssayMolecularDataCache from 'shared/cache/GenericAssayMolecularDataCache' ;
233234import { CohortOptions } from 'shared/components/plots/PlotsTab' ;
235+ import GenesetCache from 'shared/cache/GenesetCache' ;
236+ import ComplexKeyMap from 'shared/lib/complexKeyDataStructures/ComplexKeyMap' ;
237+ import sessionServiceClient from '../../../shared/api/sessionServiceInstance' ;
234238
235239type PageMode = 'patient' | 'sample' ;
236240type ResourceId = string ;
@@ -739,20 +743,28 @@ export class PatientViewPageStore {
739743 onError : ( ) => { } ,
740744 } ) ;
741745
746+ readonly genesetCache = new GenesetCache ( ) ;
747+
748+ @computed get genesetIds ( ) {
749+ return this . urlWrapper . query . geneset_list &&
750+ this . urlWrapper . query . geneset_list . trim ( ) . length
751+ ? this . urlWrapper . query . geneset_list . trim ( ) . split ( / \s + / )
752+ : [ ] ;
753+ }
754+
742755 readonly genesets = remoteData < Geneset [ ] > ( {
743756 invoke : ( ) => {
744- // if (this.genesetIds && this.genesetIds.length > 0) {
745- // return this.internalClient.fetchGenesetsUsingPOST({
746- // genesetIds: this.genesetIds.slice(),
747- // });
748- // } else {
749- // return Promise.resolve([]);
750- // }
751- return Promise . resolve ( [ ] ) ;
757+ if ( this . genesetIds && this . genesetIds . length > 0 ) {
758+ return this . internalClient . fetchGenesetsUsingPOST ( {
759+ genesetIds : this . genesetIds . slice ( ) ,
760+ } ) ;
761+ } else {
762+ return Promise . resolve ( [ ] ) ;
763+ }
764+ } ,
765+ onResult : ( genesets : Geneset [ ] ) => {
766+ this . genesetCache . addData ( genesets ) ;
752767 } ,
753- // onResult: (genesets: Geneset[]) => {
754- // this.genesetCache.addData(genesets);
755- // },
756768 } ) ;
757769
758770 readonly genericAssayEntitiesGroupedByProfileId = remoteData < {
@@ -780,30 +792,36 @@ export class PatientViewPageStore {
780792 default : [ ] ,
781793 } ) ;
782794
795+ readonly sampleMap = remoteData ( {
796+ await : ( ) => [ this . selectedCohortSamples ] ,
797+ invoke : ( ) => {
798+ return Promise . resolve (
799+ ComplexKeyMap . from ( this . selectedCohortSamples . result ! , s => ( {
800+ studyId : s . studyId ,
801+ sampleId : s . sampleId ,
802+ } ) )
803+ ) ;
804+ } ,
805+ } ) ;
806+
783807 readonly customAttributes = remoteData ( {
784- // await: () => [this.sampleMap],
808+ await : ( ) => [ this . sampleMap ] ,
785809 invoke : async ( ) => {
786- // let ret: ExtendedClinicalAttribute[] = [];
787- // if (this.appStore.isLoggedIn) {
788- // try {
789- // const unknownQueriedIdsMap = stringListToSet(
790- // this.unknownQueriedIds.result
791- // );
792- // //Add custom data from user profile
793- // const customChartSessions = await sessionServiceClient.getCustomDataForStudies(
794- // this.studyIds.filter(
795- // studyId => !unknownQueriedIdsMap[studyId]
796- // )
797- // );
798-
799- // ret = getExtendsClinicalAttributesFromCustomData(
800- // customChartSessions,
801- // this.sampleMap.result!
802- // );
803- // } catch (e) {}
804- // }
805- // return ret;
806- return Promise . resolve ( [ ] ) ;
810+ let ret : ExtendedClinicalAttribute [ ] = [ ] ;
811+ if ( this . appStore . isLoggedIn ) {
812+ try {
813+ //Add custom data from user profile
814+ const customChartSessions = await sessionServiceClient . getCustomDataForStudies (
815+ [ this . studyId ]
816+ ) ;
817+
818+ ret = getExtendsClinicalAttributesFromCustomData (
819+ customChartSessions ,
820+ this . sampleMap . result !
821+ ) ;
822+ } catch ( e ) { }
823+ }
824+ return ret ;
807825 } ,
808826 } ) ;
809827
0 commit comments