Skip to content

Commit

Permalink
Merge master to rc
Browse files Browse the repository at this point in the history
  • Loading branch information
alisman committed Aug 31, 2018
2 parents 06da3cf + 7ff7655 commit 97b0159
Show file tree
Hide file tree
Showing 25 changed files with 108 additions and 165 deletions.
2 changes: 1 addition & 1 deletion src/pages/patientView/PatientViewPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ export default class PatientViewPage extends React.Component<IPatientViewPagePro
uniqueSampleKeyToTumorType={patientViewPageStore.uniqueSampleKeyToTumorType}
molecularProfileIdToMolecularProfile={patientViewPageStore.molecularProfileIdToMolecularProfile.result}
variantCountCache={patientViewPageStore.variantCountCache}
genomeNexusEnrichmentCache={patientViewPageStore.genomeNexusEnrichmentCache}
indexedVariantAnnotations={patientViewPageStore.indexedVariantAnnotations}
discreteCNACache={patientViewPageStore.discreteCNACache}
mrnaExprRankCache={patientViewPageStore.mrnaExprRankCache}
oncoKbEvidenceCache={patientViewPageStore.oncoKbEvidenceCache}
Expand Down
24 changes: 17 additions & 7 deletions src/pages/patientView/clinicalInformation/PatientViewPageStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import request from 'superagent';
import DiscreteCNACache from "shared/cache/DiscreteCNACache";
import {getTissueImageCheckUrl, getDarwinUrl} from "../../../shared/api/urls";
import OncoKbEvidenceCache from "shared/cache/OncoKbEvidenceCache";
import GenomeNexusEnrichmentCache from "shared/cache/GenomeNexusEnrichment";
import PubMedCache from "shared/cache/PubMedCache";
import {IOncoKbData} from "shared/model/OncoKB";
import {IHotspotIndex} from "shared/model/CancerHotspots";
Expand All @@ -38,12 +37,14 @@ import {
fetchMutSigData, findMrnaRankMolecularProfileId, mergeDiscreteCNAData, fetchSamplesForPatient, fetchClinicalData,
fetchCopyNumberSegments, fetchClinicalDataForPatient, makeStudyToCancerTypeMap,
fetchCivicGenes, fetchCnaCivicGenes, fetchCivicVariants, groupBySampleId, findSamplesWithoutCancerTypeClinicalData,
fetchStudiesForSamplesWithoutCancerTypeClinicalData, fetchOncoKbAnnotatedGenesSuppressErrors
fetchStudiesForSamplesWithoutCancerTypeClinicalData, fetchOncoKbAnnotatedGenesSuppressErrors, concatMutationData
} from "shared/lib/StoreUtils";
import {indexHotspotsData, fetchHotspotsData} from "shared/lib/CancerHotspotsUtils";
import {stringListToSet} from "../../../shared/lib/StringUtils";
import {Gene as OncoKbGene} from "../../../shared/api/generated/OncoKbAPI";
import {MutationTableDownloadDataFetcher} from "shared/lib/MutationTableDownloadDataFetcher";
import { VariantAnnotation } from 'shared/api/generated/GenomeNexusAPI';
import { fetchVariantAnnotationsIndexedByGenomicLocation } from 'shared/lib/MutationAnnotator';

type PageMode = 'patient' | 'sample';

Expand Down Expand Up @@ -267,6 +268,19 @@ export class PatientViewPageStore {
invoke: async () => fetchMutSigData(this.studyId)
});

// Mutation annotation
// genome nexus
readonly indexedVariantAnnotations = remoteData<{[genomicLocation: string]: VariantAnnotation} | undefined>({
await:()=>[
this.mutationData,
this.uncalledMutationData,
],
invoke: async () => await fetchVariantAnnotationsIndexedByGenomicLocation(concatMutationData(this.mutationData, this.uncalledMutationData), ["annotation_summary", "hotspots"], AppConfig.isoformOverrideSource),
onError: (err: Error) => {
// fail silently, leave the error handling responsibility to the data consumer
}
}, undefined);

readonly hotspotData = remoteData({
await: ()=> [
this.mutationData,
Expand Down Expand Up @@ -654,10 +668,6 @@ export class PatientViewPageStore {
return new OncoKbEvidenceCache();
}

@cached get genomeNexusEnrichmentCache() {
return new GenomeNexusEnrichmentCache();
}

@cached get pubMedCache() {
return new PubMedCache();
}
Expand All @@ -675,7 +685,7 @@ export class PatientViewPageStore {
}

@cached get downloadDataFetcher() {
return new MutationTableDownloadDataFetcher(this.mutationData, () => this.genomeNexusEnrichmentCache);
return new MutationTableDownloadDataFetcher(this.mutationData);
}

@action setActiveTabId(id: string) {
Expand Down
20 changes: 14 additions & 6 deletions src/pages/resultsView/ResultsViewPageStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import PubMedCache from "shared/cache/PubMedCache";
import CancerTypeCache from "shared/cache/CancerTypeCache";
import MutationCountCache from "shared/cache/MutationCountCache";
import DiscreteCNACache from "shared/cache/DiscreteCNACache";
import GenomeNexusEnrichmentCache from "shared/cache/GenomeNexusEnrichment";
import PdbHeaderCache from "shared/cache/PdbHeaderCache";
import {
findMolecularProfileIdDiscrete, fetchMyCancerGenomeData,
Expand Down Expand Up @@ -83,6 +82,8 @@ import url from 'url';
import OncoprintClinicalDataCache, {SpecialAttribute} from "../../shared/cache/OncoprintClinicalDataCache";
import {getProteinPositionFromProteinChange} from "../../shared/lib/ProteinChangeUtils";
import {isMutation} from "../../shared/lib/CBioPortalAPIUtils";
import { fetchVariantAnnotationsIndexedByGenomicLocation } from "shared/lib/MutationAnnotator";
import { VariantAnnotation } from "shared/api/generated/GenomeNexusAPI";

type Optional<T> = (
{isApplicable: true, value: T}
Expand Down Expand Up @@ -1205,14 +1206,14 @@ export class ResultsViewPageStore {
this.samples,
this.oncoKbAnnotatedGenes.result || {},
() => this.mutationsByGene[gene.hugoGeneSymbol],
() => (this.genomeNexusEnrichmentCache),
() => (this.mutationCountCache),
this.studyIdToStudy,
this.molecularProfileIdToMolecularProfile,
this.clinicalDataForSamples,
this.studiesForSamplesWithoutCancerTypeClinicalData,
this.germlineConsentedSamples,
this.indexedHotspotData,
this.indexedVariantAnnotations,
this.uniqueSampleKeyToTumorType.result!,
this.oncoKbData
);
Expand Down Expand Up @@ -1865,6 +1866,17 @@ export class ResultsViewPageStore {
});

// Mutation annotation
// genome nexus
readonly indexedVariantAnnotations = remoteData<{[genomicLocation: string]: VariantAnnotation} | undefined>({
await:()=>[
this.mutations
],
invoke: async () => this.mutations.result? await fetchVariantAnnotationsIndexedByGenomicLocation(this.mutations.result, ["annotation_summary", "hotspots"], AppConfig.isoformOverrideSource) : undefined,
onError: (err: Error) => {
// fail silently, leave the error handling responsibility to the data consumer
}
}, undefined);

// Hotspots
readonly hotspotData = remoteData({
await:()=>[
Expand Down Expand Up @@ -2324,10 +2336,6 @@ export class ResultsViewPageStore {
return new DiscreteCNACache(this.studyToMolecularProfileDiscrete.result);
}

@cached get genomeNexusEnrichmentCache() {
return new GenomeNexusEnrichmentCache();
}

@cached get cancerTypeCache() {
return new CancerTypeCache();
}
Expand Down
2 changes: 2 additions & 0 deletions src/pages/resultsView/coExpression/CoExpressionPlot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import Timer = NodeJS.Timer;
import DownloadControls from "../../../shared/components/downloadControls/DownloadControls";
import {axisLabel, isNotProfiled} from "./CoExpressionPlotUtils";
import _ from "lodash";
import {scatterPlotSize} from "../../../shared/components/plots/PlotUtils";

type GeneId = { hugoGeneSymbol:string, entrezGeneId: number, cytoband:string};

Expand Down Expand Up @@ -219,6 +220,7 @@ export default class CoExpressionPlot extends React.Component<ICoExpressionPlotP
svgId={SVG_ID}
title={this.title}
data={this.data}
size={scatterPlotSize}
chartWidth={this.props.width}
chartHeight={this.props.height}
stroke={this.stroke}
Expand Down
5 changes: 3 additions & 2 deletions src/pages/resultsView/expression/ExpressionWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
CNA_STROKE_WIDTH,
getCnaQueries, IBoxScatterPlotPoint, INumberAxisData, IScatterPlotData, IScatterPlotSampleData, IStringAxisData,
makeBoxScatterPlotData, makeScatterPlotPointAppearance,
mutationRenderPriority, MutationSummary, mutationSummaryToAppearance, scatterPlotLegendData, scatterPlotSize,
mutationRenderPriority, MutationSummary, mutationSummaryToAppearance, scatterPlotLegendData,
scatterPlotTooltip, boxPlotTooltip, scatterPlotZIndexSortBy
} from "../plots/PlotsTabUtils";
import {getOncoprintMutationType} from "../../../shared/components/oncoprint/DataUtils";
Expand All @@ -48,6 +48,7 @@ import BoxScatterPlot from "../../../shared/components/plots/BoxScatterPlot";
import {ViewType} from "../plots/PlotsTab";
import DownloadControls from "../../../shared/components/downloadControls/DownloadControls";
import {maxPage} from "../../../shared/components/lazyMobXTable/utils";
import {scatterPlotSize} from "../../../shared/components/plots/PlotUtils";

export interface ExpressionWrapperProps {
store:ResultsViewPageStore;
Expand Down Expand Up @@ -276,7 +277,7 @@ export default class ExpressionWrapper extends React.Component<ExpressionWrapper
} else {
return Promise.resolve(_.sortBy<any>(sortedData, d=>{
//Note: we have to use slice to convert Seamless immutable array to real array, otherwise jStat chokes
return jStat.median(Array.prototype.slice((d.data.map((v:any)=>(v.value as number)))));
return jStat.median(Array.prototype.slice.apply((d.data.map((v:any)=>(v.value as number)))));
}));
}
}
Expand Down
1 change: 0 additions & 1 deletion src/pages/resultsView/mutation/Mutations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ export default class Mutations extends React.Component<IMutationsPageProps, {}>
<ResultsViewMutationMapper
store={mutationMapperStore}
discreteCNACache={this.props.store.discreteCNACache}
genomeNexusEnrichmentCache={this.props.store.genomeNexusEnrichmentCache}
oncoKbEvidenceCache={this.props.store.oncoKbEvidenceCache}
pubMedCache={this.props.store.pubMedCache}
cancerTypeCache={this.props.store.cancerTypeCache}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export default class ResultsViewMutationMapper extends MutationMapper<IResultsVi
oncoKbAnnotatedGenes={this.props.store.oncoKbAnnotatedGenes}
discreteCNACache={this.props.discreteCNACache}
studyIdToStudy={this.props.store.studyIdToStudy.result}
genomeNexusEnrichmentCache={this.props.genomeNexusEnrichmentCache}
molecularProfileIdToMolecularProfile={this.props.store.molecularProfileIdToMolecularProfile.result}
oncoKbEvidenceCache={this.props.oncoKbEvidenceCache}
pubMedCache={this.props.pubMedCache}
Expand All @@ -68,6 +67,7 @@ export default class ResultsViewMutationMapper extends MutationMapper<IResultsVi
downloadDataFetcher={this.props.store.downloadDataFetcher}
myCancerGenomeData={this.props.myCancerGenomeData}
hotspotData={this.props.store.indexedHotspotData}
indexedVariantAnnotations={this.props.store.indexedVariantAnnotations}
cosmicData={this.props.store.cosmicData.result}
oncoKbData={this.props.store.oncoKbData}
civicGenes={this.props.store.civicGenes}
Expand Down
10 changes: 5 additions & 5 deletions src/pages/resultsView/mutation/ResultsViewMutationMapperStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import {
fetchCosmicData, fetchCivicGenes, fetchCivicVariants
} from "shared/lib/StoreUtils";
import {IMutationMapperConfig} from "shared/components/mutationMapper/MutationMapper";
import GenomeNexusEnrichmentCache from "shared/cache/GenomeNexusEnrichment";
import MutationCountCache from "shared/cache/MutationCountCache";
import {MutationTableDownloadDataFetcher} from "shared/lib/MutationTableDownloadDataFetcher";
import MutationMapperStore from "shared/components/mutationMapper/MutationMapperStore";
import { VariantAnnotation } from "shared/api/generated/GenomeNexusAPI";

export default class ResultsViewMutationMapperStore extends MutationMapperStore
{
Expand All @@ -29,14 +29,14 @@ export default class ResultsViewMutationMapperStore extends MutationMapperStore
// (which will be done in the getter thats passed in here) so that the cache itself is observable
// and we will react when it changes to a new object.
getMutations:()=>Mutation[],
protected genomeNexusEnrichmentCache: ()=>GenomeNexusEnrichmentCache,
private getMutationCountCache: ()=>MutationCountCache,
public studyIdToStudy:MobxPromise<{[studyId:string]:CancerStudy}>,
public molecularProfileIdToMolecularProfile:MobxPromise<{[molecularProfileId:string]:MolecularProfile}>,
public clinicalDataForSamples: MobxPromise<ClinicalData[]>,
public studiesForSamplesWithoutCancerTypeClinicalData: MobxPromise<CancerStudy[]>,
public germlineConsentedSamples:MobxPromise<SampleIdentifier[]>,
public indexedHotspotData:MobxPromise<IHotspotIndex|undefined>,
public indexedVariantAnnotations:MobxPromise<{[genomicLocation: string]: VariantAnnotation}|undefined>,
public uniqueSampleKeyToTumorType:{[uniqueSampleKey:string]:string},
public oncoKbData:IOncoKbDataWrapper)
{
Expand All @@ -45,10 +45,10 @@ export default class ResultsViewMutationMapperStore extends MutationMapperStore
gene,
getMutations,
indexedHotspotData,
indexedVariantAnnotations,
oncoKbAnnotatedGenes,
oncoKbData,
uniqueSampleKeyToTumorType,
genomeNexusEnrichmentCache,
uniqueSampleKeyToTumorType
);

labelMobxPromises(this);
Expand Down Expand Up @@ -91,6 +91,6 @@ export default class ResultsViewMutationMapperStore extends MutationMapperStore
}, undefined);

@cached get downloadDataFetcher(): MutationTableDownloadDataFetcher {
return new MutationTableDownloadDataFetcher(this.mutationData, this.genomeNexusEnrichmentCache, this.getMutationCountCache);
return new MutationTableDownloadDataFetcher(this.mutationData, this.getMutationCountCache);
}
}
3 changes: 2 additions & 1 deletion src/pages/resultsView/plots/PlotsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
makeBoxScatterPlotData, IScatterPlotSampleData, noMutationAppearance, IBoxScatterPlotPoint, boxPlotTooltip,
getCnaQueries, getMutationQueries, getScatterPlotDownloadData, getBoxPlotDownloadData, getTablePlotDownloadData,
mutationRenderPriority, mutationSummaryRenderPriority, MutationSummary, mutationSummaryToAppearance,
CNA_STROKE_WIDTH, scatterPlotSize, PLOT_SIDELENGTH, CLIN_ATTR_DATA_TYPE,
CNA_STROKE_WIDTH, PLOT_SIDELENGTH, CLIN_ATTR_DATA_TYPE,
sortMolecularProfilesForDisplay, scatterPlotZIndexSortBy
} from "./PlotsTabUtils";
import {
Expand All @@ -40,6 +40,7 @@ import {logicalOr} from "../../../shared/lib/LogicUtils";
import {SpecialAttribute} from "../../../shared/cache/OncoprintClinicalDataCache";
import OqlStatusBanner from "../../../shared/components/oqlStatusBanner/OqlStatusBanner";
import ScrollBar from "../../../shared/components/Scrollbar/ScrollBar";
import {scatterPlotSize} from "../../../shared/components/plots/PlotUtils";

enum EventKey {
horz_logScale,
Expand Down
14 changes: 0 additions & 14 deletions src/pages/resultsView/plots/PlotsTabUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,20 +184,6 @@ export function scatterPlotZIndexSortBy<D extends Pick<IScatterPlotSampleData, "
return sortBy;
}

export function scatterPlotSize(
d:IScatterPlotSampleData,
active:boolean,
isHighlighted:boolean
) {
if (isHighlighted) {
return 8;
} else if (active) {
return 6;
} else {
return 4;
}
}

export function scatterPlotLegendData(
data:IScatterPlotSampleData[],
viewType:ViewType,
Expand Down
1 change: 0 additions & 1 deletion src/pages/tools/mutationMapper/MutationMapperTool.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,6 @@ export default class MutationMapperTool extends React.Component<IMutationMapperT
oncoKbEvidenceCache={this.store.oncoKbEvidenceCache}
pubMedCache={this.store.pubMedCache}
pdbHeaderCache={this.store.pdbHeaderCache}
genomeNexusEnrichmentCache={this.store.genomeNexusEnrichmentCache}
myCancerGenomeData={this.store.myCancerGenomeData}
config={AppConfig}
/>
Expand Down
9 changes: 2 additions & 7 deletions src/pages/tools/mutationMapper/MutationMapperToolStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {fetchHotspotsData, indexHotspotsData} from "shared/lib/CancerHotspotsUti
import {IHotspotIndex} from "shared/model/CancerHotspots";
import OncoKbEvidenceCache from "shared/cache/OncoKbEvidenceCache";
import PubMedCache from "shared/cache/PubMedCache";
import GenomeNexusEnrichmentCache from "shared/cache/GenomeNexusEnrichment";
import PdbHeaderCache from "shared/cache/PdbHeaderCache";
import MutationMapperStore from "shared/components/mutationMapper/MutationMapperStore";
import { VariantAnnotation, EnsemblTranscript } from "shared/api/generated/GenomeNexusAPI";
Expand Down Expand Up @@ -130,7 +129,7 @@ export default class MutationMapperToolStore
}, []);

readonly indexedVariantAnnotations = remoteData<{[genomicLocation: string]: VariantAnnotation} | undefined>({
invoke: async () => await fetchVariantAnnotationsIndexedByGenomicLocation(this.rawMutations, AppConfig.isoformOverrideSource),
invoke: async () => await fetchVariantAnnotationsIndexedByGenomicLocation(this.rawMutations, ["annotation_summary","hotspots"], AppConfig.isoformOverrideSource),
onError: (err: Error) => {
this.criticalErrors.push(err);
}
Expand Down Expand Up @@ -182,10 +181,10 @@ export default class MutationMapperToolStore
gene,
getMutations,
this.indexedHotspotData,
this.indexedVariantAnnotations,
this.oncoKbAnnotatedGenes.result || {},
this.oncoKbData,
this.uniqueSampleKeyToTumorType.result || {},
() => (this.genomeNexusEnrichmentCache),
);
return map;
}, {}));
Expand Down Expand Up @@ -229,10 +228,6 @@ export default class MutationMapperToolStore
return new PubMedCache();
}

@cached get genomeNexusEnrichmentCache() {
return new GenomeNexusEnrichmentCache();
}

@cached get pdbHeaderCache() {
return new PdbHeaderCache();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default class StandaloneMutationMapper extends MutationMapper<IMutationMa
<StandaloneMutationTable
uniqueSampleKeyToTumorType={this.props.store.uniqueSampleKeyToTumorType}
oncoKbAnnotatedGenes={this.props.store.oncoKbAnnotatedGenes}
genomeNexusEnrichmentCache={this.props.genomeNexusEnrichmentCache}
indexedVariantAnnotations={this.props.store.indexedVariantAnnotations}
oncoKbEvidenceCache={this.props.oncoKbEvidenceCache}
pubMedCache={this.props.pubMedCache}
dataStore={this.props.store.dataStore}
Expand Down
Loading

0 comments on commit 97b0159

Please sign in to comment.