Skip to content

Commit

Permalink
Allow numeric data type for custom data charts
Browse files Browse the repository at this point in the history
  • Loading branch information
TJMKuijpers committed Mar 28, 2023
1 parent 7ced3b6 commit 9239879
Show file tree
Hide file tree
Showing 11 changed files with 675 additions and 72 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions end-to-end-test/local/specs/core/studyview.screenshot.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const ADD_CHART_X_VS_Y_TAB = '.addChartTabs a.tabAnchor_X_Vs_Y';
const WAIT_FOR_VISIBLE_TIMEOUT = 30000;
const MUTATIONS_GENES_TABLE = "[data-test='mutations-table']";
const CANCER_GENE_FILTER_ICON = "[data-test='header-filter-icon']";
const ADD_CUSTOM_CHART_TAB = '.addChartTabs a.tabAnchor.tabAnchor_Custom_Data';

describe('study view generic assay categorical/binary features', function() {
it('generic assay pie chart should be added in the summary tab', () => {
Expand Down Expand Up @@ -79,6 +80,47 @@ describe('study view generic assay categorical/binary features', function() {
});
});

describe('Test the Custom data tab', function() {
it('Add custom data tab should have numerical and categorical selector', () => {
const url = `${CBIOPORTAL_URL}/study?id=lgg_ucsf_2014_test_generic_assay`;
goToUrlAndSetLocalStorage(url, true);
waitForNetworkQuiet();

$(ADD_CHART_BUTTON).waitForDisplayed({
timeout: WAIT_FOR_VISIBLE_TIMEOUT,
});
$(ADD_CHART_BUTTON).click();

waitForNetworkQuiet();
// Change to custom tab
$(ADD_CUSTOM_CHART_TAB).waitForDisplayed({
timeout: WAIT_FOR_VISIBLE_TIMEOUT,
});
$(ADD_CUSTOM_CHART_TAB).click();
const res = browser.checkElement('div.msk-tab.custom');
assertScreenShotMatch(res);
});
it('Selecting numerical for custom data should return a bar chart', () => {
const url = `${CBIOPORTAL_URL}/study?id=lgg_ucsf_2014_test_generic_assay`;
goToUrlAndSetLocalStorage(url, true);
waitForNetworkQuiet();

$(ADD_CHART_BUTTON).waitForDisplayed({
timeout: WAIT_FOR_VISIBLE_TIMEOUT,
});
$(ADD_CHART_BUTTON).click();

waitForNetworkQuiet();
// Change to custom tab
$(ADD_CUSTOM_CHART_TAB).waitForDisplayed({
timeout: WAIT_FOR_VISIBLE_TIMEOUT,
});
$(ADD_CUSTOM_CHART_TAB).click();
CUSTOM_CHART_TAB = $('div.msk-tab.custom');
// Add values to the input form
});
});

describe('study view x vs y charts', () => {
const X_VS_Y_CHART = `div[data-test="chart-container-X-VS-Y-AGE-MUTATION_COUNT"]`;
const X_VS_Y_HAMBURGER_ICON = `${X_VS_Y_CHART} [data-test="chart-header-hamburger-icon"]`;
Expand Down
4 changes: 2 additions & 2 deletions env/custom.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#export CBIOPORTAL_URL="http://localhost:8080"
#export GENOME_NEXUS_URL="https://www.genomenexus.org"
export CBIOPORTAL_URL="http://localhost:8081"
export GENOME_NEXUS_URL="https://www.genomenexus.org"
Original file line number Diff line number Diff line change
Expand Up @@ -2476,6 +2476,97 @@ export default class CBioPortalAPIInternal {
return response.body;
});
};

fetchCustomDataBinCountsUsingPOSTURL(parameters: {
'clinicalDataBinCountFilter': ClinicalDataBinCountFilter,
'dataBinMethod' ? : "DYNAMIC" | "STATIC",
$queryParameters ? : any
}): string {
let queryParameters: any = {};
let path = '/custom-data-bin-counts/fetch';

if (parameters['dataBinMethod'] !== undefined) {
queryParameters['dataBinMethod'] = parameters['dataBinMethod'];
}

if (parameters.$queryParameters) {
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
var parameter = parameters.$queryParameters[parameterName];
queryParameters[parameterName] = parameter;
});
}
let keys = Object.keys(queryParameters);
return this.domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '');
};

/**
* Fetch custom data bin counts by study view filter
* @method
* @name CBioPortalAPIInternal#fetchCustomDataBinCountsUsingPOST
* @param {} clinicalDataBinCountFilter - Clinical data bin count filter
* @param {string} dataBinMethod - Method for data binning
*/
fetchCustomDataBinCountsUsingPOSTWithHttpInfo(parameters: {
'clinicalDataBinCountFilter': ClinicalDataBinCountFilter,
'dataBinMethod' ? : "DYNAMIC" | "STATIC",
$queryParameters ? : any,
$domain ? : string
}): Promise < request.Response > {
const domain = parameters.$domain ? parameters.$domain : this.domain;
const errorHandlers = this.errorHandlers;
const request = this.request;
let path = '/custom-data-bin-counts/fetch';
let body: any;
let queryParameters: any = {};
let headers: any = {};
let form: any = {};
return new Promise(function(resolve, reject) {
headers['Accept'] = 'application/json';
headers['Content-Type'] = 'application/json';

if (parameters['clinicalDataBinCountFilter'] !== undefined) {
body = parameters['clinicalDataBinCountFilter'];
}

if (parameters['clinicalDataBinCountFilter'] === undefined) {
reject(new Error('Missing required parameter: clinicalDataBinCountFilter'));
return;
}

if (parameters['dataBinMethod'] !== undefined) {
queryParameters['dataBinMethod'] = parameters['dataBinMethod'];
}

if (parameters.$queryParameters) {
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
var parameter = parameters.$queryParameters[parameterName];
queryParameters[parameterName] = parameter;
});
}

request('POST', domain + path, body, headers, queryParameters, form, reject, resolve, errorHandlers);

});
};

/**
* Fetch custom data bin counts by study view filter
* @method
* @name CBioPortalAPIInternal#fetchCustomDataBinCountsUsingPOST
* @param {} clinicalDataBinCountFilter - Clinical data bin count filter
* @param {string} dataBinMethod - Method for data binning
*/
fetchCustomDataBinCountsUsingPOST(parameters: {
'clinicalDataBinCountFilter': ClinicalDataBinCountFilter,
'dataBinMethod' ? : "DYNAMIC" | "STATIC",
$queryParameters ? : any,
$domain ? : string
}): Promise < Array < ClinicalDataBin >
> {
return this.fetchCustomDataBinCountsUsingPOSTWithHttpInfo(parameters).then(function(response: request.Response) {
return response.body;
});
};
fetchCustomDataCountsUsingPOSTURL(parameters: {
'clinicalDataCountFilter': ClinicalDataCountFilter,
$queryParameters ? : any
Expand Down
Loading

0 comments on commit 9239879

Please sign in to comment.