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


Java Alignment.getTaxonCount方法代碼示例

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


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

示例1: simulateMsatPattern

import dr.evolution.alignment.Alignment; //導入方法依賴的package包/類
/**
 * Convert an alignment to a pattern
 */
public Patterns simulateMsatPattern(){
    Alignment align = simulate();

    int[] pattern = new int[align.getTaxonCount()];
    for(int i = 0; i < pattern.length; i++){
        String taxonName = align.getSequence(i).getTaxon().getId();
        int index = taxa.getTaxonIndex(taxonName);
        pattern[index] = Integer.parseInt(align.getSequence(i).getSequenceString());
    }
    Patterns patterns = new Patterns(dataType,taxa);
    patterns.addPattern(pattern);
    for(int i = 0; i < pattern.length;i++){
        System.out.print(pattern[i]+",");
    }
    System.out.println();
    
    return patterns;
}
 
開發者ID:whdc,項目名稱:ieo-beast,代碼行數:22,代碼來源:MicrosatelliteSimulator.java

示例2: writeAlignment

import dr.evolution.alignment.Alignment; //導入方法依賴的package包/類
/**
     * Generate an alignment block from these beast options
     *
     * @param alignment the alignment to write
     * @param writer    the writer
     */
    private void writeAlignment(Alignment alignment, XMLWriter writer) {

        writer.writeText("");
        writer.writeComment("The sequence alignment (each sequence refers to a taxon above).",
                "ntax=" + alignment.getTaxonCount() + " nchar=" + alignment.getSiteCount());
        if (options.samplePriorOnly) {
            writer.writeComment("Null sequences generated in order to sample from the prior only.");
        }

        if (getAlignmentDataTypeDescription(alignment) != null) {
            writer.writeOpenTag(
                    AlignmentParser.ALIGNMENT,
                    new Attribute[]{
                            new Attribute.Default<String>(XMLParser.ID, alignment.getId()),
                            new Attribute.Default<String>(DataType.DATA_TYPE, getAlignmentDataTypeDescription(alignment))
                    }
            );
        } else {
            writer.writeOpenTag(
                    AlignmentParser.ALIGNMENT, new Attribute.Default<String>(XMLParser.ID, alignment.getId()));

            writer.writeIDref(DataType.DATA_TYPE, getAlignmentDataTypeIdref(alignment));
        }

        for (int i = 0; i < alignment.getTaxonCount(); i++) {
            Taxon taxon = alignment.getTaxon(i);

            writer.writeOpenTag(SequenceParser.SEQUENCE);
            writer.writeIDref(TaxonParser.TAXON, taxon.getId());
            if (!options.samplePriorOnly) {
//                writer.checkText(alignment.getAlignedSequenceString(i));
                writer.writeText(alignment.getAlignedSequenceString(i));

//                System.out.println(taxon.getId() + ": \n" + alignment.getAlignedSequenceString(i));
//                System.out.println("len = " + alignment.getAlignedSequenceString(i).length() + "\n");
            } else {
                // generate a codon in case there is codon partitioning
                writer.writeText(NULL_SEQUENCE);
            }
            writer.writeCloseTag(SequenceParser.SEQUENCE);
        }
        writer.writeCloseTag(AlignmentParser.ALIGNMENT);
    }
 
開發者ID:beast-dev,項目名稱:beast-mcmc,代碼行數:50,代碼來源:AlignmentGenerator.java

示例3: writeAlignment

import dr.evolution.alignment.Alignment; //導入方法依賴的package包/類
/**
     * Generate an alignment block from these beast options
     *
     * @param alignment the alignment to write
     * @param writer    the writer
     */
    private void writeAlignment(Alignment alignment, XMLWriter writer) {

        writer.writeText("");
        writer.writeComment("The sequence alignment (each sequence refers to a taxon above).",
                "ntax=" + alignment.getTaxonCount() + " nchar=" + alignment.getSiteCount());
        if (options.samplePriorOnly) {
            writer.writeComment("Null sequences generated in order to sample from the prior only.");
        }

        if (getAlignmentDataTypeDescription(alignment) != null) {
            writer.writeOpenTag(
                    AlignmentParser.ALIGNMENT,
                    new Attribute[]{
                            new Attribute.Default<String>(XMLParser.ID, alignment.getId()),
                            new Attribute.Default<String>(DataType.DATA_TYPE, getAlignmentDataTypeDescription(alignment))
                    }
            );
        } else {
            writer.writeOpenTag(
                    AlignmentParser.ALIGNMENT, new Attribute.Default<String>(XMLParser.ID, alignment.getId()));

            writer.writeIDref(DataType.DATA_TYPE, getAlignmentDataTypeIdref(alignment));
        }

        for (int i = 0; i < alignment.getTaxonCount(); i++) {
            Taxon taxon = alignment.getTaxon(i);

            writer.writeOpenTag(SequenceParser.SEQUENCE);
            writer.writeIDref(TaxonParser.TAXON, taxon.getId());
            if (!options.samplePriorOnly) {
//                writer.checkText(alignment.getAlignedSequenceString(i));
                writer.writeText(alignment.getAlignedSequenceString(i));

//                System.out.println(taxon.getId() + ": \n" + alignment.getAlignedSequenceString(i));
//                System.out.println("len = " + alignment.getAlignedSequenceString(i).length() + "\n");
            } else {
                // generate a codon in case there is codon partitioning
                writer.writeText("NNN");
            }
            writer.writeCloseTag(SequenceParser.SEQUENCE);
        }
        writer.writeCloseTag(AlignmentParser.ALIGNMENT);
    }
 
開發者ID:whdc,項目名稱:ieo-beast,代碼行數:50,代碼來源:AlignmentGenerator.java


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