GATK now writes BCF output to any file with .bcf extension
-- Moved VCF and BCF writers to variantcontext.writers -- Updated vcf.jar build path -- Refactored VCFWriter and other code. Now the best (and soon to be only) way to create these files is through a factory method called VariantContextWriterFactory. Renamed the general VCFWriter interface to VariantContextWriter which is implemented by VCFWriter and BCF2Writer.
This commit is contained in:
parent
e2311294c0
commit
24864fd5b0
|
|
@ -28,7 +28,7 @@ package org.broadinstitute.sting.gatk.io.storage;
|
|||
import org.broadinstitute.sting.gatk.io.stubs.OutputStreamStub;
|
||||
import org.broadinstitute.sting.gatk.io.stubs.SAMFileWriterStub;
|
||||
import org.broadinstitute.sting.gatk.io.stubs.Stub;
|
||||
import org.broadinstitute.sting.gatk.io.stubs.VCFWriterStub;
|
||||
import org.broadinstitute.sting.gatk.io.stubs.VariantContextWriterStub;
|
||||
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
|
||||
|
||||
import java.io.File;
|
||||
|
|
@ -77,12 +77,12 @@ public class StorageFactory {
|
|||
else
|
||||
storage = new SAMFileWriterStorage((SAMFileWriterStub)stub);
|
||||
}
|
||||
else if(stub instanceof VCFWriterStub) {
|
||||
VCFWriterStub vcfWriterStub = (VCFWriterStub)stub;
|
||||
else if(stub instanceof VariantContextWriterStub) {
|
||||
VariantContextWriterStub vcfWriterStub = (VariantContextWriterStub)stub;
|
||||
if( file != null )
|
||||
storage = new VCFWriterStorage(vcfWriterStub,file);
|
||||
storage = new VariantContextWriterStorage(vcfWriterStub,file);
|
||||
else
|
||||
storage = new VCFWriterStorage(vcfWriterStub);
|
||||
storage = new VariantContextWriterStorage(vcfWriterStub);
|
||||
}
|
||||
else
|
||||
throw new ReviewedStingException("Unsupported stub type: " + stub.getClass().getName());
|
||||
|
|
|
|||
|
|
@ -3,14 +3,14 @@ package org.broadinstitute.sting.gatk.io.storage;
|
|||
import net.sf.samtools.util.BlockCompressedOutputStream;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.broad.tribble.AbstractFeatureReader;
|
||||
import org.broadinstitute.sting.gatk.io.stubs.VCFWriterStub;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.StandardVCFWriter;
|
||||
import org.broadinstitute.sting.gatk.io.stubs.VariantContextWriterStub;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFCodec;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.VCFWriter;
|
||||
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriterFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
|
@ -23,22 +23,22 @@ import java.io.PrintStream;
|
|||
* @author mhanna
|
||||
* @version 0.1
|
||||
*/
|
||||
public class VCFWriterStorage implements Storage<VCFWriterStorage>, VCFWriter {
|
||||
public class VariantContextWriterStorage implements Storage<VariantContextWriterStorage>, VariantContextWriter {
|
||||
/**
|
||||
* our log, which we want to capture anything from this class
|
||||
*/
|
||||
private static Logger logger = Logger.getLogger(VCFWriterStorage.class);
|
||||
private static Logger logger = Logger.getLogger(VariantContextWriterStorage.class);
|
||||
|
||||
protected final File file;
|
||||
protected OutputStream stream;
|
||||
protected final VCFWriter writer;
|
||||
protected final VariantContextWriter writer;
|
||||
|
||||
/**
|
||||
* Constructs an object which will write directly into the output file provided by the stub.
|
||||
* Intentionally delaying the writing of the header -- this should be filled in by the walker.
|
||||
* @param stub Stub to use when constructing the output file.
|
||||
*/
|
||||
public VCFWriterStorage( VCFWriterStub stub ) {
|
||||
public VariantContextWriterStorage(VariantContextWriterStub stub) {
|
||||
if ( stub.getFile() != null ) {
|
||||
this.file = stub.getFile();
|
||||
writer = vcfWriterToFile(stub,stub.getFile(),true);
|
||||
|
|
@ -46,7 +46,7 @@ public class VCFWriterStorage implements Storage<VCFWriterStorage>, VCFWriter {
|
|||
else if ( stub.getOutputStream() != null ) {
|
||||
this.file = null;
|
||||
this.stream = stub.getOutputStream();
|
||||
writer = new StandardVCFWriter(stream, stub.getMasterSequenceDictionary(), stub.doNotWriteGenotypes());
|
||||
writer = VariantContextWriterFactory.create(stream, stub.getMasterSequenceDictionary(), stub.getWriterOptions(false));
|
||||
}
|
||||
else
|
||||
throw new ReviewedStingException("Unable to create target to which to write; storage was provided with neither a file nor a stream.");
|
||||
|
|
@ -59,7 +59,7 @@ public class VCFWriterStorage implements Storage<VCFWriterStorage>, VCFWriter {
|
|||
* @param indexOnTheFly true to index the file on the fly. NOTE: will be forced to false for compressed files.
|
||||
* @return A VCF writer for use with this class
|
||||
*/
|
||||
private StandardVCFWriter vcfWriterToFile(VCFWriterStub stub, File file, boolean indexOnTheFly) {
|
||||
private VariantContextWriter vcfWriterToFile(VariantContextWriterStub stub, File file, boolean indexOnTheFly) {
|
||||
try {
|
||||
if ( stub.isCompressed() )
|
||||
stream = new BlockCompressedOutputStream(file);
|
||||
|
|
@ -71,7 +71,7 @@ public class VCFWriterStorage implements Storage<VCFWriterStorage>, VCFWriter {
|
|||
}
|
||||
|
||||
// The GATK/Tribble can't currently index block-compressed files on the fly. Disable OTF indexing even if the user explicitly asked for it.
|
||||
return new StandardVCFWriter(file, this.stream, stub.getMasterSequenceDictionary(), indexOnTheFly && !stub.isCompressed(), stub.doNotWriteGenotypes());
|
||||
return VariantContextWriterFactory.create(file, this.stream, stub.getMasterSequenceDictionary(), stub.getWriterOptions(indexOnTheFly));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ public class VCFWriterStorage implements Storage<VCFWriterStorage>, VCFWriter {
|
|||
* @param stub Stub to use when synthesizing file / header info.
|
||||
* @param tempFile File into which to direct the output data.
|
||||
*/
|
||||
public VCFWriterStorage(VCFWriterStub stub, File tempFile) {
|
||||
public VariantContextWriterStorage(VariantContextWriterStub stub, File tempFile) {
|
||||
logger.debug("Creating temporary VCF file " + tempFile.getAbsolutePath() + " for VCF output.");
|
||||
this.file = tempFile;
|
||||
this.writer = vcfWriterToFile(stub, file, false);
|
||||
|
|
@ -109,7 +109,7 @@ public class VCFWriterStorage implements Storage<VCFWriterStorage>, VCFWriter {
|
|||
writer.close();
|
||||
}
|
||||
|
||||
public void mergeInto(VCFWriterStorage target) {
|
||||
public void mergeInto(VariantContextWriterStorage target) {
|
||||
try {
|
||||
String sourceFilePath = file.getAbsolutePath();
|
||||
String targetFilePath = target.file != null ? target.file.getAbsolutePath() : "/dev/stdin";
|
||||
|
|
@ -27,7 +27,7 @@ package org.broadinstitute.sting.gatk.io.stubs;
|
|||
|
||||
import org.broadinstitute.sting.commandline.*;
|
||||
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.VCFWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
|
||||
|
||||
import java.io.File;
|
||||
|
|
@ -91,7 +91,7 @@ public class VCFWriterArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
|||
*/
|
||||
@Override
|
||||
public boolean supports( Class type ) {
|
||||
return VCFWriter.class.equals(type);
|
||||
return VariantContextWriter.class.equals(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -117,7 +117,7 @@ public class VCFWriterArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
|||
public Object createTypeDefault(ParsingEngine parsingEngine,ArgumentSource source, Type type) {
|
||||
if(!source.isRequired())
|
||||
throw new ReviewedStingException("BUG: tried to create type default for argument type descriptor that can't support a type default.");
|
||||
VCFWriterStub stub = new VCFWriterStub(engine, defaultOutputStream, false, argumentSources, false, false);
|
||||
VariantContextWriterStub stub = new VariantContextWriterStub(engine, defaultOutputStream, false, argumentSources, false, false);
|
||||
engine.addOutput(stub);
|
||||
return stub;
|
||||
}
|
||||
|
|
@ -148,8 +148,8 @@ public class VCFWriterArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
|||
boolean doNotWriteGenotypes = argumentIsPresent(createSitesOnlyArgumentDefinition(),matches);
|
||||
|
||||
// Create a stub for the given object.
|
||||
VCFWriterStub stub = (writerFile != null) ? new VCFWriterStub(engine, writerFile, compress, argumentSources, skipWritingHeader, doNotWriteGenotypes)
|
||||
: new VCFWriterStub(engine, defaultOutputStream, compress, argumentSources, skipWritingHeader, doNotWriteGenotypes);
|
||||
VariantContextWriterStub stub = (writerFile != null) ? new VariantContextWriterStub(engine, writerFile, compress, argumentSources, skipWritingHeader, doNotWriteGenotypes)
|
||||
: new VariantContextWriterStub(engine, defaultOutputStream, compress, argumentSources, skipWritingHeader, doNotWriteGenotypes);
|
||||
|
||||
// WARNING: Side effects required by engine!
|
||||
parsingEngine.addTags(stub,getArgumentTags(matches));
|
||||
|
|
|
|||
|
|
@ -32,13 +32,17 @@ import org.broadinstitute.sting.utils.classloader.JVMUtils;
|
|||
import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLine;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.VCFWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriterFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A stub for routing and management of genotype reading and writing.
|
||||
|
|
@ -46,7 +50,7 @@ import java.util.Collection;
|
|||
* @author ebanks
|
||||
* @version 0.1
|
||||
*/
|
||||
public class VCFWriterStub implements Stub<VCFWriter>, VCFWriter {
|
||||
public class VariantContextWriterStub implements Stub<VariantContextWriter>, VariantContextWriter {
|
||||
/**
|
||||
* The engine, central to the GATK's processing.
|
||||
*/
|
||||
|
|
@ -106,7 +110,7 @@ public class VCFWriterStub implements Stub<VCFWriter>, VCFWriter {
|
|||
* @param skipWritingHeader skip writing header.
|
||||
* @param doNotWriteGenotypes do not write genotypes.
|
||||
*/
|
||||
public VCFWriterStub(GenomeAnalysisEngine engine, File genotypeFile, boolean isCompressed, Collection<Object> argumentSources, boolean skipWritingHeader, boolean doNotWriteGenotypes) {
|
||||
public VariantContextWriterStub(GenomeAnalysisEngine engine, File genotypeFile, boolean isCompressed, Collection<Object> argumentSources, boolean skipWritingHeader, boolean doNotWriteGenotypes) {
|
||||
this.engine = engine;
|
||||
this.genotypeFile = genotypeFile;
|
||||
this.genotypeStream = null;
|
||||
|
|
@ -126,7 +130,7 @@ public class VCFWriterStub implements Stub<VCFWriter>, VCFWriter {
|
|||
* @param skipWritingHeader skip writing header.
|
||||
* @param doNotWriteGenotypes do not write genotypes.
|
||||
*/
|
||||
public VCFWriterStub(GenomeAnalysisEngine engine, OutputStream genotypeStream, boolean isCompressed, Collection<Object> argumentSources, boolean skipWritingHeader, boolean doNotWriteGenotypes) {
|
||||
public VariantContextWriterStub(GenomeAnalysisEngine engine, OutputStream genotypeStream, boolean isCompressed, Collection<Object> argumentSources, boolean skipWritingHeader, boolean doNotWriteGenotypes) {
|
||||
this.engine = engine;
|
||||
this.genotypeFile = null;
|
||||
this.genotypeStream = new PrintStream(genotypeStream);
|
||||
|
|
@ -169,12 +173,17 @@ public class VCFWriterStub implements Stub<VCFWriter>, VCFWriter {
|
|||
return engine.getMasterSequenceDictionary();
|
||||
}
|
||||
|
||||
/**
|
||||
* Should we tell the VCF writer not to write genotypes?
|
||||
* @return true if the writer should not write genotypes.
|
||||
*/
|
||||
public boolean doNotWriteGenotypes() {
|
||||
return doNotWriteGenotypes;
|
||||
public EnumSet<VariantContextWriterFactory.Options> getWriterOptions() {
|
||||
return getWriterOptions(false);
|
||||
}
|
||||
|
||||
public EnumSet<VariantContextWriterFactory.Options> getWriterOptions(boolean indexOnTheFly) {
|
||||
List<VariantContextWriterFactory.Options> options = new ArrayList<VariantContextWriterFactory.Options>();
|
||||
|
||||
if ( doNotWriteGenotypes ) options.add(VariantContextWriterFactory.Options.DO_NOT_WRITE_GENOTYPES);
|
||||
if ( indexOnTheFly && ! isCompressed() ) options.add(VariantContextWriterFactory.Options.ENABLE_ON_THE_FLY_INDEX);
|
||||
|
||||
return options.isEmpty() ? EnumSet.noneOf(VariantContextWriterFactory.Options.class) : EnumSet.copyOf(options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -38,7 +38,7 @@ import org.broadinstitute.sting.utils.BaseUtils;
|
|||
import org.broadinstitute.sting.utils.SampleUtils;
|
||||
import org.broadinstitute.sting.utils.classloader.PluginManager;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.*;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.VCFWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
|
||||
import java.util.*;
|
||||
|
|
@ -121,7 +121,7 @@ public class VariantAnnotator extends RodWalker<Integer, Integer> implements Ann
|
|||
public List<RodBinding<VariantContext>> getResourceRodBindings() { return resources; }
|
||||
|
||||
@Output(doc="File to which variants should be written",required=true)
|
||||
protected VCFWriter vcfWriter = null;
|
||||
protected VariantContextWriter vcfWriter = null;
|
||||
|
||||
/**
|
||||
* See the -list argument to view available annotations.
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
|||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.SampleUtils;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.*;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.VCFWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.*;
|
||||
|
||||
import java.util.*;
|
||||
|
|
@ -103,7 +103,7 @@ public class BeagleOutputToVCFWalker extends RodWalker<Integer, Integer> {
|
|||
public RodBinding<BeagleFeature> beaglePhased;
|
||||
|
||||
@Output(doc="VCF File to which variants should be written",required=true)
|
||||
protected VCFWriter vcfWriter = null;
|
||||
protected VariantContextWriter vcfWriter = null;
|
||||
|
||||
/**
|
||||
* If this argument is absent, and if Beagle determines that there is no sample in a site that has a variant genotype, the site will be marked as filtered (Default behavior).
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ import org.broadinstitute.sting.utils.GenomeLoc;
|
|||
import org.broadinstitute.sting.utils.MathUtils;
|
||||
import org.broadinstitute.sting.utils.SampleUtils;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.*;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.VCFWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||
import org.broadinstitute.sting.utils.exceptions.StingException;
|
||||
import org.broadinstitute.sting.utils.variantcontext.*;
|
||||
|
||||
|
|
@ -109,7 +109,7 @@ public class ProduceBeagleInputWalker extends RodWalker<Integer, Integer> {
|
|||
public double bootstrap = 0.0;
|
||||
@Hidden
|
||||
@Argument(fullName = "bootstrap_vcf",shortName = "bvcf", doc = "Output a VCF with the records used for bootstrapping filtered out", required = false)
|
||||
VCFWriter bootstrapVCFOutput = null;
|
||||
VariantContextWriter bootstrapVCFOutput = null;
|
||||
|
||||
/**
|
||||
* If sample gender is known, this flag should be set to true to ensure that Beagle treats male Chr X properly.
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ import org.broadinstitute.sting.utils.SampleUtils;
|
|||
import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLine;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.VCFWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Allele;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Genotype;
|
||||
|
|
@ -65,7 +65,7 @@ public class VariantsToBeagleUnphasedWalker extends RodWalker<Integer, Integer>
|
|||
public double bootstrap = 0.0;
|
||||
|
||||
@Argument(fullName = "bootstrap_vcf",shortName = "bsvcf", doc = "Output a VCF with the records used for bootstrapping filtered out", required = false)
|
||||
VCFWriter bootstrapVCFOutput = null;
|
||||
VariantContextWriter bootstrapVCFOutput = null;
|
||||
|
||||
@Argument(fullName = "missing", shortName = "missing", doc = "String to identify missing data in beagle output", required = false)
|
||||
public String MISSING = "?";
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.AnnotatorCompa
|
|||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.SampleUtils;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.*;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.VCFWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Allele;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Genotype;
|
||||
|
|
@ -79,7 +79,7 @@ public class DiagnoseTargets extends LocusWalker<Long, Long> implements Annotato
|
|||
private IntervalBinding<Feature> intervalTrack = null;
|
||||
|
||||
@Output(doc = "File to which variants should be written", required = true)
|
||||
private VCFWriter vcfWriter = null;
|
||||
private VariantContextWriter vcfWriter = null;
|
||||
|
||||
@Argument(fullName = "minimum_base_quality", shortName = "mbq", doc = "", required = false)
|
||||
private int minimumBaseQuality = 20;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import org.broadinstitute.sting.gatk.walkers.*;
|
|||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.SampleUtils;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.*;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.VCFWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
import org.broadinstitute.sting.utils.variantcontext.*;
|
||||
|
||||
|
|
@ -86,7 +86,7 @@ public class VariantFiltrationWalker extends RodWalker<Integer, Integer> {
|
|||
public RodBinding<Feature> mask;
|
||||
|
||||
@Output(doc="File to which variants should be written", required=true)
|
||||
protected VCFWriter writer = null;
|
||||
protected VariantContextWriter writer = null;
|
||||
|
||||
/**
|
||||
* VariantFiltration accepts any number of JEXL expressions (so you can have two named filters by using
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.AnnotatorCompa
|
|||
import org.broadinstitute.sting.utils.SampleUtils;
|
||||
import org.broadinstitute.sting.utils.baq.BAQ;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.*;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.VCFWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeLikelihoods;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
|
|
@ -152,7 +152,7 @@ public class UnifiedGenotyper extends LocusWalker<List<VariantCallContext>, Unif
|
|||
* A raw, unfiltered, highly specific callset in VCF format.
|
||||
*/
|
||||
@Output(doc="File to which variants should be written",required=true)
|
||||
protected VCFWriter writer = null;
|
||||
protected VariantContextWriter writer = null;
|
||||
|
||||
@Hidden
|
||||
@Argument(fullName = "debug_file", shortName = "debug_file", doc = "File to print all of the annotated and detailed debugging output", required = false)
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ import org.broadinstitute.sting.utils.codecs.refseq.RefSeqCodec;
|
|||
import org.broadinstitute.sting.utils.codecs.refseq.RefSeqFeature;
|
||||
import org.broadinstitute.sting.utils.codecs.refseq.Transcript;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.*;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.VCFWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||
import org.broadinstitute.sting.utils.collections.CircularArray;
|
||||
import org.broadinstitute.sting.utils.collections.PrimitivePair;
|
||||
import org.broadinstitute.sting.utils.exceptions.StingException;
|
||||
|
|
@ -131,7 +131,7 @@ public class SomaticIndelDetectorWalker extends ReadWalker<Integer,Integer> {
|
|||
// @Output
|
||||
// PrintStream out;
|
||||
@Output(doc="File to write variants (indels) in VCF format",required=true)
|
||||
protected VCFWriter vcf_writer = null;
|
||||
protected VariantContextWriter vcf_writer = null;
|
||||
|
||||
@Argument(fullName="outputFile", shortName="O", doc="output file name (BED format). DEPRECATED> Use --bed", required=true)
|
||||
@Deprecated
|
||||
|
|
@ -1113,7 +1113,7 @@ public class SomaticIndelDetectorWalker extends ReadWalker<Integer,Integer> {
|
|||
}
|
||||
}
|
||||
|
||||
public void printVCFLine(VCFWriter vcf, IndelPrecall call, boolean discard_event) {
|
||||
public void printVCFLine(VariantContextWriter vcf, IndelPrecall call, boolean discard_event) {
|
||||
|
||||
long start = call.getPosition()-1;
|
||||
// If the beginning of the chromosome is deleted (possible, however unlikely), it's unclear how to proceed.
|
||||
|
|
@ -1185,7 +1185,7 @@ public class SomaticIndelDetectorWalker extends ReadWalker<Integer,Integer> {
|
|||
}
|
||||
}
|
||||
|
||||
public void printVCFLine(VCFWriter vcf, IndelPrecall nCall, IndelPrecall tCall, boolean discard_event) {
|
||||
public void printVCFLine(VariantContextWriter vcf, IndelPrecall nCall, IndelPrecall tCall, boolean discard_event) {
|
||||
|
||||
long start = tCall.getPosition()-1;
|
||||
long stop = start;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ import org.apache.log4j.Logger;
|
|||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||
import org.broadinstitute.sting.utils.MathUtils;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.VCFWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
import org.broadinstitute.sting.utils.fasta.CachingIndexedFastaSequenceFile;
|
||||
|
|
@ -41,8 +41,8 @@ import java.util.*;
|
|||
|
||||
// Streams in VariantContext objects and streams out VariantContexts produced by merging phased segregating polymorphisms into MNP VariantContexts
|
||||
|
||||
class MergeSegregatingAlternateAllelesVCFWriter implements VCFWriter {
|
||||
private VCFWriter innerWriter;
|
||||
class MergeSegregatingAlternateAllelesVCFWriter implements VariantContextWriter {
|
||||
private VariantContextWriter innerWriter;
|
||||
|
||||
private GenomeLocParser genomeLocParser;
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ class MergeSegregatingAlternateAllelesVCFWriter implements VCFWriter {
|
|||
// Should we call innerWriter.close() in close()
|
||||
private boolean takeOwnershipOfInner;
|
||||
|
||||
public MergeSegregatingAlternateAllelesVCFWriter(VCFWriter innerWriter, GenomeLocParser genomeLocParser, File referenceFile, VariantContextMergeRule vcMergeRule, PhasingUtils.AlleleMergeRule alleleMergeRule, String singleSample, boolean emitOnlyMergedRecords, Logger logger, boolean takeOwnershipOfInner, boolean trackAltAlleleStats) {
|
||||
public MergeSegregatingAlternateAllelesVCFWriter(VariantContextWriter innerWriter, GenomeLocParser genomeLocParser, File referenceFile, VariantContextMergeRule vcMergeRule, PhasingUtils.AlleleMergeRule alleleMergeRule, String singleSample, boolean emitOnlyMergedRecords, Logger logger, boolean takeOwnershipOfInner, boolean trackAltAlleleStats) {
|
||||
this.innerWriter = innerWriter;
|
||||
this.genomeLocParser = genomeLocParser;
|
||||
try {
|
||||
|
|
@ -94,7 +94,7 @@ class MergeSegregatingAlternateAllelesVCFWriter implements VCFWriter {
|
|||
this.takeOwnershipOfInner = takeOwnershipOfInner;
|
||||
}
|
||||
|
||||
public MergeSegregatingAlternateAllelesVCFWriter(VCFWriter innerWriter, GenomeLocParser genomeLocParser, File referenceFile, int maxGenomicDistanceForMNP, Logger logger, boolean takeOwnershipOfInner) {
|
||||
public MergeSegregatingAlternateAllelesVCFWriter(VariantContextWriter innerWriter, GenomeLocParser genomeLocParser, File referenceFile, int maxGenomicDistanceForMNP, Logger logger, boolean takeOwnershipOfInner) {
|
||||
this(innerWriter, genomeLocParser, referenceFile, new DistanceMergeRule(maxGenomicDistanceForMNP, genomeLocParser), new SegregatingMNPmergeAllelesRule(), null, false, logger, takeOwnershipOfInner, true); // by default: consider all samples, emit all records, keep track of alt allele statistics
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
|||
import org.broadinstitute.sting.utils.MathUtils;
|
||||
import org.broadinstitute.sting.utils.SampleUtils;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.*;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.VCFWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
import org.broadinstitute.sting.utils.variantcontext.*;
|
||||
|
||||
|
|
@ -87,7 +87,7 @@ public class PhaseByTransmission extends RodWalker<HashMap<Byte,Integer>, HashMa
|
|||
private boolean fatherFAlleleFirst=false;
|
||||
|
||||
@Output
|
||||
protected VCFWriter vcfWriter = null;
|
||||
protected VariantContextWriter vcfWriter = null;
|
||||
|
||||
private final String TRANSMISSION_PROBABILITY_TAG_NAME = "TP";
|
||||
private final String SOURCE_NAME = "PhaseByTransmission";
|
||||
|
|
|
|||
|
|
@ -38,13 +38,13 @@ import org.broadinstitute.sting.utils.GenomeLoc;
|
|||
import org.broadinstitute.sting.utils.HasGenomeLocation;
|
||||
import org.broadinstitute.sting.utils.SampleUtils;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.*;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.SortingVCFWriter;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.VCFWriter;
|
||||
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
import org.broadinstitute.sting.utils.pileup.PileupElement;
|
||||
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
|
||||
import org.broadinstitute.sting.utils.variantcontext.*;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriterFactory;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
|
@ -102,7 +102,7 @@ public class ReadBackedPhasingWalker extends RodWalker<PhasingStatsAndOutput, Ph
|
|||
protected StandardVariantContextInputArgumentCollection variantCollection = new StandardVariantContextInputArgumentCollection();
|
||||
|
||||
@Output(doc = "File to which variants should be written", required = true)
|
||||
protected VCFWriter writer = null;
|
||||
protected VariantContextWriter writer = null;
|
||||
|
||||
@Argument(fullName = "cacheWindowSize", shortName = "cacheWindow", doc = "The window size (in bases) to cache variant sites and their reads for the phasing procedure", required = false)
|
||||
protected Integer cacheWindow = 20000;
|
||||
|
|
@ -187,7 +187,7 @@ public class ReadBackedPhasingWalker extends RodWalker<PhasingStatsAndOutput, Ph
|
|||
|
||||
private void initializeVcfWriter() {
|
||||
// Wrapper VCFWriters will take ownership of inner writers iff: inner writer != origWriter [which wasn't created here]
|
||||
VCFWriter origWriter = writer;
|
||||
VariantContextWriter origWriter = writer;
|
||||
|
||||
if (enableMergePhasedSegregatingPolymorphismsToMNP)
|
||||
writer = new MergeSegregatingAlternateAllelesVCFWriter(writer, getToolkit().getGenomeLocParser(), getToolkit().getArguments().referenceFile, maxGenomicDistanceForMNP, logger, writer != origWriter);
|
||||
|
|
@ -201,7 +201,7 @@ public class ReadBackedPhasingWalker extends RodWalker<PhasingStatsAndOutput, Ph
|
|||
But, NOTE that map() is careful to pass out a list of records to be written that FIRST includes any records discarded due to having reached mostDownstreamLocusReached,
|
||||
and only THEN records located at mostDownstreamLocusReached. The opposite order in map() would violate the startDistance limits imposed when contracting SortingVCFWriter with (2 * cacheWindow).
|
||||
*/
|
||||
writer = new SortingVCFWriter(writer, 2 * cacheWindow, writer != origWriter);
|
||||
writer = VariantContextWriterFactory.sortOnTheFly(writer, 2 * cacheWindow, writer != origWriter);
|
||||
|
||||
// setup the header fields:
|
||||
Set<VCFHeaderLine> hInfo = new HashSet<VCFHeaderLine>();
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
|||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.VCFWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
|
||||
import java.util.*;
|
||||
|
|
@ -73,7 +73,7 @@ public class DocumentationTest extends RodWalker<Integer, Integer> {
|
|||
private RodBinding<Feature> featureArg = null;
|
||||
|
||||
@Output(doc="VCFWriter",required=true)
|
||||
protected VCFWriter vcfWriter = null;
|
||||
protected VariantContextWriter vcfWriter = null;
|
||||
|
||||
@Advanced
|
||||
@Argument(fullName="setString", shortName="sn", doc="Sample name to be included in the analysis. Can be specified multiple times.", required=false)
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ import org.broadinstitute.sting.utils.SampleUtils;
|
|||
import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLine;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.VCFWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContextBuilder;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
|
||||
|
|
@ -201,7 +201,7 @@ public class GenotypeAndValidateWalker extends RodWalker<GenotypeAndValidateWalk
|
|||
* The optional output file that will have all the variants used in the Genotype and Validation essay.
|
||||
*/
|
||||
@Output(doc="Generate a VCF file with the variants considered by the walker, with a new annotation \"callStatus\" which will carry the value called in the validation VCF or BAM file", required=false)
|
||||
protected VCFWriter vcfWriter = null;
|
||||
protected VariantContextWriter vcfWriter = null;
|
||||
|
||||
/**
|
||||
* The callset to be used as truth (default) or validated (if BAM file is set to truth).
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
|||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||
import org.broadinstitute.sting.utils.SampleUtils;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.*;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.VCFWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
|
||||
|
||||
|
|
@ -117,7 +117,7 @@ public class ValidationSiteSelectorWalker extends RodWalker<Integer, Integer> {
|
|||
* The output VCF file
|
||||
*/
|
||||
@Output(doc="File to which variants should be written",required=true)
|
||||
protected VCFWriter vcfWriter = null;
|
||||
protected VariantContextWriter vcfWriter = null;
|
||||
|
||||
/**
|
||||
* Sample name(s) to subset the input VCF to, prior to selecting variants. -sn A -sn B subsets to samples A and B.
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
|||
import org.broadinstitute.sting.gatk.walkers.TreeReducible;
|
||||
import org.broadinstitute.sting.utils.SampleUtils;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.*;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.VCFWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContextBuilder;
|
||||
|
|
@ -105,7 +105,7 @@ public class ApplyRecalibration extends RodWalker<Integer, Integer> implements T
|
|||
// Outputs
|
||||
/////////////////////////////
|
||||
@Output( doc="The output filtered and recalibrated VCF file in which each variant is annotated with its VQSLOD value", required=true)
|
||||
private VCFWriter vcfWriter = null;
|
||||
private VariantContextWriter vcfWriter = null;
|
||||
|
||||
/////////////////////////////
|
||||
// Command Line Arguments
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
|||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.MathUtils;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.VCFWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||
import org.broadinstitute.sting.utils.collections.ExpandingArrayList;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Allele;
|
||||
|
|
@ -278,7 +278,7 @@ public class VariantDataManager {
|
|||
(TRUST_ALL_POLYMORPHIC || !trainVC.hasGenotypes() || trainVC.isPolymorphicInSamples());
|
||||
}
|
||||
|
||||
public void writeOutRecalibrationTable( final VCFWriter recalWriter ) {
|
||||
public void writeOutRecalibrationTable( final VariantContextWriter recalWriter ) {
|
||||
// we need to sort in coordinate order in order to produce a valid VCF
|
||||
Collections.sort( data, new Comparator<VariantDatum>() {
|
||||
public int compare(VariantDatum vd1, VariantDatum vd2) {
|
||||
|
|
|
|||
|
|
@ -37,13 +37,14 @@ import org.broadinstitute.sting.utils.MathUtils;
|
|||
import org.broadinstitute.sting.utils.QualityUtils;
|
||||
import org.broadinstitute.sting.utils.R.RScriptExecutor;
|
||||
import org.broadinstitute.sting.utils.Utils;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.StandardVCFWriter;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
|
||||
import org.broadinstitute.sting.utils.collections.ExpandingArrayList;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
import org.broadinstitute.sting.utils.io.Resource;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriterFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
|
|
@ -139,7 +140,7 @@ public class VariantRecalibrator extends RodWalker<ExpandingArrayList<VariantDat
|
|||
/////////////////////////////
|
||||
@Output(fullName="recal_file", shortName="recalFile", doc="The output recal file used by ApplyRecalibration", required=true)
|
||||
protected File recalFile = null;
|
||||
protected StandardVCFWriter recalWriter = null;
|
||||
protected VariantContextWriter recalWriter = null;
|
||||
|
||||
@Output(fullName="tranches_file", shortName="tranchesFile", doc="The output tranches file used by ApplyRecalibration", required=true)
|
||||
protected File TRANCHES_FILE;
|
||||
|
|
@ -230,7 +231,7 @@ public class VariantRecalibrator extends RodWalker<ExpandingArrayList<VariantDat
|
|||
}
|
||||
|
||||
final VCFHeader vcfHeader = new VCFHeader( null, Collections.<String>emptySet() );
|
||||
recalWriter = new StandardVCFWriter(recalFile, getMasterSequenceDictionary(), false);
|
||||
recalWriter = VariantContextWriterFactory.create(recalFile, getMasterSequenceDictionary());
|
||||
recalWriter.writeHeader(vcfHeader);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ package org.broadinstitute.sting.gatk.walkers.variantutils;
|
|||
import org.broadinstitute.sting.commandline.*;
|
||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.gatk.io.stubs.VCFWriterStub;
|
||||
import org.broadinstitute.sting.gatk.io.stubs.VariantContextWriterStub;
|
||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.Reference;
|
||||
import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
||||
|
|
@ -37,11 +37,12 @@ import org.broadinstitute.sting.gatk.walkers.annotator.ChromosomeCounts;
|
|||
import org.broadinstitute.sting.utils.SampleUtils;
|
||||
import org.broadinstitute.sting.utils.Utils;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.*;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.VCFWriter;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContextBuilder;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriterFactory;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
|
@ -114,7 +115,7 @@ public class CombineVariants extends RodWalker<Integer, Integer> {
|
|||
public List<RodBinding<VariantContext>> variants;
|
||||
|
||||
@Output(doc="File to which variants should be written",required=true)
|
||||
protected VCFWriter vcfWriter = null;
|
||||
protected VariantContextWriter vcfWriter = null;
|
||||
|
||||
@Argument(shortName="genotypeMergeOptions", doc="Determines how we should merge genotype records for samples shared across the ROD files", required=false)
|
||||
public VariantContextUtils.GenotypeMergeType genotypeMergeOption = VariantContextUtils.GenotypeMergeType.PRIORITIZE;
|
||||
|
|
@ -197,8 +198,8 @@ public class CombineVariants extends RodWalker<Integer, Integer> {
|
|||
vcfHeader.setWriteCommandLine(!SUPPRESS_COMMAND_LINE_HEADER);
|
||||
vcfWriter.writeHeader(vcfHeader);
|
||||
|
||||
if ( vcfWriter instanceof VCFWriterStub) {
|
||||
sitesOnlyVCF = ((VCFWriterStub)vcfWriter).doNotWriteGenotypes();
|
||||
if ( vcfWriter instanceof VariantContextWriterStub) {
|
||||
sitesOnlyVCF = ((VariantContextWriterStub)vcfWriter).getWriterOptions().contains(VariantContextWriterFactory.Options.DO_NOT_WRITE_GENOTYPES);
|
||||
if ( sitesOnlyVCF ) logger.info("Pre-stripping genotypes for performance");
|
||||
} else
|
||||
logger.warn("VCF output file not an instance of VCFWriterStub; cannot enable sites only output option");
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import org.broadinstitute.sting.gatk.walkers.*;
|
|||
import org.broadinstitute.sting.utils.SampleUtils;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.VCFWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
|
@ -54,7 +54,7 @@ public class FilterLiftedVariants extends RodWalker<Integer, Integer> {
|
|||
private static final int MAX_VARIANT_SIZE = 100;
|
||||
|
||||
@Output(doc="File to which variants should be written",required=true)
|
||||
protected VCFWriter writer = null;
|
||||
protected VariantContextWriter writer = null;
|
||||
|
||||
private long failedLocs = 0, totalLocs = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -34,13 +34,17 @@ import org.broadinstitute.sting.gatk.arguments.StandardVariantContextInputArgume
|
|||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.*;
|
||||
import org.broadinstitute.sting.gatk.walkers.Reference;
|
||||
import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
||||
import org.broadinstitute.sting.gatk.walkers.Window;
|
||||
import org.broadinstitute.sting.utils.SampleUtils;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.*;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.SortingVCFWriter;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.VCFWriter;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLine;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
|
||||
import org.broadinstitute.sting.utils.sam.AlignmentUtils;
|
||||
import org.broadinstitute.sting.utils.variantcontext.*;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriterFactory;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
|
@ -79,9 +83,9 @@ public class LeftAlignVariants extends RodWalker<Integer, Integer> {
|
|||
protected StandardVariantContextInputArgumentCollection variantCollection = new StandardVariantContextInputArgumentCollection();
|
||||
|
||||
@Output(doc="File to which variants should be written",required=true)
|
||||
protected VCFWriter baseWriter = null;
|
||||
protected VariantContextWriter baseWriter = null;
|
||||
|
||||
private SortingVCFWriter writer;
|
||||
private VariantContextWriter writer;
|
||||
|
||||
public void initialize() {
|
||||
String trackName = variantCollection.variants.getName();
|
||||
|
|
@ -91,7 +95,7 @@ public class LeftAlignVariants extends RodWalker<Integer, Integer> {
|
|||
Set<VCFHeaderLine> headerLines = vcfHeaders.get(trackName).getMetaData();
|
||||
baseWriter.writeHeader(new VCFHeader(headerLines, samples));
|
||||
|
||||
writer = new SortingVCFWriter(baseWriter, 200);
|
||||
writer = VariantContextWriterFactory.sortOnTheFly(baseWriter, 200);
|
||||
}
|
||||
|
||||
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,9 @@ import net.sf.picard.liftover.LiftOver;
|
|||
import net.sf.picard.util.Interval;
|
||||
import net.sf.samtools.SAMFileHeader;
|
||||
import net.sf.samtools.SAMFileReader;
|
||||
import org.broadinstitute.sting.commandline.*;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
import org.broadinstitute.sting.commandline.ArgumentCollection;
|
||||
import org.broadinstitute.sting.commandline.Output;
|
||||
import org.broadinstitute.sting.gatk.arguments.StandardVariantContextInputArgumentCollection;
|
||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
|
|
@ -36,11 +38,12 @@ import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
|||
import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
||||
import org.broadinstitute.sting.utils.SampleUtils;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.*;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.StandardVCFWriter;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContextBuilder;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriterFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
|
@ -55,7 +58,7 @@ public class LiftoverVariants extends RodWalker<Integer, Integer> {
|
|||
|
||||
@Output(doc="File to which variants should be written",required=true)
|
||||
protected File file = null;
|
||||
protected StandardVCFWriter writer = null;
|
||||
protected VariantContextWriter writer = null;
|
||||
|
||||
@Argument(fullName="chain", shortName="chain", doc="Chain file", required=true)
|
||||
protected File CHAIN = null;
|
||||
|
|
@ -100,7 +103,7 @@ public class LiftoverVariants extends RodWalker<Integer, Integer> {
|
|||
|
||||
|
||||
final VCFHeader vcfHeader = new VCFHeader(metaData, samples);
|
||||
writer = new StandardVCFWriter(file, getMasterSequenceDictionary(), false);
|
||||
writer = VariantContextWriterFactory.create(file, getMasterSequenceDictionary(), VariantContextWriterFactory.NO_OPTIONS);
|
||||
writer.writeHeader(vcfHeader);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,9 @@
|
|||
|
||||
package org.broadinstitute.sting.gatk.walkers.variantutils;
|
||||
|
||||
import org.broadinstitute.sting.commandline.*;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
import org.broadinstitute.sting.commandline.ArgumentCollection;
|
||||
import org.broadinstitute.sting.commandline.Output;
|
||||
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
||||
import org.broadinstitute.sting.gatk.arguments.StandardVariantContextInputArgumentCollection;
|
||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||
|
|
@ -32,11 +34,13 @@ import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
|||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
||||
import org.broadinstitute.sting.utils.SampleUtils;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.*;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.StandardVCFWriter;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.VCFWriter;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLine;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriterFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
|
@ -50,12 +54,12 @@ public class RandomlySplitVariants extends RodWalker<Integer, Integer> {
|
|||
protected StandardVariantContextInputArgumentCollection variantCollection = new StandardVariantContextInputArgumentCollection();
|
||||
|
||||
@Output(fullName="out1", shortName="o1", doc="File #1 to which variants should be written", required=true)
|
||||
protected VCFWriter vcfWriter1 = null;
|
||||
protected VariantContextWriter vcfWriter1 = null;
|
||||
|
||||
@Output(fullName="out2", shortName="o2", doc="File #2 to which variants should be written", required=true)
|
||||
// there's a reported bug in the GATK where we can't have 2 @Output writers
|
||||
protected File file2 = null;
|
||||
protected StandardVCFWriter vcfWriter2 = null;
|
||||
protected VariantContextWriter vcfWriter2 = null;
|
||||
|
||||
@Argument(fullName="fractionToOut1", shortName="fraction", doc="Fraction of records to be placed in out1 (must be 0 >= fraction <= 1); all other records are placed in out2", required=false)
|
||||
protected double fraction = 0.5;
|
||||
|
|
@ -74,7 +78,7 @@ public class RandomlySplitVariants extends RodWalker<Integer, Integer> {
|
|||
hInfo.addAll(VCFUtils.getHeaderFields(getToolkit(), inputNames));
|
||||
|
||||
vcfWriter1.writeHeader(new VCFHeader(hInfo, samples));
|
||||
vcfWriter2 = new StandardVCFWriter(file2, getMasterSequenceDictionary(), true);
|
||||
vcfWriter2 = VariantContextWriterFactory.create(file2, getMasterSequenceDictionary());
|
||||
vcfWriter2.writeHeader(new VCFHeader(hInfo, samples));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import org.broadinstitute.sting.utils.SampleUtils;
|
|||
import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLine;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.VCFWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||
import org.broadinstitute.sting.utils.text.ListFileUtils;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
|
||||
|
|
@ -105,7 +105,7 @@ public class SelectHeaders extends RodWalker<Integer, Integer> implements TreeRe
|
|||
protected StandardVariantContextInputArgumentCollection variantCollection = new StandardVariantContextInputArgumentCollection();
|
||||
|
||||
@Output(doc = "File to which variants should be written", required = true)
|
||||
protected VCFWriter vcfWriter;
|
||||
protected VariantContextWriter vcfWriter;
|
||||
|
||||
@Argument(fullName = "header_name", shortName = "hn", doc = "Include header. Can be specified multiple times", required = false)
|
||||
public Set<String> headerNames;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ import org.broadinstitute.sting.gatk.walkers.genotyper.UnifiedGenotyperEngine;
|
|||
import org.broadinstitute.sting.utils.MendelianViolation;
|
||||
import org.broadinstitute.sting.utils.SampleUtils;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.*;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.VCFWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
import org.broadinstitute.sting.utils.text.XReadLines;
|
||||
import org.broadinstitute.sting.utils.variantcontext.*;
|
||||
|
|
@ -204,7 +204,7 @@ public class SelectVariants extends RodWalker<Integer, Integer> implements TreeR
|
|||
protected RodBinding<VariantContext> concordanceTrack;
|
||||
|
||||
@Output(doc="File to which variants should be written",required=true)
|
||||
protected VCFWriter vcfWriter = null;
|
||||
protected VariantContextWriter vcfWriter = null;
|
||||
|
||||
@Argument(fullName="sample_name", shortName="sn", doc="Include genotypes from this sample. Can be specified multiple times", required=false)
|
||||
public Set<String> sampleNames = new HashSet<String>(0);
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import org.broadinstitute.sting.gatk.walkers.*;
|
|||
import org.broadinstitute.sting.utils.QualityUtils;
|
||||
import org.broadinstitute.sting.utils.SampleUtils;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.*;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.VCFWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Allele;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContextBuilder;
|
||||
|
|
@ -88,7 +88,7 @@ public class VariantValidationAssessor extends RodWalker<VariantContext,Integer>
|
|||
protected StandardVariantContextInputArgumentCollection variantCollection = new StandardVariantContextInputArgumentCollection();
|
||||
|
||||
@Output(doc="File to which variants should be written",required=true)
|
||||
protected VCFWriter vcfwriter = null;
|
||||
protected VariantContextWriter vcfwriter = null;
|
||||
|
||||
@Argument(fullName="maxHardy", doc="Maximum phred-scaled Hardy-Weinberg violation pvalue to consider an assay valid", required=false)
|
||||
protected double maxHardy = 20.0;
|
||||
|
|
|
|||
|
|
@ -35,16 +35,18 @@ import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
|||
import org.broadinstitute.sting.gatk.refdata.VariantContextAdaptors;
|
||||
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrackBuilder;
|
||||
import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
|
||||
import org.broadinstitute.sting.gatk.walkers.*;
|
||||
import org.broadinstitute.sting.gatk.walkers.Reference;
|
||||
import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
||||
import org.broadinstitute.sting.gatk.walkers.Window;
|
||||
import org.broadinstitute.sting.utils.BaseUtils;
|
||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.SampleUtils;
|
||||
import org.broadinstitute.sting.utils.codecs.hapmap.RawHapMapFeature;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.*;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.SortingVCFWriter;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.VCFWriter;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
import org.broadinstitute.sting.utils.variantcontext.*;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriterFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
|
@ -80,8 +82,8 @@ import java.util.*;
|
|||
public class VariantsToVCF extends RodWalker<Integer, Integer> {
|
||||
|
||||
@Output(doc="File to which variants should be written",required=true)
|
||||
protected VCFWriter baseWriter = null;
|
||||
private SortingVCFWriter vcfwriter; // needed because hapmap/dbsnp indel records move
|
||||
protected VariantContextWriter baseWriter = null;
|
||||
private VariantContextWriter vcfwriter; // needed because hapmap/dbsnp indel records move
|
||||
|
||||
/**
|
||||
* Variants from this input file are used by this tool as input.
|
||||
|
|
@ -111,7 +113,7 @@ public class VariantsToVCF extends RodWalker<Integer, Integer> {
|
|||
CloseableIterator<GATKFeature> dbsnpIterator = null;
|
||||
|
||||
public void initialize() {
|
||||
vcfwriter = new SortingVCFWriter(baseWriter, 40, false);
|
||||
vcfwriter = VariantContextWriterFactory.sortOnTheFly(baseWriter, 40, false);
|
||||
}
|
||||
|
||||
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ import net.sf.samtools.SAMFileWriter;
|
|||
import org.broad.tribble.Tribble;
|
||||
import org.broadinstitute.sting.commandline.*;
|
||||
import org.broadinstitute.sting.gatk.io.stubs.SAMFileWriterArgumentTypeDescriptor;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.VCFWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.annotation.Annotation;
|
||||
|
|
@ -157,7 +157,7 @@ public abstract class ArgumentDefinitionField extends ArgumentField {
|
|||
gatherClass = gatherer.getName();
|
||||
else if (SAMFileWriter.class.isAssignableFrom(argumentDefinition.argumentType))
|
||||
gatherClass = "BamGatherFunction";
|
||||
else if (VCFWriter.class.isAssignableFrom(argumentDefinition.argumentType))
|
||||
else if (VariantContextWriter.class.isAssignableFrom(argumentDefinition.argumentType))
|
||||
gatherClass = "VcfGatherFunction";
|
||||
else
|
||||
gatherClass = "org.broadinstitute.sting.queue.function.scattergather.SimpleTextGatherFunction";
|
||||
|
|
@ -168,7 +168,7 @@ public abstract class ArgumentDefinitionField extends ArgumentField {
|
|||
fields.add(new SAMFileWriterIndexArgumentField(argumentDefinition));
|
||||
fields.add(new SAMFileWriterMD5ArgumentField(argumentDefinition));
|
||||
}
|
||||
else if (VCFWriter.class.isAssignableFrom(argumentDefinition.argumentType)) {
|
||||
else if (VariantContextWriter.class.isAssignableFrom(argumentDefinition.argumentType)) {
|
||||
fields.add(new VCFWriterIndexArgumentField(argumentDefinition));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ import net.sf.samtools.SAMFileWriter;
|
|||
import org.apache.commons.lang.StringEscapeUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.broadinstitute.sting.gatk.filters.PlatformUnitFilterHelper;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.VCFWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
|
|
@ -241,7 +241,7 @@ public abstract class ArgumentField {
|
|||
if (InputStream.class.isAssignableFrom(clazz)) return File.class;
|
||||
if (SAMFileReader.class.isAssignableFrom(clazz)) return File.class;
|
||||
if (OutputStream.class.isAssignableFrom(clazz)) return File.class;
|
||||
if (VCFWriter.class.isAssignableFrom(clazz)) return File.class;
|
||||
if (VariantContextWriter.class.isAssignableFrom(clazz)) return File.class;
|
||||
if (SAMFileWriter.class.isAssignableFrom(clazz)) return File.class;
|
||||
if (PlatformUnitFilterHelper.class.isAssignableFrom(clazz)) return String.class;
|
||||
return clazz;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
|||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
||||
import org.broadinstitute.sting.utils.codecs.bcf2.writer.BCF2Writer;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.BCF2Writer;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
|
|
@ -76,8 +76,7 @@ public class BCF2TestWalker extends RodWalker<Integer, Integer> {
|
|||
final Map<String, VCFHeader> vcfRods = VCFUtils.getVCFHeadersFromRods(getToolkit(), Collections.singletonList(variants));
|
||||
final VCFHeader header = VCFUtils.withUpdatedContigs(vcfRods.values().iterator().next(), getToolkit());
|
||||
try {
|
||||
writer = new BCF2Writer("out", bcfFile, new FileOutputStream(bcfFile),
|
||||
getToolkit().getMasterSequenceDictionary(), ! dontIndexOnTheFly );
|
||||
writer = new BCF2Writer(bcfFile, new FileOutputStream(bcfFile), getToolkit().getMasterSequenceDictionary(), ! dontIndexOnTheFly, false );
|
||||
writer.writeHeader(header);
|
||||
} catch ( FileNotFoundException e ) {
|
||||
throw new UserException.CouldNotCreateOutputFile(bcfFile, e);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.broadinstitute.sting.utils.codecs.bcf2.writer;
|
||||
package org.broadinstitute.sting.utils.variantcontext.writer;
|
||||
|
||||
import net.sf.samtools.SAMSequenceDictionary;
|
||||
import org.apache.log4j.Logger;
|
||||
|
|
@ -30,8 +30,6 @@ import org.broadinstitute.sting.utils.codecs.bcf2.BCF2Encoder;
|
|||
import org.broadinstitute.sting.utils.codecs.bcf2.BCF2Type;
|
||||
import org.broadinstitute.sting.utils.codecs.bcf2.BCF2Utils;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.*;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.IndexingVCFWriter;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.StandardVCFWriter;
|
||||
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Allele;
|
||||
|
|
@ -42,19 +40,21 @@ import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
|||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
public class BCF2Writer extends IndexingVCFWriter {
|
||||
public class BCF2Writer extends IndexingVariantContextWriter {
|
||||
final protected static Logger logger = Logger.getLogger(BCF2Writer.class);
|
||||
private final static boolean doNotWriteGenotypes = false;
|
||||
private OutputStream outputStream; // Note: do not flush until completely done writing, to avoid issues with eventual BGZF support
|
||||
|
||||
private final OutputStream outputStream; // Note: do not flush until completely done writing, to avoid issues with eventual BGZF support
|
||||
private VCFHeader header;
|
||||
private Map<String, Integer> contigDictionary = new HashMap<String, Integer>();
|
||||
private Map<String, Integer> stringDictionaryMap = new LinkedHashMap<String, Integer>();
|
||||
private final Map<String, Integer> contigDictionary = new HashMap<String, Integer>();
|
||||
private final Map<String, Integer> stringDictionaryMap = new LinkedHashMap<String, Integer>();
|
||||
private final boolean doNotWriteGenotypes;
|
||||
|
||||
private final BCF2Encoder encoder = new BCF2Encoder(); // initialized after the header arrives
|
||||
|
||||
public BCF2Writer(final String name, final File location, final OutputStream output, final SAMSequenceDictionary refDict, final boolean enableOnTheFlyIndexing) {
|
||||
super(name, location, output, refDict, enableOnTheFlyIndexing);
|
||||
public BCF2Writer(final File location, final OutputStream output, final SAMSequenceDictionary refDict, final boolean enableOnTheFlyIndexing, final boolean doNotWriteGenotypes) {
|
||||
super(writerName(location, output), location, output, refDict, enableOnTheFlyIndexing);
|
||||
this.outputStream = getOutputStream();
|
||||
this.doNotWriteGenotypes = doNotWriteGenotypes;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
|
|
@ -81,7 +81,7 @@ public class BCF2Writer extends IndexingVCFWriter {
|
|||
// write out the header into a byte stream, get it's length, and write everything to the file
|
||||
final ByteArrayOutputStream capture = new ByteArrayOutputStream();
|
||||
final OutputStreamWriter writer = new OutputStreamWriter(capture);
|
||||
StandardVCFWriter.writeHeader(header, writer, doNotWriteGenotypes, StandardVCFWriter.getVersionLine(), "BCF2 stream");
|
||||
VCFWriter.writeHeader(header, writer, doNotWriteGenotypes, VCFWriter.getVersionLine(), "BCF2 stream");
|
||||
writer.append('\0'); // the header is null terminated by a byte
|
||||
writer.close();
|
||||
|
||||
|
|
@ -158,7 +158,7 @@ public class BCF2Writer extends IndexingVCFWriter {
|
|||
// info fields
|
||||
final int nAlleles = vc.getNAlleles();
|
||||
final int nInfo = vc.getAttributes().size();
|
||||
final int nGenotypeFormatFields = StandardVCFWriter.calcVCFGenotypeKeys(vc).size();
|
||||
final int nGenotypeFormatFields = VCFWriter.calcVCFGenotypeKeys(vc).size();
|
||||
final int nSamples = vc.getNSamples();
|
||||
|
||||
encoder.encodeRawInt((nAlleles << 16) | (nInfo & 0x00FF), BCF2Type.INT32);
|
||||
|
|
@ -212,7 +212,7 @@ public class BCF2Writer extends IndexingVCFWriter {
|
|||
|
||||
private byte[] buildSamplesData(final VariantContext vc) throws IOException {
|
||||
// write size
|
||||
List<String> genotypeFields = StandardVCFWriter.calcVCFGenotypeKeys(vc);
|
||||
List<String> genotypeFields = VCFWriter.calcVCFGenotypeKeys(vc);
|
||||
for ( final String field : genotypeFields ) {
|
||||
if ( field.equals(VCFConstants.GENOTYPE_KEY) ) {
|
||||
addGenotypes(vc);
|
||||
|
|
@ -332,7 +332,7 @@ public class BCF2Writer extends IndexingVCFWriter {
|
|||
"with > 127 alleles, but you have " + vc.getNAlleles() + " at "
|
||||
+ vc.getChr() + ":" + vc.getStart());
|
||||
|
||||
final Map<Allele, String> alleleMap = StandardVCFWriter.buildAlleleMap(vc);
|
||||
final Map<Allele, String> alleleMap = VCFWriter.buildAlleleMap(vc);
|
||||
final int requiredPloidy = 2; // TODO -- handle ploidy, will need padding / depadding
|
||||
startGenotypeField(VCFConstants.GENOTYPE_KEY, requiredPloidy, BCF2Type.INT8);
|
||||
for ( final Genotype g : vc.getGenotypes() ) {
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.broadinstitute.sting.utils.codecs.vcf.writer;
|
||||
package org.broadinstitute.sting.utils.variantcontext.writer;
|
||||
|
||||
import com.google.java.contract.Ensures;
|
||||
import com.google.java.contract.Requires;
|
||||
|
|
@ -43,7 +43,7 @@ import java.io.*;
|
|||
/**
|
||||
* this class writes VCF files
|
||||
*/
|
||||
public abstract class IndexingVCFWriter implements VCFWriter {
|
||||
public abstract class IndexingVariantContextWriter implements VariantContextWriter {
|
||||
private final String name;
|
||||
private final SAMSequenceDictionary refDict;
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ public abstract class IndexingVCFWriter implements VCFWriter {
|
|||
@Requires({"name != null",
|
||||
"! ( location == null && output == null )",
|
||||
"! ( enableOnTheFlyIndexing && location == null )"})
|
||||
protected IndexingVCFWriter(final String name, final File location, final OutputStream output, final SAMSequenceDictionary refDict, final boolean enableOnTheFlyIndexing) {
|
||||
protected IndexingVariantContextWriter(final String name, final File location, final OutputStream output, final SAMSequenceDictionary refDict, final boolean enableOnTheFlyIndexing) {
|
||||
outputStream = output;
|
||||
this.name = name;
|
||||
this.refDict = refDict;
|
||||
|
|
@ -127,19 +127,6 @@ public abstract class IndexingVCFWriter implements VCFWriter {
|
|||
protected static final String writerName(final File location, final OutputStream stream) {
|
||||
return location == null ? stream.toString() : location.getAbsolutePath();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a output stream writing to location, or throws a UserException if this fails
|
||||
* @param location
|
||||
* @return
|
||||
*/
|
||||
protected static OutputStream openOutputStream(final File location) {
|
||||
try {
|
||||
return new FileOutputStream(location);
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new UserException.CouldNotCreateOutputFile(location, "Unable to create VCF writer", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final class PositionalOutputStream extends OutputStream {
|
||||
|
|
@ -23,14 +23,14 @@
|
|||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.broadinstitute.sting.utils.codecs.vcf.writer;
|
||||
package org.broadinstitute.sting.utils.variantcontext.writer;
|
||||
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
|
||||
/**
|
||||
* this class writes VCF files, allowing records to be passed in unsorted (up to a certain genomic distance away)
|
||||
*/
|
||||
public class SortingVCFWriter extends SortingVCFWriterBase {
|
||||
public class SortingVariantContextWriter extends SortingVariantContextWriterBase {
|
||||
|
||||
// the maximum START distance between records that we'll cache
|
||||
private int maxCachingStartDistance;
|
||||
|
|
@ -42,12 +42,12 @@ public class SortingVCFWriter extends SortingVCFWriterBase {
|
|||
* @param maxCachingStartDistance the maximum start distance between records that we'll cache
|
||||
* @param takeOwnershipOfInner Should this Writer close innerWriter when it's done with it
|
||||
*/
|
||||
public SortingVCFWriter(VCFWriter innerWriter, int maxCachingStartDistance, boolean takeOwnershipOfInner) {
|
||||
public SortingVariantContextWriter(VariantContextWriter innerWriter, int maxCachingStartDistance, boolean takeOwnershipOfInner) {
|
||||
super(innerWriter, takeOwnershipOfInner);
|
||||
this.maxCachingStartDistance = maxCachingStartDistance;
|
||||
}
|
||||
|
||||
public SortingVCFWriter(VCFWriter innerWriter, int maxCachingStartDistance) {
|
||||
public SortingVariantContextWriter(VariantContextWriter innerWriter, int maxCachingStartDistance) {
|
||||
this(innerWriter, maxCachingStartDistance, false); // by default, don't own inner
|
||||
}
|
||||
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.broadinstitute.sting.utils.codecs.vcf.writer;
|
||||
package org.broadinstitute.sting.utils.variantcontext.writer;
|
||||
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
|
|
@ -35,10 +35,10 @@ import java.util.concurrent.PriorityBlockingQueue;
|
|||
* This class writes VCF files, allowing records to be passed in unsorted.
|
||||
* It also enforces that it is never passed records of the same chromosome with any other chromosome in between them.
|
||||
*/
|
||||
public abstract class SortingVCFWriterBase implements VCFWriter {
|
||||
public abstract class SortingVariantContextWriterBase implements VariantContextWriter {
|
||||
|
||||
// The VCFWriter to which to actually write the sorted VCF records
|
||||
private final VCFWriter innerWriter;
|
||||
private final VariantContextWriter innerWriter;
|
||||
|
||||
// the current queue of un-emitted records
|
||||
private final Queue<VCFRecord> queue;
|
||||
|
|
@ -65,7 +65,7 @@ public abstract class SortingVCFWriterBase implements VCFWriter {
|
|||
* @param innerWriter the VCFWriter to write to
|
||||
* @param takeOwnershipOfInner Should this Writer close innerWriter when it's done with it
|
||||
*/
|
||||
public SortingVCFWriterBase(VCFWriter innerWriter, boolean takeOwnershipOfInner) {
|
||||
public SortingVariantContextWriterBase(VariantContextWriter innerWriter, boolean takeOwnershipOfInner) {
|
||||
this.innerWriter = innerWriter;
|
||||
this.finishedChromosomes = new TreeSet<String>();
|
||||
this.takeOwnershipOfInner = takeOwnershipOfInner;
|
||||
|
|
@ -77,7 +77,7 @@ public abstract class SortingVCFWriterBase implements VCFWriter {
|
|||
this.mostUpstreamWritableLoc = BEFORE_MOST_UPSTREAM_LOC;
|
||||
}
|
||||
|
||||
public SortingVCFWriterBase(VCFWriter innerWriter) {
|
||||
public SortingVariantContextWriterBase(VariantContextWriter innerWriter) {
|
||||
this(innerWriter, false); // by default, don't own inner
|
||||
}
|
||||
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.broadinstitute.sting.utils.codecs.vcf.writer;
|
||||
package org.broadinstitute.sting.utils.variantcontext.writer;
|
||||
|
||||
import net.sf.samtools.SAMSequenceDictionary;
|
||||
import org.broad.tribble.TribbleException;
|
||||
|
|
@ -38,7 +38,7 @@ import java.util.*;
|
|||
/**
|
||||
* this class writes VCF files
|
||||
*/
|
||||
public class StandardVCFWriter extends IndexingVCFWriter {
|
||||
public class VCFWriter extends IndexingVariantContextWriter {
|
||||
private final static String VERSION_LINE = VCFHeader.METADATA_INDICATOR + VCFHeaderVersion.VCF4_1.getFormatString() + "=" + VCFHeaderVersion.VCF4_1.getVersionString();
|
||||
|
||||
// the print stream we're writing to
|
||||
|
|
@ -53,30 +53,30 @@ public class StandardVCFWriter extends IndexingVCFWriter {
|
|||
// were filters applied?
|
||||
protected boolean filtersWereAppliedToContext = false;
|
||||
|
||||
/**
|
||||
* create a VCF writer, given a file to write to
|
||||
*
|
||||
* @param location the file location to write to
|
||||
*/
|
||||
public StandardVCFWriter(final File location, final SAMSequenceDictionary refDict) {
|
||||
this(location, openOutputStream(location), refDict, true, false);
|
||||
}
|
||||
// /**
|
||||
// * create a VCF writer, given a file to write to
|
||||
// *
|
||||
// * @param location the file location to write to
|
||||
// */
|
||||
// public StandardVCFWriter(final File location, final SAMSequenceDictionary refDict) {
|
||||
// this(location, openOutputStream(location), refDict, true, false);
|
||||
// }
|
||||
//
|
||||
// public StandardVCFWriter(File location, final SAMSequenceDictionary refDict, boolean enableOnTheFlyIndexing) {
|
||||
// this(location, openOutputStream(location), refDict, enableOnTheFlyIndexing, false);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * create a VCF writer, given a stream to write to
|
||||
// *
|
||||
// * @param output the file location to write to
|
||||
// * @param doNotWriteGenotypes do not write genotypes
|
||||
// */
|
||||
// public StandardVCFWriter(final OutputStream output, final SAMSequenceDictionary refDict, final boolean doNotWriteGenotypes) {
|
||||
// this(null, output, refDict, false, doNotWriteGenotypes);
|
||||
// }
|
||||
|
||||
public StandardVCFWriter(File location, final SAMSequenceDictionary refDict, boolean enableOnTheFlyIndexing) {
|
||||
this(location, openOutputStream(location), refDict, enableOnTheFlyIndexing, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* create a VCF writer, given a stream to write to
|
||||
*
|
||||
* @param output the file location to write to
|
||||
* @param doNotWriteGenotypes do not write genotypes
|
||||
*/
|
||||
public StandardVCFWriter(final OutputStream output, final SAMSequenceDictionary refDict, final boolean doNotWriteGenotypes) {
|
||||
this(null, output, refDict, false, doNotWriteGenotypes);
|
||||
}
|
||||
|
||||
public StandardVCFWriter(final File location, final OutputStream output, final SAMSequenceDictionary refDict, final boolean enableOnTheFlyIndexing, boolean doNotWriteGenotypes) {
|
||||
public VCFWriter(final File location, final OutputStream output, final SAMSequenceDictionary refDict, final boolean enableOnTheFlyIndexing, boolean doNotWriteGenotypes) {
|
||||
super(writerName(location, output), location, output, refDict, enableOnTheFlyIndexing);
|
||||
mWriter = new BufferedWriter(new OutputStreamWriter(getOutputStream())); // todo -- fix buffer size
|
||||
this.doNotWriteGenotypes = doNotWriteGenotypes;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.broadinstitute.sting.utils.codecs.vcf.writer;
|
||||
package org.broadinstitute.sting.utils.variantcontext.writer;
|
||||
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
|
|
@ -6,7 +6,7 @@ import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
|||
/**
|
||||
* this class writes VCF files
|
||||
*/
|
||||
public interface VCFWriter {
|
||||
public interface VariantContextWriter {
|
||||
|
||||
public void writeHeader(VCFHeader header);
|
||||
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
* Copyright (c) 2012, The Broad Institute
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.broadinstitute.sting.utils.variantcontext.writer;
|
||||
|
||||
import net.sf.samtools.SAMSequenceDictionary;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.EnumSet;
|
||||
|
||||
/**
|
||||
* Factory methods to create VariantContext writers
|
||||
*
|
||||
* @author depristo
|
||||
* @since 5/12
|
||||
*/
|
||||
public class VariantContextWriterFactory {
|
||||
public enum Options {
|
||||
ENABLE_ON_THE_FLY_INDEX,
|
||||
DO_NOT_WRITE_GENOTYPES,
|
||||
FORCE_BCF
|
||||
}
|
||||
|
||||
public static final EnumSet<Options> DEFAULT_OPTIONS = EnumSet.of(Options.ENABLE_ON_THE_FLY_INDEX);
|
||||
public static final EnumSet<Options> NO_OPTIONS = EnumSet.noneOf(Options.class);
|
||||
|
||||
private VariantContextWriterFactory() {}
|
||||
|
||||
public static VariantContextWriter create(final File location, final SAMSequenceDictionary refDict) {
|
||||
return create(location, openOutputStream(location), refDict, DEFAULT_OPTIONS);
|
||||
}
|
||||
|
||||
public static VariantContextWriter create(final File location, final SAMSequenceDictionary refDict, final EnumSet<Options> options) {
|
||||
return create(location, openOutputStream(location), refDict, options);
|
||||
}
|
||||
|
||||
public static VariantContextWriter create(final File location,
|
||||
final OutputStream output,
|
||||
final SAMSequenceDictionary refDict) {
|
||||
return create(location, output, refDict, DEFAULT_OPTIONS);
|
||||
}
|
||||
|
||||
public static VariantContextWriter create(final OutputStream output,
|
||||
final SAMSequenceDictionary refDict,
|
||||
final EnumSet<Options> options) {
|
||||
return create(null, output, refDict, options);
|
||||
}
|
||||
|
||||
public static VariantContextWriter create(final File location,
|
||||
final OutputStream output,
|
||||
final SAMSequenceDictionary refDict,
|
||||
final EnumSet<Options> options) {
|
||||
final boolean enableBCF = options.contains(Options.FORCE_BCF) || (location != null && location.getName().contains(".bcf"));
|
||||
|
||||
if ( enableBCF )
|
||||
return new BCF2Writer(location, output, refDict,
|
||||
options.contains(Options.ENABLE_ON_THE_FLY_INDEX),
|
||||
options.contains(Options.DO_NOT_WRITE_GENOTYPES));
|
||||
else {
|
||||
return new VCFWriter(location, output, refDict,
|
||||
options.contains(Options.ENABLE_ON_THE_FLY_INDEX),
|
||||
options.contains(Options.DO_NOT_WRITE_GENOTYPES));
|
||||
}
|
||||
}
|
||||
|
||||
public static VariantContextWriter sortOnTheFly(final VariantContextWriter innerWriter, int maxCachingStartDistance) {
|
||||
return sortOnTheFly(innerWriter, maxCachingStartDistance, false);
|
||||
}
|
||||
|
||||
public static VariantContextWriter sortOnTheFly(final VariantContextWriter innerWriter, int maxCachingStartDistance, boolean takeOwnershipOfInner) {
|
||||
return new SortingVariantContextWriter(innerWriter, maxCachingStartDistance, takeOwnershipOfInner);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a output stream writing to location, or throws a UserException if this fails
|
||||
* @param location
|
||||
* @return
|
||||
*/
|
||||
protected static OutputStream openOutputStream(final File location) {
|
||||
try {
|
||||
return new FileOutputStream(location);
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new UserException.CouldNotCreateOutputFile(location, "Unable to create VCF writer", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,21 +4,21 @@ import net.sf.samtools.SAMSequenceDictionary;
|
|||
import org.broad.tribble.AbstractFeatureReader;
|
||||
import org.broad.tribble.CloseableTribbleIterator;
|
||||
import org.broad.tribble.Tribble;
|
||||
import org.broad.tribble.index.*;
|
||||
import org.broad.tribble.index.Index;
|
||||
import org.broad.tribble.index.IndexFactory;
|
||||
import org.broadinstitute.sting.BaseTest;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.StandardVCFWriter;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.VCFWriter;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
import org.broadinstitute.sting.utils.fasta.CachingIndexedFastaSequenceFile;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
import org.testng.Assert;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriterFactory;
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* tests out the various functions in the index factory class
|
||||
|
|
@ -56,7 +56,7 @@ public class IndexFactoryUnitTest extends BaseTest {
|
|||
AbstractFeatureReader<VariantContext> source = AbstractFeatureReader.getFeatureReader(inputFile.getAbsolutePath(), new VCFCodec(), indexFromInputFile);
|
||||
|
||||
int counter = 0;
|
||||
VCFWriter writer = new StandardVCFWriter(outputFile, dict);
|
||||
VariantContextWriter writer = VariantContextWriterFactory.create(outputFile, dict);
|
||||
writer.writeHeader((VCFHeader)source.getHeader());
|
||||
CloseableTribbleIterator<VariantContext> it = source.iterator();
|
||||
while (it.hasNext() && (counter++ < maxRecords || maxRecords == -1) ) {
|
||||
|
|
|
|||
|
|
@ -1,30 +1,31 @@
|
|||
package org.broadinstitute.sting.utils.genotype.vcf;
|
||||
|
||||
import net.sf.picard.reference.IndexedFastaSequenceFile;
|
||||
import org.broad.tribble.AbstractFeatureReader;
|
||||
import org.broad.tribble.FeatureReader;
|
||||
import org.broad.tribble.Tribble;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.StandardVCFWriter;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.writer.VCFWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.*;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.*;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
import org.testng.Assert;
|
||||
import org.broadinstitute.sting.BaseTest;
|
||||
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
|
||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFCodec;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLine;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderVersion;
|
||||
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
import org.broadinstitute.sting.utils.fasta.CachingIndexedFastaSequenceFile;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
import org.broadinstitute.sting.utils.variantcontext.*;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriterFactory;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
import net.sf.picard.reference.IndexedFastaSequenceFile;
|
||||
|
||||
|
||||
/**
|
||||
* @author aaron
|
||||
|
|
@ -56,7 +57,7 @@ public class VCFWriterUnitTest extends BaseTest {
|
|||
@Test
|
||||
public void testBasicWriteAndRead() {
|
||||
VCFHeader header = createFakeHeader(metaData,additionalColumns);
|
||||
VCFWriter writer = new StandardVCFWriter(fakeVCFFile, seq.getSequenceDictionary());
|
||||
VariantContextWriter writer = VariantContextWriterFactory.create(fakeVCFFile, seq.getSequenceDictionary());
|
||||
writer.writeHeader(header);
|
||||
writer.add(createVC(header));
|
||||
writer.add(createVC(header));
|
||||
|
|
|
|||
|
|
@ -50,10 +50,11 @@ public class VCFJarClassLoadingUnitTest {
|
|||
|
||||
ClassLoader classLoader = new URLClassLoader(jarURLs, null);
|
||||
classLoader.loadClass("org.broadinstitute.sting.utils.variantcontext.VariantContext");
|
||||
classLoader.loadClass("org.broadinstitute.sting.utils.codecs.bcf.BCF2Codec");
|
||||
classLoader.loadClass("org.broadinstitute.sting.utils.codecs.vcf.VCFCodec");
|
||||
classLoader.loadClass("org.broadinstitute.sting.utils.codecs.vcf.VCF3Codec");
|
||||
classLoader.loadClass("org.broadinstitute.sting.utils.codecs.vcf.VCFWriter");
|
||||
classLoader.loadClass("org.broadinstitute.sting.utils.codecs.vcf.writer.StandardVCFWriter");
|
||||
classLoader.loadClass("org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter");
|
||||
classLoader.loadClass("org.broadinstitute.sting.utils.variantcontext.writer.VCFWriter");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue