Skip to content

Commit

Permalink
code format change
Browse files Browse the repository at this point in the history
  • Loading branch information
Schaudge committed Sep 12, 2024
1 parent bf27374 commit f83ca03
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
* <p>
* 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.
*
*</p>
* @param context reads pileup to examine
* @param ref reference base overlapping the pileup locus
* @param features features overlapping the pileup locus
Expand Down Expand Up @@ -743,7 +744,7 @@ public List<VariantContext> callRegion(final AssemblyRegion region, final Featur

final List<VariantContext> 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 ) {
Expand Down Expand Up @@ -784,7 +785,7 @@ public List<VariantContext> 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');
}
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ public class RampedHaplotypeCallerEngine extends HaplotypeCallerEngine {
// haplotype caller phases, as consumers
final private List<Consumer<CallRegionContext>> 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,
Expand Down Expand Up @@ -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;
Expand All @@ -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");
Expand Down Expand Up @@ -145,7 +141,7 @@ private void tearRamps() {
throw new RuntimeException(e);
}
}
private class CallRegionContext {
private static class CallRegionContext {

// params
final AssemblyRegion region;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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<VariantContext> 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<VariantContext> 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());
Expand All @@ -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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ public static double logLikelihoodRatio(final int refCount, final List<Byte> 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<Byte> altQuals, final int repeatFactor, final Optional<BetaDistributionShape> afPrior) {
final int nAlt = repeatFactor * altQuals.size();
Expand Down Expand Up @@ -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<ByteArrayList> buffers = IntStream.range(0,6).mapToObj(n -> new ByteArrayList()).collect(Collectors.toList());
private final List<ByteArrayList> buffers = IntStream.range(0,6).mapToObj(n -> new ByteArrayList()).toList();

public PileupQualBuffer(final double multipleSubstitutionQualCorrection) {
MULTIPLE_SUBSTITUTION_BASE_QUAL_CORRECTION = multipleSubstitutionQualCorrection;
Expand Down

0 comments on commit f83ca03

Please sign in to comment.