本文整理汇总了Java中beast.evolution.alignment.TaxonSet类的典型用法代码示例。如果您正苦于以下问题:Java TaxonSet类的具体用法?Java TaxonSet怎么用?Java TaxonSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TaxonSet类属于beast.evolution.alignment包,在下文中一共展示了TaxonSet类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: generateSuperset
import beast.evolution.alignment.TaxonSet; //导入依赖的package包/类
public TaxonSet generateSuperset() {
List<Taxon> superSetList = new ArrayList<>();
for (int i = 0; i < nSpecies; i++) {
final String speciesName = String.format("s%d", i);
List<Taxon> taxonList = new ArrayList<>();
for (int j = 0; j < individualsPerSpecies; j++) {
final String taxonName = String.format("s%d_tip%d", i, j);
taxonList.add(new Taxon(taxonName));
}
superSetList.add(new TaxonSet(speciesName, taxonList));
}
TaxonSet speciesSuperset = new TaxonSet(superSetList);
return speciesSuperset;
}
开发者ID:genomescale,项目名称:starbeast2,代码行数:17,代码来源:MissingDataConstantIO.java
示例2: initialize
import beast.evolution.alignment.TaxonSet; //导入依赖的package包/类
private void initialize(TaxonSet speciesSuperset) throws Exception {
speciesTree = new SpeciesTreeParser();
speciesTree.initByName("newick", newickSpeciesTree, "IsLabelledNewick", true, "taxonset", speciesSuperset);
for (String geneTreeNewick: newickGeneTrees) {
TreeParser geneTree = new TreeParser();
geneTree.initByName("newick", geneTreeNewick, "IsLabelledNewick", true);
geneTrees.add(geneTree);
GeneTree geneTreeWrapper = new GeneTree();
geneTreeWrapper.initByName("tree", geneTree, "ploidy", ploidy, "speciesTree", speciesTree);
geneTreeWrappers.add(geneTreeWrapper);
}
state.initByName("stateNode", alphaParameter);
state.initByName("stateNode", meanParameter);
msc = new MultispeciesCoalescent();
msc.initByName("populationShape", alphaParameter, "populationMean", meanParameter, "distribution", geneTreeWrappers);
for (GeneTree gt: geneTreeWrappers) gt.calculateLogP();
}
开发者ID:genomescale,项目名称:starbeast2,代码行数:23,代码来源:MissingDataConstantIO.java
示例3: generateSuperset
import beast.evolution.alignment.TaxonSet; //导入依赖的package包/类
public TaxonSet generateSuperset() throws Exception {
List<Taxon> superSetList = new ArrayList<>();
for (int i = 0; i < nSpecies; i++) {
final String speciesName = String.format("s%d", i);
List<Taxon> taxonList = new ArrayList<>();
for (int j = 0; j < individualsPerSpecies; j++) {
final String taxonName = String.format("s%d_tip%d", i, j);
taxonList.add(new Taxon(taxonName));
}
superSetList.add(new TaxonSet(speciesName, taxonList));
}
TaxonSet speciesSuperSet = new TaxonSet(superSetList);
return speciesSuperSet;
}
开发者ID:genomescale,项目名称:starbeast2,代码行数:17,代码来源:BigCoordinatedExchangeTest.java
示例4: testLogP
import beast.evolution.alignment.TaxonSet; //导入依赖的package包/类
@Test
public void testLogP() throws Exception {
TaxonSet speciesSuperset = generateSuperset();
speciesTree = new SpeciesTreeParser();
speciesTree.initByName("newick", newickSpeciesTree, "IsLabelledNewick", true, "taxonset", speciesSuperset);
final int nBranches = nSpecies * 2 - 1;
popsizeParameter.initByName("value", String.valueOf(popSize), "dimension", String.valueOf(nBranches));
state.initByName("stateNode", popsizeParameter);
popModel = new ConstantPopulations();
popModel.initByName("populationSizes", popsizeParameter, "speciesTree", speciesTree);
double calculatedLogP = 0.0;
for (String geneTreeNewick: newickGeneTrees) {
TreeParser geneTree = new TreeParser();
geneTree.initByName("newick", geneTreeNewick, "IsLabelledNewick", true);
GeneTree geneTreeWrapper = new GeneTree();
geneTreeWrapper.initByName("tree", geneTree, "ploidy", ploidy, "speciesTree", speciesTree, "populationModel", popModel);
calculatedLogP += geneTreeWrapper.calculateLogP();
}
// System.out.println(String.format("expected %f, calculated %f", expectedLogP, calculatedLogP));
assertEquals(expectedLogP, calculatedLogP, allowedError);
}
开发者ID:genomescale,项目名称:starbeast2,代码行数:27,代码来源:IncompatibleTreeTest.java
示例5: generateSuperset
import beast.evolution.alignment.TaxonSet; //导入依赖的package包/类
public TaxonSet generateSuperset() {
List<Taxon> superSetList = new ArrayList<>();
for (int i = 0; i < nSpecies; i++) {
final String speciesName = String.format("T%d", i + 1);
List<Taxon> taxonList = new ArrayList<>();
for (int j = 0; j < individualsPerSpecies; j++) {
final String taxonName = String.format("T%d_%d", i + 1, j + 1);
taxonList.add(new Taxon(taxonName));
}
superSetList.add(new TaxonSet(speciesName, taxonList));
}
TaxonSet speciesSuperset = new TaxonSet(superSetList);
return speciesSuperset;
}
开发者ID:genomescale,项目名称:starbeast2,代码行数:17,代码来源:IncompatibleTreeTest.java
示例6: generateSuperset
import beast.evolution.alignment.TaxonSet; //导入依赖的package包/类
private TaxonSet generateSuperset() {
List<Taxon> superSetList = new ArrayList<>();
for (int i = 0; i < nSpecies; i++) {
final String speciesName = String.format("s%d", i);
List<Taxon> taxonList = new ArrayList<>();
for (int j = 0; j < individualsPerSpecies; j++) {
final String taxonName = String.format("s%d_tip%d", i, j);
taxonList.add(new Taxon(taxonName));
}
superSetList.add(new TaxonSet(speciesName, taxonList));
}
TaxonSet speciesSuperset = new TaxonSet(superSetList);
return speciesSuperset;
}
开发者ID:genomescale,项目名称:starbeast2,代码行数:17,代码来源:ConstantIOTest.java
示例7: initialize
import beast.evolution.alignment.TaxonSet; //导入依赖的package包/类
private void initialize(TaxonSet speciesSuperset) throws Exception {
speciesTree = new SpeciesTreeParser();
speciesTree.initByName("newick", newickSpeciesTree, "IsLabelledNewick", true, "taxonset", speciesSuperset);
for (String geneTreeNewick: newickGeneTrees) {
TreeParser geneTree = new TreeParser();
geneTree.initByName("newick", geneTreeNewick, "IsLabelledNewick", true);
geneTrees.add(geneTree);
GeneTree geneTreeWrapper = new GeneTree();
geneTreeWrapper.initByName("tree", geneTree, "ploidy", ploidy, "speciesTree", speciesTree);
geneTreeWrappers.add(geneTreeWrapper);
}
state.initByName("stateNode", alphaParameter);
state.initByName("stateNode", meanParameter);
msc = new MultispeciesCoalescent();
msc.initByName("populationShape", alphaParameter, "populationMean", meanParameter, "distribution", geneTreeWrappers);
}
开发者ID:genomescale,项目名称:starbeast2,代码行数:21,代码来源:ConstantIOTest.java
示例8: generateSuperset
import beast.evolution.alignment.TaxonSet; //导入依赖的package包/类
public TaxonSet generateSuperset() throws Exception {
List<Taxon> superSetList = new ArrayList<>();
List<Taxon> taxonListA = new ArrayList<>();
List<Taxon> taxonListB = new ArrayList<>();
List<Taxon> taxonListC = new ArrayList<>();
taxonListA.add(new Taxon("A1"));
taxonListA.add(new Taxon("A2"));
taxonListB.add(new Taxon("B1"));
taxonListB.add(new Taxon("B2"));
taxonListC.add(new Taxon("C1"));
superSetList.add(new TaxonSet("A", taxonListA));
superSetList.add(new TaxonSet("B", taxonListB));
superSetList.add(new TaxonSet("C", taxonListC));
TaxonSet speciesSuperSet = new TaxonSet(superSetList);
return speciesSuperSet;
}
开发者ID:genomescale,项目名称:starbeast2,代码行数:23,代码来源:MissingDataCoordinatedExchange.java
示例9: generateSuperset
import beast.evolution.alignment.TaxonSet; //导入依赖的package包/类
private TaxonSet generateSuperset() throws Exception {
String speciesCodes = "abc";
List<Taxon> superSetList = new ArrayList<>();
for (int i = 0; i < nSpecies; i++) {
final String speciesName = speciesCodes.substring(i, i + 1);
List<Taxon> taxonList = new ArrayList<>();
for (int j = 0; j < individualsPerSpecies; j++) {
final String taxonName = String.format("%s%d", speciesName, j + 1);
taxonList.add(new Taxon(taxonName));
}
superSetList.add(new TaxonSet(speciesName, taxonList));
}
TaxonSet speciesSuperSet = new TaxonSet(superSetList);
return speciesSuperSet;
}
开发者ID:genomescale,项目名称:starbeast2,代码行数:18,代码来源:StarbeastClockTest.java
示例10: generateSuperset
import beast.evolution.alignment.TaxonSet; //导入依赖的package包/类
public TaxonSet generateSuperset() throws Exception {
List<Taxon> superSetList = new ArrayList<>();
List<Taxon> taxonListA = new ArrayList<>();
List<Taxon> taxonListB = new ArrayList<>();
List<Taxon> taxonListC = new ArrayList<>();
taxonListA.add(new Taxon("A1"));
taxonListA.add(new Taxon("A2"));
taxonListB.add(new Taxon("B1"));
taxonListB.add(new Taxon("B2"));
taxonListC.add(new Taxon("C1"));
superSetList.add(new TaxonSet("A", taxonListA));
superSetList.add(new TaxonSet("B", taxonListB));
superSetList.add(new TaxonSet("C", taxonListC));
TaxonSet speciesSuperSet = new TaxonSet(superSetList);
return speciesSuperSet;
}
开发者ID:genomescale,项目名称:starbeast2,代码行数:22,代码来源:SmallCoordinatedExchangeTest.java
示例11: initAndValidate
import beast.evolution.alignment.TaxonSet; //导入依赖的package包/类
@Override
public void initAndValidate() {
/** maps gene taxa names to species number **/
final Map<String, Integer> taxonMap = new HashMap<>();
final List<Taxon> list = taxonSetInput.get().taxonsetInput.get();
if (list.size() <= 1) {
Log.err.println("NodeReheight operator requires at least 2 taxa while the taxon set (id=" + taxonSetInput.get().getID() +") has only " + list.size() + " taxa. "
+ "If the XML file was set up in BEAUti, this probably means a taxon assignment needs to be set up in the taxonset panel.");
// assume we are in BEAUti, back off for now
return;
}
for (int i = 0; i < list.size(); i++) {
final Taxon taxa = list.get(i);
// cast should be ok if taxon-set is the set for the species tree
final TaxonSet set = (TaxonSet) taxa;
for (final Taxon taxon : set.taxonsetInput.get()) {
taxonMap.put(taxon.getID(), i);
}
}
/** build the taxon map for each gene tree **/
m_taxonMap = new ArrayList<>();
for (final Tree tree : geneTreesInput.get()) {
final Map<Integer, Integer> map = new HashMap<>();
setupTaxaMap(tree.getRoot(), map, taxonMap);
m_taxonMap.add(map);
}
nrOfGeneTrees = geneTreesInput.get().size();
nrOfSpecies = treeInput.get().getLeafNodeCount();
}
开发者ID:CompEvol,项目名称:beast2,代码行数:34,代码来源:NodeReheight.java
示例12: randomInit
import beast.evolution.alignment.TaxonSet; //导入依赖的package包/类
private void randomInit() {
double lam = 1;
final RealParameter lambda = birthRate.get();
if( lambda != null ) {
lam = lambda.getArrayValue();
}
final Tree stree = speciesTreeInput.get();
final TaxonSet species = stree.m_taxonset.get();
final int speciesCount = species.asStringList().size();
double s = 0;
for(int k = 2; k <= speciesCount; ++k) {
s += 1.0/k;
}
final double rootHeight = (1/lam) * s;
stree.scale(rootHeight/stree.getRoot().getHeight());
randomInitGeneTrees(rootHeight);
// final List<Tree> geneTrees = genes.get();
// for (final Tree gtree : geneTrees) {
// gtree.makeCaterpillar(rootHeight, rootHeight/gtree.getInternalNodeCount(), true);
// }
}
开发者ID:CompEvol,项目名称:beast2,代码行数:22,代码来源:StarBeastStartState.java
示例13: getTaxonCandidates
import beast.evolution.alignment.TaxonSet; //导入依赖的package包/类
Set<Taxon> getTaxonCandidates(MRCAPrior prior) {
Set<Taxon> candidates = new HashSet<>();
Tree tree = prior.treeInput.get();
String [] taxa = null;
if (tree.m_taxonset.get() != null) {
try {
TaxonSet set = tree.m_taxonset.get();
set.initAndValidate();
taxa = set.asStringList().toArray(new String[0]);
} catch (Exception e) {
taxa = prior.treeInput.get().getTaxaNames();
}
} else {
taxa = prior.treeInput.get().getTaxaNames();
}
for (String taxon : taxa) {
candidates.add(doc.getTaxon(taxon));
}
return candidates;
}
开发者ID:CompEvol,项目名称:beast2,代码行数:22,代码来源:PriorListInputEditor.java
示例14: enableTipSampling
import beast.evolution.alignment.TaxonSet; //导入依赖的package包/类
private void enableTipSampling() {
// First, create/find the operator
TipDatesRandomWalker operator = null;
MRCAPrior prior = (MRCAPrior) m_beastObject;
TaxonSet taxonset = prior.taxonsetInput.get();
taxonset.initAndValidate();
// see if an old operator still hangs around -- happens when toggling the TipsOnly checkbox a few times
for (BEASTInterface o : taxonset.getOutputs()) {
if (o instanceof TipDatesRandomWalker) {
operator = (TipDatesRandomWalker) o;
}
}
if (operator == null) {
operator = new TipDatesRandomWalker();
operator.initByName("tree", prior.treeInput.get(), "taxonset", taxonset, "windowSize", 1.0, "weight", 1.0);
}
operator.setID("tipDatesSampler." + taxonset.getID());
doc.mcmc.get().setInputValue("operator", operator);
}
开发者ID:CompEvol,项目名称:beast2,代码行数:23,代码来源:MRCAPriorInputEditor.java
示例15: TreeParser
import beast.evolution.alignment.TaxonSet; //导入依赖的package包/类
/**
* Create a tree from the given newick format
*
* @param taxaNames a list of taxa names to use, or null.
* If null then IsLabelledNewick will be set to true
* @param newick the newick of the tree
* @param offset the offset to map node numbers in newick format to indices in taxaNames.
* so, name(node with nodeNumber) = taxaNames[nodeNumber-offset]
* @param adjustTipHeightsWhenMissingDateTraits
* true if tip heights should be adjusted to zero
*/
public TreeParser(final List<String> taxaNames,
final String newick,
final int offset,
final boolean adjustTipHeightsWhenMissingDateTraits) {
if (taxaNames == null) {
isLabelledNewickInput.setValue(true, this);
} else {
m_taxonset.setValue(new TaxonSet(Taxon.createTaxonList(taxaNames)), this);
}
newickInput.setValue(newick, this);
offsetInput.setValue(offset, this);
adjustTipHeightsInput.setValue(adjustTipHeightsWhenMissingDateTraits, this);
labels = taxaNames;
initAndValidate();
}
开发者ID:CompEvol,项目名称:beast2,代码行数:28,代码来源:TreeParser.java
示例16: processSets
import beast.evolution.alignment.TaxonSet; //导入依赖的package包/类
protected void processSets() {
// create monophyletic MRCAPrior for each taxon set that
// does not already have a calibration associated with it
for (TaxonSet taxonset : taxonsets) {
boolean found = false;
for (BEASTInterface o : taxonset.getOutputs()) {
if (o instanceof MRCAPrior) {
found = true;
break;
}
}
if (!found) {
MRCAPrior prior = new MRCAPrior();
prior.isMonophyleticInput.setValue(true, prior);
prior.taxonsetInput.setValue(taxonset, prior);
prior.setID(taxonset.getID() + ".prior");
// should set Tree before initialising, but we do not know the tree yet...
if (calibrations == null) {
calibrations = new ArrayList<>();
}
calibrations.add(prior);
}
}
}
开发者ID:CompEvol,项目名称:beast2,代码行数:25,代码来源:NexusParser.java
示例17: testWeightedSitesReordered
import beast.evolution.alignment.TaxonSet; //导入依赖的package包/类
public void testWeightedSitesReordered() throws Exception {
// reorder taxa
Alignment data = getAlignmentNoTInHuman();
data.setID("data");
List<Taxon> taxa = new ArrayList<>();
taxa.add(new Taxon("1chimp"));
taxa.add(new Taxon("0human"));
TaxonSet set = new TaxonSet(taxa);
data.taxonSetInput.setValue(set, data);
data.siteWeightsInput.setValue("11232, 2, 3, 4 ,1123,2,3,4,112,2,3,4,11,2,3, 4 ", data);
data.initAndValidate();
String weights = Arrays.toString(data.getWeights());
System.out.println(weights + "\n0human\t" + alignmentToString(data, data.getTaxonIndex("0human")) + "\n1chimp\t"
+ alignmentToString(data, data.getTaxonIndex("1chimp")));
assertEquals("[11243, 1123, 112, 4, 2, 2, 6, 3, 3, 8, 4, 4]", weights);
}
开发者ID:CompEvol,项目名称:beast2,代码行数:23,代码来源:FilteredAlignmentTest.java
示例18: testLogP
import beast.evolution.alignment.TaxonSet; //导入依赖的package包/类
@Test
public void testLogP() throws Exception {
TaxonSet speciesSuperset = generateSuperset();
initialize(speciesSuperset);
final double calculatedLogP = msc.calculateLogP();
// System.out.println(String.format("expected %f, calculated %f", expectedLogP, calculatedLogP));
assertEquals(expectedLogP, calculatedLogP, allowedError);
}
开发者ID:genomescale,项目名称:starbeast2,代码行数:10,代码来源:MissingDataConstantIO.java
示例19: testRates
import beast.evolution.alignment.TaxonSet; //导入依赖的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
示例20: initializeTrees
import beast.evolution.alignment.TaxonSet; //导入依赖的package包/类
public void initializeTrees(TaxonSet speciesSuperSet) throws Exception {
speciesTree = new SpeciesTreeParser();
speciesTree.initByName("newick", newickSpeciesTree, "IsLabelledNewick", true, "taxonset", speciesSuperSet);
geneTree = new TreeParser();
geneTree.initByName("newick", newickGeneTree, "IsLabelledNewick", true);
geneTreeWrapper = new GeneTree();
geneTreeWrapper.initByName("tree", geneTree, "ploidy", ploidy, "speciesTree", speciesTree);
}
开发者ID:genomescale,项目名称:starbeast2,代码行数:11,代码来源:StarbeastClockTest.java
注:本文中的beast.evolution.alignment.TaxonSet类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论