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


Java TaxonSet.setID方法代码示例

本文整理汇总了Java中beast.evolution.alignment.TaxonSet.setID方法的典型用法代码示例。如果您正苦于以下问题:Java TaxonSet.setID方法的具体用法?Java TaxonSet.setID怎么用?Java TaxonSet.setID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在beast.evolution.alignment.TaxonSet的用法示例。


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

示例1: createDistribution

import beast.evolution.alignment.TaxonSet; //导入方法依赖的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

示例2: createTaxonSet

import beast.evolution.alignment.TaxonSet; //导入方法依赖的package包/类
/** create taxonset, one taxon for each sequence in the alignment
 * and assign taxonset to the alignment
 * **/
static void createTaxonSet(Alignment a, BeautiDoc doc) {
    List<String> taxaNames = a.getTaxaNames();
    TaxonSet taxonset = new TaxonSet();
    for (final String taxaName : taxaNames) {
        taxonset.taxonsetInput.get().add(doc.getTaxon(taxaName));
    }
    taxonset.setID("TaxonSet0." + a.getID());
    try {
        taxonset.initAndValidate();
    } catch (Exception e) {
        e.printStackTrace();
    }
    doc.registerPlugin(taxonset);
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:18,代码来源:BeautiDoc.java

示例3: parseSetsBlock

import beast.evolution.alignment.TaxonSet; //导入方法依赖的package包/类
/**
 * parse sets block
 * BEGIN Sets;
 * TAXSET 'con' = 'con_SL_Gert2' 'con_SL_Tran6' 'con_SL_Tran7' 'con_SL_Gert6';
 * TAXSET 'spa' = 'spa_138a_Cerb' 'spa_JB_Eyre1' 'spa_JB_Eyre2';
 * END; [Sets]
 */
void parseSetsBlock(final BufferedReader fin) throws IOException {
    String str;
    do {
        str = nextLine(fin);
        if (str.toLowerCase().matches("\\s*taxset\\s.*")) {
        	String [] strs = str.split("=");
        	if (strs.length > 1) {
        		String str0 = strs[0].trim();
        		String [] strs2 = str0.split("\\s+");
        		if (strs2.length != 2) {
        			throw new RuntimeException("expected 'taxset <name> = ...;' but did not get two words before the = sign: " + str);
        		}
        		String taxonSetName = strs2[1];
        		str0 = strs[strs.length - 1].trim();
        		if (!str0.endsWith(";")) {
        			Log.warning.println("expected 'taxset <name> = ...;' semi-colin is missing: " + str + "\n"
        					+ "Taxa from following lines may be missing.");
        		}
        		str0 = str0.replaceAll(";", "");
        		String [] taxonNames = str0.split("\\s+");
        		TaxonSet taxonset = new TaxonSet();
        		for (String taxon : taxonNames) {
        			taxonset.taxonsetInput.get().add(new Taxon(taxon.replaceAll("'\"", "")));
        		}
        		taxonset.setID(taxonSetName.replaceAll("'\"", ""));
        		taxonsets.add(taxonset);
        	}
        }
    } while (!str.toLowerCase().contains("end;"));
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:38,代码来源:NexusParser.java


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