Home / Development / Documentation / 2.0.44 / BranchLengthsScaler
TreeGraph 2
 


info.bioinfweb.treegraph.document.io.newick
Class BranchLengthsScaler

java.lang.Object
  extended by info.bioinfweb.treegraph.document.io.newick.BranchLengthsScaler

public class BranchLengthsScaler
extends Object

Sets the branch lengths scale of a tree so that the contained branched have a specific average length. Additionally the small interval of the scale bar is set in a way that it equals about a specified value.

Since:
2.0.24
Author:
Ben Stöver

Field Summary
private  int count
           
private static BranchLengthsScaler sharedInstance
           
private  double sum
           
 
Constructor Summary
BranchLengthsScaler()
           
 
Method Summary
private  void calculateAverage(Node root)
           
static BranchLengthsScaler getSharedInstance()
           
 void setAverageScale(Tree tree, double averageLength, float smallIntervalLength)
          Sets the branch lengths scale of a tree so that the contained branched have the specified average length.
 void setDefaultAverageScale(Tree tree)
          Sets the branch lengths scale of a tree so that the contained branched have BranchFormats.DEFAULT_MIN_LENGTH as their average length.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sharedInstance

private static BranchLengthsScaler sharedInstance

count

private int count

sum

private double sum
Constructor Detail

BranchLengthsScaler

public BranchLengthsScaler()
Method Detail

getSharedInstance

public static BranchLengthsScaler getSharedInstance()

calculateAverage

private void calculateAverage(Node root)

setAverageScale

public void setAverageScale(Tree tree,
                            double averageLength,
                            float smallIntervalLength)
Sets the branch lengths scale of a tree so that the contained branched have the specified average length. Additionally the small interval of the scale bar is set in a way that it equals about a specified value.

Parameters:
tree -
averageLength - the average length in millimeters
smallIntervalLength - the approximate desired length of a small interval of the scale bar in millimeters

setDefaultAverageScale

public void setDefaultAverageScale(Tree tree)
Sets the branch lengths scale of a tree so that the contained branched have BranchFormats.DEFAULT_MIN_LENGTH as their average length. Additionally the small interval of the scale bar is set in a way that it equals about ScaleBarFormats.DEFAULT_SMALL_INTERVAL_IN_MM.

Parameters:
tree -
Since:
2.0.41