Skip to content

Commit

Permalink
Merge pull request #1377 from adamabeshouse/expr-cna
Browse files Browse the repository at this point in the history
Cna and putative driver coloring in expression tab

Former-commit-id: 40d1713
  • Loading branch information
alisman authored Aug 23, 2018
2 parents 29e24c2 + 8a2cfdd commit cadb054
Show file tree
Hide file tree
Showing 12 changed files with 856 additions and 802 deletions.
9 changes: 5 additions & 4 deletions src/pages/resultsView/ResultsViewPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,14 @@ export default class ResultsViewPage extends React.Component<IResultsViewPagePro

const store = this.resultsViewPageStore;

if (store.rnaSeqMolecularData.isComplete && store.studyIdToStudy.isComplete
&& store.mutations.isComplete && store.genes.isComplete && store.coverageInformation.isComplete) {
if (store.studyIdToStudy.isComplete
&& store.putativeDriverAnnotatedMutations.isComplete && store.genes.isComplete && store.coverageInformation.isComplete) {
return <ExpressionWrapper store={store}
studyMap={store.studyIdToStudy.result}
genes={store.genes.result}
data={store.rnaSeqMolecularData.result}
mutations={store.mutations.result}
expressionProfiles={store.expressionProfiles}
numericGeneMolecularDataCache={store.numericGeneMolecularDataCache}
mutations={store.putativeDriverAnnotatedMutations.result}
RNASeqVersion={store.expressionTabSeqVersion}
coverageInformation={store.coverageInformation.result}
onRNASeqVersionChange={(version:number)=>store.expressionTabSeqVersion=version}
Expand Down
33 changes: 33 additions & 0 deletions src/pages/resultsView/ResultsViewPageStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1768,6 +1768,39 @@ export class ResultsViewPageStore {
}
});

public annotatedCnaCache =
new MobxPromiseCache<{entrezGeneId:number}, AnnotatedNumericGeneMolecularData[]>(
q=>({
await: ()=>this.numericGeneMolecularDataCache.await(
[this.studyToMolecularProfileDiscrete, this.entrezGeneIdToGene, this.getOncoKbCnaAnnotationForOncoprint, this.molecularProfileIdToMolecularProfile],
(studyToMolecularProfileDiscrete)=>{
return _.values(studyToMolecularProfileDiscrete).map(p=>({entrezGeneId: q.entrezGeneId, molecularProfileId: p.molecularProfileId}));
}),
invoke:()=>{
const results = _.flatten(this.numericGeneMolecularDataCache.getAll(
_.values(this.studyToMolecularProfileDiscrete.result!).map(p=>({entrezGeneId: q.entrezGeneId, molecularProfileId: p.molecularProfileId}))
).map(p=>p.result!));
const entrezGeneIdToGene = this.entrezGeneIdToGene.result!;
let getOncoKbAnnotation:(datum:NumericGeneMolecularData)=>IndicatorQueryResp|undefined;
if (this.getOncoKbCnaAnnotationForOncoprint.result! instanceof Error) {
getOncoKbAnnotation = ()=>undefined;
} else {
getOncoKbAnnotation = this.getOncoKbCnaAnnotationForOncoprint.result! as typeof getOncoKbAnnotation;
}
const profileIdToProfile = this.molecularProfileIdToMolecularProfile.result!;
return Promise.resolve(results.map(d=>{
return annotateMolecularDatum(
d,
getOncoKbAnnotation,
profileIdToProfile,
entrezGeneIdToGene
);
})
);
}
})
);

readonly getPutativeDriverInfo = remoteData({
await:()=>{
const toAwait = [];
Expand Down
26 changes: 2 additions & 24 deletions src/pages/resultsView/expression/ExpressionWrapper.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,37 +18,15 @@ describe('Expression Wrapper',()=>{
instance = wrapper.instance() as ExpressionWrapper;
});


it('data transformer returns correct value based on logScale state',()=>{

instance.logScale = true;
assert.equal(instance.dataTransformer({value: 100} as NumericGeneMolecularData), 6.643856189774724);

instance.logScale = false;
assert.equal(instance.dataTransformer({value: 100} as NumericGeneMolecularData), 100);

});

it('data transformer caps expression value >= constant',()=>{

instance.logScale = true;
assert.equal(instance.dataTransformer({value: 0.0001} as NumericGeneMolecularData), -6.643856189774724, 'value less than cap');
assert.equal(instance.dataTransformer({value: 0} as NumericGeneMolecularData), -6.643856189774724, 'zero value');

instance.logScale = false;
assert.equal(instance.dataTransformer({value: 0.0001} as NumericGeneMolecularData), .0001, 'non log');
assert.equal(instance.dataTransformer({value: 0} as NumericGeneMolecularData), 0, 'non log zero');
});

// this is failing. we need new data to debug
it.skip('studies are sorted properly depending on sortBy setting',()=>{
/*it.skip('studies are sorted properly depending on sortBy setting',()=>{
instance.sortBy = "alphabetic";
assert.equal(instance.sortedData[2][0].studyId, 'chol_tcga', 'sorting is alphabetical');
instance.sortBy = "median";
assert.equal(instance.sortedData[2][0].studyId, 'laml_tcga', 'sort according to median values');
});
});*/

});
Loading

0 comments on commit cadb054

Please sign in to comment.