Fixing bug with dangling tails in which the tail connects all the way back to the reference source node.

-- List of vertices can't contain a source node.
This commit is contained in:
Ryan Poplin 2013-06-12 12:22:36 -04:00
parent b2dc7095ab
commit d1f397c711
3 changed files with 4 additions and 4 deletions

View File

@ -309,7 +309,7 @@ public class BaseGraph<V extends BaseVertex, E extends BaseEdge> extends Default
}
v = getNextReferenceVertex(v); // advance along the reference path
while( v != null && !v.equals(toVertex) ) {
bytes = ArrayUtils.addAll( bytes, getAdditionalSequence(v) );
bytes = ArrayUtils.addAll(bytes, getAdditionalSequence(v));
v = getNextReferenceVertex(v); // advance along the reference path
}
if( includeStop && v != null && v.equals(toVertex)) {
@ -561,7 +561,7 @@ public class BaseGraph<V extends BaseVertex, E extends BaseEdge> extends Default
verticesToRemove.removeAll(onPathFromRefSource);
removeAllVertices(verticesToRemove);
// simple santity checks that this algorithm is working.
// simple sanity checks that this algorithm is working.
if ( getSinks().size() > 1 ) {
throw new IllegalStateException("Should have eliminated all but the reference sink, but found " + getSinks());
}

View File

@ -207,7 +207,7 @@ public class ReadThreadingAssembler extends LocalAssemblyEngine {
* @return
*/
private boolean reasonableNumberOfPaths(final SeqGraph graph) {
final KBestPaths<SeqVertex,BaseEdge> pathFinder = new KBestPaths<SeqVertex,BaseEdge>(false);
final KBestPaths<SeqVertex,BaseEdge> pathFinder = new KBestPaths<>(false);
final List<Path<SeqVertex,BaseEdge>> allPaths = pathFinder.getKBestPaths(graph, 100000);
logger.info("Found " + allPaths.size() + " paths through " + graph + " with maximum " + maxAllowedPathsForReadThreadingAssembler);
return allPaths.size() <= maxAllowedPathsForReadThreadingAssembler;

View File

@ -339,7 +339,7 @@ public class ReadThreadingGraph extends BaseGraph<MultiDeBruijnVertex, MultiSamp
// find the lowest common ancestor path between vertex and the reference sink if available
final List<MultiDeBruijnVertex> altPath = findPathToLowestCommonAncestorOfReference(vertex);
if ( altPath == null )
if ( altPath == null || isRefSource(altPath.get(0)) )
return null;
// now get the reference path from the LCA