diff --git a/app/js/app-menu.js b/app/js/app-menu.js index 4d4aafd7a..2a0aa87a5 100644 --- a/app/js/app-menu.js +++ b/app/js/app-menu.js @@ -390,9 +390,11 @@ module.exports = function() { $("#import-experimental-data").click(function () { $("#overlay-data").trigger('click'); }); + $("#import-SBML-file").click(function () { $("#sbml-file").trigger('click'); }); + $("#import-simple-af-file").click(function () { $("#simple-af-file-input").trigger('click'); }); @@ -409,6 +411,10 @@ module.exports = function() { $("#sif-layout-input").trigger('click'); }); + $("#import-GPML-file").click(function () { + $("#gpml-file-input").trigger('click'); + }); + $("#overlay-data").change(function () { var chiseInstance = appUtilities.getActiveChiseInstance(); var cy = appUtilities.getActiveCy(); @@ -488,6 +494,34 @@ module.exports = function() { $(this).val(""); } }); + + $("#gpml-file-input").change(function () { + + var chiseInstance = appUtilities.getActiveChiseInstance(); + var cy = appUtilities.getActiveCy(); + if ($(this).val() != "") { + var file = this.files[0]; + appUtilities.setFileContent(file.name); + chiseInstance.loadGpml(file, success = function(data){ + if (cy.elements().length !== 0) { + promptConfirmationView.render(function () { + chiseInstance.loadSBGNMLText(data.message, false, file.name, cy); + }); + } + else { + chiseInstance.loadSBGNMLText(data.message, false, file.name, cy); + } + }, + error = function(data){ + promptFileConversionErrorView.render(); + document.getElementById("file-conversion-error-message").innerText = "Conversion service is not available!"; + + }); + + $(this).val(""); + } + }); + $("#simple-af-file-input").change(function () { var chiseInstance = appUtilities.getActiveChiseInstance(); @@ -1454,14 +1488,19 @@ module.exports = function() { $("#export-as-sbgnml-plain-file").click(function (evt) { fileSaveView.render("sbgn", "plain"); }); + $("#export-as-sbgnml3-plain-file").click(function (evt) { fileSaveView.render("sbgn", "plain3"); }); - $("#export-as-sbml").click(function (evt) { - fileSaveView.render("sbml", null, null); - + $("#export-as-sbml").click(function (evt) { + fileSaveView.render("sbml", null, null); }); + + $("#export-as-gpml").click(function (evt) { + fileSaveView.render("gpml", null, null); + }); + $("#add-complex-for-selected").click(function (e) { // use active chise instance diff --git a/app/js/app-utilities.js b/app/js/app-utilities.js index eac17c3e2..3ea0438d2 100644 --- a/app/js/app-utilities.js +++ b/app/js/app-utilities.js @@ -2647,16 +2647,30 @@ appUtilities.launchWithModelFile = function() { loadFcn(); } - + if (fileExtension === "gpml") { + chiseInstance.loadGpml(file, success = async function (data) { + if (cyInstance.elements().length !== 0) { + promptConfirmationView.render( function () { + chiseInstance.loadSBGNMLText(data, false, filename, cy, paramObj); + chiseInstance.endSpinner('paths-byURL-spinner'); + }); + + chiseInstance.endSpinner("paths-byURL-spinner"); + } + else { + await chiseInstance.loadSBGNMLText(data.message, false, filename, cy, paramObj); + chiseInstance.endSpinner("paths-byURL-spinner"); + } + }); + } else if (fileExtension === "xml" || fileExtension === "sbml") { - // CD file if (xmlObject.children.item(0).getAttribute('xmlns:celldesigner')) { chiseInstance.loadCellDesigner(file, success = async function (data) { if (cyInstance.elements().length !== 0) { - promptConfirmationView.render( function () { - chiseInstance.loadSBGNMLText(data, false, filename, cy, paramObj); - chiseInstance.endSpinner('paths-byURL-spinner') + promptConfirmationView.render( function () { + chiseInstance.loadSBGNMLText(data, false, filename, cy, paramObj); + chiseInstance.endSpinner('paths-byURL-spinner'); }); chiseInstance.endSpinner("paths-byURL-spinner"); @@ -2674,18 +2688,14 @@ appUtilities.launchWithModelFile = function() { await promptConfirmationView.render(async function () { await chiseInstance.loadSBGNMLText(data.message, false, filename, cy, paramObj); }); - chiseInstance.endSpinner('paths-byURL-spinner') - + chiseInstance.endSpinner('paths-byURL-spinner'); } else { - await chiseInstance.loadSBGNMLText(data.message, false, filename, cy, paramObj); - chiseInstance.endSpinner('paths-byURL-spinner') - - + await chiseInstance.loadSBGNMLText(data.message, false, filename, cy, paramObj); + chiseInstance.endSpinner('paths-byURL-spinner'); } }); } - } else { await chiseInstance.loadNwtFile(file, loadCallbackSBGNMLValidity, loadCallbackInvalidityWarning, paramObj); diff --git a/app/js/backbone-views.js b/app/js/backbone-views.js index c111332ec..c4dc4394e 100644 --- a/app/js/backbone-views.js +++ b/app/js/backbone-views.js @@ -2595,6 +2595,9 @@ var FileSaveView = Backbone.View.extend({ case 'sbml': fExt = 'sbml' break; + case 'gpml': + fExt = 'gpml' + break; case 'sif': fExt = 'sif' break; @@ -2712,6 +2715,16 @@ var FileSaveView = Backbone.View.extend({ }); } + else if(fileformat === "gpml") + { + chiseInstance.saveAsGpml(filename, function(data,errorMessage){ + + var promptSbmlConversionErrorView = new PromptSbmlConversionErrorView({el: '#prompt-sbmlConversionError-table'}); + promptSbmlConversionErrorView.render(data,errorMessage); + //document.getElementById("file-conversion-error-message").innerText = "Conversion service is not available!"; + }); + + } else if(fileformat === "sif") { chiseInstance.saveAsPlainSif( filename, true ); diff --git a/index.html b/index.html index 734845e17..7dc190970 100644 --- a/index.html +++ b/index.html @@ -102,12 +102,14 @@ +
  • Simple AF
  • SIF
  • SIF Style
  • SIF Layout
  • SBML
  • CellDesigner
  • +
  • GPML
  • SIF Layout
  • SBML
  • CellDesigner
  • +
  • GPML