Skip to content

Commit

Permalink
Merge pull request #3147 from leexgh/portal-hg38
Browse files Browse the repository at this point in the history
support grch38 in portal
  • Loading branch information
alisman committed May 5, 2020
2 parents 99b04c9 + 4fa1955 commit 24d19c0
Show file tree
Hide file tree
Showing 19 changed files with 273 additions and 72 deletions.
5 changes: 5 additions & 0 deletions src/pages/patientView/PatientViewPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,11 @@ export default class PatientViewPage extends React.Component<
this.genePanelModal
.isOpen
}
generateGenomeNexusHgvsgUrl={
this
.patientViewPageStore
.generateGenomeNexusHgvsgUrl
}
/>
</div>
)}
Expand Down
54 changes: 49 additions & 5 deletions src/pages/patientView/clinicalInformation/PatientViewPageStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,16 @@ import DiscreteCNACache from 'shared/cache/DiscreteCNACache';
import {
getDarwinUrl,
getDigitalSlideArchiveMetaUrl,
getGenomeNexusHgvsgUrl,
} from '../../../shared/api/urls';
import PubMedCache from 'shared/cache/PubMedCache';
import GenomeNexusCache from 'shared/cache/GenomeNexusCache';
import GenomeNexusMutationAssessorCache from 'shared/cache/GenomeNexusMutationAssessorCache';
import GenomeNexusMyVariantInfoCache from 'shared/cache/GenomeNexusMyVariantInfoCache';
import {
GenomeNexusAPI,
GenomeNexusAPIInternal,
} from 'genome-nexus-ts-api-client';
import {
getMyCancerGenomeData,
ICivicGene,
Expand Down Expand Up @@ -87,6 +92,7 @@ import {
mergeMutationsIncludingUncalled,
noGenePanelUsed,
ONCOKB_DEFAULT,
getGenomeNexusUrl,
} from 'shared/lib/StoreUtils';
import {
fetchCivicGenes,
Expand Down Expand Up @@ -120,6 +126,7 @@ import { AppStore, SiteError } from 'AppStore';
import { getGeneFilterDefault } from './PatientViewPageStoreUtil';
import { checkNonProfiledGenesExist } from '../PatientViewPageUtils';
import autobind from 'autobind-decorator';
import { createVariantAnnotationsByMutationFetcher } from 'shared/components/mutationMapper/MutationMapperUtils';

type PageMode = 'patient' | 'sample';

Expand Down Expand Up @@ -641,7 +648,8 @@ export class PatientViewPageStore {
this.uncalledMutationData
),
['annotation_summary', 'hotspots'],
AppConfig.serverConfig.isoformOverrideSource
AppConfig.serverConfig.isoformOverrideSource,
this.genomeNexusClient
),
onError: (err: Error) => {
// fail silently, leave the error handling responsibility to the data consumer
Expand All @@ -655,7 +663,8 @@ export class PatientViewPageStore {
invoke: async () => {
return fetchHotspotsData(
this.mutationData,
this.uncalledMutationData
this.uncalledMutationData,
this.genomeNexusInternalClient
);
},
onError: () => {
Expand Down Expand Up @@ -1516,15 +1525,30 @@ export class PatientViewPageStore {
}

@cached get genomeNexusCache() {
return new GenomeNexusCache();
return new GenomeNexusCache(
createVariantAnnotationsByMutationFetcher(
['annotation_summary'],
this.genomeNexusClient
)
);
}

@cached get genomeNexusMyVariantInfoCache() {
return new GenomeNexusMyVariantInfoCache();
return new GenomeNexusMyVariantInfoCache(
createVariantAnnotationsByMutationFetcher(
['my_variant_info'],
this.genomeNexusClient
)
);
}

@cached get genomeNexusMutationAssessorCache() {
return new GenomeNexusMutationAssessorCache();
return new GenomeNexusMutationAssessorCache(
createVariantAnnotationsByMutationFetcher(
['annotation_summary', 'mutation_assessor'],
this.genomeNexusClient
)
);
}

@cached get pubMedCache() {
Expand Down Expand Up @@ -1623,4 +1647,24 @@ export class PatientViewPageStore {
},
[]
);

@computed get referenceGenomeBuild() {
if (!this.studies.isComplete) {
throw new Error('Failed to get studies');
}
return getGenomeNexusUrl(this.studies.result);
}

@autobind
generateGenomeNexusHgvsgUrl(hgvsg: string) {
return getGenomeNexusHgvsgUrl(hgvsg, this.referenceGenomeBuild);
}

@computed get genomeNexusClient() {
return new GenomeNexusAPI(this.referenceGenomeBuild);
}

@computed get genomeNexusInternalClient() {
return new GenomeNexusAPIInternal(this.referenceGenomeBuild);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ function getTable(
MutationTableColumnType.COPY_NUM,
]}
data={[]}
generateGenomeNexusHgvsgUrl={(s: string) => s}
/>
);
}
Expand Down
3 changes: 3 additions & 0 deletions src/pages/patientView/mutation/PatientViewMutationsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,9 @@ export default class PatientViewMutationsTab extends React.Component<
genePanelIdToEntrezGeneIds={
this.props.store.genePanelIdToEntrezGeneIds.result!
}
generateGenomeNexusHgvsgUrl={
this.props.store.generateGenomeNexusHgvsgUrl
}
/>
</div>
),
Expand Down
72 changes: 65 additions & 7 deletions src/pages/resultsView/ResultsViewPageStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,14 @@ import {
IOncoKbData,
remoteData,
stringListToSet,
getBrowserWindow,
} from 'cbioportal-frontend-commons';
import { getProteinPositionFromProteinChange } from 'cbioportal-utils';
import { VariantAnnotation } from 'genome-nexus-ts-api-client';
import {
VariantAnnotation,
GenomeNexusAPI,
GenomeNexusAPIInternal,
} from 'genome-nexus-ts-api-client';
import { CancerGene, IndicatorQueryResp } from 'oncokb-ts-api-client';
import { cached, labelMobxPromises, MobxPromise } from 'mobxpromise';
import PubMedCache from 'shared/cache/PubMedCache';
Expand Down Expand Up @@ -68,6 +73,7 @@ import {
IDataQueryFilter,
isMutationProfile,
ONCOKB_DEFAULT,
getGenomeNexusUrl,
} from 'shared/lib/StoreUtils';
import { IHotspotIndex, indexHotspotsData } from 'react-mutation-mapper';
import { fetchHotspotsData } from 'shared/lib/CancerHotspotsUtils';
Expand Down Expand Up @@ -183,6 +189,8 @@ import {
} from 'shared/lib/GenericAssayUtils/GenericAssayCommonUtils';
import { getSurvivalAttributes } from './survival/SurvivalUtil';
import ComplexKeySet from '../../shared/lib/complexKeyDataStructures/ComplexKeySet';
import { createVariantAnnotationsByMutationFetcher } from 'shared/components/mutationMapper/MutationMapperUtils';
import { getGenomeNexusHgvsgUrl } from 'shared/api/urls';

type Optional<T> =
| { isApplicable: true; value: T }
Expand Down Expand Up @@ -2808,7 +2816,10 @@ export class ResultsViewPageStore {
this.germlineConsentedSamples,
this.indexedHotspotData,
this.indexedVariantAnnotations,
this.uniqueSampleKeyToTumorType.result!
this.uniqueSampleKeyToTumorType.result!,
this.generateGenomeNexusHgvsgUrl,
this.genomeNexusClient,
this.genomeNexusInternalClient
);
return map;
},
Expand Down Expand Up @@ -3192,6 +3203,33 @@ export class ResultsViewPageStore {
[]
);

@computed get referenceGenomeBuild() {
if (!this.studies.isComplete) {
throw new Error('Failed to get studies');
}
return getGenomeNexusUrl(this.studies.result);
}

@autobind
generateGenomeNexusHgvsgUrl(hgvsg: string) {
return getGenomeNexusHgvsgUrl(hgvsg, this.referenceGenomeBuild);
}

@computed get ensemblLink() {
return this.referenceGenomeBuild ===
AppConfig.serverConfig.genomenexus_url_grch38
? AppConfig.serverConfig.ensembl_transcript_grch38_url
: AppConfig.serverConfig.ensembl_transcript_url;
}

@computed get genomeNexusClient() {
return new GenomeNexusAPI(this.referenceGenomeBuild);
}

@computed get genomeNexusInternalClient() {
return new GenomeNexusAPIInternal(this.referenceGenomeBuild);
}

//this is only required to show study name and description on the results page
//CancerStudy objects for all the cohortIds
readonly queriedStudies = remoteData({
Expand Down Expand Up @@ -3985,7 +4023,8 @@ export class ResultsViewPageStore {
? await fetchVariantAnnotationsIndexedByGenomicLocation(
this.mutations.result,
['annotation_summary', 'hotspots'],
AppConfig.serverConfig.isoformOverrideSource
AppConfig.serverConfig.isoformOverrideSource,
this.genomeNexusClient
)
: undefined,
onError: (err: Error) => {
Expand All @@ -3999,7 +4038,11 @@ export class ResultsViewPageStore {
readonly hotspotData = remoteData({
await: () => [this.mutations],
invoke: () => {
return fetchHotspotsData(this.mutations);
return fetchHotspotsData(
this.mutations,
undefined,
this.genomeNexusInternalClient
);
},
});

Expand Down Expand Up @@ -4326,15 +4369,30 @@ export class ResultsViewPageStore {
* For annotations of Genome Nexus we want to fetch lazily
*/
@cached get genomeNexusCache() {
return new GenomeNexusCache();
return new GenomeNexusCache(
createVariantAnnotationsByMutationFetcher(
['annotation_summary'],
this.genomeNexusClient
)
);
}

@cached get genomeNexusMutationAssessorCache() {
return new GenomeNexusMutationAssessorCache();
return new GenomeNexusMutationAssessorCache(
createVariantAnnotationsByMutationFetcher(
['annotation_summary', 'mutation_assessor'],
this.genomeNexusClient
)
);
}

@cached get genomeNexusMyVariantInfoCache() {
return new GenomeNexusMyVariantInfoCache();
return new GenomeNexusMyVariantInfoCache(
createVariantAnnotationsByMutationFetcher(
['my_variant_info'],
this.genomeNexusClient
)
);
}

@cached get pubMedCache() {
Expand Down
12 changes: 9 additions & 3 deletions src/pages/resultsView/mutation/Mutations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,12 @@ export default class Mutations extends React.Component<
/>
</div>
<ResultsViewMutationMapper
{...convertToMutationMapperProps(
AppConfig.serverConfig
)}
{...convertToMutationMapperProps({
...AppConfig.serverConfig,
//override ensemblLink
ensembl_transcript_url: this.props.store
.ensemblLink,
})}
oncoKbPublicApiUrl={getOncoKbApiUrl()}
store={mutationMapperStore}
trackVisibility={
Expand All @@ -157,6 +160,9 @@ export default class Mutations extends React.Component<
}
pdbHeaderCache={this.props.store.pdbHeaderCache}
userEmailAddress={this.props.appStore.userName!}
generateGenomeNexusHgvsgUrl={
this.props.store.generateGenomeNexusHgvsgUrl
}
/>
</MSKTab>
);
Expand Down
3 changes: 3 additions & 0 deletions src/pages/resultsView/mutation/ResultsViewMutationMapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ export default class ResultsViewMutationMapper extends MutationMapper<
enableMyCancerGenome={this.props.enableMyCancerGenome}
enableCivic={this.props.enableCivic}
totalNumberOfExons={this.totalExonNumber}
generateGenomeNexusHgvsgUrl={
this.props.store.generateGenomeNexusHgvsgUrl
}
/>
);
}
Expand Down
16 changes: 12 additions & 4 deletions src/pages/resultsView/mutation/ResultsViewMutationMapperStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ import {
} from 'cbioportal-ts-api-client';
import { remoteData } from 'cbioportal-frontend-commons';
import { CancerGene } from 'oncokb-ts-api-client';
import { VariantAnnotation } from 'genome-nexus-ts-api-client';
import {
VariantAnnotation,
GenomeNexusAPI,
GenomeNexusAPIInternal,
} from 'genome-nexus-ts-api-client';
import { labelMobxPromises, MobxPromise, cached } from 'mobxpromise';
import { IOncoKbData } from 'cbioportal-frontend-commons';
import { fetchCosmicData } from 'shared/lib/StoreUtils';
import MutationCountCache from 'shared/cache/MutationCountCache';
import DiscreteCNACache from 'shared/cache/DiscreteCNACache';
Expand Down Expand Up @@ -62,7 +65,10 @@ export default class ResultsViewMutationMapperStore extends MutationMapperStore
>,
public uniqueSampleKeyToTumorType: {
[uniqueSampleKey: string]: string;
}
},
public generateGenomeNexusHgvsgUrl: (hgvsg: string) => string,
protected genomenexusClient?: GenomeNexusAPI,
protected genomenexusInternalClient?: GenomeNexusAPIInternal
) {
super(
mutationMapperConfig,
Expand All @@ -72,7 +78,9 @@ export default class ResultsViewMutationMapperStore extends MutationMapperStore
indexedHotspotData,
indexedVariantAnnotations,
oncoKbCancerGenes,
uniqueSampleKeyToTumorType
uniqueSampleKeyToTumorType,
genomenexusClient,
genomenexusInternalClient
);

labelMobxPromises(this);
Expand Down

0 comments on commit 24d19c0

Please sign in to comment.