Skip to content

Commit

Permalink
Revert "Revert "Upgrade htsjdk to v3.0.0. (#7867)" (#7960)"
Browse files Browse the repository at this point in the history
This reverts commit 5f9f12b.
  • Loading branch information
lbergelson committed Sep 8, 2022
1 parent 993c7f1 commit 77faccb
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ repositories {
mavenLocal()
}

final htsjdkVersion = System.getProperty('htsjdk.version','2.24.1')
final picardVersion = System.getProperty('picard.version','2.27.1')
final htsjdkVersion = System.getProperty('htsjdk.version','3.0.0')
final picardVersion = System.getProperty('picard.version','2.27.4')
final barclayVersion = System.getProperty('barclay.version','4.0.2')
final sparkVersion = System.getProperty('spark.version', '2.4.5')
final scalaVersion = System.getProperty('scala.version', '2.11')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import de.javakaffee.kryoserializers.guava.ImmutableMapSerializer;
import htsjdk.samtools.*;
import htsjdk.variant.variantcontext.Allele;
import htsjdk.variant.variantcontext.SimpleAllele;
import htsjdk.variant.vcf.VCFHeaderLineType;
import htsjdk.variant.vcf.VCFInfoHeaderLine;
import org.apache.spark.serializer.KryoRegistrator;
Expand Down Expand Up @@ -65,13 +66,13 @@ public VCFInfoHeaderLine newInstance() {
return new VCFInfoHeaderLine("TMP", 2, VCFHeaderLineType.String, "");
}
});
registration = kryo.register(Allele.class);
registration = kryo.register(SimpleAllele.class);
registration.setInstantiator(new ObjectInstantiator<Allele>() {
public Allele newInstance() {
return Allele.create("TCGA");
}
});
}
}

@Override
public void registerClasses(Kryo kryo) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package org.broadinstitute.hellbender.tools.funcotator;

import htsjdk.tribble.annotation.Strand;
import htsjdk.variant.variantcontext.SimpleAllele;

/**
* Class to represent a strand-corrected {@link htsjdk.variant.variantcontext.Allele}.
* Created by jonn on 10/24/18.
*/
public class StrandCorrectedAllele extends htsjdk.variant.variantcontext.Allele {
public class StrandCorrectedAllele extends SimpleAllele {
public static final long serialVersionUID = 1L;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,11 +415,11 @@ public static AssemblyResultSet assembleReads(final AssemblyRegion region,
* Handle pileup detected alternate alleles.
*/
@VisibleForTesting
@SuppressWarnings("deprecation")
static void processPileupAlleles(final AssemblyRegion region, final List<VariantContext> givenAlleles, final int maxMnpDistance,
final int snpAdjacentToIndelLimit, final SmithWatermanAligner aligner, final Haplotype refHaplotype,
final AssemblyResultSet assemblyResultSet, final int numHaplotypesPerIteration, final int hapFilteringKmerSize,
final SWParameters haplotypeToReferenceSWParameters) {
final int assemblyRegionStart = region.getPaddedSpan().getStart();
final int activeRegionStart = refHaplotype.getAlignmentStartHapwrtRef();
final Map<Integer, VariantContext> assembledVariants = assemblyResultSet.getVariationEvents(maxMnpDistance).stream()
.collect(Collectors.groupingBy(VariantContext::getStart, Collectors.collectingAndThen(Collectors.toList(), AssemblyBasedCallerUtils::makeMergedVariantContext)));
Expand Down Expand Up @@ -496,10 +496,10 @@ public static void addGivenAlleles(final List<VariantContext> givenAlleles, fina
final Allele longerRef = (assembledVC == null || givenVCRefLength > assembledVC.getReference().length()) ? givenVC.getReference() : assembledVC.getReference();
final List<Allele> unassembledGivenAlleles = getAllelesNotPresentInAssembly(givenVC, assembledVC, givenVCRefLength, longerRef);

final List<Allele> unassembledNonSymbolicAlleles = unassembledGivenAlleles.stream().filter(a -> {
final byte[] bases = a.getBases();
return !(Allele.wouldBeNoCallAllele(bases) || Allele.wouldBeNullAllele(bases) || Allele.wouldBeStarAllele(bases) || Allele.wouldBeSymbolicAllele(bases));
}).collect(Collectors.toList());
final List<Allele> unassembledNonSymbolicAlleles = unassembledGivenAlleles.stream()
//TODO, update the null allele check when htsjdk adds a NULL_ALLELE constant to Allele
.filter(a -> !(a.equals(Allele.NO_CALL) || a.getDisplayString().equals(String.valueOf(VCFConstants.NULL_ALLELE)) || a.equals(Allele.SPAN_DEL) || a.isSymbolic()))
.collect(Collectors.toList());

// choose the highest-scoring haplotypes along with the reference for building force-calling haplotypes
final List<Haplotype> baseHaplotypes = unassembledNonSymbolicAlleles.isEmpty() ? Collections.emptyList() : assembledHaplotypes.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import htsjdk.samtools.CigarOperator;
import htsjdk.samtools.util.Locatable;
import htsjdk.variant.variantcontext.Allele;
import htsjdk.variant.variantcontext.SimpleAllele;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.broadinstitute.hellbender.utils.SimpleInterval;
Expand All @@ -17,7 +18,7 @@
import java.util.Arrays;
import java.util.Comparator;

public final class Haplotype extends Allele {
public final class Haplotype extends SimpleAllele {
private static final long serialVersionUID = 1L;

/**
Expand Down

0 comments on commit 77faccb

Please sign in to comment.