Пример #1
0
  public void unlinkModels() {
    int[] selRows = dataTable.getSelectedRows();
    for (int row : selRows) {
      PartitionData partition = options.dataPartitions.get(row);

      PartitionSubstitutionModel model = partition.getPartitionSubstitutionModel();
      if (!model.getName().equals(partition.getName())) {
        PartitionSubstitutionModel newModel = new PartitionSubstitutionModel(options, partition);
        partition.setPartitionSubstitutionModel(newModel);
      }
    }

    modelsChanged();

    fireDataChanged();
    repaint();
  }
Пример #2
0
  /**
   * Sets the components up according to the partition model - but does not layout the top level
   * options panel.
   */
  public void setOptions() {

    if (SiteModelsPanel.DEBUG) {
      String modelName = (model == null) ? "null" : model.getName();
      Logger.getLogger("dr.app.beauti").info("ModelsPanel.setModelOptions(" + modelName + ")");
    }

    if (model == null) {
      return;
    }

    int dataType = model.getDataType().getType();
    switch (dataType) {
      case DataType.NUCLEOTIDES:
        nucSubstCombo.setSelectedItem(model.getNucSubstitutionModel());
        frequencyCombo.setSelectedItem(model.getFrequencyPolicy());

        break;

      case DataType.AMINO_ACIDS:
        aaSubstCombo.setSelectedItem(model.getAaSubstitutionModel());

        break;

      case DataType.TWO_STATES:
      case DataType.COVARION:
        binarySubstCombo.setSelectedItem(model.getBinarySubstitutionModel());
        useAmbiguitiesTreeLikelihoodCheck.setSelected(model.isUseAmbiguitiesTreeLikelihood());

        break;

      case DataType.GENERAL:
        discreteTraitSiteModelCombo.setSelectedItem(model.getDiscreteSubstType());
        activateBSSVS.setSelected(model.isActivateBSSVS());
        break;

      case DataType.CONTINUOUS:
        continuousTraitSiteModelCombo.setSelectedItem(model.getContinuousSubstModelType());

        ContinuousComponentOptions component =
            (ContinuousComponentOptions)
                model.getOptions().getComponentOptions(ContinuousComponentOptions.class);

        latLongCheck.setSelected(model.isLatitudeLongitude());
        latLongCheck.setEnabled(model.getContinuousTraitCount() == 2);
        useLambdaCheck.setSelected(component.useLambda(model));
        break;
      case DataType.MICRO_SAT:
        microsatName.setText(model.getMicrosatellite().getName());
        microsatMax.setText(Integer.toString(model.getMicrosatellite().getMax()));
        microsatMin.setText(Integer.toString(model.getMicrosatellite().getMin()));
        shareMicroSatCheck.setSelected(model.getOptions().shareMicroSat);
        rateProportionCombo.setSelectedItem(model.getRatePorportion());
        mutationBiasCombo.setSelectedItem(model.getMutationBias());
        phaseCombo.setSelectedItem(model.getPhase());
        shareMicroSatCheck.setEnabled(
            model.getOptions().getPartitionSubstitutionModels(Microsatellite.INSTANCE).size() > 1);
        break;

      default:
        throw new IllegalArgumentException("Unknown data type");
    }

    if (model.isGammaHetero() && !model.isInvarHetero()) {
      heteroCombo.setSelectedIndex(1);
    } else if (!model.isGammaHetero() && model.isInvarHetero()) {
      heteroCombo.setSelectedIndex(2);
    } else if (model.isGammaHetero() && model.isInvarHetero()) {
      heteroCombo.setSelectedIndex(3);
    } else {
      heteroCombo.setSelectedIndex(0);
    }

    gammaCatCombo.setSelectedIndex(model.getGammaCategories() - 4);

    if (model.getCodonHeteroPattern() == null) {
      codingCombo.setSelectedIndex(0);
    } else if (model.getCodonHeteroPattern().equals("112")) {
      codingCombo.setSelectedIndex(1);
    } else {
      codingCombo.setSelectedIndex(2);
    }

    substUnlinkCheck.setSelected(model.isUnlinkedSubstitutionModel());
    heteroUnlinkCheck.setSelected(model.isUnlinkedHeterogeneityModel());
    freqsUnlinkCheck.setSelected(model.isUnlinkedFrequencyModel());

    dolloCheck.setSelected(model.isDolloModel());
  }