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


Java TraitSet类代码示例

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


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

示例1: addTraitSet

import beast.evolution.tree.TraitSet; //导入依赖的package包/类
/**
 * assigns trait to first available tree *
 */
void addTraitSet(TraitSet trait) {
    if (trait != null) {
        CompoundDistribution likelihood = (CompoundDistribution) pluginmap.get("likelihood");
        for (Distribution d : likelihood.pDistributions.get()) {
            if (d instanceof GenericTreeLikelihood) {
                try {
                    // TODO: this might not be a valid type conversion from TreeInterface to Tree
                    Tree tree = (Tree) ((GenericTreeLikelihood) d).treeInput.get();
                    tree.m_traitList.setValue(trait, tree);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                scrubAll(true, false);
                return;
            }
        }
    }
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:22,代码来源:BeautiDoc.java

示例2: getTypeTrait

import beast.evolution.tree.TraitSet; //导入依赖的package包/类
/**
 * @return TraitSet with same name as typeLabel.
 */
public TraitSet getTypeTrait() {
    if (!traitsProcessed)
        processTraits(m_traitList.get());
    
    return typeTraitSet;
}
 
开发者ID:nicfel,项目名称:Mascot,代码行数:10,代码来源:TreeWithTrait.java

示例3: setTypeTrait

import beast.evolution.tree.TraitSet; //导入依赖的package包/类
/**
 * Specifically set the type trait set for this tree. A null value simply
 * removes the existing trait set.
 *
 * @param traitSet
 */
public void setTypeTrait(TraitSet traitSet) {
    if (hasTypeTrait()) {
        m_traitList.get().remove(typeTraitSet);
    }

    if (traitSet != null) {
        //m_traitList.setValue(traitSet, this);
        typeTraitInput.setValue(traitSet, this);
    }

    typeTraitSet = traitSet;
}
 
开发者ID:nicfel,项目名称:Mascot,代码行数:19,代码来源:TreeWithTrait.java

示例4: initValues

import beast.evolution.tree.TraitSet; //导入依赖的package包/类
public void initValues()   {
	// if t1 has t1 Input - do nothing
	// Set t1 to Tree's height
	//System.out.print("interval duration: "+intervals.getTotalDuration());
	if (!popModel.hasEndTime()) {
		if (tree.getDateTrait()==null) {
			//System.out.println(" NO date trait, setting t1 = "+intervals.getTotalDuration());
			popModel.setEndTime( intervals.getTotalDuration() );
		} else {
			if (tree.getDateTrait().getTraitName().equals( TraitSet.DATE_BACKWARD_TRAIT)) {
				//System.out.println(" backward date trait, setting t1 = "+intervals.getTotalDuration());
				popModel.setEndTime( intervals.getTotalDuration());
			} else {  
				//System.out.println(" Date trait, setting t1 = "+ tree.getDateTrait().getDate(0) );
				popModel.setEndTime( tree.getDateTrait().getDate(0));
			}
		}
	} else {
		//System.out.println(" Using t1 = "+popModel.getEndTime());
	}
	
    nrSamples = intervals.getSampleCount();
    sp = new DoubleMatrix[nrSamples];               
    nrSamples++;
    // Extant Lineages and state probabilities
    stateProbabilities.init(tree.getNodeCount(), numStates);
	    	
}
 
开发者ID:mrc-ide,项目名称:PhyDyn,代码行数:29,代码来源:STreeLikelihood.java

示例5: findPriorityBeastObjects

import beast.evolution.tree.TraitSet; //导入依赖的package包/类
private void findPriorityBeastObjects(BEASTInterface beastObject, List<BEASTInterface> priorityBeastObjects) throws IllegalArgumentException, IllegalAccessException {
   	if (beastObject.getClass().equals(Alignment.class)) {
   		priorityBeastObjects.add(beastObject);
   	}
   	if (beastObject instanceof TraitSet) {
   		priorityBeastObjects.add(beastObject);
   	}
	for (BEASTInterface beastObject2 : beastObject.listActiveBEASTObjects()) {
		findPriorityBeastObjects(beastObject2, priorityBeastObjects);
	}
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:12,代码来源:JSONProducer.java

示例6: testDateBackward

import beast.evolution.tree.TraitSet; //导入依赖的package包/类
@Test
public void testDateBackward() {
	int Nleaves = 2; 
    TraitSet timeTrait = new TraitSet();

    timeTrait.initByName(
            "traitname", "date-backward",
            "taxa", taxonSet(Nleaves),
            "value", "t0=0, t1=10");
    // The trait actually represents the age of the taxa relative to
    // each other with arbitrary zero, so we test it like this.
    assertEquals(-10.0, timeTrait.getValue("t0")-timeTrait.getValue("t1"), 1e-7);
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:14,代码来源:TraitSetTest.java

示例7: testDateForward

import beast.evolution.tree.TraitSet; //导入依赖的package包/类
@Test
public void testDateForward() {
	int Nleaves = 2; 
    TraitSet timeTrait = new TraitSet();

    timeTrait.initByName(
            "traitname", "date-forward",
            "taxa", taxonSet(Nleaves),
            "value", "t0=0, t1=10");
    // The trait actually represents the age of the taxa relative to
    // each other with arbitrary zero, so we test it like this.
    assertEquals(10.0, timeTrait.getValue("t0")-timeTrait.getValue("t1"), 1e-7);
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:14,代码来源:TraitSetTest.java

示例8: testDateForwardUnspecified

import beast.evolution.tree.TraitSet; //导入依赖的package包/类
@Test
public void testDateForwardUnspecified() {
	int Nleaves = 2; 
    TraitSet timeTrait = new TraitSet();

    timeTrait.initByName(
            "traitname", "date-forward",
            "taxa", taxonSet(Nleaves),
            "value", "t1=10");
    // The trait actually represents the age of the taxa relative to
    // each other with arbitrary zero, so we test it like this.
    assertEquals(0.0, timeTrait.getValue("t0")-timeTrait.getValue("t1"), 1e-7);
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:14,代码来源:TraitSetTest.java

示例9: getDates

import beast.evolution.tree.TraitSet; //导入依赖的package包/类
static public TraitSet getDates(TaxonSet taxa) throws Exception {
    TraitSet timeTrait = new TraitSet();
    String trait = String.join(",", (Iterable<String>) IntStream.range(0, 16).mapToObj(i -> taxa.getTaxonId(i) + "=" + i / 3.0)::iterator);
    timeTrait.initByName(
            "traitname", "date-forward",
            "taxa", taxa,
            "value", trait);
    return timeTrait;
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:10,代码来源:UnorderedAlignmentsTest.java

示例10: getTree

import beast.evolution.tree.TraitSet; //导入依赖的package包/类
static public Tree getTree(TaxonSet taxa) throws Exception {
    Tree tree = new RandomTree();
    TraitSet dates = getDates(taxa);
    ConstantPopulation constant = new ConstantPopulation();
    constant.initByName("popSize", new RealParameter("5.0"));
    tree.initByName(
            "taxonset", taxa,
            "populationModel", constant,
            "trait", dates);
    return tree;
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:12,代码来源:UnorderedAlignmentsTest.java

示例11: getRandomTree

import beast.evolution.tree.TraitSet; //导入依赖的package包/类
public Tree getRandomTree(double popSize, Alignment dummyAlg, String[] taxa, int[] dates) throws Exception {
        TaxonSet taxonSet = new TaxonSet(dummyAlg);
        StringBuilder traitSB = new StringBuilder();
        for (int i=0; i<taxa.length; i++) {
            if (i>0)
                traitSB.append(",");
            traitSB.append(taxa[i]).append("=").append(dates[i]);
        }
//        out.println(traitSB.toString());

        TraitSet timeTrait = new TraitSet();
        timeTrait.initByName(
                "traitname", "date-backward",
                "taxa", taxonSet,
                "value", traitSB.toString());

        ConstantPopulation popFunc = new ConstantPopulation();
        popFunc.initByName("popSize", new RealParameter(Double.toString(popSize)));

        // Create RandomTree and TreeInterval instances
        RandomTree tree = new RandomTree();
//        TreeIntervals intervals = new TreeIntervals();

        tree.initByName(
                "taxa", dummyAlg,
                "populationModel", popFunc,
                "trait", timeTrait);

//        intervals.initByName("tree", tree);

        return tree;
    }
 
开发者ID:CompEvol,项目名称:NZGOT,代码行数:33,代码来源:TreeSeqSimulatorCustomized.java

示例12: getRandomTree

import beast.evolution.tree.TraitSet; //导入依赖的package包/类
public Tree getRandomTree(double popSize, Alignment dummyAlg, String[] taxa, int[] dates) throws Exception {
        TaxonSet taxonSet = new TaxonSet(dummyAlg);
        traitSB = new StringBuilder();
        for (int i=0; i<taxa.length; i++) {
            if (i>0)
                traitSB.append(",");
            traitSB.append(taxa[i]).append("=").append(dates[i]);
        }
//        out.println(traitSB.toString());

        TraitSet timeTrait = new TraitSet();
        timeTrait.initByName(
                "traitname", traitName,
                "taxa", taxonSet,
                "value", traitSB.toString());

        ConstantPopulation popFunc = new ConstantPopulation();
        popFunc.initByName("popSize", new RealParameter(Double.toString(popSize)));

        // Create RandomTree and TreeInterval instances
        RandomTree tree = new RandomTree();
//        TreeIntervals intervals = new TreeIntervals();

        tree.initByName(
                "taxa", dummyAlg,
                "populationModel", popFunc,
                "trait", timeTrait);

//        intervals.initByName("tree", tree);

        return tree;
    }
 
开发者ID:CompEvol,项目名称:NZGOT,代码行数:33,代码来源:TreeSeqSimulator.java

示例13: type

import beast.evolution.tree.TraitSet; //导入依赖的package包/类
@Override
public Class<?> type() {
    return TraitSet.class;
}
 
开发者ID:nicfel,项目名称:Mascot,代码行数:5,代码来源:TypeTraitSetInputEditor.java

示例14: TypeTraitTableModel

import beast.evolution.tree.TraitSet; //导入依赖的package包/类
public TypeTraitTableModel(TraitSet typeTraitSet) {
    this.typeTraitSet = typeTraitSet;
}
 
开发者ID:nicfel,项目名称:Mascot,代码行数:4,代码来源:TypeTraitSetInputEditor.java

示例15: processTraits

import beast.evolution.tree.TraitSet; //导入依赖的package包/类
@Override
protected void processTraits(List<TraitSet> traitList) {
    super.processTraits(traitList);
    
    // Record trait set associated with leaf types.
    for (TraitSet traitSet : traitList) {
        if (traitSet.getTraitName().equals(typeLabel)) {
            typeTraitSet = traitSet;
            break;
        }
    }

    // Use explicitly-identified type trait set if available.
    // Seems dumb, but needed for BEAUti as ListInputEditors
    // muck things up...
    if (typeTraitInput.get() != null)
        typeTraitSet = typeTraitInput.get();

    // Construct type list.
    if (typeTraitSet == null) {
        if (getTaxonset() != null) {
            TraitSet dummyTraitSet = new TraitSet();

            StringBuilder sb = new StringBuilder();
            for (int i=0; i<getTaxonset().getTaxonCount(); i++) {
                if (i>0)
                    sb.append(",\n");
                sb.append(getTaxonset().getTaxonId(i)).append("=NOT_SET");
            }
            try {
                dummyTraitSet.initByName(
                    "traitname", "type",
                    "taxa", getTaxonset(),
                    "value", sb.toString());
                dummyTraitSet.setID("typeTraitSet.t:"
                    + BeautiDoc.parsePartition(getID()));
                setTypeTrait(dummyTraitSet);
            } catch (Exception ex) {
                System.out.println("Error setting default type trait.");
            }
        }
    }

    if (typeTraitSet != null) {

        Set<String> typeSet = new HashSet<>();

        int nTaxa = typeTraitSet.taxaInput.get().asStringList().size();
        for (int i = 0; i < nTaxa; i++)
            typeSet.add(typeTraitSet.getStringValue(i));

        // Include any addittional trait values in type list
        if (typeTraitValuesInput.get() != null) {
            for (String typeName : typeTraitValuesInput.get().split(","))
                typeSet.add(typeName);
        }

        typeList = Lists.newArrayList(typeSet);
        Collections.sort(typeList);

        System.out.println("Type trait with the following types detected:");
        for (int i = 0; i < typeList.size(); i++)
            System.out.println(typeList.get(i) + " (" + i + ")");

    }
}
 
开发者ID:nicfel,项目名称:Mascot,代码行数:67,代码来源:TreeWithTrait.java


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