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


Java Alignment.getSequenceCount方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: createAlignment

import dr.evolution.alignment.Alignment; //导入方法依赖的package包/类
private Map createAlignment(Alignment alignment) {

        Map a = new HashMap();
        a.put("id",  (alignment.getId() != null ? alignment.getId() : "alignment"));

        List<Map> ss = new ArrayList<Map>();
        for (int i = 0; i < alignment.getSequenceCount(); i++) {
            Sequence sequence = alignment.getSequence(i);
            ss.add(createSequence(sequence));
        }

        a.put("sequences", ss);
        return a;
    }
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:15,代码来源:DataModelImporter.java

示例6: main

import dr.evolution.alignment.Alignment; //导入方法依赖的package包/类
public static void main(String[] args) throws java.io.IOException, Importer.ImportException {

        NexusImporter importer = new NexusImporter(new FileReader(args[0]));

        Alignment alignment = importer.importAlignment();

        ExtractPairs pairs = new ExtractPairs(alignment);

        Parameter muParam = new Parameter.Default(1.0);
        Parameter kappaParam = new Parameter.Default(1.0);
        kappaParam.addBounds(new Parameter.DefaultBounds(100.0, 0.0, 1));
        muParam.addBounds(new Parameter.DefaultBounds(1.0, 1.0, 1));

        Parameter freqParam = new Parameter.Default(alignment.getStateFrequencies());

        FrequencyModel freqModel = new FrequencyModel(Nucleotides.INSTANCE,freqParam);

        SubstitutionModel substModel = new HKY(kappaParam, freqModel);

        SiteModel siteModel = new GammaSiteModel(substModel, muParam, null, 1, null);

        ScoreMatrix scoreMatrix = new ScoreMatrix(siteModel, 0.1);


        double threshold = 0.1;

        List<PairDistance> pairDistances = new ArrayList<PairDistance>();
        Set<Integer> sequencesUsed = new HashSet<Integer>();
        List<Integer> allGaps = new ArrayList<Integer>();
        for (int i = 0; i < alignment.getSequenceCount(); i++) {
            for (int j = i+1; j < alignment.getSequenceCount(); j++) {
                Alignment pairAlignment = pairs.getPairAlignment(i,j);
                if (pairAlignment != null) {
                    SitePatterns patterns = new SitePatterns(pairAlignment);

                    double distance = getGeneticDistance(scoreMatrix, patterns);
                    if (distance < threshold) {
                        List gaps = new ArrayList();
                        GapUtils.getGapSizes(pairAlignment, gaps);
                        pairDistances.add(new PairDistance(i,j,distance, gaps, pairAlignment.getSiteCount()));
                        System.out.print(".");
                    } else {
                        System.out.print("*");
                    }
                } else {
                    System.out.print("x");
                }
            }
            System.out.println();
        }

        Collections.sort(pairDistances);
        int totalLength = 0;
        for (PairDistance pairDistance : pairDistances) {

            Integer x = pairDistance.x;
            Integer y = pairDistance.y;

            if (!sequencesUsed.contains(x) && !sequencesUsed.contains(y)) {
                allGaps.addAll(pairDistance.gaps);
                sequencesUsed.add(x);
                sequencesUsed.add(y);
                System.out.println("Added pair (" + x + "," + y + ") d=" + pairDistance.distance + " L=" + pairDistance.alignmentLength);
                totalLength += pairDistance.alignmentLength;
            }
        }

        printFrequencyTable(allGaps);
        System.out.println("total length=" + totalLength);
    }
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:71,代码来源:AlignmentScore.java


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