import org.forester.sdi.GSDI;
import org.forester.sdi.SDI;
import org.forester.sdi.SDI.TaxonomyComparisonBase;
+import org.forester.sdi.SDIException;
import org.forester.sdi.SDIse;
-import org.forester.sdi.SdiException;
import org.forester.util.CommandLineArguments;
import org.forester.util.EasyWriter;
import org.forester.util.ForesterConstants;
sdi = new SDIse( gene_tree, species_tree );
}
}
- catch ( final SdiException e ) {
+ catch ( final SDIException e ) {
log_writer.println( "User Error: " + e.getLocalizedMessage() );
log_writer.close();
ForesterUtil.fatalError( PRG_NAME, e.getLocalizedMessage() );
import org.forester.phylogeny.iterators.PreorderTreeIterator;
import org.forester.sdi.DistanceCalculator;
import org.forester.sdi.RIO;
+import org.forester.sdi.SDIException;
import org.forester.sdi.SDIR;
-import org.forester.sdi.SdiException;
import org.forester.util.ForesterUtil;
public class rio {
final int warn_no_orthos,
final double warn_one_ortho,
final int bootstraps,
- final double t_orthologs_dc ) throws IOException, SdiException {
+ final double t_orthologs_dc ) throws IOException, SDIException {
Phylogeny consensus_tree = null;
Phylogeny
// to be a consensus tree.
import org.forester.phylogeny.PhylogenyMethods;
import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory;
import org.forester.phylogeny.factories.PhylogenyFactory;
+import org.forester.sdi.SDIException;
import org.forester.sdi.SDIR;
import org.forester.sdi.SDIse;
-import org.forester.sdi.SdiException;
import org.forester.util.ForesterUtil;
/*
* set to true, then out of the resulting trees with minimal
* mapping cost or minimal number of duplications the tree with
* the minimal height is chosen
- * @throws SdiException
+ * @throws SDIException
*/
public static void infer( final File indir,
final File species_tree_file,
final boolean write_trees,
final boolean minimize_mapping_cost,
boolean minimize_sum_of_dup,
- final boolean minimize_height ) throws IOException, SdiException {
+ final boolean minimize_height ) throws IOException, SDIException {
final int MIN_EXT_NODES = 4; // Minimal size of trees [in ext nodes]
// to be analyzed.
final int MAX_EXT_NODES = 5000; // Maximal size of trees [in ext nodes]
import org.forester.phylogeny.Phylogeny;
import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory;
import org.forester.phylogeny.factories.PhylogenyFactory;
+import org.forester.sdi.SDIException;
import org.forester.sdi.SDIx;
-import org.forester.sdi.SdiException;
import org.forester.util.CommandLineArguments;
import org.forester.util.ForesterUtil;
final static private String PRG_VERSION = "0.001 alpha";
final static private String PRG_DATE = "2009.10.14";
- public static void main( final String args[] ) throws SdiException {
+ public static void main( final String args[] ) throws SDIException {
ForesterUtil.printProgramInformation( PRG_NAME, PRG_VERSION, PRG_DATE );
System.out.println();
CommandLineArguments cla = null;
}
final public List<PhylogenyNode> getAllDescendants() {
-
return _descendants;
}
-
-
+
final public int getNumberOfDescendants() {
if ( _descendants == null ) {
return 0;
final Phylogeny species_tree,
final boolean most_parsimonious_duplication_model,
final boolean strip_gene_tree,
- final boolean strip_species_tree ) throws SdiException {
+ final boolean strip_species_tree ) throws SDIException {
super( gene_tree, species_tree );
_speciation_or_duplication_events_sum = 0;
_speciations_sum = 0;
}
GSDI( final Phylogeny gene_tree, final Phylogeny species_tree, final boolean most_parsimonious_duplication_model )
- throws SdiException {
+ throws SDIException {
this( gene_tree, species_tree, most_parsimonious_duplication_model, false, false );
}
/**
* This allows for linking of internal nodes of the species tree (as opposed
* to just external nodes, as in the method it overrides.
- * @throws SdiException
+ * @throws SDIException
*
*/
@Override
- final void linkNodesOfG() throws SdiException {
+ final void linkNodesOfG() throws SDIException {
final Map<String, PhylogenyNode> species_to_node_map = new HashMap<String, PhylogenyNode>();
final List<PhylogenyNode> species_tree_ext_nodes = new ArrayList<PhylogenyNode>();
final TaxonomyComparisonBase tax_comp_base = determineTaxonomyComparisonBase( _gene_tree );
final String tax_str = taxonomyToString( s, tax_comp_base );
if ( !ForesterUtil.isEmpty( tax_str ) ) {
if ( species_to_node_map.containsKey( tax_str ) ) {
- throw new SdiException( "taxonomy \"" + s + "\" is not unique in species tree" );
+ throw new SDIException( "taxonomy \"" + s + "\" is not unique in species tree" );
}
species_to_node_map.put( tax_str, s );
}
_stripped_gene_tree_nodes.add( g );
}
else {
- throw new SdiException( "gene tree node \"" + g + "\" has no taxonomic data" );
+ throw new SDIException( "gene tree node \"" + g + "\" has no taxonomic data" );
}
}
else {
_stripped_gene_tree_nodes.add( g );
}
else {
- throw new SdiException( "gene tree node \"" + g + "\" has no appropriate taxonomic data" );
+ throw new SDIException( "gene tree node \"" + g + "\" has no appropriate taxonomic data" );
}
}
else {
_stripped_gene_tree_nodes.add( g );
}
else {
- throw new SdiException( "taxonomy \"" + g.getNodeData().getTaxonomy()
+ throw new SDIException( "taxonomy \"" + g.getNodeData().getTaxonomy()
+ "\" not present in species tree" );
}
}
* @param query
* the sequence name of the squence whose orthologs are to be
* inferred
- * @throws SdiException
+ * @throws SDIException
*/
public void inferOrthologs( final File gene_trees_file, final Phylogeny species_tree, final String query )
- throws IOException, SdiException {
+ throws IOException, SDIException {
int bs = 0;
if ( RIO.TIME ) {
_time = System.currentTimeMillis();
// Helper method which performs the actual ortholog inference for
// the external node with seqname query.
private void inferOrthologsHelper( final Phylogeny gene_tree, final Phylogeny species_tree, final String query )
- throws SdiException {
+ throws SDIException {
Phylogeny assigned_tree = null;
List<PhylogenyNode> nodes = null;
final SDIR sdiunrooted = new SDIR();
GeneralTable<String, Integer> _super_orthologs = null;
GeneralTable<String, Integer> _ultra_paralogs = null;
- private void doInferOrthologs( final Phylogeny gene_tree, final Phylogeny species_tree ) throws SdiException {
+ private void doInferOrthologs( final Phylogeny gene_tree, final Phylogeny species_tree ) throws SDIException {
final SDIR sdiunrooted = new SDIR();
final Phylogeny assigned_tree = sdiunrooted.infer( gene_tree,
species_tree,
* links (sets the field "link" of PhylogenyNode) each external
* PhylogenyNode of gene_tree to the external PhylogenyNode of species_tree
* which has the same species name.
- * @throws SdiException
+ * @throws SDIException
*/
- void linkNodesOfG() throws SdiException {
+ void linkNodesOfG() throws SDIException {
final Map<String, PhylogenyNode> speciestree_ext_nodes = new HashMap<String, PhylogenyNode>();
final TaxonomyComparisonBase tax_comp_base = determineTaxonomyComparisonBase();
// Put references to all external nodes of the species tree into a map.
package org.forester.sdi;
-public class SdiException extends Exception {
+public class SDIException extends Exception {
/**
*
*/
private static final long serialVersionUID = 5154733429066500435L;
- public SdiException() {
+ public SDIException() {
super();
}
- public SdiException( final String message ) {
+ public SDIException( final String message ) {
super( message );
}
}
* Array) must be no lower than 1
* @return array of rooted Trees with duplication vs. speciation assigned if
* return_trees is set to true, null otherwise
- * @throws SdiException
+ * @throws SDIException
*/
public Phylogeny[] infer( final Phylogeny gene_tree,
final Phylogeny species_tree,
boolean minimize_sum_of_dup,
final boolean minimize_height,
final boolean return_trees,
- int max_trees_to_return ) throws SdiException {
+ int max_trees_to_return ) throws SDIException {
init();
SDIse sdise = null;
final ArrayList<Phylogeny> trees = new ArrayList<Phylogeny>();
* reference to a rooted binary species Phylogeny which might get
* stripped in the process, must have species names in the
* species name fields for all external nodes
- * @throws SdiException
+ * @throws SDIException
*/
- public SDIse( final Phylogeny gene_tree, final Phylogeny species_tree ) throws SdiException {
+ public SDIse( final Phylogeny gene_tree, final Phylogeny species_tree ) throws SDIException {
super( gene_tree, species_tree );
_duplications_sum = 0;
getSpeciesTree().preOrderReId();
private void analyze( final Phylogeny gene_tree,
final String gene_tree_file_name,
final Phylogeny[] species_trees,
- final File out_dir ) throws IOException, SdiException {
+ final File out_dir ) throws IOException, SDIException {
final boolean minimize_cost = true;
final boolean minimize_sum_of_dup = true;
final boolean minimize_height = true;
}
public void method1( final List<File> gene_tree_files, final Phylogeny[] species_trees, final File out_dir )
- throws IOException, SdiException {
+ throws IOException, SDIException {
checkSpeciesTreesForEqualNumberOfExtNodes( species_trees );
final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
for( final File gene_tree_file : gene_tree_files ) {
import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory;
import org.forester.phylogeny.factories.PhylogenyFactory;
-import com.itextpdf.text.pdf.ArabicLigaturizer;
-
public final class TestGSDI {
private final static Phylogeny createPhylogeny( final String nhx ) throws IOException {
System.out.println( "failed." );
failed++;
}
-
System.out.print( "SDIunrooted: " );
if ( Test.testSDIunrooted() ) {
System.out.println( "OK." );
return true;
}
-
-
private static boolean testUniprotTaxonomySearch() {
try {
List<UniProtTaxonomy> results = SequenceDbWsTools.getTaxonomiesFromCommonNameStrict( "starlet sea anemone",
// To prevent accessing online dbs in too quick succession.
Thread.sleep( 20 );
}
- catch ( InterruptedException e ) {
+ catch ( final InterruptedException e ) {
e.printStackTrace();
}
return result;