Increase max cigar elements from SW before failing path creation to 20 from 6

-- This allows more diversity in paths, which is sometimes necessary when we cannot simply graphs that have large bubbles
This commit is contained in:
Mark DePristo 2013-03-25 18:38:12 -04:00
parent b1b615b668
commit 39f2e811e5
1 changed files with 11 additions and 3 deletions

View File

@ -68,6 +68,8 @@ import java.util.*;
* *
*/ */
class Path<T extends BaseVertex> { class Path<T extends BaseVertex> {
private final static int MAX_CIGAR_ELEMENTS_BEFORE_FAILING_SW = 20;
// the last vertex seen in the path // the last vertex seen in the path
private final T lastVertex; private final T lastVertex;
@ -357,7 +359,7 @@ class Path<T extends BaseVertex> {
} }
final Cigar swCigar = swConsensus.getCigar(); final Cigar swCigar = swConsensus.getCigar();
if( swCigar.numCigarElements() > 6 ) { // this bubble is too divergent from the reference if( swCigar.numCigarElements() > MAX_CIGAR_ELEMENTS_BEFORE_FAILING_SW ) { // this bubble is too divergent from the reference
returnCigar.add(new CigarElement(1, CigarOperator.N)); returnCigar.add(new CigarElement(1, CigarOperator.N));
} else { } else {
for( int iii = 0; iii < swCigar.numCigarElements(); iii++ ) { for( int iii = 0; iii < swCigar.numCigarElements(); iii++ ) {
@ -399,9 +401,15 @@ class Path<T extends BaseVertex> {
*/ */
public boolean equalScoreAndSequence(final Path<T> other) { public boolean equalScoreAndSequence(final Path<T> other) {
if ( other == null ) throw new IllegalArgumentException("other cannot be null"); if ( other == null ) throw new IllegalArgumentException("other cannot be null");
return getScore() == other.getScore() && equalSequence(other);
}
if ( getScore() != other.getScore() ) /**
return false; * Tests that this and other have the same vertices in the same order with the same seq
* @param other the other path to consider. Cannot be null
* @return true if this and path are equal, false otherwise
*/
public boolean equalSequence(final Path<T> other) {
final List<T> mine = getVertices(); final List<T> mine = getVertices();
final List<T> yours = other.getVertices(); final List<T> yours = other.getVertices();
if ( mine.size() == yours.size() ) { // hehehe if ( mine.size() == yours.size() ) { // hehehe