From 202e1f0b1310d8f0d154452f4f3b3478600a553c Mon Sep 17 00:00:00 2001 From: Tom White Date: Thu, 8 Aug 2019 10:51:37 +0100 Subject: [PATCH] Fix calls to deprecated htsjdk APIs --- src/main/java/org/disq_bio/disq/BaiWriteOption.java | 4 ++-- src/main/java/org/disq_bio/disq/CraiWriteOption.java | 4 ++-- src/main/java/org/disq_bio/disq/SbiWriteOption.java | 4 ++-- .../java/org/disq_bio/disq/TabixIndexWriteOption.java | 4 ++-- .../java/org/disq_bio/disq/impl/file/BaiMerger.java | 4 ++-- .../java/org/disq_bio/disq/impl/file/CraiMerger.java | 3 ++- .../java/org/disq_bio/disq/impl/file/SbiMerger.java | 3 ++- .../disq/impl/formats/bam/BamRecordGuesserChecker.java | 3 ++- .../org/disq_bio/disq/impl/formats/bam/BamSink.java | 6 ++---- .../org/disq_bio/disq/impl/formats/bam/BamSource.java | 3 ++- .../impl/formats/bam/HeaderlessBamOutputFormat.java | 10 ++++++---- .../disq/impl/formats/cram/CramOutputFormat.java | 5 +++-- .../impl/formats/cram/CramReferenceSourceBuilder.java | 7 +++---- .../org/disq_bio/disq/impl/formats/cram/CramSink.java | 3 +-- .../org/disq_bio/disq/impl/formats/vcf/VcfSource.java | 4 ++-- src/test/java/org/disq_bio/disq/BaseTest.java | 4 ++-- .../java/org/disq_bio/disq/HtsjdkReadsRddTest.java | 5 +++-- src/test/java/org/disq_bio/disq/TbiMergingTest.java | 6 +++--- src/test/java/org/disq_bio/disq/VcfTestUtil.java | 7 +++---- 19 files changed, 46 insertions(+), 43 deletions(-) diff --git a/src/main/java/org/disq_bio/disq/BaiWriteOption.java b/src/main/java/org/disq_bio/disq/BaiWriteOption.java index acbe3aa..3935b1a 100644 --- a/src/main/java/org/disq_bio/disq/BaiWriteOption.java +++ b/src/main/java/org/disq_bio/disq/BaiWriteOption.java @@ -25,7 +25,7 @@ */ package org.disq_bio.disq; -import htsjdk.samtools.BAMIndex; +import htsjdk.samtools.util.FileExtensions; /** An option for for enabling or disabling writing BAI files. Disabled by default. */ public enum BaiWriteOption implements WriteOption { @@ -44,6 +44,6 @@ public static BaiWriteOption fromBoolean(boolean writeBai) { /** @return the extension for BAI files. */ public static String getIndexExtension() { - return BAMIndex.BAMIndexSuffix; + return FileExtensions.BAI_INDEX; } } diff --git a/src/main/java/org/disq_bio/disq/CraiWriteOption.java b/src/main/java/org/disq_bio/disq/CraiWriteOption.java index 12ac294..84c37aa 100644 --- a/src/main/java/org/disq_bio/disq/CraiWriteOption.java +++ b/src/main/java/org/disq_bio/disq/CraiWriteOption.java @@ -25,7 +25,7 @@ */ package org.disq_bio.disq; -import htsjdk.samtools.cram.CRAIIndex; +import htsjdk.samtools.util.FileExtensions; /** An option for for enabling or disabling writing CRAI files. Disabled by default. */ public enum CraiWriteOption implements WriteOption { @@ -44,6 +44,6 @@ public static CraiWriteOption fromBoolean(boolean writeCrai) { /** @return the extension for CRAI files. */ public static String getIndexExtension() { - return CRAIIndex.CRAI_INDEX_SUFFIX; + return FileExtensions.CRAM_INDEX; } } diff --git a/src/main/java/org/disq_bio/disq/SbiWriteOption.java b/src/main/java/org/disq_bio/disq/SbiWriteOption.java index 7595c63..f012c4c 100644 --- a/src/main/java/org/disq_bio/disq/SbiWriteOption.java +++ b/src/main/java/org/disq_bio/disq/SbiWriteOption.java @@ -25,7 +25,7 @@ */ package org.disq_bio.disq; -import htsjdk.samtools.SBIIndex; +import htsjdk.samtools.util.FileExtensions; /** An option for for enabling or disabling writing SBI files. Disabled by default. */ public enum SbiWriteOption implements WriteOption { @@ -44,6 +44,6 @@ public static SbiWriteOption fromBoolean(boolean writeSbi) { /** @return the extension for SBI files. */ public static String getIndexExtension() { - return SBIIndex.FILE_EXTENSION; + return FileExtensions.SBI; } } diff --git a/src/main/java/org/disq_bio/disq/TabixIndexWriteOption.java b/src/main/java/org/disq_bio/disq/TabixIndexWriteOption.java index 781fe05..1a8aa54 100644 --- a/src/main/java/org/disq_bio/disq/TabixIndexWriteOption.java +++ b/src/main/java/org/disq_bio/disq/TabixIndexWriteOption.java @@ -25,7 +25,7 @@ */ package org.disq_bio.disq; -import htsjdk.tribble.util.TabixUtils; +import htsjdk.samtools.util.FileExtensions; /** An option for for enabling or disabling writing tabix files. Disabled by default. */ public enum TabixIndexWriteOption implements WriteOption { @@ -44,6 +44,6 @@ public static TabixIndexWriteOption fromBoolean(boolean writeTabix) { /** @return the extension for tabix files. */ public static String getIndexExtension() { - return TabixUtils.STANDARD_INDEX_EXTENSION; + return FileExtensions.TABIX_INDEX; } } diff --git a/src/main/java/org/disq_bio/disq/impl/file/BaiMerger.java b/src/main/java/org/disq_bio/disq/impl/file/BaiMerger.java index 9a2c650..71421a7 100644 --- a/src/main/java/org/disq_bio/disq/impl/file/BaiMerger.java +++ b/src/main/java/org/disq_bio/disq/impl/file/BaiMerger.java @@ -26,7 +26,6 @@ package org.disq_bio.disq.impl.file; import htsjdk.samtools.AbstractBAMFileIndex; -import htsjdk.samtools.BAMIndex; import htsjdk.samtools.BAMIndexMerger; import htsjdk.samtools.IndexMerger; import htsjdk.samtools.SAMFileHeader; @@ -36,6 +35,7 @@ import java.io.IOException; import java.io.OutputStream; import org.apache.hadoop.conf.Configuration; +import org.disq_bio.disq.BaiWriteOption; /** Merges BAM index files for (headerless) parts of a BAM file into a single index file. */ public class BaiMerger extends IndexFileMerger { @@ -45,7 +45,7 @@ public BaiMerger(FileSystemWrapper fileSystemWrapper) { @Override protected String getIndexExtension() { - return BAMIndex.BAMIndexSuffix; + return BaiWriteOption.getIndexExtension(); } @Override diff --git a/src/main/java/org/disq_bio/disq/impl/file/CraiMerger.java b/src/main/java/org/disq_bio/disq/impl/file/CraiMerger.java index 9d7124c..6ed7d03 100644 --- a/src/main/java/org/disq_bio/disq/impl/file/CraiMerger.java +++ b/src/main/java/org/disq_bio/disq/impl/file/CraiMerger.java @@ -34,6 +34,7 @@ import java.io.IOException; import java.io.OutputStream; import org.apache.hadoop.conf.Configuration; +import org.disq_bio.disq.CraiWriteOption; /** Merges CRAM index files for (headerless) parts of a CRAM file into a single index file. */ public class CraiMerger extends IndexFileMerger { @@ -43,7 +44,7 @@ public CraiMerger(FileSystemWrapper fileSystemWrapper) { @Override protected String getIndexExtension() { - return CRAIIndex.CRAI_INDEX_SUFFIX; + return CraiWriteOption.getIndexExtension(); } @Override diff --git a/src/main/java/org/disq_bio/disq/impl/file/SbiMerger.java b/src/main/java/org/disq_bio/disq/impl/file/SbiMerger.java index 78f97d7..9de4758 100644 --- a/src/main/java/org/disq_bio/disq/impl/file/SbiMerger.java +++ b/src/main/java/org/disq_bio/disq/impl/file/SbiMerger.java @@ -33,6 +33,7 @@ import java.io.IOException; import java.io.OutputStream; import org.apache.hadoop.conf.Configuration; +import org.disq_bio.disq.SbiWriteOption; public class SbiMerger extends IndexFileMerger { @@ -42,7 +43,7 @@ public SbiMerger(FileSystemWrapper fileSystemWrapper) { @Override protected String getIndexExtension() { - return SBIIndex.FILE_EXTENSION; + return SbiWriteOption.getIndexExtension(); } @Override diff --git a/src/main/java/org/disq_bio/disq/impl/formats/bam/BamRecordGuesserChecker.java b/src/main/java/org/disq_bio/disq/impl/formats/bam/BamRecordGuesserChecker.java index 717b708..92afb61 100644 --- a/src/main/java/org/disq_bio/disq/impl/formats/bam/BamRecordGuesserChecker.java +++ b/src/main/java/org/disq_bio/disq/impl/formats/bam/BamRecordGuesserChecker.java @@ -30,6 +30,7 @@ import htsjdk.samtools.SBIIndex; import htsjdk.samtools.seekablestream.SeekableStream; import htsjdk.samtools.util.BlockCompressedFilePointerUtil; +import htsjdk.samtools.util.FileExtensions; import java.io.IOException; import java.io.OutputStream; import java.io.Serializable; @@ -79,7 +80,7 @@ public BamRecordGuesserChecker(boolean useNio) { } SBIIndex getSBIIndex(Configuration conf, String bamFile) throws IOException { - String sbiFile = bamFile + SBIIndex.FILE_EXTENSION; + String sbiFile = bamFile + FileExtensions.SBI; if (!fileSystemWrapper.exists(conf, sbiFile)) { // create SBI file try (SeekableStream in = fileSystemWrapper.open(conf, bamFile); diff --git a/src/main/java/org/disq_bio/disq/impl/formats/bam/BamSink.java b/src/main/java/org/disq_bio/disq/impl/formats/bam/BamSink.java index c2f8861..9864984 100644 --- a/src/main/java/org/disq_bio/disq/impl/formats/bam/BamSink.java +++ b/src/main/java/org/disq_bio/disq/impl/formats/bam/BamSink.java @@ -26,10 +26,8 @@ package org.disq_bio.disq.impl.formats.bam; import htsjdk.samtools.BAMFileWriter; -import htsjdk.samtools.BAMIndex; import htsjdk.samtools.SAMFileHeader; import htsjdk.samtools.SAMRecord; -import htsjdk.samtools.SBIIndex; import htsjdk.samtools.util.BlockCompressedStreamConstants; import java.io.IOException; import java.io.OutputStream; @@ -122,7 +120,7 @@ public void save( .mergeParts( conf, tempPartsDirectory, - path + SBIIndex.FILE_EXTENSION, + path + SbiWriteOption.getIndexExtension(), header, partLengths, fileLength); @@ -132,7 +130,7 @@ public void save( .mergeParts( conf, tempPartsDirectory, - path + BAMIndex.BAMIndexSuffix, + path + BaiWriteOption.getIndexExtension(), header, partLengths, fileLength); diff --git a/src/main/java/org/disq_bio/disq/impl/formats/bam/BamSource.java b/src/main/java/org/disq_bio/disq/impl/formats/bam/BamSource.java index a8fc112..9b4acac 100644 --- a/src/main/java/org/disq_bio/disq/impl/formats/bam/BamSource.java +++ b/src/main/java/org/disq_bio/disq/impl/formats/bam/BamSource.java @@ -38,6 +38,7 @@ import htsjdk.samtools.seekablestream.SeekableStream; import htsjdk.samtools.util.BlockCompressedFilePointerUtil; import htsjdk.samtools.util.CloseableIterator; +import htsjdk.samtools.util.FileExtensions; import htsjdk.samtools.util.Locatable; import java.io.IOException; import java.io.Serializable; @@ -95,7 +96,7 @@ protected JavaRDD getPathChunks( String referenceSourcePath) throws IOException { - String sbiPath = path + SBIIndex.FILE_EXTENSION; + String sbiPath = path + FileExtensions.SBI; if (fileSystemWrapper.exists(jsc.hadoopConfiguration(), sbiPath)) { logger.debug("Using SBI file {} for finding splits", sbiPath); try (SeekableStream sbiStream = fileSystemWrapper.open(jsc.hadoopConfiguration(), sbiPath)) { diff --git a/src/main/java/org/disq_bio/disq/impl/formats/bam/HeaderlessBamOutputFormat.java b/src/main/java/org/disq_bio/disq/impl/formats/bam/HeaderlessBamOutputFormat.java index ae33945..ff0a027 100644 --- a/src/main/java/org/disq_bio/disq/impl/formats/bam/HeaderlessBamOutputFormat.java +++ b/src/main/java/org/disq_bio/disq/impl/formats/bam/HeaderlessBamOutputFormat.java @@ -26,7 +26,6 @@ package org.disq_bio.disq.impl.formats.bam; import htsjdk.samtools.BAMFileSpan; -import htsjdk.samtools.BAMIndex; import htsjdk.samtools.BAMIndexer2; import htsjdk.samtools.BAMRecordCodec; import htsjdk.samtools.Chunk; @@ -34,7 +33,6 @@ import htsjdk.samtools.SAMFileSource; import htsjdk.samtools.SAMRecord; import htsjdk.samtools.SAMRecordHelper; -import htsjdk.samtools.SBIIndex; import htsjdk.samtools.SBIIndexWriter; import htsjdk.samtools.util.BinaryCodec; import htsjdk.samtools.util.BlockCompressedOutputStream; @@ -45,7 +43,9 @@ import org.apache.hadoop.mapreduce.RecordWriter; import org.apache.hadoop.mapreduce.TaskAttemptContext; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; +import org.disq_bio.disq.BaiWriteOption; import org.disq_bio.disq.HtsjdkReadsRdd; +import org.disq_bio.disq.SbiWriteOption; import org.disq_bio.disq.impl.formats.bgzf.TerminatorlessBlockCompressedOutputStream; /** @@ -176,13 +176,15 @@ public RecordWriter getRecordWriter(TaskAttemptContext taskAtte Path sbiFile; if (writeSbiFile) { // ensure sbi files are hidden so they don't interfere with merging of part files - sbiFile = new Path(file.getParent(), "." + file.getName() + SBIIndex.FILE_EXTENSION); + sbiFile = + new Path(file.getParent(), "." + file.getName() + SbiWriteOption.getIndexExtension()); } else { sbiFile = null; } Path baiFile; if (writeBaiFile) { - baiFile = new Path(file.getParent(), "." + file.getName() + BAMIndex.BAMIndexSuffix); + baiFile = + new Path(file.getParent(), "." + file.getName() + BaiWriteOption.getIndexExtension()); } else { baiFile = null; } diff --git a/src/main/java/org/disq_bio/disq/impl/formats/cram/CramOutputFormat.java b/src/main/java/org/disq_bio/disq/impl/formats/cram/CramOutputFormat.java index 1d64c79..85dd150 100644 --- a/src/main/java/org/disq_bio/disq/impl/formats/cram/CramOutputFormat.java +++ b/src/main/java/org/disq_bio/disq/impl/formats/cram/CramOutputFormat.java @@ -29,7 +29,6 @@ import htsjdk.samtools.CRAMContainerStreamWriter; import htsjdk.samtools.SAMFileHeader; import htsjdk.samtools.SAMRecord; -import htsjdk.samtools.cram.CRAIIndex; import htsjdk.samtools.cram.ref.CRAMReferenceSource; import java.io.IOException; import java.io.OutputStream; @@ -38,6 +37,7 @@ import org.apache.hadoop.mapreduce.RecordWriter; import org.apache.hadoop.mapreduce.TaskAttemptContext; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; +import org.disq_bio.disq.CraiWriteOption; import org.disq_bio.disq.HtsjdkReadsRdd; import org.disq_bio.disq.impl.file.FileSystemWrapper; import org.disq_bio.disq.impl.file.HadoopFileSystemWrapper; @@ -73,7 +73,8 @@ public RecordWriter getRecordWriter(TaskAttemptContext taskAtte Path craiFile; if (writeCraiFile) { // ensure CRAI files are hidden so they don't interfere with merging of part files - craiFile = new Path(file.getParent(), "." + file.getName() + CRAIIndex.CRAI_INDEX_SUFFIX); + craiFile = + new Path(file.getParent(), "." + file.getName() + CraiWriteOption.getIndexExtension()); } else { craiFile = null; } diff --git a/src/main/java/org/disq_bio/disq/impl/formats/cram/CramReferenceSourceBuilder.java b/src/main/java/org/disq_bio/disq/impl/formats/cram/CramReferenceSourceBuilder.java index 1e256d4..7621e5e 100644 --- a/src/main/java/org/disq_bio/disq/impl/formats/cram/CramReferenceSourceBuilder.java +++ b/src/main/java/org/disq_bio/disq/impl/formats/cram/CramReferenceSourceBuilder.java @@ -32,6 +32,7 @@ import htsjdk.samtools.reference.ReferenceSequenceFile; import htsjdk.samtools.reference.ReferenceSequenceFileFactory; import htsjdk.samtools.seekablestream.SeekableStream; +import htsjdk.samtools.util.FileExtensions; import htsjdk.samtools.util.GZIIndex; import htsjdk.samtools.util.IOUtil; import java.io.IOException; @@ -40,16 +41,14 @@ /** A utility class for creating a {@link CRAMReferenceSource}. */ public class CramReferenceSourceBuilder { - private static final String FASTA_INDEX_EXTENSION = ".fai"; - public static CRAMReferenceSource build( FileSystemWrapper fileSystemWrapper, Configuration conf, String referenceSourcePath) throws IOException { SeekableStream refIn = fileSystemWrapper.open(conf, referenceSourcePath); - String indexPath = referenceSourcePath + FASTA_INDEX_EXTENSION; + String indexPath = referenceSourcePath + FileExtensions.FASTA_INDEX; ReferenceSequenceFile refSeqFile; if (IOUtil.hasBlockCompressedExtension(referenceSourcePath)) { - String gziIndexPath = referenceSourcePath + GZIIndex.DEFAULT_EXTENSION; + String gziIndexPath = referenceSourcePath + FileExtensions.GZI; try (SeekableStream indexIn = fileSystemWrapper.open(conf, indexPath); SeekableStream gziIndexIn = fileSystemWrapper.open(conf, gziIndexPath)) { FastaSequenceIndex index = new FastaSequenceIndex(indexIn); diff --git a/src/main/java/org/disq_bio/disq/impl/formats/cram/CramSink.java b/src/main/java/org/disq_bio/disq/impl/formats/cram/CramSink.java index 7016151..4c3fb40 100644 --- a/src/main/java/org/disq_bio/disq/impl/formats/cram/CramSink.java +++ b/src/main/java/org/disq_bio/disq/impl/formats/cram/CramSink.java @@ -28,7 +28,6 @@ import htsjdk.samtools.CRAMContainerStreamWriter; import htsjdk.samtools.SAMFileHeader; import htsjdk.samtools.SAMRecord; -import htsjdk.samtools.cram.CRAIIndex; import htsjdk.samtools.cram.build.CramIO; import htsjdk.samtools.cram.common.CramVersions; import htsjdk.samtools.cram.ref.CRAMReferenceSource; @@ -121,7 +120,7 @@ public void save( .mergeParts( conf, tempPartsDirectory, - path + CRAIIndex.CRAI_INDEX_SUFFIX, + path + CraiWriteOption.getIndexExtension(), header, partLengths, fileLength); diff --git a/src/main/java/org/disq_bio/disq/impl/formats/vcf/VcfSource.java b/src/main/java/org/disq_bio/disq/impl/formats/vcf/VcfSource.java index 5d6f187..e6510a3 100644 --- a/src/main/java/org/disq_bio/disq/impl/formats/vcf/VcfSource.java +++ b/src/main/java/org/disq_bio/disq/impl/formats/vcf/VcfSource.java @@ -25,9 +25,9 @@ */ package org.disq_bio.disq.impl.formats.vcf; -import htsjdk.samtools.SamStreams; import htsjdk.samtools.seekablestream.SeekableStream; import htsjdk.samtools.util.BlockCompressedInputStream; +import htsjdk.samtools.util.IOUtil; import htsjdk.samtools.util.Locatable; import htsjdk.samtools.util.OverlapDetector; import htsjdk.tribble.FeatureCodecHeader; @@ -108,7 +108,7 @@ private static InputStream bufferAndDecompressIfNecessary(final InputStream in) BufferedInputStream bis = new BufferedInputStream(in); // despite the name, SamStreams.isGzippedSAMFile looks for any gzipped stream (including block // compressed) - return SamStreams.isGzippedSAMFile(bis) ? new GZIPInputStream(bis) : bis; + return IOUtil.isGZIPInputStream(bis) ? new GZIPInputStream(bis) : bis; } public JavaRDD getVariants( diff --git a/src/test/java/org/disq_bio/disq/BaseTest.java b/src/test/java/org/disq_bio/disq/BaseTest.java index aa108e4..aaf6654 100644 --- a/src/test/java/org/disq_bio/disq/BaseTest.java +++ b/src/test/java/org/disq_bio/disq/BaseTest.java @@ -25,7 +25,7 @@ */ package org.disq_bio.disq; -import htsjdk.samtools.SBIIndex; +import htsjdk.samtools.util.FileExtensions; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; @@ -143,7 +143,7 @@ protected List listPartFiles(String dir) throws IOException { protected List listSBIIndexFiles(String dir) throws IOException { return Files.list(Paths.get(URI.create(dir))) - .filter(path -> path.getFileName().toString().endsWith(SBIIndex.FILE_EXTENSION)) + .filter(path -> path.getFileName().toString().endsWith(FileExtensions.SBI)) .map(path -> path.toUri().toString()) .collect(Collectors.toList()); } diff --git a/src/test/java/org/disq_bio/disq/HtsjdkReadsRddTest.java b/src/test/java/org/disq_bio/disq/HtsjdkReadsRddTest.java index 3faaf1f..10d3903 100644 --- a/src/test/java/org/disq_bio/disq/HtsjdkReadsRddTest.java +++ b/src/test/java/org/disq_bio/disq/HtsjdkReadsRddTest.java @@ -31,6 +31,7 @@ import htsjdk.samtools.SBIIndex; import htsjdk.samtools.seekablestream.SeekablePathStream; import htsjdk.samtools.seekablestream.SeekableStream; +import htsjdk.samtools.util.FileExtensions; import htsjdk.samtools.util.Interval; import htsjdk.samtools.util.Locatable; import java.io.ByteArrayInputStream; @@ -180,7 +181,7 @@ public void testWriteSBIIndex(String inputFile, int splitSize, boolean useNio) t createTempPath(SamFormat.fromFormatWriteOption(ReadsFormatWriteOption.BAM).getExtension()); htsjdkReadsRddStorage.write(htsjdkReadsRdd, outputPath, SbiWriteOption.ENABLE); - Path sbiFile = Paths.get(URI.create(outputPath + SBIIndex.FILE_EXTENSION)); + Path sbiFile = Paths.get(URI.create(outputPath + FileExtensions.SBI)); Assert.assertTrue(Files.exists(sbiFile)); SBIIndex actualSbiIndex = SBIIndex.load(sbiFile); @@ -501,7 +502,7 @@ public void testSBIIndexWrittenWhenNotCoordinateSorted() throws Exception { createTempPath(SamFormat.fromFormatWriteOption(ReadsFormatWriteOption.BAM).getExtension()); htsjdkReadsRddStorage.write(htsjdkReadsRdd, outputPath, SbiWriteOption.ENABLE); - Assert.assertTrue(Files.exists(Paths.get(URI.create(outputPath + SBIIndex.FILE_EXTENSION)))); + Assert.assertTrue(Files.exists(Paths.get(URI.create(outputPath + FileExtensions.SBI)))); } @Test diff --git a/src/test/java/org/disq_bio/disq/TbiMergingTest.java b/src/test/java/org/disq_bio/disq/TbiMergingTest.java index c09d4dd..fe2d5b9 100644 --- a/src/test/java/org/disq_bio/disq/TbiMergingTest.java +++ b/src/test/java/org/disq_bio/disq/TbiMergingTest.java @@ -26,10 +26,10 @@ package org.disq_bio.disq; import htsjdk.samtools.TbiEqualityChecker; +import htsjdk.samtools.util.FileExtensions; import htsjdk.samtools.util.RuntimeIOException; import htsjdk.tribble.index.IndexFactory; import htsjdk.tribble.index.tabix.TabixIndex; -import htsjdk.tribble.util.TabixUtils; import htsjdk.variant.vcf.VCFCodec; import java.io.File; import java.io.IOException; @@ -84,8 +84,8 @@ public void test(String inputFile) throws Exception { File outputVcf = new File(URI.create(outputPath)); File outputTbi = - new File(outputVcf.getParent(), outputVcf.getName() + TabixUtils.STANDARD_INDEX_EXTENSION); - String outputTbiHtsjdkPath = createTempPath(TabixUtils.STANDARD_INDEX_EXTENSION); + new File(outputVcf.getParent(), outputVcf.getName() + FileExtensions.TABIX_INDEX); + String outputTbiHtsjdkPath = createTempPath(FileExtensions.TABIX_INDEX); File outputTbiHtsjdk = indexVcf(outputVcf, new File(URI.create(outputTbiHtsjdkPath))); // Don't check for strict equality (byte identical), since the TBI files diff --git a/src/test/java/org/disq_bio/disq/VcfTestUtil.java b/src/test/java/org/disq_bio/disq/VcfTestUtil.java index 009066c..f2eb884 100644 --- a/src/test/java/org/disq_bio/disq/VcfTestUtil.java +++ b/src/test/java/org/disq_bio/disq/VcfTestUtil.java @@ -27,8 +27,8 @@ import com.google.common.io.Files; import htsjdk.samtools.util.BlockCompressedInputStream; +import htsjdk.samtools.util.FileExtensions; import htsjdk.samtools.util.Interval; -import htsjdk.tribble.util.TabixUtils; import htsjdk.variant.variantcontext.VariantContext; import htsjdk.variant.vcf.VCFFileReader; import java.io.*; @@ -43,11 +43,10 @@ public static VCFFileReader parseVcf(File vcf) throws IOException { actualVcf = File.createTempFile(vcf.getName(), ".gz"); actualVcf.deleteOnExit(); Files.copy(vcf, actualVcf); - File tbi = new File(vcf.getParent(), vcf.getName() + TabixUtils.STANDARD_INDEX_EXTENSION); + File tbi = new File(vcf.getParent(), vcf.getName() + FileExtensions.TABIX_INDEX); if (tbi.exists()) { File actualTbi = - new File( - actualVcf.getParent(), actualVcf.getName() + TabixUtils.STANDARD_INDEX_EXTENSION); + new File(actualVcf.getParent(), actualVcf.getName() + FileExtensions.TABIX_INDEX); actualTbi.deleteOnExit(); Files.copy(tbi, actualTbi); }