Mentions légales du service

Skip to content
Snippets Groups Projects
Commit b12ed609 authored by Jérôme Euzenat's avatar Jérôme Euzenat
Browse files

- improved and corrected bug in cut(.)

parent f9275bd0
No related branches found
No related tags found
No related merge requests found
...@@ -437,18 +437,17 @@ public class BasicAlignment implements Alignment { ...@@ -437,18 +437,17 @@ public class BasicAlignment implements Alignment {
if ( method.equals("perc") ){ if ( method.equals("perc") ){
i = (new Double(size*threshold)).intValue(); i = (new Double(size*threshold)).intValue();
} else if ( method.equals("best") ){ } else if ( method.equals("best") ){
i = new Double(threshold*100).intValue(); i = java.lang.Math.min( size, new Double(threshold*100).intValue() );
} else if ( method.equals("hardgap") || method.equals("propgap") ){ } else if ( method.equals("hardgap") || method.equals("propgap") ){
double gap; double gap;
double last = ((Cell)buffer.get(0)).getStrength(); double last = ((Cell)buffer.get(0)).getStrength();
if ( method.equals("propgap") ) gap = last * threshold; if ( method.equals("propgap") ) gap = last * threshold;
else gap = threshold; else gap = threshold;
for( i=1; i < size && !found ;) { for( i=1; i < size && !found ; i++) {
if ( last - ((Cell)buffer.get(i)).getStrength() > gap ) found = true; if ( last - ((Cell)buffer.get(i)).getStrength() > gap ) found = true;
else { else {
last = ((Cell)buffer.get(i)).getStrength(); last = ((Cell)buffer.get(i)).getStrength();
if ( method.equals("propgap") ) gap = last * threshold; if ( method.equals("propgap") ) gap = last * threshold;
i++;
} }
} }
} else { } else {
...@@ -457,16 +456,15 @@ public class BasicAlignment implements Alignment { ...@@ -457,16 +456,15 @@ public class BasicAlignment implements Alignment {
else if ( method.equals("span") ) max = ((Cell)buffer.get(0)).getStrength() - threshold; else if ( method.equals("span") ) max = ((Cell)buffer.get(0)).getStrength() - threshold;
else if ( method.equals("prop") ) max = ((Cell)buffer.get(0)).getStrength() * threshold; else if ( method.equals("prop") ) max = ((Cell)buffer.get(0)).getStrength() * threshold;
else throw new AlignmentException( "Not a cut specification : "+method ); else throw new AlignmentException( "Not a cut specification : "+method );
for( i=0; i < size && !found ;) { for( i=0; i < size && !found ; i++) {
if ( ((Cell)buffer.get(i)).getStrength() < max ) found = true; if ( ((Cell)buffer.get(i)).getStrength() < max ) found = true;
else i++;
} }
} }
// Introduce the result back in the structure // Introduce the result back in the structure
size = i; size = i;
hash1.clear(); hash1.clear();
hash2.clear(); hash2.clear();
for( i = 0; i < size; i++ ) { for( i=0; i < size; i++ ) {
addCell( (Cell)buffer.get(i) ); addCell( (Cell)buffer.get(i) );
} }
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment