當前位置: 首頁>>代碼示例>>Java>>正文


Java Alignment.getState方法代碼示例

本文整理匯總了Java中dr.evolution.alignment.Alignment.getState方法的典型用法代碼示例。如果您正苦於以下問題:Java Alignment.getState方法的具體用法?Java Alignment.getState怎麽用?Java Alignment.getState使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在dr.evolution.alignment.Alignment的用法示例。


在下文中一共展示了Alignment.getState方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: BasicColourSampler

import dr.evolution.alignment.Alignment; //導入方法依賴的package包/類
public BasicColourSampler(Alignment tipColours, Tree tree) {

        if (tipColours.getSiteCount() != 1) {
            throw new IllegalArgumentException("Tip colour alignment must consist of a single column!");
        }

        nodeColours = new int[tree.getNodeCount()];
        colourCount = tipColours.getDataType().getStateCount();

        leafColourCounts = new int[colourCount];

        // initialize external node colours
        for (int i = 0; i < tree.getExternalNodeCount(); i++) {
            NodeRef node = tree.getExternalNode(i);
            int colour = tipColours.getState(tipColours.getTaxonIndex(tree.getTaxonId(i)), 0);
            nodeColours[node.getNumber()] = colour;
            leafColourCounts[colour]++;
        }

        nodePartials = new double[tree.getNodeCount()][colourCount];
    }
 
開發者ID:beast-dev,項目名稱:beast-mcmc,代碼行數:22,代碼來源:BasicColourSampler.java

示例2: StructuredColourSampler

import dr.evolution.alignment.Alignment; //導入方法依賴的package包/類
public StructuredColourSampler(Alignment tipColours, Tree tree, boolean nodeBias, boolean branchBias, boolean secondIteration) {

        if (tipColours.getSiteCount() != 1) {
            throw new IllegalArgumentException("Tip colour alignment must consist of a single column!");
        }

        nodeColours = new int[tree.getNodeCount()];
        colourCount = tipColours.getDataType().getStateCount();

        leafColourCounts = new int[colourCount];
        // initialize external node colours
        for (int i = 0; i < tree.getExternalNodeCount(); i++) {
            NodeRef node = tree.getExternalNode(i);
            int colour = tipColours.getState(tipColours.getTaxonIndex(tree.getTaxonId(i)), 0);
            nodeColours[node.getNumber()] = colour;
            leafColourCounts[colour]++;
        }

        useNodeBias = nodeBias;
        useBranchBias = branchBias;
        useSecondColourIteration = secondIteration;

        initialize(tree);     // uses only tree constants (number of tips, etc)

    }
 
開發者ID:beast-dev,項目名稱:beast-mcmc,代碼行數:26,代碼來源:StructuredColourSampler.java

示例3: isSegregating

import dr.evolution.alignment.Alignment; //導入方法依賴的package包/類
public static boolean isSegregating(Alignment a, int j, int[] counts) {
	for (int i = 0; i < counts.length; i++) {
		counts[i] = 0;
	}
	int seqCount = a.getSequenceCount();
	for (int i = 0; i < seqCount; i++) {
		int state = a.getState(i, j);
		if (state >= 0 && state < counts.length) {
			counts[a.getState(i, j)] += 1;
		}
	}
       for(int count : counts) {
           if( count > 0 && count < seqCount ) return true;
       }
	return false;
}
 
開發者ID:beast-dev,項目名稱:beast-mcmc,代碼行數:17,代碼來源:SelectionMapping.java

示例4: initAlignment

import dr.evolution.alignment.Alignment; //導入方法依賴的package包/類
/**
 * Initializes the iAlignment array from the given alignment.
 */
private void initAlignment(Alignment alignment, int[] treeIndex) {
	
	int numSeqs = alignment.getSequenceCount();
	int numSites = alignment.getSiteCount();
	DataType dataType = alignment.getDataType();
	int numStates = dataType.getStateCount();
	
	iAlignment = new IntMathVec[numSites];
	
	int[] column = new int[numSeqs];
	for (int i =0; i < numSites; i++) {
		for (int j = 0; j < numSeqs; j++) {
			column[treeIndex[j]] = ((alignment.getState(j, i) >= numStates) ? 0 : 1);	
		}
		iAlignment[i] = new IntMathVec(column);
	}
}
 
開發者ID:beast-dev,項目名稱:beast-mcmc,代碼行數:21,代碼來源:HomologyRecursion.java

示例5: initAlignment

import dr.evolution.alignment.Alignment; //導入方法依賴的package包/類
/**
 * Initializes the iAlignment array from the given alignment.
 */
private void initAlignment(Alignment alignment, int[] treeIndex) {

    int numSeqs = alignment.getSequenceCount();
    int numSites = alignment.getSiteCount();
    DataType dataType = alignment.getDataType();
    int numStates = dataType.getStateCount();

    iAlignment = new int[numSeqs][numSites];

    // populate alignment in order of tree
    for (int i = 0; i < numSeqs; i++) {
        for (int j = 0; j < numSites; j++) {
            iAlignment[treeIndex[i]][j] = alignment.getState(i, j);
        }
    }
}
 
開發者ID:beast-dev,項目名稱:beast-mcmc,代碼行數:20,代碼來源:IstvanOperator.java

示例6: getPartialsForGroupSizeOne

import dr.evolution.alignment.Alignment; //導入方法依賴的package包/類
private void getPartialsForGroupSizeOne(Taxon tax, double[] tipPartials)
{
	Alignment aln = data.getAlignment();
	int sc = aln.getStateCount();
	int index = aln.getTaxonIndex(tax);
	int j=0;
	for(int i=0; i<aln.getSiteCount(); i++){
		int s = aln.getState(index, i);
		if(s>=sc){
			for(int k=0; k<sc; k++)
				tipPartials[j + k] = 1.0;
		}else
			System.arraycopy(internalMatrix, s*sc, tipPartials, j, sc);
		j += sc;
	}
}
 
開發者ID:beast-dev,項目名稱:beast-mcmc,代碼行數:17,代碼來源:HiddenLinkageModel.java

示例7: isSingleton

import dr.evolution.alignment.Alignment; //導入方法依賴的package包/類
public static boolean isSingleton(Alignment a, int j, int[] counts) {
	for (int i = 0; i < counts.length; i++) {
		counts[i] = 0;
	}
	for (int i = 0; i < a.getSequenceCount(); i++) {
		int state = a.getState(i, j);
		if (state >= 0 && state < counts.length) {
			counts[a.getState(i, j)] += 1;
		}
	}
       for(int count : counts) {
           if( count == 1 ) return true;
       }
	return false;
}
 
開發者ID:beast-dev,項目名稱:beast-mcmc,代碼行數:16,代碼來源:SelectionMapping.java

示例8: computeTipPartials

import dr.evolution.alignment.Alignment; //導入方法依賴的package包/類
private void computeTipPartials(int nodeIndex){
	if(!dirtyTipPartials[nodeIndex]){
		swapTipPartials(nodeIndex);
		dirtyTipPartials[nodeIndex]=true;
	}
	double[] tipPartials = this.tipPartials[nodeIndex];

	// if this is one of the reference organisms, then return the resolved partials
	// if this is a linkage group, return partials that correspond to probabilities of each nucleotide.
	Alignment aln = data.getAlignment();
	int sc = aln.getStateCount();
	for(int i=0; i<tipPartials.length; i++){
		tipPartials[i]=0.0;
	}
	if(nodeIndex < data.getReferenceTaxa().getTaxonCount()){			
		int j=0;
		for(int i=0; i<aln.getSiteCount(); i++){
			int s = aln.getState(nodeIndex, i);
			if(s>=sc){
				for(int k=0; k<sc; k++)
					tipPartials[j + k] = 1.0;
			}else
				tipPartials[j + s] = 1.0;
			j += sc;
		}
	}else{
		int gI = nodeIndex - data.getReferenceTaxa().getTaxonCount();
		HashSet<Taxon> group = groups.get(gI);
		int internalNum = data.getReadsTaxa().getTaxonCount();
		Taxon firstTax=null;
		boolean peeled = false;
		for(Taxon tax : group){
			if(firstTax==null)
			{
				firstTax = tax;
				continue;
			}
			int c2 = data.getReadsTaxa().getTaxonIndex(tax);
			if(!peeled){
				int c1 = data.getReadsTaxa().getTaxonIndex(firstTax);
				core.setNodePartialsForUpdate(internalNum);
                core.calculatePartials(c1, c2, internalNum);
			}else{
				core.setNodePartialsForUpdate(internalNum);
                core.calculatePartials(internalNum-1, c2, internalNum);
			}
			internalNum++;
			peeled = true;
		}
		if(group.size()==0)
		{
			for(int i=0; i<tipPartials.length; i++)
				tipPartials[i]=1.0;
		}else if(!peeled)
			getPartialsForGroupSizeOne(firstTax, tipPartials);
		else
			core.getPartials(internalNum-1, tipPartials);
	}
}
 
開發者ID:beast-dev,項目名稱:beast-mcmc,代碼行數:60,代碼來源:HiddenLinkageModel.java


注:本文中的dr.evolution.alignment.Alignment.getState方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。