Search in sources :

Example 36 with Locus

use of bacter.Locus in project bacter by tgvaughan.

the class ConversionGraphStatsLogger method getMeanEdgeLength.

/**
 * Obtain mean length of converted edges in ACG.
 *
 * @param acg
 * @return mean length, or NaN if ACG has no converted edges
 */
public static double getMeanEdgeLength(ConversionGraph acg) {
    if (acg.getTotalConvCount() < 1)
        return Double.NaN;
    double mean = 0.0;
    for (Locus locus : acg.getLoci()) {
        for (Conversion conv : acg.getConversions(locus)) mean += conv.getHeight2() - conv.getHeight1();
    }
    mean /= acg.getTotalConvCount();
    return mean;
}
Also used : Locus(bacter.Locus) Conversion(bacter.Conversion)

Example 37 with Locus

use of bacter.Locus in project bacter by tgvaughan.

the class ConvertedRegionLogger method init.

@Override
public void init(PrintStream out) {
    final ConversionGraph arg = acgInput.get();
    String mainID = (getID() == null || getID().matches(("\\s*"))) ? arg.getID() + ".converted" : getID();
    for (Locus locus : acgInput.get().getLoci()) out.print(mainID + "." + locus.getID() + "\t");
}
Also used : Locus(bacter.Locus) ConversionGraph(bacter.ConversionGraph)

Aggregations

Locus (bacter.Locus)37 Conversion (bacter.Conversion)27 Node (beast.evolution.tree.Node)17 ConversionGraph (bacter.ConversionGraph)10 ArrayList (java.util.ArrayList)7 Test (org.junit.Test)7 RealParameter (beast.core.parameter.RealParameter)6 TaxonSet (beast.evolution.alignment.TaxonSet)5 SiteModel (beast.evolution.sitemodel.SiteModel)5 JukesCantor (beast.evolution.substitutionmodel.JukesCantor)5 ConstantPopulation (beast.evolution.tree.coalescent.ConstantPopulation)5 PrintStream (java.io.PrintStream)4 ClusterTree (beast.util.ClusterTree)3 SimulatedACG (bacter.model.SimulatedACG)2 NexusBuilder (feast.nexus.NexusBuilder)2 TaxaBlock (feast.nexus.TaxaBlock)2 FileNotFoundException (java.io.FileNotFoundException)2 Iterator (java.util.Iterator)2 CFEventList (bacter.CFEventList)1 ACGCoalescent (bacter.model.ACGCoalescent)1