Search in sources :

Example 31 with Sequence

use of dr.evolution.sequence.Sequence in project beast-mcmc by beast-dev.

the class TraceCorrelationAssert method createAlignment.

protected void createAlignment(Object[][] taxa_sequence, DataType dataType) {
    alignment = new SimpleAlignment();
    alignment.setDataType(dataType);
    //        alignment.setDataType(Nucleotides.INSTANCE);
    // 6, 17
    taxa = new Taxon[taxa_sequence[0].length];
    System.out.println("Taxon len = " + taxa_sequence[0].length);
    System.out.println("Alignment len = " + taxa_sequence[1].length);
    if (taxa_sequence.length > 2)
        System.out.println("Date len = " + taxa_sequence[2].length);
    for (int i = 0; i < taxa_sequence[0].length; i++) {
        taxa[i] = new Taxon(taxa_sequence[0][i].toString());
        if (taxa_sequence.length > 2) {
            Date date = new Date((Double) taxa_sequence[2][i], Units.Type.YEARS, (Boolean) taxa_sequence[3][0]);
            taxa[i].setDate(date);
        }
        //taxonList.addTaxon(taxon);
        Sequence sequence = new Sequence(taxa_sequence[1][i].toString());
        sequence.setTaxon(taxa[i]);
        sequence.setDataType(dataType);
        alignment.addSequence(sequence);
    }
}
Also used : SimpleAlignment(dr.evolution.alignment.SimpleAlignment) Taxon(dr.evolution.util.Taxon) Sequence(dr.evolution.sequence.Sequence) Date(dr.evolution.util.Date)

Aggregations

Sequence (dr.evolution.sequence.Sequence)31 SimpleAlignment (dr.evolution.alignment.SimpleAlignment)15 Taxon (dr.evolution.util.Taxon)12 DataType (dr.evolution.datatype.DataType)6 BranchRateModel (dr.evomodel.branchratemodel.BranchRateModel)6 GammaSiteRateModel (dr.evomodel.siteratemodel.GammaSiteRateModel)5 TreeModel (dr.evomodel.tree.TreeModel)5 Parameter (dr.inference.model.Parameter)5 Tree (dr.evolution.tree.Tree)4 Date (dr.evolution.util.Date)4 HomogeneousBranchModel (dr.evomodel.branchmodel.HomogeneousBranchModel)4 DefaultBranchRateModel (dr.evomodel.branchratemodel.DefaultBranchRateModel)4 FrequencyModel (dr.evomodel.substmodel.FrequencyModel)4 Partition (dr.app.beagle.tools.Partition)3 NewickImporter (dr.evolution.io.NewickImporter)3 HKY (dr.evomodel.substmodel.nucleotide.HKY)3 ArrayList (java.util.ArrayList)3 BeagleSequenceSimulator (dr.app.beagle.tools.BeagleSequenceSimulator)2 ImportException (dr.evolution.io.Importer.ImportException)2 Taxa (dr.evolution.util.Taxa)2