Bugfixes for VCFWriterUnitTest and TestProvider to deal with stricter VCFWriter behavior

This commit is contained in:
Mark DePristo 2012-06-15 15:14:36 -04:00
parent 9c81f45c9f
commit d015a5738d
3 changed files with 9 additions and 4 deletions

View File

@ -10,6 +10,7 @@ import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.utils.exceptions.UserException;
import org.broadinstitute.sting.utils.fasta.CachingIndexedFastaSequenceFile;
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.utils.variantcontext.writer.Options;
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriterFactory;
import org.testng.annotations.BeforeTest;
@ -19,6 +20,7 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;
import java.util.EnumSet;
/**
* tests out the various functions in the index factory class
@ -56,7 +58,8 @@ public class IndexFactoryUnitTest extends BaseTest {
AbstractFeatureReader<VariantContext> source = AbstractFeatureReader.getFeatureReader(inputFile.getAbsolutePath(), new VCFCodec(), indexFromInputFile);
int counter = 0;
VariantContextWriter writer = VariantContextWriterFactory.create(outputFile, dict);
final EnumSet<Options> options = EnumSet.of(Options.ALLOW_MISSING_FIELDS_IN_HEADER);
VariantContextWriter writer = VariantContextWriterFactory.create(outputFile, dict, options);
writer.writeHeader((VCFHeader)source.getHeader());
CloseableTribbleIterator<VariantContext> it = source.iterator();
while (it.hasNext() && (counter++ < maxRecords || maxRecords == -1) ) {

View File

@ -147,7 +147,8 @@ public class VariantContextTestProvider {
logger.warn("Reading records from " + file);
for ( final VariantContext raw : x.getSecond() ) {
fullyDecoded.add(raw.fullyDecode(x.getFirst()));
if ( raw != null )
fullyDecoded.add(raw.fullyDecode(x.getFirst()));
}
logger.warn("Done reading " + file);
@ -328,7 +329,7 @@ public class VariantContextTestProvider {
addGenotypeTests(site, homRef, het, homVar);
// test no GT at all
addGenotypeTests(site);
addGenotypeTests(site, new GenotypeBuilder("noGT", new ArrayList<Allele>(0)).attribute("INT1", 10).make());
final List<Allele> noCall = Arrays.asList(Allele.NO_CALL, Allele.NO_CALL);

View File

@ -83,7 +83,8 @@ public class VCFWriterUnitTest extends BaseTest {
@Test
public void testBasicWriteAndRead() {
VCFHeader header = createFakeHeader(metaData,additionalColumns);
VariantContextWriter writer = VariantContextWriterFactory.create(fakeVCFFile, seq.getSequenceDictionary());
final EnumSet<Options> options = EnumSet.of(Options.ALLOW_MISSING_FIELDS_IN_HEADER);
VariantContextWriter writer = VariantContextWriterFactory.create(fakeVCFFile, seq.getSequenceDictionary(), options);
writer.writeHeader(header);
writer.add(createVC(header));
writer.add(createVC(header));