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


Java Alignment.getPattern方法代码示例

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


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

示例1: setStates

import beast.evolution.alignment.Alignment; //导入方法依赖的package包/类
/**
 * Sets the partials from a sequence in an alignment.
 *
 * @param beagle        beagle
 * @param nodeIndex     nodeIndex
 * @param taxon         the taxon
 */
protected final void setStates(Beagle beagle,
                               int nodeIndex, int taxon) {
    Alignment data = dataInput.get();
    int i;

    int[] states = new int[patternCount];

    for (i = 0; i < patternCount; i++) {
        int code = data.getPattern(taxon, i);
        int[] statesForCode = data.getDataType().getStatesForCode(code);
        if (statesForCode.length==1)
            states[i] = statesForCode[0];
        else
            states[i] = code; // Causes ambiguous states to be ignored.
    }

    beagle.setTipStates(nodeIndex, states);
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:26,代码来源:BeagleTreeLikelihood.java

示例2: setStates

import beast.evolution.alignment.Alignment; //导入方法依赖的package包/类
/**
 * set leaf states in likelihood core *
 */
protected void setStates(Node node, int patternCount) {
    if (node.isLeaf()) {
        Alignment data = dataInput.get();
        int i;
        int[] states = new int[patternCount];
        int taxonIndex = getTaxonIndex(node.getID(), data);
        for (i = 0; i < patternCount; i++) {
            int code = data.getPattern(taxonIndex, i);
            int[] statesForCode = data.getDataType().getStatesForCode(code);
            if (statesForCode.length==1)
                states[i] = statesForCode[0];
            else
                states[i] = code; // Causes ambiguous states to be ignored.
        }
        likelihoodCore.setNodeStates(node.getNr(), states);

    } else {
        setStates(node.getLeft(), patternCount);
        setStates(node.getRight(), patternCount);
    }
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:25,代码来源:TreeLikelihood.java

示例3: guessSizes

import beast.evolution.alignment.Alignment; //导入方法依赖的package包/类
static public Integer[] guessSizes(Alignment alignment_) {
	Integer[] guessedSizes = new Integer[alignment_.getSiteCount()];
	for (int site = 0; site < alignment_.getSiteCount(); ++site) {
		guessedSizes[site] = 0;
		for (int i : alignment_.getPattern(alignment_.getPatternIndex(site))) {
			if (i >= guessedSizes[site]) {
				guessedSizes[site] = i + 1;
			}
		}
	}
	return guessedSizes;
}
 
开发者ID:Anaphory,项目名称:correlatedcharacters,代码行数:13,代码来源:CompoundAlignment.java

示例4: setPartials

import beast.evolution.alignment.Alignment; //导入方法依赖的package包/类
/**
 * Sets the partials from a sequence in an alignment.
 *
 * @param beagle        beagle
 * @param nodeIndex     nodeIndex
 * @param taxon the taxon
 */
protected final void setPartials(Beagle beagle,
                                 int nodeIndex, int taxon) {
    Alignment data = dataInput.get();

    double[] partials = new double[patternCount * m_nStateCount * categoryCount];

    int v = 0;
    for (int i = 0; i < patternCount; i++) {

    	double[] tipProbabilities = data.getTipLikelihoods(taxon,i);
        if (tipProbabilities != null) {
        	for (int state = 0; state < m_nStateCount; state++) {
        		partials[v++] = tipProbabilities[state];
        	}
        }
        else {
        	int stateCount = data.getPattern(taxon, i);
            boolean[] stateSet = data.getStateSet(stateCount);
            for (int state = 0; state < m_nStateCount; state++) {
            	 partials[v++] = (stateSet[state] ? 1.0 : 0.0);                
            }
        }
    }

    // if there is more than one category then replicate the partials for each
    int n = patternCount * m_nStateCount;
    int k = n;
    for (int i = 1; i < categoryCount; i++) {
        System.arraycopy(partials, 0, partials, k, n);
        k += n;
    }

    beagle.setPartials(nodeIndex, partials);
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:42,代码来源:BeagleTreeLikelihood.java

示例5: setPartials

import beast.evolution.alignment.Alignment; //导入方法依赖的package包/类
/**
 * set leaf partials in likelihood core *
 */
protected void setPartials(Node node, int patternCount) {
    if (node.isLeaf()) {
        Alignment data = dataInput.get();
        int states = data.getDataType().getStateCount();
        double[] partials = new double[patternCount * states];
        int k = 0;
        int taxonIndex = getTaxonIndex(node.getID(), data);
        for (int patternIndex_ = 0; patternIndex_ < patternCount; patternIndex_++) {                
            double[] tipLikelihoods = data.getTipLikelihoods(taxonIndex,patternIndex_);
            if (tipLikelihoods != null) {
            	for (int state = 0; state < states; state++) {
            		partials[k++] = tipLikelihoods[state];
            	}
            }
            else {
            	int stateCount = data.getPattern(taxonIndex, patternIndex_);
             boolean[] stateSet = data.getStateSet(stateCount);
             for (int state = 0; state < states; state++) {
             	 partials[k++] = (stateSet[state] ? 1.0 : 0.0);                
             }
            }
        }
        likelihoodCore.setNodePartials(node.getNr(), partials);

    } else {
        setPartials(node.getLeft(), patternCount);
        setPartials(node.getRight(), patternCount);
    }
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:33,代码来源:TreeLikelihood.java

示例6: alignmentToString

import beast.evolution.alignment.Alignment; //导入方法依赖的package包/类
String alignmentToString(Alignment data, int iTaxon) throws Exception {
        int[] states = new int[data.getSiteCount()];
        for (int i = 0; i < data.getSiteCount(); i++) {
            int iPattern = data.getPatternIndex(i);
            int[] sitePattern = data.getPattern(iPattern);
            states[i] = sitePattern[iTaxon];
        }

//        for (int i = 0; i < data.getPatternCount(); i++) {
//            int[] sitePattern = data.getPattern(i);
//            states[i] = sitePattern[iTaxon];
//        }
        return data.getDataType().state2string(states);
    }
 
开发者ID:CompEvol,项目名称:beast2,代码行数:15,代码来源:FilteredAlignmentTest.java


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