本文整理汇总了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;
}
示例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);
}
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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);
}