Commit 4fbe0d0d authored by Sander Bollen's avatar Sander Bollen
Browse files

setting reference dictionaries

parent 97d99695
......@@ -106,7 +106,11 @@ object AnnotateVcfWithBed extends ToolCommand {
val reader = new VCFFileReader(commandArgs.inputFile, false)
val header = reader.getFileHeader
val writer = new AsyncVariantContextWriter(new VariantContextWriterBuilder().setOutputFile(commandArgs.outputFile).build)
val writer = new AsyncVariantContextWriter(new VariantContextWriterBuilder().
setOutputFile(commandArgs.outputFile).
setReferenceDictionary(header.getSequenceDictionary).
build)
val fieldType = commandArgs.fieldType match {
case "Integer" => VCFHeaderLineType.Integer
case "Flag" => VCFHeaderLineType.Flag
......
......@@ -87,7 +87,8 @@ object CheckAllelesVcfInBam extends ToolCommand {
val bamHeaders = bamReaders.map(x => (x._1, x._2.getFileHeader))
val reader = new VCFFileReader(commandArgs.inputFile, false)
val writer = new AsyncVariantContextWriter(new VariantContextWriterBuilder().setOutputFile(commandArgs.outputFile).build)
val writer = new AsyncVariantContextWriter(new VariantContextWriterBuilder().setOutputFile(commandArgs.outputFile).
setReferenceDictionary(reader.getFileHeader.getSequenceDictionary).build)
val header = reader.getFileHeader
for ((sample, _) <- bamReaders) {
......
......@@ -93,7 +93,10 @@ object MergeAlleles extends ToolCommand {
val readers = commandArgs.inputFiles.map(new VCFFileReader(_, true))
val referenceFile = new FastaSequenceFile(commandArgs.reference, true)
val writer = new AsyncVariantContextWriter(new VariantContextWriterBuilder().setOutputFile(commandArgs.outputFile).build)
val writer = new AsyncVariantContextWriter(new VariantContextWriterBuilder().
setReferenceDictionary(referenceFile.getSequenceDictionary).
setOutputFile(commandArgs.outputFile).
build)
val header = new VCFHeader
val referenceDict = referenceFile.getSequenceDictionary
header.setSequenceDictionary(referenceDict)
......
......@@ -51,6 +51,11 @@ object VcfWithVcf extends ToolCommand {
val header = reader.getFileHeader
val secondHeader = secondaryReader.getFileHeader
val writer = new AsyncVariantContextWriter(new VariantContextWriterBuilder().
setOutputFile(commandArgs.outputFile).
setReferenceDictionary(header.getSequenceDictionary).
build)
writer.writeHeader(header)
for (x <- commandArgs.fields) {
if (header.hasInfoLine(x.outputField))
......@@ -65,9 +70,7 @@ object VcfWithVcf extends ToolCommand {
header.addMetaDataLine(newHeaderLine)
}
val writer = new AsyncVariantContextWriter(new VariantContextWriterBuilder().
setOutputFile(commandArgs.outputFile).build())
writer.writeHeader(header)
var idx = 0
for (record <- reader) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment