FORESTER 1.8

forester.tools
Class RIO

java.lang.Object
  |
  +--forester.tools.RIO

public class RIO
extends java.lang.Object

Version:
1.300 -- last modified: 06/12/01
Author:
Christian M. Zmasek

Constructor Summary
RIO()
          Default constructor.
 
Method Summary
 int getBootstraps()
          Returns the numbers of trees analyzed.
 double getDistance(java.lang.String name)
          Returns the distance to a sequences/taxa after a distance list file has been read in with readDistanceList(File).
 double getDistance(java.lang.String name1, java.lang.String name2)
          Returns the distance between two sequences/taxa after a distance matrix file has been read in with readDistanceMatrix(File).
 int getExtNodesOfAnalyzedGeneTrees()
          Returns the numbers of number of ext nodes in gene trees analyzed (after stripping).
 java.util.HashMap getInferredOrthologs(java.lang.String seq_name)
          Returns a HashMap containing the inferred orthologs of the external gene tree node with the sequence name seq_name.
 java.util.HashMap getInferredSuperOrthologs(java.lang.String seq_name)
          Returns a HashMap containing the inferred "super orthologs" of the external gene tree node with the sequence name seq_name.
 java.lang.String getOrder(int sort)
          Returns the order in which ortholog (o), "super ortholog" (s) and distance (d) are returned and sorted (priority of sort always goes from left to right), given sort.
 long getTime()
          Returns the time (in ms) needed to run "inferOrthologs".
 void inferOrthologs(java.io.File gene_trees_file, Tree species_tree)
          Infers the orthologs (and "super orthologs") for each external node of the gene Trees in multiple tree File gene_trees_file (=output of PHYLIP NEIGHBOR, for example).
 void inferOrthologs(java.io.File gene_trees_file, Tree species_tree, java.lang.String query)
          Infers the orthologs (and "super orthologs") for each external node of the gene Trees in multiple tree File gene_trees_file (=output of PHYLIP NEIGHBOR, for example).
 void inferOrthologs(Tree[] gene_trees, Tree species_tree)
          Infers the orthologs (and "super orthologs") for each external node in Tree array gene_trees.
 java.util.ArrayList inferredOrthologsToArrayList(java.lang.String seq_name, double threshold_orthologs, double threshold_super_orthologs)
          Returns an ArrayList containg the names of orthologs of the Node with seq name seq_name.
 void inferredOrthologsToFile(java.io.File outfile, int sort, double threshold_orthologs, double threshold_super_orthologs)
          Writes the orthologs as well as the "super orthologs" for each external nodes of the gene trees to outfile.
 java.lang.String inferredOrthologsToString(java.lang.String query_name, int sort, double threshold_orthologs, double threshold_super_orthologs)
          Returns a String containg the names of orthologs of the Node with seq name query_name.
 void inferredOrthologTableToFile(java.io.File outfile)
          Writes the orthologs for each external nodes of the gene trees to outfile in the form of a table.
 void inferredSuperOrthologTableToFile(java.io.File outfile)
          Writes the "super orthologs" for each external nodes of the gene trees to outfile in the form of a table.
 void readDistanceList(java.io.File dist_list)
          Reads in the distance list file dist_list.
 void readDistanceMatrix(java.io.File matrix_file)
          Reads in the distance matrix file matrix_file.
static int roundToInt(double d)
          Rounds a double to a int.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RIO

public RIO()
Default constructor.
Method Detail

inferOrthologs

public void inferOrthologs(java.io.File gene_trees_file,
                           Tree species_tree,
                           java.lang.String query)
                    throws java.lang.Exception
Infers the orthologs (and "super orthologs") for each external node of the gene Trees in multiple tree File gene_trees_file (=output of PHYLIP NEIGHBOR, for example). Tallies how many times each sequence is orthologous towards the query. Gene duplications are inferred using SDI. Modifies its argument species_tree. Is a little faster than "inferOrthologs(File,Tree)" since orthologs are only inferred for query.

To obtain the results use the methods listed below.

(Last modified: 06/12/01)

Parameters:
gene_trees_file - a File containing gene Trees in NH format, which is the result of performing a bootstrap analysis in PHYLIP
species_tree - a species Tree, which has species names in its species fields
query - the sequence name of the squence whose orthologs are to be inferred
See Also:
getInferredOrthologs(String), getInferredSuperOrthologs(String), inferredOrthologsToString(String,int,double,double), inferredOrthologsToFile(File,int,double,double), inferredOrthologTableToFile(File), inferredSuperOrthologTableToFile(File)

inferOrthologs

public void inferOrthologs(Tree[] gene_trees,
                           Tree species_tree)
Infers the orthologs (and "super orthologs") for each external node in Tree array gene_trees. Tallies how many times each sequence is orthologous towards all other ones. Gene duplications are inferred using SDI. Modifies its arguments gene_trees and species_tree. Method "inferOrthologs(File,Tree)" accomplishes the same, but needs less memory since not all gene Trees have to be kept in memory.

To obtain the results use the methods listed below.

(Last modified: 12/07/00)

Parameters:
gene_trees - a Tree[] which is the result of performing a bootstrap analysis, nodes of trees must have species names and sequence names in the appropriate fields
species_tree - a species Tree, which has species names in its species fields
See Also:
getInferredOrthologs(String), getInferredSuperOrthologs(String), inferredOrthologsToString(String,int,double,double), inferredOrthologsToFile(File,int,double,double), inferredOrthologTableToFile(File), inferredSuperOrthologTableToFile(File)

inferOrthologs

public void inferOrthologs(java.io.File gene_trees_file,
                           Tree species_tree)
                    throws java.lang.Exception
Infers the orthologs (and "super orthologs") for each external node of the gene Trees in multiple tree File gene_trees_file (=output of PHYLIP NEIGHBOR, for example). Tallies how many times each sequence is orthologous towards all other ones. Gene duplications are inferred using SDI. Modifies its argument species_tree. Might be a little slower than "inferOrthologs(File,Tree,String)". Needs less memory than "inferOrthologs(Tree[],Tree)" since not all gene Trees have to be kept in memory.

To obtain the results use the methods listed below.

(Last modified: 12/07/00)

Parameters:
gene_trees_file - a File containing gene Trees in NH format, which is the result of performing a bootstrap analysis in PHYLIP
species_tree - a species Tree, which has species names in its species fields
See Also:
inferOrthologs(File,Tree,String), getInferredOrthologs(String), getInferredSuperOrthologs(String), inferredOrthologsToString(String,int,double,double), inferredOrthologsToFile(File,int,double,double), inferredOrthologTableToFile(File), inferredSuperOrthologTableToFile(File)

inferredOrthologsToString

public java.lang.String inferredOrthologsToString(java.lang.String query_name,
                                                  int sort,
                                                  double threshold_orthologs,
                                                  double threshold_super_orthologs)
                                           throws java.lang.Exception
Returns a String containg the names of orthologs of the Node with seq name query_name. The String also contains how many times a particular ortholog has been observed. The order and sort priority of this is determined by sort in the following manner:

Returns null if orthologs have not been calculated (successfully); or if distance list or matrix have not been read in (successfully) -- in case sort > 2.

Returns "-" if no putative orthologs have been found.

Orthologs are to be inferred by method "inferOrthologs".

(Last modified: 05/08/01)

Parameters:
query_name - sequence name of a external node of the gene trees
sort - order and sort priority
bootstraps -  
threshold_orthologs - the minimal number of observations for a a sequence to be reported as orthologous, in percents (0.0-100.0%)
threshold_super_orthologs - the minimal number of observations for a a sequence to be reported as super orthologous, in percents (0.0-100.0%) -- the relation between "threshold_orthologs" and "threshold_super_orthologs" is AND
Returns:
String containing the inferred orthologs, String containing "-" if no orthologs have been found null in case of error
See Also:
inferOrthologs(File,Tree,String), inferOrthologs(Tree[],Tree), inferOrthologs(File,Tree), getOrder(int)

inferredOrthologsToArrayList

public java.util.ArrayList inferredOrthologsToArrayList(java.lang.String seq_name,
                                                        double threshold_orthologs,
                                                        double threshold_super_orthologs)
                                                 throws java.lang.Exception
Returns an ArrayList containg the names of orthologs of the Node with seq name seq_name.
(Last modified: 05/08/01)
Parameters:
seq_name - sequence name of a external node of the gene trees
threshold_orthologs - the minimal number of observations for a a sequence to be reported as orthologous as percentage (0.0-100.0%)
threshold_super_orthologs - the minimal number of observations for a a sequence to be reported as super orthologous -- the relation between "threshold_orthologs" and "threshold_super_orthologs" is AND as percentage (0.0-100.0%)
Returns:
ArrayList containg the names of orthologs of the Node with seq name seq_name
See Also:
inferOrthologs(Tree[],Tree), inferOrthologs(File,Tree), getOrder(int)

inferredOrthologsToFile

public void inferredOrthologsToFile(java.io.File outfile,
                                    int sort,
                                    double threshold_orthologs,
                                    double threshold_super_orthologs)
                             throws java.lang.Exception
Writes the orthologs as well as the "super orthologs" for each external nodes of the gene trees to outfile. For the meaning of sort
Parameters:
sort - order and sort priority
threshold_orthologs - the minimal number of observations for a a sequence to be reported as orthologous
threshold_super_orthologs - the minimal number of observations for a a sequence to be reported as super orthologous -- the relation between "threshold_orthologs" and "threshold_super_orthologs" is AND
See Also:
Orthologs are to be inferred by method "inferOrthologs". Overwrites without asking! (Last modified: 12/07/00), inferredOrthologsToString(String,int,double,double), inferOrthologs(Tree[],Tree), inferOrthologs(File,Tree), getOrder(int)

inferredOrthologTableToFile

public void inferredOrthologTableToFile(java.io.File outfile)
                                 throws java.lang.Exception
Writes the orthologs for each external nodes of the gene trees to outfile in the form of a table. Orthologs are to be inferred by method "inferOrthologs". Overwrites without asking! (Last modified: 12/07/00)
Parameters:
outfile - the File to write to
See Also:
inferOrthologs(Tree[],Tree), inferOrthologs(File,Tree)

inferredSuperOrthologTableToFile

public void inferredSuperOrthologTableToFile(java.io.File outfile)
                                      throws java.lang.Exception
Writes the "super orthologs" for each external nodes of the gene trees to outfile in the form of a table. Super orthologs are to be inferred by method "inferOrthologs". Overwrites without asking! (Last modified: 11/28/00)
Parameters:
outfile - the File to write to
See Also:
inferOrthologs(Tree[],Tree), inferOrthologs(File,Tree)

getInferredOrthologs

public java.util.HashMap getInferredOrthologs(java.lang.String seq_name)
                                       throws java.lang.Exception
Returns a HashMap containing the inferred orthologs of the external gene tree node with the sequence name seq_name. Sequence names are the keys (String), numbers of observations are the values (Int). Orthologs are to be inferred by method "inferOrthologs". Throws an exception if seq_name is not found. (Last modified: 05/08/01)
Parameters:
seq_name - sequence name of a external node of the gene trees
Returns:
HashMap containing the inferred orthologs (name(String)->value(Int))
See Also:
inferOrthologs(Tree[],Tree), inferOrthologs(File,Tree)

getInferredSuperOrthologs

public java.util.HashMap getInferredSuperOrthologs(java.lang.String seq_name)
                                            throws java.lang.Exception
Returns a HashMap containing the inferred "super orthologs" of the external gene tree node with the sequence name seq_name. Sequence names are the keys (String), numbers of observations are the values (Int). Super orthologs are to be inferred by method "inferOrthologs". Throws an exception if seq_name is not found. (Last modified: 05/08/01)
Parameters:
seq_name - sequence name of a external node of the gene trees
Returns:
HashMap containing the inferred super orthologs (name(String)->value(Int))
See Also:
inferOrthologs(Tree[],Tree), inferOrthologs(File,Tree)

getOrder

public java.lang.String getOrder(int sort)
Returns the order in which ortholog (o), "super ortholog" (s) and distance (d) are returned and sorted (priority of sort always goes from left to right), given sort. For the meaning of sort
Parameters:
sort - determines order and sort priority
Returns:
String indicating the order
See Also:

(Last modified: 11/29/00), inferredOrthologsToString(String,int,double,double), inferredOrthologsToFile(File,int,double,double)


getTime

public long getTime()
Returns the time (in ms) needed to run "inferOrthologs". Final variable TIME needs to be set to true.

(Last modified: 11/14/00)

Returns:
time (in ms) needed to run method "inferOrthologs"
See Also:
inferOrthologs(Tree[],Tree), inferOrthologs(File,Tree)

getBootstraps

public int getBootstraps()
Returns the numbers of trees analyzed.

(Last modified: 02/20/00)

Returns:
the numbers of trees analyzed
See Also:
inferOrthologs(Tree[],Tree), inferOrthologs(File,Tree)

getExtNodesOfAnalyzedGeneTrees

public int getExtNodesOfAnalyzedGeneTrees()
Returns the numbers of number of ext nodes in gene trees analyzed (after stripping).

(Last modified: 05/02/00)

Returns:
number of ext nodes in gene trees analyzed (after stripping)
See Also:
inferOrthologs(Tree[],Tree), inferOrthologs(File,Tree)

readDistanceMatrix

public void readDistanceMatrix(java.io.File matrix_file)
                        throws java.lang.Exception
Reads in the distance matrix file matrix_file. The file must have the following format.

[number of sequences, is ignored, and is not necessary]
name x x x 
name x x x
name x x x

Number of white spaces does not matter. Such files are produces by PHYLIP PROTDIST. Files produced by TREE-PUZZLE need to be modified to remove the newlines "inside" the rows.

(Last modified: 11/28/00)

Parameters:
matrix_file - a File containing a distance matrix
See Also:
getDistance(String,String)

readDistanceList

public void readDistanceList(java.io.File dist_list)
                      throws java.lang.Exception
Reads in the distance list file dist_list. The file must have the following format.

name x
name x
name x
Number of white spaces does not matter. Such files are produces by modified TREE-PUZZLE.

(Last modified: 05/30/01)

Parameters:
dist_list - a File containing a distance matrix
See Also:
getDistance(String)

getDistance

public double getDistance(java.lang.String name1,
                          java.lang.String name2)
                   throws java.lang.Exception
Returns the distance between two sequences/taxa after a distance matrix file has been read in with readDistanceMatrix(File). Throws an exception if name1 or name2 are not found or if no matrix has been read in.

(Last modified: 11/28/00)

Parameters:
name1 - a sequence name name2 a sequence name
See Also:
readDistanceMatrix(File)

getDistance

public double getDistance(java.lang.String name)
                   throws java.lang.Exception
Returns the distance to a sequences/taxa after a distance list file has been read in with readDistanceList(File). Throws an exception if name is not found or if no list has been read in.

(Last modified: 05/30/01)

Parameters:
name - a sequence name
See Also:
readDistanceList(File)

roundToInt

public static int roundToInt(double d)
Rounds a double to a int.

(Last modified: 03/15/01)

Parameters:
d - a double to be rounded to a int
Returns:
d rounded to a int

FORESTER 1.8