Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into merge-master-to-r…
Browse files Browse the repository at this point in the history
…elease-3.4.0

Former-commit-id: 4acc841dae523963cf45a8ccecaa52b7d6c27104
  • Loading branch information
Gaofei Zhao committed May 22, 2020
2 parents 6617aa7 + 9a91e38 commit 6f5554c
Show file tree
Hide file tree
Showing 14 changed files with 340 additions and 1,118 deletions.
15 changes: 15 additions & 0 deletions end-to-end-test/remote/specs/core/results.logic.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -554,3 +554,18 @@ describe('invalid query from url', function() {
waitForOncoprint(ONCOPRINT_TIMEOUT);
});
});

describe('survival redirect button', function() {
it('redirects to comparison survival tab', () => {
goToUrlAndSetLocalStorage(
`${CBIOPORTAL_URL}/results/oncoprint?Z_SCORE_THRESHOLD=2.0&cancer_study_id=coadread_tcga_pub&cancer_study_list=coadread_tcga_pub&case_set_id=coadread_tcga_pub_nonhypermut&comparison_subtab=survival&gene_list=KRAS%20NRAS%20BRAF&gene_set_choice=user-defined-list&genetic_profile_ids_PROFILE_COPY_NUMBER_ALTERATION=coadread_tcga_pub_gistic&genetic_profile_ids_PROFILE_MUTATION_EXTENDED=coadread_tcga_pub_mutations`
);

browser.waitForExist('.tabAnchor.tabAnchor_survival', 10000);
browser.click('.tabAnchor.tabAnchor_survival');
browser.waitForExist(
'div[data-test="ComparisonPageSurvivalTabDiv"]',
60000
);
});
});
58 changes: 58 additions & 0 deletions src/pages/groupComparison/GroupComparisonUtils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
unionSamples,
splitData,
getDefaultGroupName,
getGroupsDownloadData,
} from './GroupComparisonUtils';
import deepEqualInAnyOrder from 'deep-equal-in-any-order';
import ComplexKeySet from '../../shared/lib/complexKeyDataStructures/ComplexKeySet';
Expand Down Expand Up @@ -3263,4 +3264,61 @@ describe('GroupComparisonUtils', () => {
);
});
});
describe('getGroupsDownloadData', () => {
it('returns the correct data', () => {
const samples = [
{
sampleId: 'sample1',
patientId: 'patient1',
studyId: 'study1',
uniqueSampleKey: '1-1',
},
{
sampleId: 'sample2',
patientId: 'patient1',
studyId: 'study1',
uniqueSampleKey: '2-1',
},
{
sampleId: 'sample3',
patientId: 'patient2',
studyId: 'study1',
uniqueSampleKey: '3-1',
},
{
sampleId: 'sample1',
patientId: 'patient3',
studyId: 'study2',
uniqueSampleKey: '1-2',
},
{
sampleId: 'sample2',
patientId: 'patient3',
studyId: 'study2',
uniqueSampleKey: '2-2',
},
] as Sample[];
const groups = [
{ uid: 'group1', name: 'A' },
{ uid: 'group2', name: 'B' },
{ uid: 'group3', name: 'C' },
] as ComparisonGroup[];
const sampleKeyToGroups: any = {
'1-1': { group1: true },
'2-1': { group1: true, group2: true },
'3-1': { group2: true },
'1-2': { group2: true, group3: true },
'2-2': { group1: true, group2: true, group3: true },
};
assert.equal(
getGroupsDownloadData(samples, groups, sampleKeyToGroups),
'Sample ID\tPatient ID\tStudy ID\tA\tB\tC\n' +
'sample1\tpatient1\tstudy1\tYes\tNo\tNo\n' +
'sample2\tpatient1\tstudy1\tYes\tYes\tNo\n' +
'sample3\tpatient2\tstudy1\tNo\tYes\tNo\n' +
'sample1\tpatient3\tstudy2\tNo\tYes\tYes\n' +
'sample2\tpatient3\tstudy2\tYes\tYes\tYes'
);
});
});
});
28 changes: 28 additions & 0 deletions src/pages/groupComparison/GroupComparisonUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -844,3 +844,31 @@ export function getOverlapComputations<
excludedFromAnalysis: _.mapValues(removedGroups, g => true as true),
};
}

export function getGroupsDownloadData(
samples: Sample[],
groups: ComparisonGroup[],
sampleKeyToGroups: {
[uniqueSampleKey: string]: { [groupUid: string]: boolean };
}
) {
const lines: string[][] = [];
const header = ['Sample ID', 'Patient ID', 'Study ID'].concat(
groups.map(g => g.name)
);
lines.push(header);
for (const sample of samples) {
const groupMembershipMap = sampleKeyToGroups[sample.uniqueSampleKey];
const line = [sample.sampleId, sample.patientId, sample.studyId].concat(
groups.map(g => {
if (groupMembershipMap[g.uid]) {
return 'Yes';
} else {
return 'No';
}
})
);
lines.push(line);
}
return lines.map(line => line.join('\t')).join('\n');
}
2 changes: 2 additions & 0 deletions src/pages/groupComparison/Overlap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,8 @@ export default class Overlap extends React.Component<IOverlapProps, {}> {
{this.plotExists && (
<DownloadControls
getSvg={this.getSvg}
getData={this.props.store.getGroupsDownloadDataPromise}
buttons={['SVG', 'PNG', 'PDF', 'Data']}
filename={'overlap'}
dontFade={true}
style={{ position: 'absolute', right: 10, top: 10 }}
Expand Down
19 changes: 18 additions & 1 deletion src/pages/resultsView/ResultsViewPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ import OQLTextArea, {
GeneBoxType,
} from 'shared/components/GeneSelectionBox/OQLTextArea';
import browser from 'bowser';
import { GroupComparisonTab } from '../groupComparison/GroupComparisonTabs';
import NotUsingGenePanelWarning from './NotUsingGenePanelWarning';
import Survival from '../groupComparison/Survival';
import ResultsViewComparisonStore from './comparison/ResultsViewComparisonStore';

export function initStore(
appStore: AppStore,
Expand Down Expand Up @@ -324,7 +328,20 @@ export default class ResultsViewPage extends React.Component<
);
},
},

{
id: ResultsViewTab.SURVIVAL_REDIRECT,
hide: () =>
!this.resultsViewPageStore.survivalClinicalDataExists
.isComplete ||
!this.resultsViewPageStore.survivalClinicalDataExists
.result!,
getTab: () => (
<MSKTab
id={ResultsViewTab.SURVIVAL_REDIRECT}
linkText="Survival"
></MSKTab>
),
},
{
id: ResultsViewTab.CN_SEGMENTS,
hide: () => {
Expand Down
1 change: 1 addition & 0 deletions src/pages/resultsView/ResultsViewPageHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { VirtualStudy } from '../../shared/model/VirtualStudy';

export enum ResultsViewTab {
ONCOPRINT = 'oncoprint',
SURVIVAL_REDIRECT = 'survival',
CANCER_TYPES_SUMMARY = 'cancerTypesSummary',
MUTUAL_EXCLUSIVITY = 'mutualExclusivity',
PLOTS = 'plots',
Expand Down
27 changes: 25 additions & 2 deletions src/pages/resultsView/ResultsViewPageStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ import {
isMutationProfile,
ONCOKB_DEFAULT,
getGenomeNexusUrl,
fetchSurvivalDataExists,
getSurvivalClinicalAttributesPrefix,
} from 'shared/lib/StoreUtils';
import { IHotspotIndex, indexHotspotsData } from 'react-mutation-mapper';
import { fetchHotspotsData } from 'shared/lib/CancerHotspotsUtils';
Expand Down Expand Up @@ -190,6 +192,7 @@ import {
import ComplexKeySet from '../../shared/lib/complexKeyDataStructures/ComplexKeySet';
import { createVariantAnnotationsByMutationFetcher } from 'shared/components/mutationMapper/MutationMapperUtils';
import { getGenomeNexusHgvsgUrl } from 'shared/api/urls';
import ResultsViewComparisonStore from './comparison/ResultsViewComparisonStore';

type Optional<T> =
| { isApplicable: true; value: T }
Expand Down Expand Up @@ -790,14 +793,14 @@ export class ResultsViewPageStore {
}

readonly comparisonGroups = remoteData<Group[]>({
await: () => [this.studyIds],
await: () => [this.queriedStudies],
invoke: async () => {
let ret: Group[] = [];
if (this.appStore.isLoggedIn) {
try {
ret = ret.concat(
await comparisonClient.getGroupsForStudies(
this.studyIds.result!
this.queriedStudies.result!.map(x => x.studyId)
)
);
} catch (e) {
Expand Down Expand Up @@ -2004,6 +2007,26 @@ export class ResultsViewPageStore {
},
});

readonly survivalClinicalAttributesPrefix = remoteData({
await: () => [this.clinicalAttributes],
invoke: () => {
return Promise.resolve(
getSurvivalClinicalAttributesPrefix(
this.clinicalAttributes.result!
)
);
},
});

readonly survivalClinicalDataExists = remoteData<boolean>({
await: () => [this.samples, this.survivalClinicalAttributesPrefix],
invoke: () =>
fetchSurvivalDataExists(
this.samples.result!,
this.survivalClinicalAttributesPrefix.result!
),
});

readonly samplesByDetailedCancerType = remoteData<{
[cancerType: string]: Sample[];
}>({
Expand Down
2 changes: 1 addition & 1 deletion src/pages/staticPages/datasetView/DatasetList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export default class DataSetsPageTable extends React.Component<
},
},
{ name: 'All', type: 'all' },
{ name: 'Sequenced', type: 'sequenced' },
{ name: 'Mutations', type: 'sequenced' }, // product team requested this be titled mutations
{ name: 'CNA', type: 'cna' },
{
name: 'RNA-Seq',
Expand Down
52 changes: 44 additions & 8 deletions src/pages/staticPages/tutorials/Tutorials.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,7 @@ export default class Tutorials extends React.Component<{}, {}> {
</li>

<li>
Group Comparison (May 21, 2020, 11am-12pm
EDT)&nbsp;
<a
target="_blank"
href="https://dfci.zoom.us/webinar/register/7315875611981/WN_An_3l0XYQHCoinWvclUrlw"
>
register
</a>
<a href="#webinar-4">Group Comparison</a>
</li>

<li>
Expand Down Expand Up @@ -295,6 +288,49 @@ export default class Tutorials extends React.Component<{}, {}> {
</h4>
</div>
<hr />
<h2 id={'webinar-4'}>
Webinar #4: Group Comparison <ReturnToTop />
</h2>

<iframe
src="https://www.youtube.com/embed/Tx4HZCrIe5c"
frameBorder="0"
width="720"
height="434"
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen={true}
></iframe>
<div>
<span style={{ fontSize: 'large' }}>Watch on </span>
<h4 style={{ display: 'inline' }}>
<a
target="_blank"
href="https://www.youtube.com/watch?v=Tx4HZCrIe5c"
>
YouTube.com
</a>
</h4>
<span style={{ fontSize: 'large' }}> or </span>
<h4 style={{ display: 'inline' }}>
<a
target="_blank"
href="https://www.bilibili.com/video/BV1VZ4y1W76p"
>
bilibili.com
</a>
</h4>
<span style={{ color: '#eee' }}> | </span>
<h4 style={{ display: 'inline' }}>
<a
href={`${AppConfig.serverConfig
.skin_documentation_baseurl!}tutorials/cBioPortal Webinar 4 Group Comparison.pdf`}
>
Download slides
</a>
</h4>
</div>
<hr />

{/*<h1 id={'tutorials'}>Tutorials</h1>*/}
<h2 id={'single-study-exploration'}>
Tutorial #1: Single Study Exploration
Expand Down
Loading

0 comments on commit 6f5554c

Please sign in to comment.