public class VariantContextWriterBuilder
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
VariantContextWriterBuilder.OutputType |
Modifier and Type | Field and Description |
---|---|
static java.util.EnumSet<Options> |
DEFAULT_OPTIONS |
static java.util.EnumSet<VariantContextWriterBuilder.OutputType> |
FILE_TYPES |
static java.util.EnumSet<Options> |
NO_OPTIONS |
protected java.util.EnumSet<Options> |
options |
static java.util.EnumSet<VariantContextWriterBuilder.OutputType> |
STREAM_TYPES |
Constructor and Description |
---|
VariantContextWriterBuilder()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
VariantContextWriter |
build()
Validate and build the
VariantContextWriter . |
VariantContextWriter |
build(java.nio.file.OpenOption... openOptions)
Validate and build the
VariantContextWriter . |
VariantContextWriterBuilder |
clearIndexCreator()
Do not pass an
IndexCreator to the next VariantContextWriter created by this builder. |
VariantContextWriterBuilder |
clearOptions()
Remove all options from the set of
Options for the VariantContextWriterBuilder . |
static VariantContextWriterBuilder.OutputType |
determineOutputTypeFromFile(java.io.File file)
Attempts to determine the type of file/data to write based on the File path being
written to.
|
static VariantContextWriterBuilder.OutputType |
determineOutputTypeFromFile(java.nio.file.Path path)
Attempts to determine the type of file/data to write based on the File path being
written to.
|
VariantContextWriterBuilder |
modifyOption(Options option,
boolean setIt)
Set or unset option depending on the boolean given
|
VariantContextWriterBuilder |
setBuffer(int bufferSize)
Set a buffer size for the file output stream passed to the next
VariantContextWriter created by this builder. |
VariantContextWriterBuilder |
setCreateMD5()
Create an MD5 digest file for the next
VariantContextWriter created by this builder. |
VariantContextWriterBuilder |
setCreateMD5(boolean createMD5)
Choose whether to also create an MD5 digest file for the next
VariantContextWriter created by this builder. |
static void |
setDefaultOption(Options option)
Add one option to the set of default
Options that will be used as the initial set of options
for all VariantContextWriterBuilders created after this call. |
VariantContextWriterBuilder |
setIndexCreator(IndexCreator idxCreator)
Set an IndexCreator for the next
VariantContextWriter created by this builder. |
VariantContextWriterBuilder |
setOption(Options option)
Add one option to the set of
Options for the VariantContextWriterBuilder , if it's not already present. |
VariantContextWriterBuilder |
setOptions(java.util.EnumSet<Options> options)
Replace the set of
Options for the VariantContextWriterBuilder with a new set. |
VariantContextWriterBuilder |
setOutputBCFStream(java.io.OutputStream outStream)
Set the output BCF stream for the next
VariantContextWriter created by this builder. |
VariantContextWriterBuilder |
setOutputFile(java.io.File outFile)
Set the output file for the next
VariantContextWriter created by this builder. |
VariantContextWriterBuilder |
setOutputFile(java.lang.String outFile)
Set the output file for the next
VariantContextWriter created by this builder. |
VariantContextWriterBuilder |
setOutputFileType(VariantContextWriterBuilder.OutputType outType)
Set the output file type for the next
VariantContextWriter created by this builder. |
VariantContextWriterBuilder |
setOutputPath(java.nio.file.Path outPath)
Set the output file for the next
VariantContextWriter created by this builder. |
VariantContextWriterBuilder |
setOutputStream(java.io.OutputStream outStream)
Set the output stream (VCF, by default) for the next
VariantContextWriter created by this builder. |
VariantContextWriterBuilder |
setOutputVCFStream(java.io.OutputStream outStream)
Set the output VCF stream for the next
VariantContextWriter created by this builder. |
VariantContextWriterBuilder |
setReferenceDictionary(SAMSequenceDictionary refDict)
Set the reference dictionary to be used by
VariantContextWriter s created by this builder. |
VariantContextWriterBuilder |
unsetBuffering()
Do not use buffering in the next
VariantContextWriter created by this builder. |
VariantContextWriterBuilder |
unsetCreateMD5()
Don't create an MD5 digest file for the next
VariantContextWriter created by this builder. |
static void |
unsetDefaultOption(Options option)
Remove an option from the set of default
Options that will be used as the initial set of options
for all VariantContextWriterBuilders created after this call. |
VariantContextWriterBuilder |
unsetOption(Options option)
Remove one option from the set of
Options for the VariantContextWriterBuilder , if it's present. |
public static final java.util.EnumSet<Options> DEFAULT_OPTIONS
public static final java.util.EnumSet<Options> NO_OPTIONS
public static final java.util.EnumSet<VariantContextWriterBuilder.OutputType> FILE_TYPES
public static final java.util.EnumSet<VariantContextWriterBuilder.OutputType> STREAM_TYPES
protected java.util.EnumSet<Options> options
public VariantContextWriterBuilder()
USE_ASYNC_IO
to the Options if it is present in Defaults.public VariantContextWriterBuilder setReferenceDictionary(SAMSequenceDictionary refDict)
VariantContextWriter
s created by this builder.refDict
- the reference dictionaryVariantContextWriterBuilder
public VariantContextWriterBuilder setOutputFile(java.io.File outFile)
VariantContextWriter
created by this builder.
Determines file type implicitly from the filename.outFile
- the file the VariantContextWriter
will write toVariantContextWriterBuilder
public VariantContextWriterBuilder setOutputPath(java.nio.file.Path outPath)
VariantContextWriter
created by this builder.
Determines file type implicitly from the filename.outPath
- the file the VariantContextWriter
will write toVariantContextWriterBuilder
public VariantContextWriterBuilder setOutputFile(java.lang.String outFile)
VariantContextWriter
created by this builder.
Determines file type implicitly from the filename.outFile
- the file the VariantContextWriter
will write toVariantContextWriterBuilder
public VariantContextWriterBuilder setOutputFileType(VariantContextWriterBuilder.OutputType outType)
VariantContextWriter
created by this builder.outType
- the type of file the VariantContextWriter
will write toVariantContextWriterBuilder
public VariantContextWriterBuilder setOutputVCFStream(java.io.OutputStream outStream)
VariantContextWriter
created by this builder.
If buffered writing is desired, caller must provide some kind of buffered OutputStream
.outStream
- the output stream to write toVariantContextWriterBuilder
public VariantContextWriterBuilder setOutputBCFStream(java.io.OutputStream outStream)
VariantContextWriter
created by this builder.
If buffered writing is desired, caller must provide some kind of buffered OutputStream
.outStream
- the output stream to write toVariantContextWriterBuilder
public VariantContextWriterBuilder setOutputStream(java.io.OutputStream outStream)
VariantContextWriter
created by this builder.
If buffered writing is desired, caller must provide some kind of buffered OutputStream
.outStream
- the output stream to write topublic VariantContextWriterBuilder setIndexCreator(IndexCreator idxCreator)
VariantContextWriter
created by this builder.idxCreator
- the IndexCreator
to useVariantContextWriterBuilder
public VariantContextWriterBuilder clearIndexCreator()
IndexCreator
to the next VariantContextWriter
created by this builder.VariantContextWriterBuilder
public VariantContextWriterBuilder setBuffer(int bufferSize)
VariantContextWriter
created by this builder.
Set to 0 for no buffering.
Does not affect OutputStreams passed directly to VariantContextWriterBuilder
.bufferSize
- the buffer size to useVariantContextWriterBuilder
public VariantContextWriterBuilder unsetBuffering()
VariantContextWriter
created by this builder.
Does not affect OutputStream
s passed directly to VariantContextWriterBuilder
.VariantContextWriterBuilder
public VariantContextWriterBuilder setCreateMD5(boolean createMD5)
VariantContextWriter
created by this builder.createMD5
- boolean, true
to create an MD5 digestVariantContextWriterBuilder
public VariantContextWriterBuilder setCreateMD5()
VariantContextWriter
created by this builder.VariantContextWriterBuilder
public VariantContextWriterBuilder unsetCreateMD5()
VariantContextWriter
created by this builder.VariantContextWriterBuilder
public VariantContextWriterBuilder setOptions(java.util.EnumSet<Options> options)
Options
for the VariantContextWriterBuilder
with a new set.options
- the complete set of options to useVariantContextWriterBuilder
public VariantContextWriterBuilder setOption(Options option)
Options
for the VariantContextWriterBuilder
, if it's not already present.option
- the option to setVariantContextWriterBuilder
public VariantContextWriterBuilder unsetOption(Options option)
Options
for the VariantContextWriterBuilder
, if it's present.option
- the option to unsetVariantContextWriterBuilder
public VariantContextWriterBuilder modifyOption(Options option, boolean setIt)
option
- the option to modifysetIt
- true to set the option, false to unset it.VariantContextWriterBuilder
public static void setDefaultOption(Options option)
Options
that will be used as the initial set of options
for all VariantContextWriterBuilders created after this call.option
- the option to setpublic static void unsetDefaultOption(Options option)
Options
that will be used as the initial set of options
for all VariantContextWriterBuilders created after this call.option
- the option to unsetpublic VariantContextWriterBuilder clearOptions()
Options
for the VariantContextWriterBuilder
.public VariantContextWriter build()
VariantContextWriter
.VariantContextWriter
as specified by previous method calls.RuntimeIOException
- if the writer is configured to write to a file, and the corresponding path does not exist.java.lang.IllegalArgumentException
- if no output file or stream is specified.java.lang.IllegalArgumentException
- if Options.INDEX_ON_THE_FLY
is specified and no reference dictionary is provided.java.lang.IllegalArgumentException
- if Options.INDEX_ON_THE_FLY
is specified and a stream output is specified.public VariantContextWriter build(java.nio.file.OpenOption... openOptions)
VariantContextWriter
.openOptions
- options to use when opening the underlying output stream.VariantContextWriter
as specified by previous method calls,
optionally applying the specified OpenOptions.RuntimeIOException
- if the writer is configured to write to a file, and the corresponding path does not exist.java.lang.IllegalArgumentException
- if no output file or stream is specified.java.lang.IllegalArgumentException
- if Options.INDEX_ON_THE_FLY
is specified and no reference dictionary is provided.java.lang.IllegalArgumentException
- if Options.INDEX_ON_THE_FLY
is specified and a stream output is specified.public static VariantContextWriterBuilder.OutputType determineOutputTypeFromFile(java.io.File file)
file
- A file whose VariantContextWriterBuilder.OutputType
we want to inferVariantContextWriterBuilder.OutputType
. Never null
.public static VariantContextWriterBuilder.OutputType determineOutputTypeFromFile(java.nio.file.Path path)
path
- A file whose VariantContextWriterBuilder.OutputType
we want to inferVariantContextWriterBuilder.OutputType
. Never null
.