diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/HaplotypeCallerEngine.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/HaplotypeCallerEngine.java index 70caf3ddd7c..0daf64cf5ac 100644 --- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/HaplotypeCallerEngine.java +++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/HaplotypeCallerEngine.java @@ -648,10 +648,11 @@ protected HaplotypeCallerGenotypingEngine getLocalGenotypingEngine(Locatable reg /** * Given a pileup, returns an ActivityProfileState containing the probability (0.0 to 1.0) that it's an "active" site. * + *

* Note that the current implementation will always return either 1.0 or 0.0, as it relies on the smoothing in * {@link org.broadinstitute.hellbender.utils.activityprofile.BandPassActivityProfile} to create the full distribution * of probabilities. This is consistent with GATK 3. - * + *

* @param context reads pileup to examine * @param ref reference base overlapping the pileup locus * @param features features overlapping the pileup locus @@ -743,7 +744,7 @@ public List callRegion(final AssemblyRegion region, final Featur final List VCpriors = new ArrayList<>(); if (hcArgs.standardArgs.genotypeArgs.supportVariants != null) { - features.getValues(hcArgs.standardArgs.genotypeArgs.supportVariants).stream().forEach(VCpriors::add); + VCpriors.addAll(features.getValues(hcArgs.standardArgs.genotypeArgs.supportVariants)); } if ( hcArgs.sampleNameToUse != null ) { @@ -784,7 +785,7 @@ public List callRegion(final AssemblyRegion region, final Featur if (assemblyDebugOutStream != null) { try { assemblyDebugOutStream.write("\nThere were " + untrimmedAssemblyResult.getHaplotypeList().size() + " haplotypes found. Here they are:\n"); - for (final String haplotype : untrimmedAssemblyResult.getHaplotypeList().stream().map(Haplotype::toString).sorted().collect(Collectors.toList())) { + for (final String haplotype : untrimmedAssemblyResult.getHaplotypeList().stream().map(Haplotype::toString).sorted().toList()) { assemblyDebugOutStream.write(haplotype); assemblyDebugOutStream.append('\n'); } @@ -1110,7 +1111,7 @@ public void shutdown() { if (pdhmmLikelihoodCalculationEngine != null) pdhmmLikelihoodCalculationEngine.close(); aligner.close(); haplotypeBAMWriter.ifPresent(HaplotypeBAMWriter::close); - assembledEventMapVcfOutputWriter.ifPresent(writer -> {assembledEventMapVariants.get().forEach(event -> writer.add(event)); writer.close();}); + assembledEventMapVcfOutputWriter.ifPresent(writer -> {assembledEventMapVariants.get().forEach(writer::add); writer.close();}); if ( referenceReader != null) { try { referenceReader.close(); diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/RampedHaplotypeCallerEngine.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/RampedHaplotypeCallerEngine.java index a77c9b45218..303858de21d 100644 --- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/RampedHaplotypeCallerEngine.java +++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/RampedHaplotypeCallerEngine.java @@ -53,12 +53,12 @@ public class RampedHaplotypeCallerEngine extends HaplotypeCallerEngine { // haplotype caller phases, as consumers final private List> phases = Arrays.asList( - p -> prepare(p), - p -> assemble(p), - p -> computeReadLikelihoods(p), - p -> uncollapse(p), - p -> filter(p), - p -> genotype(p) + this::prepare, + this::assemble, + this::computeReadLikelihoods, + this::uncollapse, + this::filter, + this::genotype ); public RampedHaplotypeCallerEngine(final HaplotypeCallerArgumentCollection hcArgs, AssemblyRegionArgumentCollection assemblyRegionArgs, boolean createBamOutIndex, @@ -91,8 +91,6 @@ public void buildRamps() { // create ramp switch ( rpArgs.offRampType ) { - case NONE: - break; case PRE_FILTER_OFF: preFilterOffRamp = new PreFilterOffRamp(rpArgs.offRampFile); break; @@ -111,8 +109,6 @@ public void buildRamps() { // create ramp switch ( rpArgs.onRampType ) { - case NONE: - break; case POST_FILTER_ON: if ( rpArgs.offRampType == RampedHaplotypeCallerArgumentCollection.OffRampTypeEnum.PRE_FILTER_OFF ) { throw new IllegalArgumentException("an on ramp, if present, must be before the off ramp"); @@ -145,7 +141,7 @@ private void tearRamps() { throw new RuntimeException(e); } } - private class CallRegionContext { + private static class CallRegionContext { // params final AssemblyRegion region; @@ -232,7 +228,7 @@ private void prepare(final CallRegionContext context) { context.VCpriors = new ArrayList<>(); if (hcArgs.standardArgs.genotypeArgs.supportVariants != null) { - context.features.getValues(hcArgs.standardArgs.genotypeArgs.supportVariants).stream().forEach(context.VCpriors::add); + context.VCpriors.addAll(context.features.getValues(hcArgs.standardArgs.genotypeArgs.supportVariants)); } if (hcArgs.sampleNameToUse != null) { @@ -324,7 +320,8 @@ private void assemble(final CallRegionContext context) { // run the local assembler, getting back a collection of information on how we should proceed RampUtils.logReads(rpArgs.rampsDebugReads, "BEFORE untrimmedAssemblyResult reads", context.region.getReads()); - List forcedPileupAlleles = Collections.emptyList(); // TODO: we currently do not support pileup alleles in RampedHaplotypeCaller, this should be added + // TODO: we currently do not support pileup alleles in RampedHaplotypeCaller, this should be added ... + // List forcedPileupAlleles = Collections.emptyList(); final AssemblyResultSet untrimmedAssemblyResult = AssemblyBasedCallerUtils.assembleReads(context.region, hcArgs, readsHeader, samplesList, logger, referenceReader, assemblyEngine, aligner, !hcArgs.doNotCorrectOverlappingBaseQualities, postFilterOnRamp != null); RampUtils.logReads(rpArgs.rampsDebugReads, "AFTER untrimmedAssemblyResult reads", context.region.getReads()); @@ -342,7 +339,7 @@ private void assemble(final CallRegionContext context) { if (assemblyDebugOutStream != null) { assemblyDebugOutStream.write("\nThere were " + untrimmedAssemblyResult.getHaplotypeList().size() + " haplotypes found. Here they are:"); - for (final String haplotype : untrimmedAssemblyResult.getHaplotypeList().stream().map(Haplotype::toString).sorted().collect(Collectors.toList())) { + for (final String haplotype : untrimmedAssemblyResult.getHaplotypeList().stream().map(Haplotype::toString).sorted().toList()) { assemblyDebugOutStream.write(haplotype); } } diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/mutect/Mutect2Engine.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/mutect/Mutect2Engine.java index f7abbd1a4b6..5409a957cc1 100644 --- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/mutect/Mutect2Engine.java +++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/mutect/Mutect2Engine.java @@ -612,7 +612,7 @@ public static double logLikelihoodRatio(final int refCount, final List alt * @param altQuals Phred-scaled qualities of alt-supporting reads * @param repeatFactor Number of times each alt qual is duplicated * @param afPrior Beta prior on alt allele fraction - * @return + * @return double */ public static double logLikelihoodRatio(final int nRef, final List altQuals, final int repeatFactor, final Optional afPrior) { final int nAlt = repeatFactor * altQuals.size(); @@ -700,7 +700,7 @@ private static class PileupQualBuffer { private static double MULTIPLE_SUBSTITUTION_BASE_QUAL_CORRECTION; // indices 0-3 are A,C,G,T; 4 is other substitution (just in case it's some exotic protocol); 5 is indel - private List buffers = IntStream.range(0,6).mapToObj(n -> new ByteArrayList()).collect(Collectors.toList()); + private final List buffers = IntStream.range(0,6).mapToObj(n -> new ByteArrayList()).toList(); public PileupQualBuffer(final double multipleSubstitutionQualCorrection) { MULTIPLE_SUBSTITUTION_BASE_QUAL_CORRECTION = multipleSubstitutionQualCorrection;