git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
inprogress
[jalview.git]
/
forester
/
java
/
src
/
org
/
forester
/
sdi
/
SDIR.java
diff --git
a/forester/java/src/org/forester/sdi/SDIR.java
b/forester/java/src/org/forester/sdi/SDIR.java
index
2b72221
..
dbab226
100644
(file)
--- a/
forester/java/src/org/forester/sdi/SDIR.java
+++ b/
forester/java/src/org/forester/sdi/SDIR.java
@@
-23,7
+23,7
@@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
//
// Contact: phylosoft @ gmail . com
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
//
// Contact: phylosoft @ gmail . com
-// WWW: www.phylosoft.org/forester
+// WWW: https://sites.google.com/site/cmzmasek/home/software/forester
package org.forester.sdi;
package org.forester.sdi;
@@
-212,7
+212,7
@@
public class SDIR {
* 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
* 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,
*/
public Phylogeny[] infer( final Phylogeny gene_tree,
final Phylogeny species_tree,
@@
-220,9
+220,9
@@
public class SDIR {
boolean minimize_sum_of_dup,
final boolean minimize_height,
final boolean return_trees,
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();
init();
- SDIse sdise = null;
+ SDI sdise = null;
final ArrayList<Phylogeny> trees = new ArrayList<Phylogeny>();
Phylogeny[] tree_array = null;
List<PhylogenyBranch> branches = null;
final ArrayList<Phylogeny> trees = new ArrayList<Phylogeny>();
Phylogeny[] tree_array = null;
List<PhylogenyBranch> branches = null;
@@
-266,26
+266,23
@@
public class SDIR {
final PhylogenyNode n = iter.next();
if ( n.isRoot() ) {
if ( ( n.getNumberOfDescendants() != 2 ) && ( n.getNumberOfDescendants() != 3 ) ) {
final PhylogenyNode n = iter.next();
if ( n.isRoot() ) {
if ( ( n.getNumberOfDescendants() != 2 ) && ( n.getNumberOfDescendants() != 3 ) ) {
- throw new IllegalArgumentException( "attempt to run SDI on gene tree with "
- + n.getNumberOfDescendants() + " child nodes at its root" );
+ throw new SDIException( "gene tree has " + n.getNumberOfDescendants() + " descendents at its root" );
}
}
else if ( !n.isExternal() && ( n.getNumberOfDescendants() != 2 ) ) {
}
}
else if ( !n.isExternal() && ( n.getNumberOfDescendants() != 2 ) ) {
- throw new IllegalArgumentException( "attempt to run SDI on gene tree which is not completely binary [found node with "
- + n.getNumberOfDescendants() + " child nodes]" );
+ throw new SDIException( "gene tree is not completely binary" );
}
}
for( final PhylogenyNodeIterator iter = species_tree.iteratorPostorder(); iter.hasNext(); ) {
final PhylogenyNode n = iter.next();
if ( !n.isExternal() && ( n.getNumberOfDescendants() != 2 ) ) {
}
}
for( final PhylogenyNodeIterator iter = species_tree.iteratorPostorder(); iter.hasNext(); ) {
final PhylogenyNode n = iter.next();
if ( !n.isExternal() && ( n.getNumberOfDescendants() != 2 ) ) {
- throw new IllegalArgumentException( "attempt to run SDI with a species tree which is not completely binary (after stripping) [found node with "
- + n.getNumberOfDescendants() + " child nodes]" );
+ throw new SDIException( "species tree (after stripping) is not completely binary" );
}
}
g.reRoot( g.getFirstExternalNode() );
branches = SDIR.getBranchesInPreorder( g );
if ( minimize_mapping_cost || minimize_sum_of_dup ) {
}
}
g.reRoot( g.getFirstExternalNode() );
branches = SDIR.getBranchesInPreorder( g );
if ( minimize_mapping_cost || minimize_sum_of_dup ) {
- sdise = new SDIse( g, species_tree );
+ sdise = new SDI( g, species_tree );
duplications = sdise.getDuplicationsSum();
}
final Set<PhylogenyBranch> used_root_placements = new HashSet<PhylogenyBranch>();
duplications = sdise.getDuplicationsSum();
}
final Set<PhylogenyBranch> used_root_placements = new HashSet<PhylogenyBranch>();
@@
-295,7
+292,7
@@
public class SDIR {
prev_root_c2 = prev_root.getChildNode2();
prev_root_was_dup = prev_root.isDuplication();
final PhylogenyBranch current_branch = branches.get( j );
prev_root_c2 = prev_root.getChildNode2();
prev_root_was_dup = prev_root.isDuplication();
final PhylogenyBranch current_branch = branches.get( j );
- g.reRoot( current_branch );
+ GSDIR.reRoot( current_branch, g );
if ( minimize_mapping_cost || minimize_sum_of_dup ) {
duplications = sdise.updateM( prev_root_was_dup, prev_root_c1, prev_root_c2 );
}
if ( minimize_mapping_cost || minimize_sum_of_dup ) {
duplications = sdise.updateM( prev_root_was_dup, prev_root_c1, prev_root_c2 );
}
@@
-421,7
+418,7
@@
public class SDIR {
height = height__diff[ 0 ];
diff = height__diff[ 1 ];
if ( Math.abs( diff ) < SDIR.ZERO_DIFF ) {
height = height__diff[ 0 ];
diff = height__diff[ 1 ];
if ( Math.abs( diff ) < SDIR.ZERO_DIFF ) {
- sdise = new SDIse( g, species_tree );
+ sdise = new SDI( g, species_tree );
min_duplications = sdise.getDuplicationsSum();
min_height = height;
min_diff = Math.abs( diff );
min_duplications = sdise.getDuplicationsSum();
min_height = height;
min_diff = Math.abs( diff );
@@
-497,8
+494,8
@@
public class SDIR {
branches.add( new PhylogenyBranch( t.getRoot().getChildNode1(), t.getRoot().getChildNode2() ) );
return branches;
}
branches.add( new PhylogenyBranch( t.getRoot().getChildNode1(), t.getRoot().getChildNode2() ) );
return branches;
}
- final Set<Integer> one = new HashSet<Integer>();
- final Set<Integer> two = new HashSet<Integer>();
+ final Set<Long> one = new HashSet<Long>();
+ final Set<Long> two = new HashSet<Long>();
PhylogenyNode node = t.getRoot();
while ( !node.isRoot() || !two.contains( node.getId() ) ) {
if ( !node.isExternal() && !two.contains( node.getId() ) ) {
PhylogenyNode node = t.getRoot();
while ( !node.isRoot() || !two.contains( node.getId() ) ) {
if ( !node.isExternal() && !two.contains( node.getId() ) ) {