Skip to content

Commit

Permalink
oncoprint - allow adding gaps to string-valued clinical tracks
Browse files Browse the repository at this point in the history
Signed-off-by: Abeshouse, Adam A./Sloan Kettering Institute <[email protected]>
  • Loading branch information
Abeshouse, Adam A./Sloan Kettering Institute committed Dec 11, 2019
1 parent 19fa84e commit e8a6bca
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 28 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 36 additions & 15 deletions end-to-end-test/remote/specs/core/oncoprint.screenshot.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@ const CBIOPORTAL_URL = process.env.CBIOPORTAL_URL.replace(/\/$/, "");

const ONCOPRINT_TIMEOUT = 60000;


function getNthTrackOptionsElements(n) {
// n is one-indexed

const button_selector = "#oncoprintDiv .oncoprintjs__track_options__toggle_btn_img.nth-"+n;
const dropdown_selector = "#oncoprintDiv .oncoprintjs__track_options__dropdown.nth-"+n;

return {
button: $(button_selector),
button_selector,
dropdown: $(dropdown_selector),
dropdown_selector
};
}

describe("oncoprint screenshot tests", function() {
it("coadread_tcga_pub with clinical and heatmap tracks", function(){
var url = `${CBIOPORTAL_URL}/index.do?cancer_study_id=coadread_tcga_pub&Z_SCORE_THRESHOLD=1&RPPA_SCORE_THRESHOLD=2&data_priority=0&case_set_id=coadread_tcga_pub_nonhypermut&gene_list=KRAS%20NRAS%20BRAF&geneset_list=%20&tab_index=tab_visualize&Action=Submit&genetic_profile_ids_PROFILE_MUTATION_EXTENDED=coadread_tcga_pub_mutations&genetic_profile_ids_PROFILE_COPY_NUMBER_ALTERATION=coadread_tcga_pub_gistic&genetic_profile_ids_PROFILE_MRNA_EXPRESSION=coadread_tcga_pub_rna_seq_mrna_median_Zscores&show_samples=false&clinicallist=0%2C2%2CMETHYLATION_SUBTYPE&heatmap_track_groups=coadread_tcga_pub_rna_seq_mrna_median_Zscores%2CKRAS%2CNRAS%2CBRAF&`;
Expand Down Expand Up @@ -93,6 +108,27 @@ describe("oncoprint screenshot tests", function() {
var res = checkOncoprintElement('.oncoprintContainer');
assertScreenShotMatch(res);
});
it("coadread_tcga_pub with column gaps inserted based on clinical track", function() {
goToUrlAndSetLocalStorage(`${CBIOPORTAL_URL}/results?Z_SCORE_THRESHOLD=2.0&cancer_study_id=coadread_tcga_pub&cancer_study_list=coadread_tcga_pub&case_ids=&case_set_id=coadread_tcga_pub_nonhypermut&clinicallist=CANCER_TYPE_DETAILED&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&oncoprint_cluster_profile=&oncoprint_sortby=`);
waitForOncoprint(ONCOPRINT_TIMEOUT);

const cancerTypeDetailedElements = getNthTrackOptionsElements(1);
setDropdownOpen(true, cancerTypeDetailedElements.button_selector, cancerTypeDetailedElements.dropdown_selector, "Failed to open cancer type detailed track menu");
browser.click(`${cancerTypeDetailedElements.dropdown_selector} li:nth-child(9)`); // Click "show gaps"
browser.pause(100); // give time to sort and insert gaps

// open minimap
browser.waitForExist('[data-test="ShowMinimapButton"]');
browser.click('[data-test="ShowMinimapButton"]');

// zoom to fit
browser.waitForVisible('.oncoprint-zoomtofit-btn');
browser.click('.oncoprint-zoomtofit-btn');
browser.pause(100); // give time to rezoom

const res = checkOncoprintElement('.oncoprintContainer');
assertScreenShotMatch(res);
});
});

describe("track group headers", function() {
Expand Down Expand Up @@ -153,21 +189,6 @@ describe("track group headers", function() {
});

describe("sorting", function(){

function getNthTrackOptionsElements(n) {
// n is one-indexed

const button_selector = "#oncoprintDiv .oncoprintjs__track_options__toggle_btn_img.nth-"+n;
const dropdown_selector = "#oncoprintDiv .oncoprintjs__track_options__dropdown.nth-"+n;

return {
button: $(button_selector),
button_selector,
dropdown: $(dropdown_selector),
dropdown_selector
};
}

it("oncoprint should sort patients correctly in coadread_tcga_pub", function(){
goToUrlAndSetLocalStorage(CBIOPORTAL_URL);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
"node-sass": "^4.9.3",
"numeral": "^2.0.6",
"object-sizeof": "^1.2.0",
"oncoprintjs": "4.0.8",
"oncoprintjs": "4.1.1",
"parameter-validator": "^1.0.2",
"pdfobject": "^2.0.201604172",
"pegjs": "^0.10.0",
Expand Down
6 changes: 3 additions & 3 deletions src/pages/staticPages/tools/oncoprinter/Oncoprinter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,13 @@ export default class Oncoprinter extends React.Component<IOncoprinterProps, {}>
}
},
onSetHorzZoom:(z:number)=>{
this.oncoprint.setHorzZoom(z);
this.oncoprint.setHorzZoomCentered(z);
},
onClickZoomIn:()=>{
this.oncoprint.setHorzZoom(this.oncoprint.getHorzZoom()/0.7);
this.oncoprint.setHorzZoomCentered(this.oncoprint.getHorzZoom()/0.7);
},
onClickZoomOut:()=>{
this.oncoprint.setHorzZoom(this.oncoprint.getHorzZoom()*0.7);
this.oncoprint.setHorzZoomCentered(this.oncoprint.getHorzZoom()*0.7);
}
};
}
Expand Down
5 changes: 3 additions & 2 deletions src/shared/components/oncoprint/DeltaUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ function transitionClinicalTrack(
rule_set_params.legend_label = nextSpec.label;
rule_set_params.exclude_from_legend = !nextProps.showClinicalTrackLegends;
rule_set_params.na_legend_label = nextSpec.na_legend_label;
const clinicalTrackParams = {
const clinicalTrackParams:UserTrackSpec<any> = {
rule_set_params,
data: nextSpec.data,
data_id_key: "uid",
Expand All @@ -804,7 +804,8 @@ function transitionClinicalTrack(
init_sort_direction: 0 as 0,
target_group: CLINICAL_TRACK_GROUP_INDEX,
onSortDirectionChange: nextProps.onTrackSortDirectionChange,
custom_track_options: nextSpec.custom_options
custom_track_options: nextSpec.custom_options,
track_can_show_gaps: nextSpec.datatype === "string"
};
trackSpecKeyToTrackId[nextSpec.key] = oncoprint.addTracks([clinicalTrackParams])[0];
} else if (nextSpec && prevSpec) {
Expand Down
6 changes: 3 additions & 3 deletions src/shared/components/oncoprint/ResultsViewOncoprint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -659,13 +659,13 @@ export default class ResultsViewOncoprint extends React.Component<IResultsViewOn
}
},
onSetHorzZoom:(z:number)=>{
this.oncoprint.setHorzZoom(z);
this.oncoprint.setHorzZoomCentered(z);
},
onClickZoomIn:()=>{
this.oncoprint.setHorzZoom(this.oncoprint.getHorzZoom()/0.7);
this.oncoprint.setHorzZoomCentered(this.oncoprint.getHorzZoom()/0.7);
},
onClickZoomOut:()=>{
this.oncoprint.setHorzZoom(this.oncoprint.getHorzZoom()*0.7);
this.oncoprint.setHorzZoomCentered(this.oncoprint.getHorzZoom()*0.7);
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1279,6 +1279,7 @@ export default class OncoprintControls extends React.Component<
onClick={this.toggleShowMinimap}
>
<img
data-test="ShowMinimapButton"
src={require('./toggle-minimap.svg')}
alt="icon"
style={{ width: 15, height: 15 }}
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10715,10 +10715,10 @@ oncokb-styles@~0.1.0:
resolved "https://registry.yarnpkg.com/oncokb-styles/-/oncokb-styles-0.1.0.tgz#3a67a03dbdf6ebdde497c77451fef167afe00c4f"
integrity sha512-4vhF2Q5hAbOyKWlstA/AItd33cnXbp/Z1Zluxnlc7u0Dz6GnqnrZFK/upUleT4CTES6k5+QWT4Zv95+l5FL0hg==

oncoprintjs@4.0.8:
version "4.0.8"
resolved "https://registry.yarnpkg.com/oncoprintjs/-/oncoprintjs-4.0.8.tgz#03d586ea45c415805d952ddeb6fc5399a9e4737b"
integrity sha512-wSl9je+fEgitLRydOKae1gftKCB0XRv5oqbNYE9+Y1inLYj7RUVqDKTBS+HaYaAFD+vmEVoTPTtboRpiE5obQw==
oncoprintjs@4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/oncoprintjs/-/oncoprintjs-4.1.1.tgz#c9afd6fb3b05afc9b3b8e66b08bf992ce91be377"
integrity sha512-5uoWHWgtSIQn27tBRcI3Moh7yG4ZBoDr76/osvFC8BIEB1vZ1Ikc3kNoqrXEZcTubtrvLqWPXj5xV999wMcD1Q==
dependencies:
gl-matrix "2.3.2"
jquery "^3.0.0"
Expand Down

0 comments on commit e8a6bca

Please sign in to comment.