public void run() { if (main.getBioPAXModel() == null) { MessageDialog.openError(main.getShell(), "Error!", "Load or query a BioPAX model first!"); return; } // open dialog CompartmentQueryParamWithEntitiesDialog dialog = new CompartmentQueryParamWithEntitiesDialog(main); options = dialog.open(options); if (!options.isCancel()) { options.setCancel(true); } else { return; } // Source and target node sets Set<String> source = new HashSet<String>(dialog.getSourceAddedCompartments()); Set<String> target = new HashSet<String>(dialog.getTargetAddedCompartments()); Set<BioPAXElement> result = QueryExecuter.runPathsFromTo( BioPAXUtil.getElementsAtLocations(main.getBioPAXModel(), source), BioPAXUtil.getElementsAtLocations(main.getBioPAXModel(), target), main.getBioPAXModel(), options.getLimitType() ? LimitType.NORMAL : LimitType.SHORTEST_PLUS_K, options.getLengthLimit()); viewAndHighlightResult(result, options.isCurrentView(), "Query Result"); }
/** * Create shell for query dialogs * * @param opt */ protected void createContents(QueryOptionsPack opt) { shell = new Shell(getParent(), SWT.RESIZE | SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); // Information is added as the first thing into each query dialog. infoLabel = new Label(shell, SWT.NONE); GridData gridData = new GridData(GridData.FILL, GridData.FILL, false, false); // Maximum span within all different query dialogs gridData.horizontalSpan = 8; gridData.verticalSpan = 6; infoLabel.setLayoutData(gridData); if (forSIF) selectedTypes = opt.getSifTypes(); }
/** After clicking execute button, all data in dialog is saved to GoIOptionsPack */ public void storeValuesToOptionsPack(QueryOptionsPack opt) { // store Length Limit opt.setLengthLimit(Integer.parseInt(lengthLimit.getText())); // if currentView is selected if (currentViewButton.getSelection()) { opt.setCurrentView(true); } // if newView is selected else { opt.setCurrentView(false); } if (downstreamButton != null) { // if downstream is selected if (downstreamButton.getSelection()) { opt.setDownstream(true); opt.setUpstream(false); } // if upstream is selected else if (upstreamButton.getSelection()) { opt.setDownstream(false); opt.setUpstream(true); } // if both is selected else { opt.setDownstream(true); opt.setUpstream(true); } } // store stop distance according to user's selection if (shortestPlusKButton != null) { opt.setLimitType(!shortestPlusKButton.getSelection()); opt.setShortestPlusKLimit(Integer.parseInt(shortestPlusK.getText())); } // if strict is selected. if (strictButton != null && strictButton.getSelection()) { opt.setStrict(true); } else { opt.setStrict(false); } if (sourceST != null) opt.setSourceList(sourceST.getSymbols()); if (targetST != null) opt.setTargetList(targetST.getSymbols()); if (forSIF) { opt.setSifTypes(selectedTypes); } }
/** * After creating the dialog box, initial values are assigned to the fields with data in opt * OptionsPack */ public void setInitialValues(QueryOptionsPack opt) { if (main.getPathwayGraph() == null) { newViewButton.setSelection(true); currentViewButton.setSelection(false); currentViewButton.setEnabled(false); opt.setCurrentView(false); } if (opt.isCurrentView()) { currentViewButton.setSelection(true); } else { newViewButton.setSelection(true); } lengthLimit.setText(String.valueOf(opt.getLengthLimit())); if (sourceST != null && opt.getSourceList() != null) { sourceST.symbolText.setText(opt.getOneStringSources()); } if (targetST != null && opt.getTargetList() != null) { targetST.symbolText.setText(opt.getOneStringTargets()); } if (downstreamButton != null) { // Downstream, Upstream or Both if (opt.isDownstream() && opt.isUpstream() && bothButton != null) { bothButton.setSelection(true); } else if (opt.isDownstream()) { downstreamButton.setSelection(true); } else if (opt.isUpstream()) { upstreamButton.setSelection(true); } } if (strictButton != null) { // Strict if (opt.isStrict()) { strictButton.setSelection(true); } } // Set both texts' values if (shortestPlusK != null) { shortestPlusK.setText(String.valueOf(opt.getShortestPlusKLimit())); } if (shortestPlusKButton != null) { shortestPlusKButton.setSelection(!opt.getLimitType()); } }