Search in sources :

Example 1 with ContinuousComponentOptions

use of dr.app.beauti.components.continuous.ContinuousComponentOptions in project beast-mcmc by beast-dev.

the class PartitionModelPanel method setOptions.

/**
     * 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.getDiscreteSubstType() != DiscreteSubstModelType.GLM_SUBST ? model.isActivateBSSVS() : false);
            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());
}
Also used : ContinuousComponentOptions(dr.app.beauti.components.continuous.ContinuousComponentOptions)

Example 2 with ContinuousComponentOptions

use of dr.app.beauti.components.continuous.ContinuousComponentOptions in project beast-mcmc by beast-dev.

the class BeautiOptions method updateTraitParameters.

private void updateTraitParameters(AbstractPartitionData partition) {
    if (partition.isCreatedFromTrait()) {
        ContinuousComponentOptions comp = (ContinuousComponentOptions) getComponentOptions(ContinuousComponentOptions.class);
        comp.createParameters(this);
        DiscreteTraitsComponentOptions comp2 = (DiscreteTraitsComponentOptions) getComponentOptions(DiscreteTraitsComponentOptions.class);
        comp2.createParameters(this);
        AncestralStatesComponentOptions comp3 = (AncestralStatesComponentOptions) getComponentOptions(AncestralStatesComponentOptions.class);
        comp3.setReconstructAtNodes(partition, true);
        comp3.setReconstructAtMRCA(partition, false);
    }
}
Also used : DiscreteTraitsComponentOptions(dr.app.beauti.components.discrete.DiscreteTraitsComponentOptions) ContinuousComponentOptions(dr.app.beauti.components.continuous.ContinuousComponentOptions) AncestralStatesComponentOptions(dr.app.beauti.components.ancestralstates.AncestralStatesComponentOptions)

Aggregations

ContinuousComponentOptions (dr.app.beauti.components.continuous.ContinuousComponentOptions)2 AncestralStatesComponentOptions (dr.app.beauti.components.ancestralstates.AncestralStatesComponentOptions)1 DiscreteTraitsComponentOptions (dr.app.beauti.components.discrete.DiscreteTraitsComponentOptions)1