phylonet.ilp
Class IlpGenerator

java.lang.Object
  extended by phylonet.ilp.IlpGenerator

public class IlpGenerator
extends java.lang.Object

IlpGenerator defines methods for generating CPLEX inputs.

Author:
cvthan

Constructor Summary
IlpGenerator()
           
 
Method Summary
 void assignNodeTime(STITree<java.lang.Double> tree)
          Convert the tree with branch lengths into the tree with time.
 java.util.List<java.util.BitSet> computeAllClusters(java.util.List<Tree> geneTrees)
          Compute all clusters induced by a list of trees.
 java.util.List<java.util.BitSet> computeTreeClusters(Tree tree)
          Computer clusters induced by a tree.
static void genCplex(java.lang.String[] args)
           
 void generateCplexInput(STITree<java.lang.Integer> speciesTree, java.util.List<Tree> geneTrees, java.lang.String cplexFileName, java.lang.String variableFileName, java.lang.String scriptFileName)
          This function generates CPLEX inputs according to the method described in the paper "Accurate and efficient tree reconstruction from genome-size multi-locus data under the coalescent".
 void generateSpeciesTrees(java.util.List<Tree> geneTrees, java.io.File destination)
          Generates a list of species trees by constructing from maximal sets of compatible clusters induced by gene trees, and writes this list to the supplied file.
static void genSpeciesTrees(java.lang.String[] args)
           
 void getValidGeneTrees(java.lang.String gtFile, java.lang.String validGtFile)
          This function filters from the set of gene trees those whose node times satisfy: time(parent) > time(children).
static void printUsage()
          Print help message about how to use
 void setSfWeight(double w)
          Set weight for sf.
 void setSgWeight(double w)
          Set weight for sg.
 void setTaxa(java.util.List<java.lang.String> t)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlpGenerator

public IlpGenerator()
Method Detail

setTaxa

public void setTaxa(java.util.List<java.lang.String> t)

genSpeciesTrees

public static void genSpeciesTrees(java.lang.String[] args)

genCplex

public static void genCplex(java.lang.String[] args)

setSfWeight

public void setSfWeight(double w)
Set weight for sf.

Parameters:
w: - sf weight.

setSgWeight

public void setSgWeight(double w)
Set weight for sg.

Parameters:
w: - sg weight.

generateSpeciesTrees

public void generateSpeciesTrees(java.util.List<Tree> geneTrees,
                                 java.io.File destination)
                          throws java.io.IOException
Generates a list of species trees by constructing from maximal sets of compatible clusters induced by gene trees, and writes this list to the supplied file.

Parameters:
geneTrees - the list of gene trees from which we want to build species trees
destination - the file to which the generated species trees should be written
Throws:
java.io.IOException - if an I/O error is encountered while opening, writing to, or closing the destination file

generateCplexInput

public void generateCplexInput(STITree<java.lang.Integer> speciesTree,
                               java.util.List<Tree> geneTrees,
                               java.lang.String cplexFileName,
                               java.lang.String variableFileName,
                               java.lang.String scriptFileName)
This function generates CPLEX inputs according to the method described in the paper "Accurate and efficient tree reconstruction from genome-size multi-locus data under the coalescent".

Parameters:
speciesTree: - File containing the species tree
geneTrees: - File containing the gene trees. The function assumes that all gene trees in this file satisfy the property that time(parent) > time(children).
cplexFileName: - File will contain the input to CPLEX
variableFileName: - File will contain variable mappings. This is valuable when one wants to parse CPLEX outputs.
scriptFileName: - File containing CPLEX commands to run CPLEX, and get the optimization solution.

getValidGeneTrees

public void getValidGeneTrees(java.lang.String gtFile,
                              java.lang.String validGtFile)
This function filters from the set of gene trees those whose node times satisfy: time(parent) > time(children).

Parameters:
gtFile: - File containing the original gene trees.
validGtFile: - File containing new "valid" gene trees (ie., those satisfy the description above).

assignNodeTime

public void assignNodeTime(STITree<java.lang.Double> tree)
Convert the tree with branch lengths into the tree with time. The time of the leaves are assigned 0.

Parameters:
tree: - The tree with branch lengths.

printUsage

public static void printUsage()
Print help message about how to use


computeAllClusters

public java.util.List<java.util.BitSet> computeAllClusters(java.util.List<Tree> geneTrees)
Compute all clusters induced by a list of trees.

Parameters:
geneTrees: - List of gene trees.

computeTreeClusters

public java.util.List<java.util.BitSet> computeTreeClusters(Tree tree)
Computer clusters induced by a tree.

Parameters:
tree: - The tree we want to compute clusters.