Skip to content

Commit

Permalink
Fixed debug log severity for read threading messages. (#8419)
Browse files Browse the repository at this point in the history
* Fixed debug log severity for read threading messages.
  • Loading branch information
jonn-smith authored and rickymagner committed Nov 28, 2023
1 parent e11853a commit 555b25b
Showing 1 changed file with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,9 @@ List<Haplotype> findBestPaths(final Collection<T> graphs, final Map<T, AssemblyR
resultSet.add(h);
}

logger.log(debug ? Level.INFO : Level.OFF, () -> "Adding haplotype " + h.getCigar() + " from graph with kmer " + assemblyResult.getKmerSize());
if (debug) {
logger.info("Adding haplotype " + h.getCigar() + " from graph with kmer " + assemblyResult.getKmerSize());
}
}
}

Expand Down Expand Up @@ -623,7 +625,7 @@ private AssemblyResult createGraph(final Iterable<GATKRead> reads,
if ( !allowNonUniqueKmersInRef && !ReadThreadingGraph.determineNonUniqueKmers(
new ReadThreadingGraph.SequenceForKmers("ref", refHaplotype.getBases(), 0,
refHaplotype.getBases().length, 1, true), kmerSize).isEmpty() ) {
logger.log(debug ? Level.INFO : Level.OFF, () -> "Not using kmer size of " + kmerSize + " in read threading assembler because reference contains non-unique kmers");
logDebugNotUsingKmerSize(debug, kmerSize);

return null;
}
Expand Down Expand Up @@ -655,13 +657,13 @@ private AssemblyResult createGraph(final Iterable<GATKRead> reads,

// sanity check: make sure there are no cycles in the graph, unless we are in experimental mode
if ( generateSeqGraph && rtgraph.hasCycles() ) {
logger.log(debug ? Level.INFO : Level.OFF, () -> "Not using kmer size of " + kmerSize + " in read threading assembler because it contains a cycle");
logDebugNotUsingKmerSize(debug, kmerSize);
return null;
}

// sanity check: make sure the graph had enough complexity with the given kmer
if ( ! allowLowComplexityGraphs && rtgraph.isLowQualityGraph() ) {
logger.log(debug ? Level.INFO : Level.OFF, () -> "Not using kmer size of " + kmerSize + " in read threading assembler because it does not produce a graph with enough complexity");
logDebugNotUsingKmerSize(debug, kmerSize);
return null;
}

Expand Down Expand Up @@ -705,7 +707,7 @@ private AssemblyResult getAssemblyResult(final AbstractReadThreadingGraph rtgrap
return new AssemblyResult(AssemblyResult.Status.ASSEMBLED_SOME_VARIATION, initialSeqGraph, null);
}

logger.log(debug ? Level.INFO : Level.OFF, () -> "Using kmer size of " + rtgraph.getKmerSize() + " in read threading assembler");
logDebugKmerSize(debug, rtgraph.getKmerSize());

initialSeqGraph.cleanNonRefPaths(); // TODO -- I don't this is possible by construction

Expand All @@ -719,7 +721,7 @@ private AssemblyResult getAssemblyResult(final AbstractReadThreadingGraph rtgrap
return new AssemblyResult(AssemblyResult.Status.ASSEMBLED_SOME_VARIATION, null, rtgraph);
}

logger.log(debug ? Level.INFO : Level.OFF, () -> "Using kmer size of " + rtgraph.getKmerSize() + " in read threading assembler");
logDebugKmerSize(debug, rtgraph.getKmerSize());

final AssemblyResult cleaned = getResultSetForRTGraph(rtgraph);
final AssemblyResult.Status status = cleaned.getStatus();
Expand Down Expand Up @@ -801,6 +803,18 @@ public void setMinBaseQualityToUseInAssembly(byte minBaseQualityToUseInAssembly)
this.minBaseQualityToUseInAssembly = minBaseQualityToUseInAssembly;
}

private void logDebugKmerSize(final boolean debug, final int kmerSize) {
if (debug) {
logger.info("Using kmer size of " + kmerSize + " in read threading assembler");
}
}

private void logDebugNotUsingKmerSize(final boolean debug, final int kmerSize) {
if(debug) {
logger.info( "Not using kmer size of " + kmerSize + " in read threading assembler because reference contains non-unique kmers");
}
}

public boolean isDebug() {
return debug;
}
Expand Down

0 comments on commit 555b25b

Please sign in to comment.