Loading .gitignore +1 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ src/htsjdk.iml *.iml *.ipr *.iws out/ Loading src/main/java/htsjdk/samtools/BAMFileWriter.java +7 −9 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ import htsjdk.samtools.util.IOUtil; import htsjdk.samtools.util.RuntimeIOException; import htsjdk.samtools.util.zip.DeflaterFactory; import java.io.DataOutputStream; import java.io.File; import java.io.IOException; import java.io.OutputStream; Loading @@ -37,7 +36,6 @@ import java.io.StringWriter; import java.io.Writer; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; /** * Concrete implementation of SAMFileWriter for writing gzipped BAM files. Loading @@ -51,37 +49,37 @@ class BAMFileWriter extends SAMFileWriterImpl { protected BAMFileWriter(final File path) { blockCompressedOutputStream = new BlockCompressedOutputStream(path); outputBinaryCodec = new BinaryCodec(new DataOutputStream(blockCompressedOutputStream)); outputBinaryCodec = new BinaryCodec(blockCompressedOutputStream); outputBinaryCodec.setOutputFileName(path.getAbsolutePath()); } protected BAMFileWriter(final File path, final int compressionLevel) { blockCompressedOutputStream = new BlockCompressedOutputStream(path, compressionLevel); outputBinaryCodec = new BinaryCodec(new DataOutputStream(blockCompressedOutputStream)); outputBinaryCodec = new BinaryCodec(blockCompressedOutputStream); outputBinaryCodec.setOutputFileName(path.getAbsolutePath()); } protected BAMFileWriter(final OutputStream os, final File file) { blockCompressedOutputStream = new BlockCompressedOutputStream(os, file); outputBinaryCodec = new BinaryCodec(new DataOutputStream(blockCompressedOutputStream)); outputBinaryCodec = new BinaryCodec(blockCompressedOutputStream); outputBinaryCodec.setOutputFileName(getPathString(file)); } protected BAMFileWriter(final OutputStream os, final File file, final int compressionLevel) { blockCompressedOutputStream = new BlockCompressedOutputStream(os, file, compressionLevel); outputBinaryCodec = new BinaryCodec(new DataOutputStream(blockCompressedOutputStream)); outputBinaryCodec = new BinaryCodec(blockCompressedOutputStream); outputBinaryCodec.setOutputFileName(getPathString(file)); } protected BAMFileWriter(final OutputStream os, final File file, final int compressionLevel, final DeflaterFactory deflaterFactory) { blockCompressedOutputStream = new BlockCompressedOutputStream(os, file, compressionLevel, deflaterFactory); outputBinaryCodec = new BinaryCodec(new DataOutputStream(blockCompressedOutputStream)); outputBinaryCodec = new BinaryCodec(blockCompressedOutputStream); outputBinaryCodec.setOutputFileName(getPathString(file)); } protected BAMFileWriter(final OutputStream os, final String absoluteFilename, final int compressionLevel, final DeflaterFactory deflaterFactory) { blockCompressedOutputStream = new BlockCompressedOutputStream(os, null, compressionLevel, deflaterFactory); outputBinaryCodec = new BinaryCodec(new DataOutputStream(blockCompressedOutputStream)); outputBinaryCodec = new BinaryCodec(blockCompressedOutputStream); outputBinaryCodec.setOutputFileName(absoluteFilename); } Loading Loading @@ -204,7 +202,7 @@ class BAMFileWriter extends SAMFileWriterImpl { protected static void writeHeader(final OutputStream outputStream, final SAMFileHeader samFileHeader) { final BlockCompressedOutputStream blockCompressedOutputStream = new BlockCompressedOutputStream(outputStream, null); final BinaryCodec outputBinaryCodec = new BinaryCodec(new DataOutputStream(blockCompressedOutputStream)); final BinaryCodec outputBinaryCodec = new BinaryCodec(blockCompressedOutputStream); writeHeader(outputBinaryCodec, samFileHeader); try { blockCompressedOutputStream.flush(); Loading src/main/java/htsjdk/samtools/Defaults.java +1 −1 Original line number Diff line number Diff line Loading @@ -110,7 +110,7 @@ public class Defaults { } REFERENCE_FASTA = getFileProperty("reference_fasta", null); USE_CRAM_REF_DOWNLOAD = getBooleanProperty("use_cram_ref_download", false); EBI_REFERENCE_SERVICE_URL_MASK = "http://www.ebi.ac.uk/ena/cram/md5/%s"; EBI_REFERENCE_SERVICE_URL_MASK = "https://www.ebi.ac.uk/ena/cram/md5/%s"; CUSTOM_READER_FACTORY = getStringProperty("custom_reader", ""); SAM_FLAG_FIELD_FORMAT = SamFlagField.valueOf(getStringProperty("sam_flag_field_format", SamFlagField.DECIMAL.name())); SRA_LIBRARIES_DOWNLOAD = getBooleanProperty("sra_libraries_download", false); Loading src/main/java/htsjdk/samtools/DownsamplingIteratorFactory.java +1 −1 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ public class DownsamplingIteratorFactory { "strategy to finish. Works in a single pass, and will provide accuracy close to (but often not as good as) HighAccuracy while requiring " + "memory proportional to the set of reads emitted from the ConstantMemory strategy to the HighAccuracy strategy. Works well when downsampling " + "large inputs to small proportions (e.g. downsampling hundreds of millions of reads and retaining only 2%. Should be accurate 99.9% of the time " + "when the input contains >= 50,000 templates (read names). For smaller inputs, HighAccuracy is recommended instead."; "when the input contains more than 50,000 templates (read names). For smaller inputs, HighAccuracy is recommended instead."; /** Describes the available downsampling strategies. */ public enum Strategy { Loading src/main/java/htsjdk/samtools/NotPrimarySkippingIterator.java +5 −27 Original line number Diff line number Diff line Loading @@ -24,39 +24,17 @@ package htsjdk.samtools; import htsjdk.samtools.util.CloseableIterator; import htsjdk.samtools.util.PeekIterator; /** * Wrapper around SAMRecord iterator that skips over non-primary elements. * This iterator conflates a filtering iterator and a peekable iterator. It would be cleaner to * handle those concerns separately. * @deprecated use {@link SecondaryAlignmentSkippingIterator} instead. */ public class NotPrimarySkippingIterator { private final PeekIterator<SAMRecord> it; @Deprecated public class NotPrimarySkippingIterator extends SecondaryAlignmentSkippingIterator { public NotPrimarySkippingIterator(final CloseableIterator<SAMRecord> underlyingIt) { it = new PeekIterator<SAMRecord>(underlyingIt); skipAnyNotprimary(); } public boolean hasCurrent() { return it.hasNext(); } public SAMRecord getCurrent() { assert(hasCurrent()); return it.peek(); } public boolean advance() { it.next(); skipAnyNotprimary(); return hasCurrent(); } private void skipAnyNotprimary() { while (it.hasNext() && it.peek().getNotPrimaryAlignmentFlag()) { it.next(); } public NotPrimarySkippingIterator(CloseableIterator<SAMRecord> underlyingIt) { super(underlyingIt); } } Loading
.gitignore +1 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ src/htsjdk.iml *.iml *.ipr *.iws out/ Loading
src/main/java/htsjdk/samtools/BAMFileWriter.java +7 −9 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ import htsjdk.samtools.util.IOUtil; import htsjdk.samtools.util.RuntimeIOException; import htsjdk.samtools.util.zip.DeflaterFactory; import java.io.DataOutputStream; import java.io.File; import java.io.IOException; import java.io.OutputStream; Loading @@ -37,7 +36,6 @@ import java.io.StringWriter; import java.io.Writer; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; /** * Concrete implementation of SAMFileWriter for writing gzipped BAM files. Loading @@ -51,37 +49,37 @@ class BAMFileWriter extends SAMFileWriterImpl { protected BAMFileWriter(final File path) { blockCompressedOutputStream = new BlockCompressedOutputStream(path); outputBinaryCodec = new BinaryCodec(new DataOutputStream(blockCompressedOutputStream)); outputBinaryCodec = new BinaryCodec(blockCompressedOutputStream); outputBinaryCodec.setOutputFileName(path.getAbsolutePath()); } protected BAMFileWriter(final File path, final int compressionLevel) { blockCompressedOutputStream = new BlockCompressedOutputStream(path, compressionLevel); outputBinaryCodec = new BinaryCodec(new DataOutputStream(blockCompressedOutputStream)); outputBinaryCodec = new BinaryCodec(blockCompressedOutputStream); outputBinaryCodec.setOutputFileName(path.getAbsolutePath()); } protected BAMFileWriter(final OutputStream os, final File file) { blockCompressedOutputStream = new BlockCompressedOutputStream(os, file); outputBinaryCodec = new BinaryCodec(new DataOutputStream(blockCompressedOutputStream)); outputBinaryCodec = new BinaryCodec(blockCompressedOutputStream); outputBinaryCodec.setOutputFileName(getPathString(file)); } protected BAMFileWriter(final OutputStream os, final File file, final int compressionLevel) { blockCompressedOutputStream = new BlockCompressedOutputStream(os, file, compressionLevel); outputBinaryCodec = new BinaryCodec(new DataOutputStream(blockCompressedOutputStream)); outputBinaryCodec = new BinaryCodec(blockCompressedOutputStream); outputBinaryCodec.setOutputFileName(getPathString(file)); } protected BAMFileWriter(final OutputStream os, final File file, final int compressionLevel, final DeflaterFactory deflaterFactory) { blockCompressedOutputStream = new BlockCompressedOutputStream(os, file, compressionLevel, deflaterFactory); outputBinaryCodec = new BinaryCodec(new DataOutputStream(blockCompressedOutputStream)); outputBinaryCodec = new BinaryCodec(blockCompressedOutputStream); outputBinaryCodec.setOutputFileName(getPathString(file)); } protected BAMFileWriter(final OutputStream os, final String absoluteFilename, final int compressionLevel, final DeflaterFactory deflaterFactory) { blockCompressedOutputStream = new BlockCompressedOutputStream(os, null, compressionLevel, deflaterFactory); outputBinaryCodec = new BinaryCodec(new DataOutputStream(blockCompressedOutputStream)); outputBinaryCodec = new BinaryCodec(blockCompressedOutputStream); outputBinaryCodec.setOutputFileName(absoluteFilename); } Loading Loading @@ -204,7 +202,7 @@ class BAMFileWriter extends SAMFileWriterImpl { protected static void writeHeader(final OutputStream outputStream, final SAMFileHeader samFileHeader) { final BlockCompressedOutputStream blockCompressedOutputStream = new BlockCompressedOutputStream(outputStream, null); final BinaryCodec outputBinaryCodec = new BinaryCodec(new DataOutputStream(blockCompressedOutputStream)); final BinaryCodec outputBinaryCodec = new BinaryCodec(blockCompressedOutputStream); writeHeader(outputBinaryCodec, samFileHeader); try { blockCompressedOutputStream.flush(); Loading
src/main/java/htsjdk/samtools/Defaults.java +1 −1 Original line number Diff line number Diff line Loading @@ -110,7 +110,7 @@ public class Defaults { } REFERENCE_FASTA = getFileProperty("reference_fasta", null); USE_CRAM_REF_DOWNLOAD = getBooleanProperty("use_cram_ref_download", false); EBI_REFERENCE_SERVICE_URL_MASK = "http://www.ebi.ac.uk/ena/cram/md5/%s"; EBI_REFERENCE_SERVICE_URL_MASK = "https://www.ebi.ac.uk/ena/cram/md5/%s"; CUSTOM_READER_FACTORY = getStringProperty("custom_reader", ""); SAM_FLAG_FIELD_FORMAT = SamFlagField.valueOf(getStringProperty("sam_flag_field_format", SamFlagField.DECIMAL.name())); SRA_LIBRARIES_DOWNLOAD = getBooleanProperty("sra_libraries_download", false); Loading
src/main/java/htsjdk/samtools/DownsamplingIteratorFactory.java +1 −1 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ public class DownsamplingIteratorFactory { "strategy to finish. Works in a single pass, and will provide accuracy close to (but often not as good as) HighAccuracy while requiring " + "memory proportional to the set of reads emitted from the ConstantMemory strategy to the HighAccuracy strategy. Works well when downsampling " + "large inputs to small proportions (e.g. downsampling hundreds of millions of reads and retaining only 2%. Should be accurate 99.9% of the time " + "when the input contains >= 50,000 templates (read names). For smaller inputs, HighAccuracy is recommended instead."; "when the input contains more than 50,000 templates (read names). For smaller inputs, HighAccuracy is recommended instead."; /** Describes the available downsampling strategies. */ public enum Strategy { Loading
src/main/java/htsjdk/samtools/NotPrimarySkippingIterator.java +5 −27 Original line number Diff line number Diff line Loading @@ -24,39 +24,17 @@ package htsjdk.samtools; import htsjdk.samtools.util.CloseableIterator; import htsjdk.samtools.util.PeekIterator; /** * Wrapper around SAMRecord iterator that skips over non-primary elements. * This iterator conflates a filtering iterator and a peekable iterator. It would be cleaner to * handle those concerns separately. * @deprecated use {@link SecondaryAlignmentSkippingIterator} instead. */ public class NotPrimarySkippingIterator { private final PeekIterator<SAMRecord> it; @Deprecated public class NotPrimarySkippingIterator extends SecondaryAlignmentSkippingIterator { public NotPrimarySkippingIterator(final CloseableIterator<SAMRecord> underlyingIt) { it = new PeekIterator<SAMRecord>(underlyingIt); skipAnyNotprimary(); } public boolean hasCurrent() { return it.hasNext(); } public SAMRecord getCurrent() { assert(hasCurrent()); return it.peek(); } public boolean advance() { it.next(); skipAnyNotprimary(); return hasCurrent(); } private void skipAnyNotprimary() { while (it.hasNext() && it.peek().getNotPrimaryAlignmentFlag()) { it.next(); } public NotPrimarySkippingIterator(CloseableIterator<SAMRecord> underlyingIt) { super(underlyingIt); } }