private void networkComboBoxActionPerformed(java.awt.event.ActionEvent evt) { if (this.networkComboBox.getSelectedObjects().length == 0 || !this.networkComboBox.isEnabled()) { return; } if (numberComboBox.isVisible()) { if (networkComboBox.getSelectedItem().toString().compareToIgnoreCase("<Select Population>") == 0 || networkComboBox.getSelectedItem().toString().compareToIgnoreCase("<Select Network>") == 0) { return; } else { Project project = Model.getInstance().getProject(this.projectComboBox.getSelectedItem().toString()); MarkerSet m = project.getMarker(markerSetComboBox.getSelectedItem().toString()); Population p = m.getPopulation(networkComboBox.getSelectedItem().toString()); if (p.isStructureGenerated()) { numberComboBox.setEnabled(true); numberComboBox.removeAllItems(); for (int n = 2; n < 11; n++) { numberComboBox.addItem(n); } } else { numberComboBox.removeAllItems(); numberComboBox.addItem(p.getTotPopIfUserGen()); numberComboBox.setEnabled(false); } } } }
/** * Checks conditions and starts the algorithm. * * @param evt */ private void runButtonActionPerformed(java.awt.event.ActionEvent evt) { if (this.projectComboBox.getSelectedItem().equals("")) { UIMessages.showErrorMessage("Please select a project", "Error"); return; } if (this.traitSetComboBox.getSelectedIndex() < 0) { UIMessages.showErrorMessage("Please select a trait option", "Error"); return; } String projectName = projectComboBox.getSelectedItem().toString(); String traitName = traitSetComboBox.getSelectedItem().toString(); String markerName = markerSetComboBox.getSelectedItem().toString(); Project ap = Model.getInstance().getProject(projectName); TraitSet ts = ap.getTrait(traitName); MarkerSet ms = ap.getMarker(markerName); if (this.algorithmComboBox.getSelectedIndex() < 0 && !this.loadAssociationRadioButton.isSelected()) { UIMessages.showErrorMessage("Please select an algorithm", "Error"); return; } if (this.algorithmComboBox.getSelectedItem().equals("Adaptive Multi-Task Lasso")) { ArrayList<String> where = new ArrayList<String>(); where.add("markersetid = " + ms.getId()); if (Integer.parseInt( DataManager.runSelectQuery("count(*)", "feature", true, where, null).get(0)) < 1) { UIMessages.showErrorMessage("Selected marker set does not have features", "Error"); return; } } if (this.markerSetComboBox.getSelectedIndex() < 0) { UIMessages.showErrorMessage("Please select a marker", "Error"); return; } if (this.networkComboBox.getSelectedIndex() < 0 && this.networkComboBox.isEnabled()) { UIMessages.showErrorMessage( "Please select a valid network option for selected algorithm", "Error"); return; } if (this.networkComboBox.getSelectedIndex() < 0 && this.networkComboBox.isEnabled()) { UIMessages.showErrorMessage( "Please select a valid Population option for selected algorithm", "Error"); return; } if (this.numberComboBox.isEnabled() && this.numberComboBox.getSelectedIndex() < 0) { UIMessages.showErrorMessage( "Please select a valid Population option for this algorithm", "Error"); return; } if (this.nameTextField.getText().equals("")) { UIMessages.showErrorMessage("Please specify a valid name", "Error"); return; } if (Model.getInstance() .getProject(projectComboBox.getSelectedItem().toString()) .isAssocNamePresentInProject(this.nameTextField.getText())) { UIMessages.showErrorMessage("Specified name already exists for this project", "Error"); return; } String networkName = this.networkComboBox.getSelectedItem().toString(); String algoName = this.algorithmComboBox.getSelectedItem().toString(); String popno = this.numberComboBox.getSelectedItem().toString(); if (!this.numberComboBox.isEnabled()) { popno = "1"; } algoName = (algoName.equals("")) ? null : algoName; Network net = (Network) ts.getTraitStructure(networkName); if (ts.getNetworks().size() == 0) // without a network, we will be unable // to view this visualization, so we add it here. { try { view.addAlgorithm( Algorithms.NetworkAlgorithms.algonames().get(0), Algorithms.NetworkAlgorithms.jobTypeID().get(0), ap.getId(), ts.getId(), ms.getId()); } catch (Exception e) { } } if (this.createAssociationRadioButton.isSelected()) { int structtype = algorithmComboBox.getSelectedIndex() < 0 ? -1 : Algorithms.AssociationAlgorithms.inputStructure() .get(algorithmComboBox.getSelectedIndex()); IOFilesForIOLasso ioffio = null; if (structtype == 3) { ioffio = new IOFilesForIOLasso(currentComponentReference); ioffio.setVisible(true); if (ioffio.getInputFilePath() == null || ioffio.getInputFilePath().length() < 5 || ioffio.getOutputFilePath() == null || ioffio.getOutputFilePath().length() < 5) { UIMessages.showErrorMessage("I/O Lasso needs valid group files", "Error"); return; } } AssociationParameterObject apo = new AssociationParameterObject( (Network) ts.getTraitStructure(networkName), this.nameTextField.getText(), ms.getPopulation(networkName), popno, ioffio); int idx = this.algorithmComboBox.getSelectedIndex() - 1; view.addAlgorithm( Algorithms.AssociationAlgorithms.algonames().get(idx), Algorithms.AssociationAlgorithms.jobTypeID().get(idx), ap.getId(), ts.getId(), ms.getId(), apo); } else { DataAddRemoveHandler.getInstance() .addAssociation( ap.getId(), ts, ms, this.nameTextField.getText(), this.associationFilePathTextField.getText(), null); } this.dispose(); }