Esempio n. 1
0
  public boolean queryOptions() {
    if (!okToInteractWithUser(
        CAN_PROCEED_ANYWAY,
        "Querying Options")) // Debugg.println needs to check that options set well enough to
                             // proceed anyway
    return true;
    boolean closeWizard = false;

    if ((MesquiteTrunk.isMacOSXBeforeSnowLeopard()) && MesquiteDialog.currentWizard == null) {
      CommandRecord cRec = null;
      cRec = MesquiteThread.getCurrentCommandRecordDefIfNull(null);
      if (cRec != null) {
        cRec.requestEstablishWizard(true);
        closeWizard = true;
      }
    }

    MesquiteInteger buttonPressed = new MesquiteInteger(1);

    queryOptionsDialog =
        new ExtensibleDialog(
            containerOfModule(),
            "TNT Options & Locations",
            buttonPressed); // MesquiteTrunk.mesquiteTrunk.containerOfModule()
    //		queryOptionsDialog.addLabel("TNT - Options and Locations");
    String helpString =
        "This module will prepare a matrix for TNT, and ask TNT do to an analysis.  A command-line version of TNT must be installed. "
            + "You can ask it to do a bootstrap analysis or not. "
            + "Mesquite will read in the trees found by TNT. ";

    queryOptionsDialog.appendToHelpString(helpString);
    queryOptionsDialog.setHelpURL(zephyrRunnerEmployer.getProgramURL());

    MesquiteTabbedPanel tabbedPanel = queryOptionsDialog.addMesquiteTabbedPanel();

    tabbedPanel.addPanel("TNT Program Details", true);
    externalProcRunner.addItemsToDialogPanel(queryOptionsDialog);
    Checkbox parallelCheckBox =
        queryOptionsDialog.addCheckBox("use PVM for parallel processing", parallel);
    parallelCheckBox.addItemListener(this);
    IntegerField slavesField =
        queryOptionsDialog.addIntegerField(
            "Number of Slaves", numSlaves, 4, 0, MesquiteInteger.infinite);
    IntegerField maxRamField =
        queryOptionsDialog.addIntegerField("mxram value", mxram, 4, 0, MesquiteInteger.infinite);

    tabbedPanel.addPanel("Search Options", true);
    Choice searchStyleChoice = null;
    if (bootstrapAllowed)
      searchStyleChoice =
          queryOptionsDialog.addPopUpMenu(
              "Type of search/resampling:",
              new String[] {
                "Regular Search",
                "Bootstrap",
                "Jackknife",
                "Symmetric Resampled",
                "Poisson Bootstrap"
              },
              searchStyle);
    queryOptionsDialog.addLabel("Regular Search Commands");
    searchField = queryOptionsDialog.addTextAreaSmallFont(searchArguments, 7, 80);
    searchScriptPathField =
        queryOptionsDialog.addTextField(
            "Path to TNT run file containing search commands", searchScriptPath, 40);
    Button browseSearchScriptPathButton =
        queryOptionsDialog.addAListenedButton("Browse...", null, this);
    browseSearchScriptPathButton.setActionCommand("browseSearchScript");
    harvestOnlyStrictConsensusBox =
        queryOptionsDialog.addCheckBox("only acquire strict consensus", harvestOnlyStrictConsensus);
    queryOptionsDialog.addHorizontalLine(1);
    //		Checkbox doBootstrapBox = queryOptionsDialog.addCheckBox("do bootstrapping", doBootstrap);
    if (bootstrapAllowed) {
      bootStrapRepsField =
          queryOptionsDialog.addIntegerField(
              "Resampling Replicates", bootstrapreps, 8, 0, MesquiteInteger.infinite);
      queryOptionsDialog.addLabel("Resampling Search Commands");
      bootstrapSearchField =
          queryOptionsDialog.addTextAreaSmallFont(bootstrapSearchArguments, 7, 80);
      bootSearchScriptPathField =
          queryOptionsDialog.addTextField(
              "Path to TNT run file containing search commands for resampled",
              bootSearchScriptPath,
              30);
      Button browseBootSearchScriptPathButton =
          queryOptionsDialog.addAListenedButton("Browse...", null, this);
      browseSearchScriptPathButton.setActionCommand("browseBootSearchScript");
      resamplingAllConsensusTreesBox =
          queryOptionsDialog.addCheckBox(
              "allow TNT to calculate consensus tree", !resamplingAllConsensusTrees);
    }

    adjustDialogText();
    queryOptionsDialog.addHorizontalLine(1);
    queryOptionsDialog.addNewDialogPanel();
    useDefaultsButton = queryOptionsDialog.addAListenedButton("Set to Defaults", null, this);
    useDefaultsButton.setActionCommand("setToDefaults");

    tabbedPanel.addPanel("Other Options", true);
    convertGapsBox =
        queryOptionsDialog.addCheckBox(
            "convert gaps to missing (to avoid gap=extra state)", convertGapsToMissing);
    queryOptionsDialog.addHorizontalLine(1);
    queryOptionsDialog.addLabel("Post-Search TNT Commands");
    otherOptionsField = queryOptionsDialog.addTextAreaSmallFont(otherOptions, 7, 80);
    queryOptionsDialog.addHorizontalLine(1);
    queryOptionsDialog.addNewDialogPanel();
    useDefaultsOtherOptionsButton =
        queryOptionsDialog.addAListenedButton("Set to Defaults", null, this);
    useDefaultsOtherOptionsButton.setActionCommand("setToDefaultsOtherOptions");

    tabbedPanel.cleanup();
    queryOptionsDialog.nullifyAddPanel();

    queryOptionsDialog.completeAndShowDialog("Search", "Cancel", null, null);

    if (buttonPressed.getValue() == 0) {
      boolean infererOK = (treeInferer == null || treeInferer.optionsChosen());
      if (externalProcRunner.optionsChosen() && infererOK) {
        if (bootstrapAllowed) {
          bootstrapreps = bootStrapRepsField.getValue();
          bootstrapSearchArguments = bootstrapSearchField.getText();
          bootSearchScriptPath = bootSearchScriptPathField.getText();
          harvestOnlyStrictConsensus = harvestOnlyStrictConsensusBox.getState();
          resamplingAllConsensusTrees = !resamplingAllConsensusTreesBox.getState();
          searchStyle = searchStyleChoice.getSelectedIndex();
        }
        numSlaves = slavesField.getValue();
        otherOptions = otherOptionsField.getText();
        convertGapsToMissing = convertGapsBox.getState();
        parallel = parallelCheckBox.getState();
        //				doBootstrap = doBootstrapBox.getState();
        searchArguments = searchField.getText();
        searchScriptPath = searchScriptPathField.getText();
        mxram = maxRamField.getValue();

        storeRunnerPreferences();
      }
    }
    queryOptionsDialog.dispose();
    if (closeWizard) MesquiteDialog.closeWizard();

    return (buttonPressed.getValue() == 0);
  }