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


Java Alignment.initByName方法代码示例

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


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

示例1: testNarrowExchange4Taxa

import beast.evolution.alignment.Alignment; //导入方法依赖的package包/类
@Test 
public void testNarrowExchange4Taxa() throws Exception {
	
       int runs = 10000;
       Randomizer.setSeed(666);
       // test that going from source tree to target tree 
       // is as likely as going the other way around
       // taking the HR in account.
       Sequence A = new Sequence("A", "A");
       Sequence B = new Sequence("B", "A");
       Sequence C = new Sequence("C", "A");
       Sequence D = new Sequence("D", "A");

       Alignment data = new Alignment();
       data.initByName("sequence", A, "sequence", B, "sequence", C, "sequence", D,
               "dataType", "nucleotide"
       );
       String sourceTree = "((A:2.0,B:2.0):1.0,(C:1.0,D:1.0):2.0):0.0"; // ((A,B),(C,D))
       String targetTree = "((A:2.0,(C:1.0,D:1.0):1.0):1.0,B:3.0):0.0"; // ((A,(C,D)),B)
       testNarrowExchange(sourceTree, targetTree, runs, data);
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:22,代码来源:ExchangeOperatorTest.java

示例2: testNarrowExchange5Taxa

import beast.evolution.alignment.Alignment; //导入方法依赖的package包/类
@Test
public void testNarrowExchange5Taxa() throws Exception {
   	int runs = 10000;
    Randomizer.setSeed(666);
       Sequence A = new Sequence("A", "A");
       Sequence B = new Sequence("B", "A");
       Sequence C = new Sequence("C", "A");
       Sequence D = new Sequence("D", "A");
       Sequence E = new Sequence("E", "A");

       Alignment data = new Alignment();
       data.initByName("sequence", A, "sequence", B, "sequence", C, "sequence", D, "sequence", E,
               "dataType", "nucleotide"
       );
       String sourceTree = "(((A:2.0,B:2.0):1.0,(C:1.0,D:1.0):2.0):1.0,E:4.0):0.0"; // (((A,B),(C,D)),E)
       String targetTree = "(((A:2.0,(C:1.0,D:1.0):1.0):1.0,B:3.0):1.0,E:4.0):0.0"; // (((A,(C,D)),B),E)
       testNarrowExchange(sourceTree, targetTree, runs, data);
   }
 
开发者ID:CompEvol,项目名称:beast2,代码行数:19,代码来源:ExchangeOperatorTest.java

示例3: testNarrowExchange6Taxa

import beast.evolution.alignment.Alignment; //导入方法依赖的package包/类
@Test
public void testNarrowExchange6Taxa() throws Exception {
   	int runs = 10000;
    Randomizer.setSeed(666);
       Sequence A = new Sequence("A", "A");
       Sequence B = new Sequence("B", "A");
       Sequence C = new Sequence("C", "A");
       Sequence D = new Sequence("D", "A");
       Sequence E = new Sequence("E", "A");
       Sequence F = new Sequence("F", "A");

       Alignment data = new Alignment();
       data.initByName("sequence", A, "sequence", B, "sequence", C, "sequence", D, "sequence", E, "sequence", F,
               "dataType", "nucleotide"
       );
       //String sourceTree = "((((A:2.0,B:2.0):1.0,(C:1.0,D:1.0):2.0):1.0,E:4.0):1.0,F:5.0):0.0"; // ((((A,B),(C,D)),E),F)
       //String targetTree = "((((A:2.0,(C:1.0,D:1.0):1.0):1.0,B:3.0):1.0,E:4.0):1.0,F:5.0):0.0"; // ((((A,(C,D)),B),E),F)

       String sourceTree = "(((A:5.0,B:5.0):2.0,((C:5.0,D:5.0):1.0,E:6.0):1.0):1.0,F:8.0):0.0"; 
       String targetTree = "(((A:5.0,B:5.0):2.0,F:7.0):1.0,((C:5.0,D:5.0):1.0,E:6.0):2.0):0.0"; 

       testNarrowExchange(sourceTree, targetTree, runs, data);
   }
 
开发者ID:CompEvol,项目名称:beast2,代码行数:24,代码来源:ExchangeOperatorTest.java

示例4: getAminoAcidAlignment

import beast.evolution.alignment.Alignment; //导入方法依赖的package包/类
static public Alignment getAminoAcidAlignment() throws Exception {
    Sequence Struthio_camelus = new Sequence("Struthio_camelus", "VKYPNTNEEGKEVVLPKILSPIGSDGVYSNELANIEYTNVSKAAAAAFATVDDYKPVPLDYMLDSKTSNKNNVVESSGTLRHFGK");
    Sequence Rhea_americana = new Sequence("Rhea_americana", "VKYPNTNEEGKEVLLPEILNPVGTDGVYSNELANIEYTNVAKDAAAAFATVDDHKPVSLEYMLDSKTSNKDNVVESNGTLSHFGK");
    Sequence Pterocnemia_pennata = new Sequence("Pterocnemia_pennata", "VKYPNTNEEGKEVLLPEILNPVGADGVYSNELANIEYTNVSKDHDEVFATVDDHKPVSLEYMLDSKTSNKDNVVESNGTLSHFGK");
    Alignment data = new Alignment();
    data.initByName("sequence", Struthio_camelus, "sequence", Rhea_americana, "sequence", Pterocnemia_pennata,
            "dataType", "aminoacid"
    );
    return data;
}
 
开发者ID:jessiewu,项目名称:substBMA,代码行数:11,代码来源:BEASTTestCase.java

示例5: getCovarionAlignment

import beast.evolution.alignment.Alignment; //导入方法依赖的package包/类
static public Alignment getCovarionAlignment() throws Exception {
    Alignment data = new Alignment();
    data.initByName("sequence", German_ST, "sequence", Dutch_List, "sequence", English_ST, "sequence", French, "sequence", Italian, "sequence", Spanish,
            "dataType", "twoStateCovarion", "strip", true
    );
    return data;
}
 
开发者ID:jessiewu,项目名称:substBMA,代码行数:8,代码来源:BEASTTestCase.java

示例6: testMarginalisationOfLikelihoodNucleotide

import beast.evolution.alignment.Alignment; //导入方法依赖的package包/类
@Test
public void testMarginalisationOfLikelihoodNucleotide() throws Exception {
	// test summation over all patterns adds to 1 for nucleotide data

	Sequence German_ST =  new Sequence("German_ST", "           AAAAAAAAAAAAAAAA CCCCCCCCCCCCCCCC GGGGGGGGGGGGGGGG TTTTTTTTTTTTTTTT");
	Sequence Dutch_List = new Sequence("Dutch_List", "          AAAACCCCGGGGTTTT AAAACCCCGGGGTTTT AAAACCCCGGGGTTTT AAAACCCCGGGGTTTT");
	Sequence English_ST = new Sequence("English_ST", "          ACGTACGTACGTACGT ACGTACGTACGTACGT ACGTACGTACGTACGT ACGTACGTACGTACGT");

    Alignment data = new Alignment();
    data.initByName("sequence", German_ST, "sequence", Dutch_List, "sequence", English_ST,
            "dataType", "nucleotide"
    );

    Tree tree = BEASTTestCase.getTree(data, "(English_ST:0.22743347188019544,(German_ST:0.10557648379843088,Dutch_List:0.10557648379843088):0.12185698808176457):0.0;");


    RealParameter frequencies = new RealParameter("0.2 0.3 0.4 0.1");
    Frequencies freqs = new Frequencies();
    freqs.initByName("frequencies", frequencies);
    GeneralSubstitutionModel gsm = new GeneralSubstitutionModel();
    gsm.initByName("rates", "1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0", "frequencies", freqs);

    SiteModel siteModel = new SiteModel();
    siteModel.initByName("mutationRate", "1.0", "gammaCategoryCount", 1, "substModel", gsm);

    TreeLikelihood likelihood = newTreeLikelihood();
    likelihood.initByName("data", data, "tree", tree, "siteModel", siteModel);

    likelihood.initByName("useAmbiguities", false, "data", data, "tree", tree, "siteModel", siteModel);
    likelihood.calculateLogP();
    double [] logPs = likelihood.getPatternLogLikelihoods();
    double P = 0;
    for (double d : logPs) {
    	P += Math.exp(d);
    }
    assertEquals(P, 1.0, BEASTTestCase.PRECISION);
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:38,代码来源:TreeLikelihoodTest.java

示例7: testBeagleRNALikelihood

import beast.evolution.alignment.Alignment; //导入方法依赖的package包/类
/**
 * Test only effective when BEAGLE installed - otherwise it will always
 * pass since BEAGLE code will never be run.
 *
 * @throws Exception
 */
@Test
public void testBeagleRNALikelihood() throws Exception {

    Sequence seq1 = new Sequence("t1", "GUACGUACGUAC");
    Sequence seq2 = new Sequence("t2", "UACGUACGUACG");
    Sequence seq3 = new Sequence("t3", "ACGUACGUACGU");

    Alignment data = new Alignment();
    data.initByName("sequence", seq1,
            "sequence", seq2,
            "sequence", seq3,
            "dataType", "nucleotide");

    Tree tree = BEASTTestCase.getTree(data, "((t1:0.5,t2:0.5):0.5,t3:1.0):0.0;");

    SiteModel siteModel = new SiteModel();
    siteModel.initByName("gammaCategoryCount", 1, "substModel", new JukesCantor());

    TreeLikelihood likelihoodNoBeagle = newTreeLikelihood();

    likelihoodNoBeagle.initByName("data", data, "tree", tree, "siteModel", siteModel);
    double logLnoBeagle = likelihoodNoBeagle.calculateLogP();

    System.setProperty("java.only", "false");
    TreeLikelihood likelihoodBeagle = new TreeLikelihood();
    likelihoodBeagle.initByName("data", data, "tree", tree, "siteModel", siteModel);
    double logLBeagle = likelihoodBeagle.calculateLogP();

    assertEquals(logLBeagle, logLnoBeagle, BEASTTestCase.PRECISION);
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:37,代码来源:TreeLikelihoodTest.java

示例8: getUncertainAlignment

import beast.evolution.alignment.Alignment; //导入方法依赖的package包/类
static public Alignment getUncertainAlignment(boolean duplicate) throws Exception {
     
      String seq1Probs = new String("0.7,0.0,0.3,0.0; 0.0,0.3,0.0,0.7; 0.0,0.0,0.0,1.0;");
      String seq2Probs = new String("0.7,0.0,0.3,0.0; 0.0,0.3,0.0,0.7; 0.0,1.0,0.0,0.0;");
      String seq3Probs = new String("0.4,0.0,0.6,0.0; 0.0,0.6,0.0,0.4; 0.0,1.0,0.0,0.0;");
      
      if (duplicate) {
      	seq1Probs += seq1Probs;
      	seq2Probs += seq2Probs;
      	seq3Probs += seq3Probs;
      }
      Sequence seq1 = new Sequence();
seq1.initByName("taxon","seq1","value",seq1Probs,"uncertain",true);
Sequence seq2 = new Sequence();
seq2.initByName("taxon","seq2","value",seq2Probs,"uncertain",true);
Sequence seq3 = new Sequence();
seq3.initByName("taxon","seq3","value",seq3Probs,"uncertain",true);
              
      Alignment data = new Alignment();
      
      data.initByName("sequence", seq1, "sequence", seq2, "sequence", seq3,
              "dataType", "nucleotide"                
      );

  	DataType dataType = data.getDataType();
      System.out.println("Most probable sequences:");
  	for (List<Integer> seq : data.getCounts()) {
  		System.out.println(dataType.state2string(seq));    		
  	}
  	
      return data;
  }
 
开发者ID:CompEvol,项目名称:beast2,代码行数:33,代码来源:UncertainAlignmentTest.java

示例9: getAlignment

import beast.evolution.alignment.Alignment; //导入方法依赖的package包/类
static public Alignment getAlignment() throws Exception {
	
	// The sequences now denote the most likely annotation        
	Sequence seq1 = new Sequence("seq1", "ATT");
    Sequence seq2 = new Sequence("seq2", "ATC");
    Sequence seq3 = new Sequence("seq3", "GCC");
    
    Alignment data = new Alignment();
    
    data.initByName("sequence", seq1, "sequence", seq2, "sequence", seq3,
            "dataType", "nucleotide"                
    );
	
    return data;
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:16,代码来源:UncertainAlignmentTest.java

示例10: getAlignment

import beast.evolution.alignment.Alignment; //导入方法依赖的package包/类
static public Alignment getAlignment(TaxonSet taxa, Tree tree, SiteModel siteModel) throws Exception {
    Alignment dummy = new Alignment();
    Object [] args = new String[2 * taxa.getTaxonCount() + 2];
    args[args.length - 2] = "dataType";
    args[args.length - 1] = "nucleotide";
    for (int i = 0; i < taxa.getTaxonCount(); ++i) {
        args[2*i] = taxa.getTaxonId(i);
        args[2*i+1] = "N";
    }
    dummy.initByName(args);
    SimulatedAlignment data = new SimulatedAlignment();
    data.initByName("data", dummy, "tree", tree, "siteModel", siteModel);
    return data;
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:15,代码来源:UnorderedAlignmentsTest.java

示例11: getAlignment

import beast.evolution.alignment.Alignment; //导入方法依赖的package包/类
static public Alignment getAlignment() throws Exception {
    Sequence human = new Sequence("0human", "AAAACCCCGGGGTTTT");
    Sequence chimp = new Sequence("1chimp", "ACGTACGTACGTACGT");

    Alignment data = new Alignment();
    data.initByName("sequence", human, "sequence", chimp,
            "dataType", "nucleotide"
    );
    return data;
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:11,代码来源:FilteredAlignmentTest.java

示例12: getAlignmentNoTInHuman

import beast.evolution.alignment.Alignment; //导入方法依赖的package包/类
static public Alignment getAlignmentNoTInHuman() throws Exception {
    Sequence human = new Sequence("0human", "AAAACCCCGGGGAAAA");
    Sequence chimp = new Sequence("1chimp", "ACGTACGTACGTACGT");

    Alignment data = new Alignment();
    data.initByName("sequence", human, "sequence", chimp,
            "dataType", "nucleotide"
    );
    return data;
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:11,代码来源:FilteredAlignmentTest.java

示例13: getAlignment2

import beast.evolution.alignment.Alignment; //导入方法依赖的package包/类
static public Alignment getAlignment2() throws Exception {
	// reordered from getAlignment()
    Sequence human = new Sequence("0human", "AAAACCCCTTTTGGGG");
    Sequence chimp = new Sequence("1chimp", "ACTGACGTACGTACGT");

    Alignment data = new Alignment();
    data.initByName("sequence", human, "sequence", chimp,
            "dataType", "nucleotide"
    );
    return data;
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:12,代码来源:FilteredAlignmentTest.java

示例14: getAlignment3

import beast.evolution.alignment.Alignment; //导入方法依赖的package包/类
static public Alignment getAlignment3() throws Exception {
	// reordered from getAlignment() & with duplicates
    Sequence human = new Sequence("0human", "GGGAAA");
    Sequence chimp = new Sequence("1chimp", "AGGACA");

    Alignment data = new Alignment();
    data.initByName("sequence", human, "sequence", chimp,
            "dataType", "nucleotide"
    );
    return data;
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:12,代码来源:FilteredAlignmentTest.java

示例15: getFourTaxaNoData

import beast.evolution.alignment.Alignment; //导入方法依赖的package包/类
public Alignment getFourTaxaNoData() throws Exception {
    Sequence a = new Sequence("A", "A");
    Sequence b = new Sequence("B", "A");
    Sequence c = new Sequence("C", "A");
    Sequence d = new Sequence("D", "A");

    Alignment data = new Alignment();
    data.initByName("sequence", a, "sequence", b, "sequence", c, "sequence", d, "dataType", "nucleotide");
    return data;
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:11,代码来源:BEASTTestCase.java


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