Skip to content

Commit

Permalink
Make VariantContextWriterBuilder warn when indexing-on-the-fly is ena…
Browse files Browse the repository at this point in the history
…bled for stream output (#1328)

* downgraded exception to warning when index-on-the-fly is enabled for stream outputs
* Resolving a template for invoking streams in gatk
* removing the tests that are no longer relevant given the change in approach
  • Loading branch information
jamesemery authored and Yossi Farjoun committed Jun 17, 2019
1 parent b804a47 commit f13d075
Show file tree
Hide file tree
Showing 2 changed files with 486 additions and 497 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import htsjdk.samtools.util.BlockCompressedOutputStream;
import htsjdk.samtools.util.IOUtil;
import htsjdk.samtools.util.Md5CalculatingOutputStream;
import htsjdk.samtools.util.Log;
import htsjdk.samtools.util.RuntimeIOException;
import htsjdk.tribble.index.IndexCreator;
import htsjdk.tribble.index.tabix.TabixFormat;
Expand Down Expand Up @@ -109,6 +110,7 @@ public class VariantContextWriterBuilder {
public static final EnumSet<Options> DEFAULT_OPTIONS = EnumSet.of(Options.INDEX_ON_THE_FLY);
public static final EnumSet<Options> NO_OPTIONS = EnumSet.noneOf(Options.class);
private static final OpenOption[] EMPTY_OPEN_OPTION_ARRAY = new OpenOption[0];
private static final Log log = Log.getInstance(VariantContextWriter.class);

public enum OutputType {
UNSPECIFIED,
Expand Down Expand Up @@ -483,14 +485,18 @@ else if (STREAM_TYPES.contains(this.outType))
writer = createBCFWriter(outPath, outStreamFromFile);
break;
case VCF_STREAM:
if (options.contains(Options.INDEX_ON_THE_FLY))
throw new IllegalArgumentException("VCF index creation not supported for stream output.");
if (options.contains(Options.INDEX_ON_THE_FLY)) {
log.warn("VCF index creation not supported for stream output, index will not be created");
options.remove(Options.INDEX_ON_THE_FLY);
}

writer = createVCFWriter(null, outStreamFromFile);
break;
case BCF_STREAM:
if (options.contains(Options.INDEX_ON_THE_FLY))
throw new IllegalArgumentException("BCF index creation not supported for stream output.");
if (options.contains(Options.INDEX_ON_THE_FLY)) {
log.warn("BCF index creation not supported for stream output, index will not be created");
options.remove(Options.INDEX_ON_THE_FLY);
}

writer = createBCFWriter(null, outStream);
break;
Expand Down
Loading

0 comments on commit f13d075

Please sign in to comment.