- /**
- * Updates the mapping function M after the root of the gene tree has been
- * moved by one branch. It calculates M for the root of the gene tree and
- * one of its two children.
- * <p>
- * To be used ONLY by method "SDIunrooted.fastInfer(Phylogeny,Phylogeny)".
- * <p>
- * (Last modfied: )
- *
- * @param prev_root_was_dup
- * true if the previous root was a duplication, false otherwise
- * @param prev_root_c1
- * child 1 of the previous root
- * @param prev_root_c2
- * child 2 of the previous root
- * @return number of duplications which have been assigned in gene tree
- */
- // int updateM( final boolean prev_root_was_dup,
- // final PhylogenyNode prev_root_c1, final PhylogenyNode prev_root_c2 ) {
- // final PhylogenyNode root = getGeneTree().getRoot();
- // if ( ( root.getChildNode1() == prev_root_c1 )
- // || ( root.getChildNode2() == prev_root_c1 ) ) {
- // calculateMforNode( prev_root_c1 );
- // }
- // else {
- // calculateMforNode( prev_root_c2 );
- // }
- // Event event = null;
- // if ( prev_root_was_dup ) {
- // event = Event.createSingleDuplicationEvent();
- // }
- // else {
- // event = Event.createSingleSpeciationEvent();
- // }
- // root.getPhylogenyNodeData().setEvent( event );
- // calculateMforNode( root );
- // return getDuplications();
- // } // updateM( boolean, PhylogenyNode, PhylogenyNode )
- // Helper method for updateM( boolean, PhylogenyNode, PhylogenyNode )
- // Calculates M for PhylogenyNode n, given that M for the two children
- // of n has been calculated.
- // (Last modified: 10/02/01)
- // private void calculateMforNode( final PhylogenyNode n ) {
- // if ( !n.isExternal() ) {
- // boolean was_duplication = n.isDuplication();
- // PhylogenyNode a = n.getChildNode1().getLink(), b = n
- // .getChildNode2().getLink();
- // while ( a != b ) {
- // if ( a.getID() > b.getID() ) {
- // a = a.getParent();
- // }
- // else {
- // b = b.getParent();
- // }
- // }
- // n.setLink( a );
- // Event event = null;
- // if ( ( a == n.getChildNode1().getLink() )
- // || ( a == n.getChildNode2().getLink() ) ) {
- // event = Event.createSingleDuplicationEvent();
- // if ( !was_duplication ) {
- // increaseDuplications();
- // }
- // }
- // else {
- // event = Event.createSingleSpeciationEvent();
- // if ( was_duplication ) {
- // decreaseDuplications();
- // }
- // }
- // n.getPhylogenyNodeData().setEvent( event );
- // }
- // } // calculateMforNode( PhylogenyNode )