当前位置: 首页>>代码示例>>Java>>正文


Java State类代码示例

本文整理汇总了Java中beast.core.State的典型用法代码示例。如果您正苦于以下问题:Java State类的具体用法?Java State怎么用?Java State使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


State类属于beast.core包,在下文中一共展示了State类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: MissingDataConstantIO

import beast.core.State; //导入依赖的package包/类
public MissingDataConstantIO() throws Exception {
    ploidy = 2.0;
    nSpecies = 4;
    expectedLogP = -10.956285249389675; // haven't checked this is the right answer

    state = new State();
    alphaParameter = new RealParameter();
    meanParameter = new RealParameter();

    alphaParameter.initByName("value", String.valueOf(alpha));
    meanParameter.initByName("value", String.valueOf(mean));
    
    newickSpeciesTree = "((s0:0.32057156677143211,s3:0.32057156677143211):1.2653250035015629,(s1:0.56540722294658641,s2:0.56540722294658641):1.0204893473264085)";
    newickGeneTrees.add("((((s0_tip1:0.3416660303037105,s3_tip0:0.3416660303037105):0.024561190897159135,s0_tip0:0.36622722120086965):0.0643095990846464,s3_tip1:0.43053682028551604):1.4201019862262891,(s2_tip0:0.19897724687831703,s2_tip1:0.19897724687831703):1.651661559633488)");
    newickGeneTrees.add("((s3_tip0:0.09482581277282173,s3_tip1:0.09482581277282173):1.6017973588278296,((s1_tip0:0.33170960882423645,s1_tip1:0.33170960882423645):0.29497523293318856,(s2_tip0:0.2908611340994834,s2_tip1:0.2908611340994834):0.3358237076579416):1.0699383298432266)");
}
 
开发者ID:genomescale,项目名称:starbeast2,代码行数:17,代码来源:MissingDataConstantIO.java

示例2: ConstantIOTest

import beast.core.State; //导入依赖的package包/类
public ConstantIOTest() throws Exception {
    ploidy = 2.0;
    nSpecies = 4;
    expectedLogP = -14.5233984762; // this should be the right answer (calculated by hand)

    state = new State();
    alphaParameter = new RealParameter();
    meanParameter = new RealParameter();

    alphaParameter.initByName("value", String.valueOf(alpha));
    meanParameter.initByName("value", String.valueOf(mean));

    newickSpeciesTree = "((s0:0.32057156677143211,s3:0.32057156677143211):1.2653250035015629,(s1:0.56540722294658641,s2:0.56540722294658641):1.0204893473264085)";
    newickGeneTrees.add("((((s0_tip1:0.3416660303037105,s3_tip0:0.3416660303037105):0.024561190897159135,s0_tip0:0.36622722120086965):0.0643095990846464,s3_tip1:0.43053682028551604):1.4201019862262891,((s1_tip0:0.14473698225381706,s1_tip1:0.14473698225381706):0.5135479407233198,(s2_tip0:0.19897724687831703,s2_tip1:0.19897724687831703):0.4593076760988198):1.1923538835346683)");
    newickGeneTrees.add("(((s0_tip0:0.04173231934154758,s0_tip1:0.04173231934154758):0.7845256741090114,(s3_tip0:0.09482581277282173,s3_tip1:0.09482581277282173):0.7314321806777372):0.8703651781500925,((s1_tip0:0.33170960882423645,s1_tip1:0.33170960882423645):0.29497523293318856,(s2_tip0:0.2908611340994834,s2_tip1:0.2908611340994834):0.3358237076579416):1.0699383298432266)");
}
 
开发者ID:genomescale,项目名称:starbeast2,代码行数:17,代码来源:ConstantIOTest.java

示例3: testRates

import beast.core.State; //导入依赖的package包/类
@Test
public void testRates() throws Exception {
    initializeTree();

    meanRateParameter = new RealParameter();
    stdevParameter = new RealParameter();
    branchRatesParameter = new IntegerParameter();

    meanRateParameter.initByName("value", String.valueOf(meanRate));
    stdevParameter.initByName("value", String.valueOf(1.0));
    branchRatesParameter.initByName("value", String.valueOf(initialBranchRate));

    // Create dummy state to allow statenode editing
    State state = new State();
    state.initByName("stateNode", meanRateParameter);
    state.initByName("stateNode", branchRatesParameter);
    state.initialise();

    clockModel = new UncorrelatedRates();
    clockModel.initByName("tree", testTree, "rates", branchRatesParameter, "stdev", stdevParameter, "estimateRoot", false, "clock.rate", meanRateParameter);

    initializeRates();
    checkRates();
}
 
开发者ID:genomescale,项目名称:starbeast2,代码行数:25,代码来源:UncorrelatedRatesTest.java

示例4: testCanOperate

import beast.core.State; //导入依赖的package包/类
@Test
public void testCanOperate() {
	// Test whether a validly initialised operator may make proposals
	State state = new State();
	RealParameter parameter = new RealParameter(new Double[] { 1., 1., 1., 1. });
	state.initByName("stateNode", parameter);
	state.initialise();
	DeltaExchangeOperator d = new DeltaExchangeOperator();
	// An invalid operator should either fail in initByName or make valid
	// proposals
	try {
		d.initByName("parameter", parameter);
	} catch (RuntimeException e) {
		return;
	}
	d.proposal();
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:18,代码来源:DeltaExchangeOperatorTest.java

示例5: testDDPointer

import beast.core.State; //导入依赖的package包/类
public void testDDPointer(){
    try{
    for(Instance test: tests){
        test.setup();
        DPPointer pointer = test.getDPPointer();
        ParameterList paramList =  test.getParameterList();
        State state = new State();

    state.initByName(
            "stateNode", pointer,
            "stateNode", paramList
    );
    state.initialise();

        operationEx1(pointer,paramList);
    }
    }catch(Exception e){
        throw new RuntimeException(e);

    }

}
 
开发者ID:jessiewu,项目名称:substBMA,代码行数:23,代码来源:DPPointerTest.java

示例6: NS

import beast.core.State; //导入依赖的package包/类
public NS(int chainLength, int preBurnin, int particleCount, int subChainLength, State state, List<Operator> operators, CompoundDistribution distribution, Double epsilon) {
	initByName("chainLength", chainLength, 
			"preBurnin", preBurnin, 
			"particleCount", particleCount,
			"subChainLength", subChainLength,
			"state", state,
			"operator", operators,
			"distribution", distribution,
			"epsilon", epsilon);
}
 
开发者ID:BEAST2-Dev,项目名称:nested-sampling,代码行数:11,代码来源:NS.java

示例7: testUniformity

import beast.core.State; //导入依赖的package包/类
public void testUniformity() throws Exception {
	Double[] m_parameters = new Double[length];
	Integer[] m_indices = new Integer[length];
	Integer[] m_sizes = new Integer[length];
	for (int i = 0; i < length; ++i) {
		m_parameters[i] = 1.;
		m_indices[i] = i;
		m_sizes[i] = 1;
	}
	StateNode parameters = new RealParameter(m_parameters);
	StateNode indices = new IntegerParameter(m_indices);
	StateNode sizes = new IntegerParameter(m_sizes);
	State state = new State();
	state.initByName("stateNode", parameters, "stateNode", indices,
			"stateNode", sizes);

	RescaledDirichlet rescaledDirichlet = new RescaledDirichlet();
	rescaledDirichlet.initByName("sizes", sizes);

	Distribution prior = new Prior();
	prior.initByName("x", parameters, "distr", rescaledDirichlet);

	Operator merger = new MergeOperator();
	merger.initByName("parameters", parameters, "groupings", indices,
			"sizes", sizes, "weight", 1.);
	Operator splitter = new SplitOperator();
	splitter.initByName("parameters", parameters, "groupings", indices,
			"sizes", sizes, "weight", 1.);

	// It would be nice to have a logger that could just write the results
	// into a list, so we can easily check the likelihood that this does
	// indeed form a uniform prior, and show how to analyse results.
	MCMC mcmc = new MCMC();
	mcmc.initByName("chainLength", 100000, "preBurnin", 1, "state", state,
			"distribution", prior, "operator", merger, "operator", splitter);

	mcmc.run();
	throw new RuntimeException("The core of this test remains unimplemented");
}
 
开发者ID:Anaphory,项目名称:correlatedcharacters,代码行数:40,代码来源:UniformTest.java

示例8: testRates

import beast.core.State; //导入依赖的package包/类
@Test
public void testRates() throws Exception {
    testTree = new TreeParser();
    testTree.initByName("newick", newickTree, "IsLabelledNewick", true);

    // Create dummy state to allow statenode editing
    State state = new State();
    state.initialise();

    treeLengthLogger = new TreeLengthLogger();
    treeLengthLogger.initByName("tree", testTree);
    final double computedLength = treeLengthLogger.getArrayValue();

    assertEquals(expectedLength, computedLength, allowedError);
}
 
开发者ID:genomescale,项目名称:starbeast2,代码行数:16,代码来源:TreeLengthLoggerTest.java

示例9: IncompatibleTreeTest

import beast.core.State; //导入依赖的package包/类
public IncompatibleTreeTest() throws Exception {
    popSize = 0.3;
    ploidy = 2.0;
    nSpecies = 8;
    expectedLogP = Double.NEGATIVE_INFINITY;

    state = new State();
    popsizeParameter = new RealParameter();

    newickSpeciesTree = "((T4:5.982015323363934,((T1:1.9435075796666423,T2:1.9435075796666423):2.031076829347149,T3:3.9745844090137914):2.007430914350143):1.9848867018863912,(((T5:0.021716110420807247,T7:0.021716110420807247):0.005999952952004395,T6:0.027716063372811642):0.0043842395682471905,T8:0.03210030294105883):7.934801722309267)";
    newickGeneTrees.add("((((((T1_1:0.579713480872118,(T2_1:0.05611562075920323,T2_2:0.05611562075920323):0.5235978601129148):0.08787237243508017,T1_2:0.6675858533071982):0.09003817632305622,T3_2:0.7576240296302544):0.7947472706863555,T3_1:1.55237130031661):0.9175463345004531,((T4_1:0.07822345639893319,T4_2:0.07822345639893319):1.9276398321493908,T8_1:2.005863288548324):0.464054346268739):0.7187520201759066,((((T5_1:0.04820585227227065,T5_2:0.04820585227227065):0.44158170738649616,T8_2:0.4897875596587668):0.03103744358250654,((T6_1:0.03361079557684876,T7_1:0.03361079557684876):0.006140006250793695,T7_2:0.03975080182764246):0.4810742014136309):1.0088148036996385,T6_2:1.5296398069409118):1.6590298480520578)");
    newickGeneTrees.add("(((T1_1:1.1016256770243424,(T2_1:0.19828874072367977,T3_2:0.19828874072367977):0.9033369363006627):1.2800224449580238,((T2_2:1.1639549747191034,T3_1:1.1639549747191034):0.6916011764687042,((((T5_1:0.10938777466296375,T7_2:0.10938777466296375):0.4116904771092121,(T6_1:0.48594284383657343,T8_2:0.48594284383657343):0.03513540793560238):0.6520597260635511,(T5_2:0.14642483340635992,(T6_2:0.1325524781224538,T7_1:0.1325524781224538):0.013872355283906124):1.0267131444293671):0.12025146840841128,T8_1:1.2933894462441382):0.5621667049436694):0.5260919707945586):1.2502348026420713,(T1_2:2.4985948064682164,(T4_1:0.023970638819853857,T4_2:0.023970638819853857):2.4746241676483627):1.133288118156221)");
}
 
开发者ID:genomescale,项目名称:starbeast2,代码行数:14,代码来源:IncompatibleTreeTest.java

示例10: testRates

import beast.core.State; //导入依赖的package包/类
@Test
public void testRates() throws Exception {
    TaxonSet speciesSuperSet = generateSuperset();
    initializeTrees(speciesSuperSet);

    meanRateParameter = new RealParameter();
    stdevParameter = new RealParameter();
    branchRatesParameter = new IntegerParameter();

    meanRateParameter.initByName("value", String.valueOf(meanRate));
    stdevParameter.initByName("value", String.valueOf(1.0));
    branchRatesParameter.initByName("value", String.valueOf(initialBranchRate));

    // Create dummy state to allow statenode editing
    State state = new State();
    state.initByName("stateNode", meanRateParameter);
    state.initByName("stateNode", branchRatesParameter);
    state.initialise();

    speciesTreeClock = new UncorrelatedRates();
    speciesTreeClock.initByName("tree", speciesTree, "rates", branchRatesParameter, "stdev", stdevParameter, "estimateRoot", true);
    initializeRates();

    geneTreeClock = new StarBeastClock();
    geneTreeClock.initByName("geneTree", geneTreeWrapper, "speciesTreeRates", speciesTreeClock, "clock.rate", meanRateParameter);
    checkRates();
}
 
开发者ID:genomescale,项目名称:starbeast2,代码行数:28,代码来源:StarbeastClockTest.java

示例11: LinearWithConstantRootTest

import beast.core.State; //导入依赖的package包/类
public LinearWithConstantRootTest() throws Exception {
    popSize = 0.3;
    ploidy = 2.0;
    nSpecies = 4;
    expectedLogP = 2.8879769759752225; // need to double check this at some point

    state = new State();
    tipPopSizesParameter = new RealParameter();
    topPopSizesParameter = new RealParameter();

    newickSpeciesTree = "((s0:0.32057156677143211,s3:0.32057156677143211):1.2653250035015629,(s1:0.56540722294658641,s2:0.56540722294658641):1.0204893473264085)";
    newickGeneTrees.add("((((s0_tip1:0.3416660303037105,s3_tip0:0.3416660303037105):0.024561190897159135,s0_tip0:0.36622722120086965):0.0643095990846464,s3_tip1:0.43053682028551604):1.4201019862262891,((s1_tip0:0.14473698225381706,s1_tip1:0.14473698225381706):0.5135479407233198,(s2_tip0:0.19897724687831703,s2_tip1:0.19897724687831703):0.4593076760988198):1.1923538835346683)");
    newickGeneTrees.add("(((s0_tip0:0.04173231934154758,s0_tip1:0.04173231934154758):0.7845256741090114,(s3_tip0:0.09482581277282173,s3_tip1:0.09482581277282173):0.7314321806777372):0.8703651781500925,((s1_tip0:0.33170960882423645,s1_tip1:0.33170960882423645):0.29497523293318856,(s2_tip0:0.2908611340994834,s2_tip1:0.2908611340994834):0.3358237076579416):1.0699383298432266)");
}
 
开发者ID:genomescale,项目名称:starbeast2,代码行数:15,代码来源:LinearWithConstantRootTest.java

示例12: ConstantPopulationTest

import beast.core.State; //导入依赖的package包/类
public ConstantPopulationTest() throws Exception {
    popSize = 0.3;
    ploidy = 2.0;
    nSpecies = 4;
    expectedLogP = 2.0784641098; // this should be the right answer (calculated by hand)

    state = new State();
    popsizeParameter = new RealParameter();

    newickSpeciesTree = "((s0:0.32057156677143211,s3:0.32057156677143211):1.2653250035015629,(s1:0.56540722294658641,s2:0.56540722294658641):1.0204893473264085)";
    newickGeneTrees.add("((((s0_tip1:0.3416660303037105,s3_tip0:0.3416660303037105):0.024561190897159135,s0_tip0:0.36622722120086965):0.0643095990846464,s3_tip1:0.43053682028551604):1.4201019862262891,((s1_tip0:0.14473698225381706,s1_tip1:0.14473698225381706):0.5135479407233198,(s2_tip0:0.19897724687831703,s2_tip1:0.19897724687831703):0.4593076760988198):1.1923538835346683)");
    newickGeneTrees.add("(((s0_tip0:0.04173231934154758,s0_tip1:0.04173231934154758):0.7845256741090114,(s3_tip0:0.09482581277282173,s3_tip1:0.09482581277282173):0.7314321806777372):0.8703651781500925,((s1_tip0:0.33170960882423645,s1_tip1:0.33170960882423645):0.29497523293318856,(s2_tip0:0.2908611340994834,s2_tip1:0.2908611340994834):0.3358237076579416):1.0699383298432266)");
}
 
开发者ID:genomescale,项目名称:starbeast2,代码行数:14,代码来源:ConstantPopulationTest.java

示例13: sample

import beast.core.State; //导入依赖的package包/类
@Override
public void sample(State state, Random random) {
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:4,代码来源:TreeDistribution.java

示例14: createDistribution

import beast.core.State; //导入依赖的package包/类
@Override
public List<Distribution> createDistribution(BeautiDoc doc) {
	MRCAPrior prior = new MRCAPrior();
    try {
	
        List<Tree> trees = new ArrayList<>();
        getDoc().scrubAll(true, false);
        State state = (State) doc.pluginmap.get("state");
        for (StateNode node : state.stateNodeInput.get()) {
            if (node instanceof Tree) { // && ((Tree) node).m_initial.get() != null) {
                trees.add((Tree) node);
            }
        }
        int treeIndex = 0;
        if (trees.size() > 1) {
            String[] treeIDs = new String[trees.size()];
            for (int j = 0; j < treeIDs.length; j++) {
                treeIDs[j] = trees.get(j).getID();
            }
            treeIndex = JOptionPane.showOptionDialog(null, "Select a tree", "MRCA selector",
                    JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null,
                    treeIDs, trees.get(0));
        }
        if (treeIndex < 0) {
            return null;
        }
        prior.treeInput.setValue(trees.get(treeIndex), prior);
        TaxonSet taxonSet = new TaxonSet();
	
        TaxonSetDialog dlg = new TaxonSetDialog(taxonSet, getTaxonCandidates(prior), doc);
        if (!dlg.showDialog() || dlg.taxonSet.getID() == null || dlg.taxonSet.getID().trim().equals("")) {
            return null;
        }
        taxonSet = dlg.taxonSet;
        if (taxonSet.taxonsetInput.get().size() == 0) {
        	JOptionPane.showMessageDialog(doc.beauti, "At least one taxon should be included in the taxon set",
        			"Error specifying taxon set", JOptionPane.ERROR_MESSAGE);
        	return null;
        }
        int i = 1;
        String id = taxonSet.getID();
        while (doc.pluginmap.containsKey(taxonSet.getID()) && doc.pluginmap.get(taxonSet.getID()) != taxonSet) {
        	taxonSet.setID(id + i);
        	i++;
        }
        BEASTObjectPanel.addPluginToMap(taxonSet, doc);
        prior.taxonsetInput.setValue(taxonSet, prior);
        prior.setID(taxonSet.getID() + ".prior");
        // this sets up the type
        prior.distInput.setValue(new OneOnX(), prior);
        // this removes the parametric distribution
        prior.distInput.setValue(null, prior);
	
        Logger logger = (Logger) doc.pluginmap.get("tracelog");
        logger.loggersInput.setValue(prior, logger);
    } catch (Exception e) {
        // TODO: handle exception
    }
    List<Distribution> selectedPlugins = new ArrayList<>();
    selectedPlugins.add(prior);
    g_collapsedIDs.add(prior.getID());
    return selectedPlugins;
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:64,代码来源:PriorListInputEditor.java

示例15: customConnector

import beast.core.State; //导入依赖的package包/类
public static void customConnector(BeautiDoc doc) {
	Object o0 = doc.pluginmap.get("prior");
	if (o0 != null && o0 instanceof CompoundDistribution) {
		CompoundDistribution p =  (CompoundDistribution) o0;
		for (Distribution p0 : p.pDistributions.get()) {
			if (p0 instanceof MRCAPrior) {
				MRCAPrior prior = (MRCAPrior) p0;
		        if (prior.treeInput.get() != null) {
		        	boolean isInState = false;
		        	for (BEASTInterface o : prior.treeInput.get().getOutputs()) {
		        		if (o instanceof State) {
		        			isInState = true;
		        			break;
		        		}
		        	}
		        	if (!isInState) {
		        		doc.disconnect(prior, "prior", "distribution");
		        		doc.disconnect(prior, "tracelog", "log");
		        		if (prior.onlyUseTipsInput.get()) {
		        			disableTipSampling(prior, doc);
		        		}
		        		doc.unregisterPlugin(prior);
		        		return;
		        	}
				}
			}
		}
	}

}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:31,代码来源:MRCAPriorInputEditor.java


注:本文中的beast.core.State类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。