public class FastaReferenceWriterBuilder
extends java.lang.Object
FastaReferenceWriter
You can set each of the four outputs (fasta, dictionary and index, both gzi and fai) to a file or a stream.
by default if you provide a file to the fasta an accompanying set of indexes and dictionary will be created.
This behaviour can be controlled by setMakeDictOutput(boolean) and setMakeFaiOutput(boolean)
and setMakeGziOutput(boolean)
The default bases-per-line is .
Setting a file or an output stream for any of the four outputs (fasta, fai, gzi or dict) will invalidate the other output type (i.e. setting a file output will invalidate a previous stream and vice-versa).
| Constructor and Description |
|---|
FastaReferenceWriterBuilder() |
| Modifier and Type | Method and Description |
|---|---|
FastaReferenceWriter |
build()
Create the
FastaReferenceWriter. |
protected static int |
checkBasesPerLine(int value) |
boolean |
getEmitMd5() |
FastaReferenceWriterBuilder |
setBasesPerLine(int basesPerLine)
Sets the number of bases each line of the fasta file will have.
|
FastaReferenceWriterBuilder |
setDictFile(java.nio.file.Path dictFile)
Set the output dictionary file to write to.
|
FastaReferenceWriterBuilder |
setDictOutput(java.io.OutputStream dictOutput)
Set the output stream for writing the dictionary.
|
FastaReferenceWriterBuilder |
setEmitMd5(boolean emitMd5) |
FastaReferenceWriterBuilder |
setFastaFile(java.nio.file.Path fastaFile)
Set the output fasta file to write to.
|
FastaReferenceWriterBuilder |
setFastaOutput(java.io.OutputStream fastaOutput)
Set the output stream for writing the reference.
|
FastaReferenceWriterBuilder |
setGziIndexFile(java.nio.file.Path gziIndexFile)
Set the output gzi index file to write to.
|
FastaReferenceWriterBuilder |
setGziIndexOutput(java.io.OutputStream gziIndexOutput)
Set the output stream for writing the index.
|
FastaReferenceWriterBuilder |
setIndexFile(java.nio.file.Path faiIndexFile)
Set the output fai index file to write to.
|
FastaReferenceWriterBuilder |
setIndexOutput(java.io.OutputStream faiIndexOutput)
Set the output stream for writing the index.
|
FastaReferenceWriterBuilder |
setMakeDictOutput(boolean makeDictOutput)
Sets whether to automatically generate an dictionary file from the name of the fasta-file (assuming it is given
as a file).
|
FastaReferenceWriterBuilder |
setMakeFaiOutput(boolean makeFaiOutput)
Sets whether to automatically generate an index file from the name of the fasta-file (assuming it is given
as a file).
|
FastaReferenceWriterBuilder |
setMakeGziOutput(boolean makeGziOutput)
Sets whether to automatically generate a gzi index file using an index file name derived from the name of
the fasta-file (assuming the fasta file is a valid bgzipped file).
|
protected static int checkBasesPerLine(int value)
public FastaReferenceWriterBuilder setFastaFile(java.nio.file.Path fastaFile)
fastaFile - a Path to the output fasta file.public FastaReferenceWriterBuilder setMakeFaiOutput(boolean makeFaiOutput)
makeFaiOutput - a boolean flagpublic FastaReferenceWriterBuilder setMakeDictOutput(boolean makeDictOutput)
makeDictOutput - a boolean flagpublic FastaReferenceWriterBuilder setMakeGziOutput(boolean makeGziOutput)
makeGziOutput - a boolean flagpublic FastaReferenceWriterBuilder setBasesPerLine(int basesPerLine)
basesPerLine - integer (must be positive, validated on build()) indicating the number of bases per line in
the outputpublic FastaReferenceWriterBuilder setIndexFile(java.nio.file.Path faiIndexFile)
public FastaReferenceWriterBuilder setGziIndexFile(java.nio.file.Path gziIndexFile)
public FastaReferenceWriterBuilder setDictFile(java.nio.file.Path dictFile)
public FastaReferenceWriterBuilder setFastaOutput(java.io.OutputStream fastaOutput)
NOTE: If you would like to output a BlockCompressed fasta file it is recommended you use setFastaFile(Path)
as that codepath will handle generation of a gzi index automatically.
fastaOutput - a OutputStream for the output fasta file.public FastaReferenceWriterBuilder setIndexOutput(java.io.OutputStream faiIndexOutput)
faiIndexOutput - a OutputStream for the output index. Doesn't support compressed streams.public FastaReferenceWriterBuilder setGziIndexOutput(java.io.OutputStream gziIndexOutput)
gziIndexOutput - a OutputStream for the gzi output index. Doesn't support compressed streams.public FastaReferenceWriterBuilder setDictOutput(java.io.OutputStream dictOutput)
dictOutput - a OutputStream for the output dictionary. Doesn't support compressed streams.public FastaReferenceWriter build() throws java.io.IOException
FastaReferenceWriter. This is were all the validations happen:
FastaReferenceWriterjava.io.IOException - if trouble opening filespublic boolean getEmitMd5()
public FastaReferenceWriterBuilder setEmitMd5(boolean emitMd5)
emitMd5 - whether the reference builder will emit the M5 tag in the header line
* (and populate it with the md5 digest of the sequence)