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 2c9ee1f commit c906aee
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 28 deletions.
46 changes: 31 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,22 @@ 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);

// open minimap just to see how it doesnt reflect the column gaps
browser.waitForExist('[data-test="ShowMinimapButton"]');
browser.click('[data-test="ShowMinimapButton"]');

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

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

describe("track group headers", function() {
Expand Down Expand Up @@ -153,21 +184,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.0",
"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.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/oncoprintjs/-/oncoprintjs-4.1.0.tgz#7f253f6235b1523e3ada8bb8960ad545696203af"
integrity sha512-RHJDoWOsfFt39j/bUidRARqMbGy9MJXN3Z7SaSl1oDE5E0VNwhBeZbCSuakTZJjTJkGeqqhqr30QhPDfrEHkJA==
dependencies:
gl-matrix "2.3.2"
jquery "^3.0.0"
Expand Down

0 comments on commit c906aee

Please sign in to comment.