From 24aebd6583207dfff9aeb8495ab78ac7544f5a85 Mon Sep 17 00:00:00 2001 From: Jonn Smith Date: Fri, 14 Jul 2023 20:33:48 +0000 Subject: [PATCH 1/3] Fixed debug log severity for read threading messages. --- .../readthreading/ReadThreadingAssembler.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/readthreading/ReadThreadingAssembler.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/readthreading/ReadThreadingAssembler.java index 1deef9e2f31..57bdf6344a2 100644 --- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/readthreading/ReadThreadingAssembler.java +++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/readthreading/ReadThreadingAssembler.java @@ -396,7 +396,7 @@ List findBestPaths(final Collection graphs, final Map "Adding haplotype " + h.getCigar() + " from graph with kmer " + assemblyResult.getKmerSize()); + logger.log(debug ? Level.INFO : Level.TRACE, () -> "Adding haplotype " + h.getCigar() + " from graph with kmer " + assemblyResult.getKmerSize()); } } @@ -623,7 +623,7 @@ private AssemblyResult createGraph(final Iterable 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"); + logger.log(debug ? Level.INFO : Level.TRACE, () -> "Not using kmer size of " + kmerSize + " in read threading assembler because reference contains non-unique kmers"); return null; } @@ -655,13 +655,13 @@ private AssemblyResult createGraph(final Iterable 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"); + logger.log(debug ? Level.INFO : Level.TRACE, () -> "Not using kmer size of " + kmerSize + " in read threading assembler because it contains a cycle"); 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"); + logger.log(debug ? Level.INFO : Level.TRACE, () -> "Not using kmer size of " + kmerSize + " in read threading assembler because it does not produce a graph with enough complexity"); return null; } @@ -705,7 +705,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"); + logger.log(debug ? Level.INFO : Level.TRACE, () -> "Using kmer size of " + rtgraph.getKmerSize() + " in read threading assembler"); initialSeqGraph.cleanNonRefPaths(); // TODO -- I don't this is possible by construction @@ -719,7 +719,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"); + logger.log(debug ? Level.INFO : Level.TRACE, () -> "Using kmer size of " + rtgraph.getKmerSize() + " in read threading assembler"); final AssemblyResult cleaned = getResultSetForRTGraph(rtgraph); final AssemblyResult.Status status = cleaned.getStatus(); From cc187910aae08e390571eba7e784c1b20436366c Mon Sep 17 00:00:00 2001 From: Jonn Smith Date: Wed, 16 Aug 2023 15:06:16 +0000 Subject: [PATCH 2/3] Addressed review comments. --- .../readthreading/ReadThreadingAssembler.java | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/readthreading/ReadThreadingAssembler.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/readthreading/ReadThreadingAssembler.java index 57bdf6344a2..fbe96185c9e 100644 --- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/readthreading/ReadThreadingAssembler.java +++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/readthreading/ReadThreadingAssembler.java @@ -623,7 +623,7 @@ private AssemblyResult createGraph(final Iterable 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.TRACE, () -> "Not using kmer size of " + kmerSize + " in read threading assembler because reference contains non-unique kmers"); + logDebugNotUsingKmerSize(debug, kmerSize); return null; } @@ -655,13 +655,13 @@ private AssemblyResult createGraph(final Iterable 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.TRACE, () -> "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.TRACE, () -> "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; } @@ -705,7 +705,7 @@ private AssemblyResult getAssemblyResult(final AbstractReadThreadingGraph rtgrap return new AssemblyResult(AssemblyResult.Status.ASSEMBLED_SOME_VARIATION, initialSeqGraph, null); } - logger.log(debug ? Level.INFO : Level.TRACE, () -> "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 @@ -719,7 +719,7 @@ private AssemblyResult getAssemblyResult(final AbstractReadThreadingGraph rtgrap return new AssemblyResult(AssemblyResult.Status.ASSEMBLED_SOME_VARIATION, null, rtgraph); } - logger.log(debug ? Level.INFO : Level.TRACE, () -> "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(); @@ -801,6 +801,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; } From 4713b87adfa2f275b50764654af2bf037cbdf0e9 Mon Sep 17 00:00:00 2001 From: Jonn Smith Date: Wed, 16 Aug 2023 15:08:24 +0000 Subject: [PATCH 3/3] Fixing one more spot with ternary log level. --- .../haplotypecaller/readthreading/ReadThreadingAssembler.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/readthreading/ReadThreadingAssembler.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/readthreading/ReadThreadingAssembler.java index fbe96185c9e..f81e31028ed 100644 --- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/readthreading/ReadThreadingAssembler.java +++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/readthreading/ReadThreadingAssembler.java @@ -396,7 +396,9 @@ List findBestPaths(final Collection graphs, final Map "Adding haplotype " + h.getCigar() + " from graph with kmer " + assemblyResult.getKmerSize()); + if (debug) { + logger.info("Adding haplotype " + h.getCigar() + " from graph with kmer " + assemblyResult.getKmerSize()); + } } }