• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java StateNode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: log

import beast.core.StateNode; //导入依赖的package包/类
@Override
public void log(int nSample, PrintStream out) {
    // make sure we get the current version of the inputs
    SpeciesTreeInterface speciesTree = speciesTreeInput.get();
    SpeciesTreeInterface tree = (SpeciesTreeInterface) speciesTree.getCurrent();
    List<Function> metadata = parameterInput.get();
    for (int i = 0; i < metadata.size(); i++) {
        if (metadata.get(i) instanceof StateNode) {
            metadata.set(i, ((StateNode) metadata.get(i)).getCurrent());
        }
    }
    BranchRateModel branchRateModel = clockModelInput.get();
    PopulationModel populationModel = populationModelInput.get();
    // write out the log tree with meta data
    out.print("tree STATE_" + nSample + " = ");
    tree.getRoot().sort();
    out.print(toNewick(tree.getRoot(), metadata, branchRateModel, populationModel));
    //out.print(tree.getRoot().toShortNewick(false));
    out.print(";");
}
 
开发者ID:genomescale,项目名称:starbeast2,代码行数:21,代码来源:SpeciesTreeLogger.java


示例2: log

import beast.core.StateNode; //导入依赖的package包/类
@Override
public void log(int sample, PrintStream out) {
    // make sure we get the current version of the inputs
    Tree tree = (Tree) treeInput.get().getCurrent();
    List<Function> metadata = parameterInput.get();
    for (int i = 0; i < metadata.size(); i++) {
    	if (metadata.get(i) instanceof StateNode) {
    		metadata.set(i, ((StateNode) metadata.get(i)).getCurrent());
    	}
    }
    BranchRateModel.Base branchRateModel = clockModelInput.get();
    // write out the log tree with meta data
    out.print("tree STATE_" + sample + " = ");
    tree.getRoot().sort();
    out.print(toNewick(tree.getRoot(), metadata, branchRateModel));
    //out.print(tree.getRoot().toShortNewick(false));
    out.print(";");
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:19,代码来源:TreeWithMetaDataLogger.java


示例3: assignTo

import beast.core.StateNode; //导入依赖的package包/类
@Override
  public void assignTo(StateNode other) {
      if (!(other instanceof GeneralParameterList))
          throw new RuntimeException("Incompatible statenodes in assignTo "
                  + "call.");
      
      @SuppressWarnings("unchecked")
GeneralParameterList<T> otherParamList = (GeneralParameterList<T>)other;
      
      otherParamList.pList.clear();
      for (QuietParameter param : pList)
          otherParamList.pList.add(param.copy());
      
      otherParamList.dimension = dimension;
      otherParamList.minorDimension = minorDimension;
      otherParamList.lowerBound = lowerBound;
      otherParamList.upperBound = upperBound;
      otherParamList.deallocatedKeys = new TreeSet<>(deallocatedKeys);
      otherParamList.nextUnallocatedKey = nextUnallocatedKey;
  }
 
开发者ID:CompEvol,项目名称:beast2,代码行数:21,代码来源:GeneralParameterList.java


示例4: assignFrom

import beast.core.StateNode; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
   public void assignFrom(StateNode other) {
       if (!(other instanceof GeneralParameterList))
           throw new RuntimeException("Incompatible statenodes in assignFrom "
                   + "call.");
       
	GeneralParameterList<T> otherParamList = (GeneralParameterList<T>)other;
       
       pList.clear();
       for (Object paramObj : otherParamList.pList)
           pList.add((QuietParameter) paramObj);
       
       dimension = otherParamList.dimension;
       minorDimension = otherParamList.minorDimension;
       lowerBound = otherParamList.lowerBound;
       upperBound = otherParamList.upperBound;
       deallocatedKeys = new TreeSet<>(otherParamList.deallocatedKeys);
       nextUnallocatedKey = otherParamList.nextUnallocatedKey;
   }
 
开发者ID:CompEvol,项目名称:beast2,代码行数:21,代码来源:GeneralParameterList.java


示例5: log

import beast.core.StateNode; //导入依赖的package包/类
@Override
    public void log(int nSample, PrintStream out) {
    	states = mascotInput.get().dynamicsInput.get().getDimension();
    	
        // make sure we get the current version of the inputs
//        Tree tree = (Tree) mascotInput.get().treeIntervalsInput.get().treeInput.get().getCurrent();
        //calculate the state of each node
    	calculateNodeStates();
    	
    	used = new boolean[stateProbabilities.length];
    	report = false;
        List<Function> metadata = parameterInput.get();
        for (int i = 0; i < metadata.size(); i++) {
        	if (metadata.get(i) instanceof StateNode) {
        		metadata.set(i, ((StateNode) metadata.get(i)).getCurrent());
        	}
        }
        BranchRateModel.Base branchRateModel = clockModelInput.get();
        // write out the log tree with meta data
        out.print("tree STATE_" + nSample + " = ");
        mascotInput.get().treeIntervalsInput.get().treeInput.get().getRoot().sort();
        root = mascotInput.get().treeIntervalsInput.get().treeInput.get().getRoot();
        out.print(toNewick(root, metadata, branchRateModel));
        out.print(";");
        
        for (int i = 0; i < used.length; i++)
        	if(!used[i])
        		System.err.println("not all nodes used");
        if (report)
        	System.err.println("error in node numbers");
    }
 
开发者ID:nicfel,项目名称:Mascot,代码行数:32,代码来源:StructuredTreeLoggerCollaps.java


示例6: log

import beast.core.StateNode; //导入依赖的package包/类
@Override
    public void log(int nSample, PrintStream out) {
    	states = mascotInput.get().dynamicsInput.get().getDimension();
    	
        // make sure we get the current version of the inputs
//        Tree tree = (Tree) mascotInput.get().treeIntervalsInput.get().treeInput.get().getCurrent();
        //calculate the state of each node
    	try {
			CalculateNodeStates();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    	
    	used = new boolean[stateProbabilities.length];
    	report = false;
        List<Function> metadata = parameterInput.get();
        for (int i = 0; i < metadata.size(); i++) {
        	if (metadata.get(i) instanceof StateNode) {
        		metadata.set(i, ((StateNode) metadata.get(i)).getCurrent());
        	}
        }
        BranchRateModel.Base branchRateModel = clockModelInput.get();
        // write out the log tree with meta data
        out.print("tree STATE_" + nSample + " = ");
        mascotInput.get().treeIntervalsInput.get().treeInput.get().getRoot().sort();
        root = mascotInput.get().treeIntervalsInput.get().treeInput.get().getRoot();
        out.print(toNewick(root, metadata, branchRateModel));
        out.print(";");
        
        for (int i = 0; i < used.length; i++)
        	if(!used[i])
        		System.err.println("not all nodes used");
        if (report)
        	System.err.println("error in node numbers");
    }
 
开发者ID:nicfel,项目名称:Mascot,代码行数:37,代码来源:StructuredTreeLogger.java


示例7: testUniformity

import beast.core.StateNode; //导入依赖的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: getInitialisedStateNodes

import beast.core.StateNode; //导入依赖的package包/类
@Override
public void getInitialisedStateNodes(final List<StateNode> stateNodes) {
    stateNodes.add(speciesTreeInput.get());

    for (final Tree g : genes.get()) {
        stateNodes.add(g);
    }

    final RealParameter brate = birthRate.get();
    if (brate != null) {
        stateNodes.add(brate) ;
    }
}
 
开发者ID:genomescale,项目名称:starbeast2,代码行数:14,代码来源:StarBeastInitializer.java


示例9: addCondition

import beast.core.StateNode; //导入依赖的package包/类
/**
 * add item to the list *
 * @param stateNode
 */
public void addCondition(final Input<? extends StateNode> stateNode) {
    if (stateNode.get() == null) return;

    if (conditions == null) conditions = new ArrayList<>();

    conditions.add(stateNode.get().getID());
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:12,代码来源:SiteModelInterface.java


示例10: listStateNodes

import beast.core.StateNode; //导入依赖的package包/类
@Override
public List<StateNode> listStateNodes() {
    List<StateNode> stateNodeList = new ArrayList<>();
    
    for (Operator op : operatorsInput.get())
        stateNodeList.addAll(op.listStateNodes());
    
    return stateNodeList;
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:10,代码来源:JointOperator.java


示例11: outsideBounds

import beast.core.StateNode; //导入依赖的package包/类
private boolean outsideBounds(final StateNode node) {
    if (node instanceof Parameter<?>) {
        final Parameter<?> p = (Parameter<?>) node;
        final Double lower = (Double) p.getLower();
        final Double upper = (Double) p.getUpper();
        final Double value = (Double) p.getValue();
        if (value < lower || value > upper) {
            return true;
        }
    }
    return false;
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:13,代码来源:UpDownOperator.java


示例12: log

import beast.core.StateNode; //导入依赖的package包/类
@Override
public void log(final int sample, final PrintStream out) {
    // make sure we get the current version of the inputs
    final Tree tree = (Tree) treeInput.get().getCurrent();
    Function metadata = parameterInput.get();
    if (metadata instanceof StateNode) {
        metadata = ((StateNode) metadata).getCurrent();
    }
    Function metadataTop = parameterTopInput.get();
    if (metadataTop != null && metadataTop instanceof StateNode) {
        metadataTop = ((StateNode) metadataTop).getCurrent();
    }

    List<Function> metadataList = metadataInput.get();
    for (int i = 0; i < metadataList.size(); i++) {
    	if (metadataList.get(i) instanceof StateNode) {
    		metadataList.set(i, ((StateNode) metadataList.get(i)).getCurrent());
    	}
    }

    // write out the log tree with meta data
    out.print("tree STATE_" + sample + " = ");
    tree.getRoot().sort();
    out.print(toNewick(tree.getRoot(), metadata, metadataTop, metadataList));
    //out.print(tree.getRoot().toShortNewick(false));
    out.print(";");
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:28,代码来源:SpeciesTreeLogger.java


示例13: createDistribution

import beast.core.StateNode; //导入依赖的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


示例14: getLabel

import beast.core.StateNode; //导入依赖的package包/类
String getLabel(Operator operator) {
    String name = operator.getClass().getName();
    name = name.substring(name.lastIndexOf('.') + 1);
    name = name.replaceAll("Operator", "");
    if (name.matches(".*[A-Z].*")) {
        name = name.replaceAll("(.)([A-Z])", "$1 $2");
    }
    name += ": ";
    try {
        for (BEASTInterface beastObject2 : operator.listActiveBEASTObjects()) {
            if (beastObject2 instanceof StateNode && ((StateNode) beastObject2).isEstimatedInput.get()) {
                name += beastObject2.getID() + " ";
            }
            // issue https://github.com/CompEvol/beast2/issues/661
            if (name.length() > 100) {
            	name += "... ";
            	break;
            }
        }
    } catch (Exception e) {
        // ignore
    }
    String tipText = getDoc().tipTextMap.get(operator.getID());
    if (tipText != null) {
        name += " " + tipText;
    }
    return name;
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:29,代码来源:OperatorListInputEditor.java


示例15: recompute

import beast.core.StateNode; //导入依赖的package包/类
/**
 * collect values of the compounds into an array *
 */
private void recompute() {
    int k = 0;
    for (BEASTObject beastObject : m_values.get()) {
        Function valuable = (Function) beastObject;
        if (beastObject instanceof StateNode) {
            valuable = ((StateNode) beastObject).getCurrent();
        }
        int dimension = valuable.getDimension();
        for (int i = 0; i < dimension; i++) {
            m_fValues[k++] = valuable.getArrayValue(i);
        }
    }
    m_bRecompute = false;
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:18,代码来源:CompoundValuable.java


示例16: assignTo

import beast.core.StateNode; //导入依赖的package包/类
@Override
public void assignTo(final StateNode other) {
    @SuppressWarnings("unchecked")
    final Parameter.Base<T> copy = (Parameter.Base<T>) other;
    copy.setID(getID());
    copy.index = index;
    copy.values = values.clone();
    //System.arraycopy(values, 0, copy.values, 0, values.length);
    copy.m_fLower = m_fLower;
    copy.m_fUpper = m_fUpper;
    copy.m_bIsDirty = new boolean[values.length];
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:13,代码来源:Parameter.java


示例17: assignFrom

import beast.core.StateNode; //导入依赖的package包/类
@Override
public void assignFrom(final StateNode other) {
    @SuppressWarnings("unchecked")
    final Parameter.Base<T> source = (Parameter.Base<T>) other;
    setID(source.getID());
    values = source.values.clone();
    storedValues = source.storedValues.clone();
    System.arraycopy(source.values, 0, values, 0, values.length);
    m_fLower = source.m_fLower;
    m_fUpper = source.m_fUpper;
    m_bIsDirty = new boolean[source.values.length];
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:13,代码来源:Parameter.java


示例18: assignFromFragile

import beast.core.StateNode; //导入依赖的package包/类
@Override
public void assignFromFragile(final StateNode other) {
    @SuppressWarnings("unchecked")
    final Parameter.Base<T> source = (Parameter.Base<T>) other;
    System.arraycopy(source.values, 0, values, 0, Math.min(values.length, source.getDimension()));
    Arrays.fill(m_bIsDirty, false);
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:8,代码来源:Parameter.java


示例19: register

import beast.core.StateNode; //导入依赖的package包/类
static public void register(Operator operator, final Object... operands) {
	HashMap<String, StateNode> operandsMap;
	operandsMap = new HashMap<String, StateNode>();
	if (operands.length % 2 == 1) {
		throw new RuntimeException("Expected even number of arguments, name-value pairs");
	}
	for (int i = 0; i < operands.length; i += 2) {
		if (operands[i] instanceof String) {
			final String name = (String) operands[i];
			if (operands[i + 1] instanceof StateNode) {
				final StateNode node = (StateNode) operands[i + 1];
				operandsMap.put(name, node);
			} else {
				throw new IllegalArgumentException("Expected a StateNode in " + (i + 1) + "th argument ");
			}
		} else {
			throw new IllegalArgumentException("Expected a String in " + i + "th argument ");
		}
	}
	State state = new State();
	state.initByName("stateNode", new ArrayList<StateNode>(operandsMap.values()));
	state.initialise();
	Object[] operandsAndWeight = new Object[operands.length + 2];
	for (int i = 0; i < operands.length; ++i) {
		operandsAndWeight[i] = operands[i];
	}
	operandsAndWeight[operands.length] = "weight";
	operandsAndWeight[operands.length + 1] = "1";
	operator.initByName(operandsAndWeight);
	operator.validateInputs();
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:32,代码来源:TestOperator.java


示例20: addCondition

import beast.core.StateNode; //导入依赖的package包/类
/**
 * add item to the list *
 * @param stateNode
 */
public void addCondition(final StateNode stateNode) {
    if (stateNode == null) return;

    if (conditions == null) conditions = new ArrayList<String>();

    conditions.add(stateNode.getID());
}
 
开发者ID:jessiewu,项目名称:substBMA,代码行数:12,代码来源:QuietSiteModel.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RsaVerifier类代码示例发布时间:2022-05-23
下一篇:
Java ManagementServerProperties类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap