本文整理汇总了Java中htsjdk.variant.variantcontext.writer.Options类的典型用法代码示例。如果您正苦于以下问题:Java Options类的具体用法?Java Options怎么用?Java Options使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Options类属于htsjdk.variant.variantcontext.writer包,在下文中一共展示了Options类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createVCFWriter
import htsjdk.variant.variantcontext.writer.Options; //导入依赖的package包/类
public static VariantContextWriter createVCFWriter(final File outFile,VCFHeader header) {
Utils.nonNull(outFile);
VariantContextWriterBuilder vcWriterBuilder = new VariantContextWriterBuilder().clearOptions()
.setOutputFile(outFile);
if (lenientVCFProcessing) {
vcWriterBuilder = vcWriterBuilder.setOption(Options.ALLOW_MISSING_FIELDS_IN_HEADER);
}
if (createOutputVariantIndex && null != header) {
vcWriterBuilder = vcWriterBuilder.setOption(Options.INDEX_ON_THE_FLY);
}
if (createOutputVariantMD5) {
vcWriterBuilder.setCreateMD5();
}
if (null != header) {
vcWriterBuilder = vcWriterBuilder.setReferenceDictionary(header.getSequenceDictionary());
}
return vcWriterBuilder.build();
}
开发者ID:BGI-flexlab,项目名称:SOAPgaea,代码行数:24,代码来源:VariantRecalibrator.java
示例2: vcfHeaderToStrings
import htsjdk.variant.variantcontext.writer.Options; //导入依赖的package包/类
public static List<String> vcfHeaderToStrings(VCFHeader header) {
File fakeVCFFile;
List<String> str= new ArrayList<String>();
try {
fakeVCFFile = Utils.createTempFile(".vcfheader", ".vcf");
fakeVCFFile.deleteOnExit();
final VariantContextWriter writer = new VariantContextWriterBuilder()
.setOutputFile(fakeVCFFile)
.setReferenceDictionary(header.getSequenceDictionary())
.setOptions(EnumSet.of(Options.ALLOW_MISSING_FIELDS_IN_HEADER, Options.WRITE_FULL_FORMAT_FIELD))
.build();
writer.writeHeader(header);
writer.close();
BufferedReader br= new BufferedReader(new FileReader(fakeVCFFile));
String line= br.readLine();
while(line != null){
str.add(line);
line= br.readLine();
}
br.close();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
开发者ID:dariober,项目名称:ASCIIGenome,代码行数:27,代码来源:Utils.java
示例3: encodeAll
import htsjdk.variant.variantcontext.writer.Options; //导入依赖的package包/类
@Override
public Map<String, Object> encodeAll(OutputStream outputStream, Iterator<? extends VCFVariant> features) throws IOException {
SAMSequenceDictionary seqDict = new SAMSequenceDictionary();
EnumSet<Options> options = VariantContextWriterFactory.DEFAULT_OPTIONS;
options.add(Options.ALLOW_MISSING_FIELDS_IN_HEADER);
options.remove(Options.INDEX_ON_THE_FLY);
VariantContextWriter writer = VariantContextWriterFactory.create(outputStream, seqDict, options);
writer.writeHeader(this.header);
while(features.hasNext()){
writer.add(features.next().getVariantContext());
}
return null;
}
开发者ID:hyounesy,项目名称:ALEA,代码行数:18,代码来源:VCFEncoder.java
示例4: getVariantContextWriter
import htsjdk.variant.variantcontext.writer.Options; //导入依赖的package包/类
/** Gets the variant context writer if the output VCF is to be written, otherwise empty. */
private Optional<VariantContextWriter> getVariantContextWriter(final VCFFileReader truthReader, final VCFFileReader callReader) {
if (OUTPUT_VCF) {
final File outputVcfFile = new File(OUTPUT + OUTPUT_VCF_FILE_EXTENSION);
final VariantContextWriterBuilder builder = new VariantContextWriterBuilder()
.setOutputFile(outputVcfFile)
.setReferenceDictionary(callReader.getFileHeader().getSequenceDictionary())
.setOption(Options.ALLOW_MISSING_FIELDS_IN_HEADER)
.setOption(Options.INDEX_ON_THE_FLY);
final VariantContextWriter writer = builder.build();
// create the output header
final List<String> sampleNames = Arrays.asList(OUTPUT_VCF_CALL_SAMPLE_NAME, OUTPUT_VCF_TRUTH_SAMPLE_NAME);
final Set<VCFHeaderLine> headerLines = new HashSet<>();
headerLines.addAll(callReader.getFileHeader().getMetaDataInInputOrder());
headerLines.addAll(truthReader.getFileHeader().getMetaDataInInputOrder());
headerLines.add(CONTINGENCY_STATE_HEADER_LINE);
writer.writeHeader(new VCFHeader(headerLines, sampleNames));
return Optional.of(writer);
}
else {
return Optional.empty();
}
}
开发者ID:broadinstitute,项目名称:picard,代码行数:25,代码来源:GenotypeConcordance.java
示例5: createTemporaryIndexedVcfFromInput
import htsjdk.variant.variantcontext.writer.Options; //导入依赖的package包/类
/**
* This method makes a copy of the input VCF and creates an index file for it in the same location.
* This is done so that we don't need to store the index file in the same repo
* The copy of the input is done so that it and its index are in the same directory which is typically required.
*
* @param vcfFile the vcf file to index
* @return File a vcf file (index file is created in same path).
*/
public static File createTemporaryIndexedVcfFromInput(final File vcfFile, final String tempFilePrefix) throws IOException {
final String extension;
if (vcfFile.getAbsolutePath().endsWith(".vcf")) extension = ".vcf";
else if (vcfFile.getAbsolutePath().endsWith(".vcf.gz")) extension = ".vcf.gz";
else
throw new IllegalArgumentException("couldn't find a .vcf or .vcf.gz ending for input file " + vcfFile.getAbsolutePath());
File output = createTemporaryIndexedVcfFile(tempFilePrefix, extension);
final VCFFileReader in = new VCFFileReader(vcfFile, false);
final VCFHeader header = in.getFileHeader();
final VariantContextWriter out = new VariantContextWriterBuilder().
setReferenceDictionary(header.getSequenceDictionary()).
setOptions(EnumSet.of(Options.INDEX_ON_THE_FLY)).
setOutputFile(output).build();
out.writeHeader(header);
for (final VariantContext ctx : in) {
out.add(ctx);
}
out.close();
in.close();
return output;
}
开发者ID:broadinstitute,项目名称:picard,代码行数:34,代码来源:VcfTestUtils.java
示例6: init
import htsjdk.variant.variantcontext.writer.Options; //导入依赖的package包/类
private void init(
OutputStream output, VCFHeader header, final boolean writeHeader)
throws IOException
{
final BCFStoppableOutputStream stopOut =
new BCFStoppableOutputStream(!writeHeader, output);
writer = new VariantContextWriterBuilder().clearOptions()
.setOption(Options.FORCE_BCF)
.setOutputBCFStream(stopOut).build();
writer.writeHeader(header);
stopOut.stopped = false;
setInputHeader(header);
}
开发者ID:HadoopGenomics,项目名称:Hadoop-BAM,代码行数:17,代码来源:BCFRecordWriter.java
示例7: createVCFWriter
import htsjdk.variant.variantcontext.writer.Options; //导入依赖的package包/类
/**
* Creates a VariantContextWriter whose outputFile type is determined by
* the outFile's extension, using the best available sequence dictionary for
* this tool, and default index, leniency and md5 generation settings.
*
* @param outFile output File for this writer. May not be null.
* @returns VariantContextWriter must be closed by the caller
*/
public VariantContextWriter createVCFWriter(final File outFile) {
Utils.nonNull(outFile);
final SAMSequenceDictionary sequenceDictionary = getBestAvailableSequenceDictionary();
List<Options> options = new ArrayList<>();
if (lenientVCFProcessing) {
options.add(Options.ALLOW_MISSING_FIELDS_IN_HEADER);
}
if (createOutputVariantIndex) {
if (null == sequenceDictionary) {
logger.warn("An variant index will not be created - a sequence dictionary is required to create an output index");
// fall through and create without an index
} else {
options.add(Options.INDEX_ON_THE_FLY);
}
}
return GATKVariantContextUtils.createVCFWriter(
outFile,
sequenceDictionary,
createOutputVariantMD5,
options.toArray(new Options[options.size()]));
}
开发者ID:broadinstitute,项目名称:gatk,代码行数:34,代码来源:GATKTool.java
示例8: makeVCFWriter
import htsjdk.variant.variantcontext.writer.Options; //导入依赖的package包/类
/**
* Create a VCF or GVCF writer as appropriate, given our arguments
*
* @param outputVCF location to which the vcf should be written
* @param readsDictionary sequence dictionary for the reads
* @return a VCF or GVCF writer as appropriate, ready to use
*/
public VariantContextWriter makeVCFWriter( final String outputVCF, final SAMSequenceDictionary readsDictionary,
final boolean createOutputVariantIndex, final boolean createOutputVariantMD5 ) {
Utils.nonNull(outputVCF);
Utils.nonNull(readsDictionary);
VariantContextWriter writer = GATKVariantContextUtils.createVCFWriter(
new File(outputVCF),
readsDictionary,
createOutputVariantMD5,
createOutputVariantIndex ?
new Options[]{Options.INDEX_ON_THE_FLY} :
new Options[0]
);
if ( hcArgs.emitReferenceConfidence == ReferenceConfidenceMode.GVCF ) {
try {
writer = new GVCFWriter(writer, hcArgs.GVCFGQBands, hcArgs.genotypeArgs.samplePloidy);
} catch ( IllegalArgumentException e ) {
throw new CommandLineException.BadArgumentValue("GQBands", "are malformed: " + e.getMessage());
}
}
return writer;
}
开发者ID:broadinstitute,项目名称:gatk,代码行数:32,代码来源:HaplotypeCallerEngine.java
示例9: getVariantContextWriter
import htsjdk.variant.variantcontext.writer.Options; //导入依赖的package包/类
private static VariantContextWriter getVariantContextWriter(final OutputStream outputStream,
final SAMSequenceDictionary referenceSequenceDictionary) {
VariantContextWriterBuilder vcWriterBuilder = new VariantContextWriterBuilder()
.clearOptions()
.setOutputStream(outputStream);
if (null != referenceSequenceDictionary) {
vcWriterBuilder = vcWriterBuilder.setReferenceDictionary(referenceSequenceDictionary);
}
// todo: remove this when things are solid?
vcWriterBuilder = vcWriterBuilder.setOption(Options.ALLOW_MISSING_FIELDS_IN_HEADER);
for (final Options opt : new Options[]{}) {
vcWriterBuilder = vcWriterBuilder.setOption(opt);
}
return vcWriterBuilder.build();
}
开发者ID:broadinstitute,项目名称:gatk,代码行数:18,代码来源:SVVCFWriter.java
示例10: testCreateVCFWriterLenientFalse
import htsjdk.variant.variantcontext.writer.Options; //导入依赖的package包/类
@Test(dataProvider = "createVCFWriterLenientData", expectedExceptions = IllegalStateException.class)
public void testCreateVCFWriterLenientFalse(
final String outputExtension,
final String indexExtension, // unused
final boolean createIndex,
final boolean createMD5) throws IOException {
final File tmpDir = createTempDir("createVCFTest");
final File outputFile = new File(tmpDir.getAbsolutePath(), "createVCFTest" + outputExtension);
Options options[] = createIndex ?
new Options[] {Options.INDEX_ON_THE_FLY} :
new Options[] {};
try (final VariantContextWriter vcw = GATKVariantContextUtils.createVCFWriter(
outputFile,
makeSimpleSequenceDictionary(),
createMD5,
options)) {
writeHeader(vcw);
writeBadVariant(vcw); // write a bad attribute and throw...
}
}
开发者ID:broadinstitute,项目名称:gatk,代码行数:23,代码来源:GATKVariantContextUtilsUnitTest.java
示例11: openVariantContextWriter
import htsjdk.variant.variantcontext.writer.Options; //导入依赖的package包/类
/**
* Return a new {@link VariantContextWriter} that uses the header from <code>reader</code> but has the header
* extended header through {@link #extendHeaderFields}.
*
* @param header
* the VCF header to use for the construction
* @param fileName
* path to output file
* @param additionalHeaderLines
* additional {@link VCFHeaderLine}s to add
* @param generateIndex
* whether or not to generate an index
* @return A correct writer for variantContexts
*/
public static VariantContextWriter openVariantContextWriter(VCFHeader header, String fileName,
Collection<VCFHeaderLine> additionalHeaderLines, boolean generateIndex) {
VariantContextWriterBuilder builder = makeBuilder(header);
builder.setOutputFile(new File(fileName));
if (!generateIndex)
builder.unsetOption(Options.INDEX_ON_THE_FLY);
// construct VariantContextWriter and write out header
VariantContextWriter out = builder.build();
final VCFHeader updatedHeader = extendHeaderFields(new VCFHeader(header));
for (VCFHeaderLine headerLine : additionalHeaderLines)
updatedHeader.addMetaDataLine(headerLine);
out.writeHeader(updatedHeader);
return out;
}
开发者ID:charite,项目名称:jannovar,代码行数:30,代码来源:VariantContextWriterConstructionHelper.java
示例12: initBuilder
import htsjdk.variant.variantcontext.writer.Options; //导入依赖的package包/类
private void initBuilder(OutputStream os, boolean doNotWriteGenotypes,
boolean allowMissingFieldsInHeader) {
builder = new VariantContextWriterBuilder();
builder.clearOptions();
if(doNotWriteGenotypes) {
builder.setOption(Options.DO_NOT_WRITE_GENOTYPES);
}
if(allowMissingFieldsInHeader) {
builder.setOption(Options.ALLOW_MISSING_FIELDS_IN_HEADER);
}
builder.setOutputStream(os);
}
开发者ID:BGI-flexlab,项目名称:SOAPgaea,代码行数:13,代码来源:VCFFileWriter.java
示例13: doWork
import htsjdk.variant.variantcontext.writer.Options; //导入依赖的package包/类
@Override
protected int doWork() {
final ProgressLogger progress = new ProgressLogger(LOG, 10000);
IOUtil.assertFileIsReadable(INPUT);
IOUtil.assertFileIsWritable(OUTPUT);
final VCFFileReader reader = new VCFFileReader(INPUT, REQUIRE_INDEX);
final VCFHeader header = new VCFHeader(reader.getFileHeader());
final SAMSequenceDictionary sequenceDictionary = header.getSequenceDictionary();
if (CREATE_INDEX && sequenceDictionary == null) {
throw new PicardException("A sequence dictionary must be available in the input file when creating indexed output.");
}
final VariantContextWriterBuilder builder = new VariantContextWriterBuilder()
.setOutputFile(OUTPUT)
.setReferenceDictionary(sequenceDictionary);
if (CREATE_INDEX)
builder.setOption(Options.INDEX_ON_THE_FLY);
else
builder.unsetOption(Options.INDEX_ON_THE_FLY);
final VariantContextWriter writer = builder.build();
writer.writeHeader(header);
final CloseableIterator<VariantContext> iterator = reader.iterator();
while (iterator.hasNext()) {
final VariantContext context = iterator.next();
writer.add(context);
progress.record(context.getContig(), context.getStart());
}
CloserUtil.close(iterator);
CloserUtil.close(reader);
writer.close();
return 0;
}
开发者ID:broadinstitute,项目名称:picard,代码行数:38,代码来源:VcfFormatConverter.java
示例14: writeSortedOutput
import htsjdk.variant.variantcontext.writer.Options; //导入依赖的package包/类
private void writeSortedOutput(final VCFHeader outputHeader, final SortingCollection<VariantContext> sortedOutput) {
final ProgressLogger writeProgress = new ProgressLogger(log, 25000, "wrote", "records");
final EnumSet<Options> options = CREATE_INDEX ? EnumSet.of(Options.INDEX_ON_THE_FLY) : EnumSet.noneOf(Options.class);
final VariantContextWriter out = new VariantContextWriterBuilder().
setReferenceDictionary(outputHeader.getSequenceDictionary()).
setOptions(options).
setOutputFile(OUTPUT).build();
out.writeHeader(outputHeader);
for (final VariantContext variantContext : sortedOutput) {
out.add(variantContext);
writeProgress.record(variantContext.getContig(), variantContext.getStart());
}
out.close();
}
开发者ID:broadinstitute,项目名称:picard,代码行数:15,代码来源:SortVcf.java
示例15: doWork
import htsjdk.variant.variantcontext.writer.Options; //导入依赖的package包/类
@Override
protected int doWork() {
IOUtil.assertFileIsReadable(INPUT);
IOUtil.assertFileIsWritable(OUTPUT);
final VCFFileReader in = new VCFFileReader(INPUT);
final VCFHeader header = in.getFileHeader();
if (header.getGenotypeSamples().size() > 1) {
throw new IllegalArgumentException("Input VCF must be single-sample.");
}
if (OLD_SAMPLE_NAME != null && !OLD_SAMPLE_NAME.equals(header.getGenotypeSamples().get(0))) {
throw new IllegalArgumentException("Input VCF did not contain expected sample. Contained: " + header.getGenotypeSamples().get(0));
}
final EnumSet<Options> options = EnumSet.copyOf(VariantContextWriterBuilder.DEFAULT_OPTIONS);
if (CREATE_INDEX) options.add(Options.INDEX_ON_THE_FLY); else options.remove(Options.INDEX_ON_THE_FLY);
final VCFHeader outHeader = new VCFHeader(header.getMetaDataInInputOrder(), CollectionUtil.makeList(NEW_SAMPLE_NAME));
final VariantContextWriter out = new VariantContextWriterBuilder()
.setOptions(options)
.setOutputFile(OUTPUT).setReferenceDictionary(outHeader.getSequenceDictionary()).build();
out.writeHeader(outHeader);
for (final VariantContext ctx : in) {
out.add(ctx);
}
out.close();
in.close();
return 0;
}
开发者ID:broadinstitute,项目名称:picard,代码行数:35,代码来源:RenameSampleInVcf.java
示例16: createVCFWriter
import htsjdk.variant.variantcontext.writer.Options; //导入依赖的package包/类
/**
* Creates a VariantContextWriter whose outputFile type is based on the extension of the output file name.
* The default options set by VariantContextWriter are cleared before applying ALLOW_MISSING_FIELDS_IN_HEADER (if
* <code>lenientProcessing</code> is set), followed by the set of options specified by any <code>options</code> args.
*
* @param outFile output File for this writer. May not be null.
* @param referenceDictionary required if on the fly indexing is set, otherwise can be null
* @param createMD5 true if an md5 file should be created
* @param options variable length list of additional Options to be set for this writer
* @returns VariantContextWriter must be closed by the caller
*/
public static VariantContextWriter createVCFWriter(
final File outFile,
final SAMSequenceDictionary referenceDictionary,
final boolean createMD5,
final Options... options)
{
Utils.nonNull(outFile);
VariantContextWriterBuilder vcWriterBuilder =
new VariantContextWriterBuilder().clearOptions().setOutputFile(outFile);
if (VariantContextWriterBuilder.OutputType.UNSPECIFIED == getVariantFileTypeFromExtension(outFile)) {
// the only way the user has to specify an output type is by file extension, and htsjdk
// throws if it can't map the file extension to a known vcf type, so fallback to a default
// of VCF
logger.warn(String.format(
"Can't determine output variant file format from output file extension \"%s\". Defaulting to VCF.",
FilenameUtils.getExtension(outFile.getPath())));
vcWriterBuilder = vcWriterBuilder.setOutputFileType(VariantContextWriterBuilder.OutputType.VCF);
}
if (createMD5) {
vcWriterBuilder.setCreateMD5();
}
if (null != referenceDictionary) {
vcWriterBuilder = vcWriterBuilder.setReferenceDictionary(referenceDictionary);
}
for (Options opt : options) {
vcWriterBuilder = vcWriterBuilder.setOption(opt);
}
return vcWriterBuilder.build();
}
开发者ID:broadinstitute,项目名称:gatk,代码行数:47,代码来源:GATKVariantContextUtils.java
示例17: testCreateVCFWriterWithOptions
import htsjdk.variant.variantcontext.writer.Options; //导入依赖的package包/类
@Test(dataProvider = "createVCFWriterData")
public void testCreateVCFWriterWithOptions(
final String outputExtension,
final String indexExtension,
final boolean createIndex,
final boolean createMD5) throws IOException {
final File tmpDir = createTempDir("createVCFTest");
final File outputFile = new File(tmpDir.getAbsolutePath(), "createVCFTest" + outputExtension);
Options options[] = createIndex ?
new Options[] {Options.INDEX_ON_THE_FLY} :
new Options[] {};
try (final VariantContextWriter writer = GATKVariantContextUtils.createVCFWriter(
outputFile,
makeSimpleSequenceDictionary(),
createMD5,
options)) {
writeHeader(writer);
}
final File outFileIndex = new File(outputFile.getAbsolutePath() + indexExtension);
final File outFileMD5 = new File(outputFile.getAbsolutePath() + ".md5");
Assert.assertTrue(outputFile.exists(), "No output file was not created");
Assert.assertEquals(outFileIndex.exists(), createIndex, "The createIndex argument was not honored");
Assert.assertEquals(outFileMD5.exists(), createMD5, "The createMD5 argument was not honored");
verifyFileType(outputFile, outputExtension);
}
开发者ID:broadinstitute,项目名称:gatk,代码行数:31,代码来源:GATKVariantContextUtilsUnitTest.java
示例18: testCreateVCFWriterLenientTrue
import htsjdk.variant.variantcontext.writer.Options; //导入依赖的package包/类
@Test(dataProvider = "createVCFWriterLenientData")
public void testCreateVCFWriterLenientTrue(
final String outputExtension,
final String indexExtension,
final boolean createIndex,
final boolean createMD5) throws IOException {
final File tmpDir = createTempDir("createVCFTest");
final File outputFile = new File(tmpDir.getAbsolutePath(), "createVCFTest" + outputExtension);
Options options[] = createIndex ?
new Options[] {Options.ALLOW_MISSING_FIELDS_IN_HEADER, Options.INDEX_ON_THE_FLY} :
new Options[] {Options.ALLOW_MISSING_FIELDS_IN_HEADER};
try (final VariantContextWriter vcw = GATKVariantContextUtils.createVCFWriter(
outputFile,
makeSimpleSequenceDictionary(),
createMD5,
options)) {
writeHeader(vcw);
writeBadVariant(vcw); // verify leniency by writing a bogus attribute
}
final File outFileIndex = new File(outputFile.getAbsolutePath() + indexExtension);
final File outFileMD5 = new File(outputFile.getAbsolutePath() + ".md5");
Assert.assertTrue(outputFile.exists(), "No output file was not created");
Assert.assertEquals(outFileIndex.exists(), createIndex, "The createIndex argument was not honored");
Assert.assertEquals(outFileMD5.exists(), createMD5, "The createMD5 argument was not honored");
}
开发者ID:broadinstitute,项目名称:gatk,代码行数:30,代码来源:GATKVariantContextUtilsUnitTest.java
示例19: testCreateVariantContextWriterNoReference
import htsjdk.variant.variantcontext.writer.Options; //导入依赖的package包/类
@Test(expectedExceptions=IllegalArgumentException.class)
public void testCreateVariantContextWriterNoReference() {
// should throw due to lack of reference
final File outFile = createTempFile("testVCFWriter", ".vcf");
final VariantContextWriter vcw =
GATKVariantContextUtils.createVCFWriter(
outFile,
null,
true,
Options.INDEX_ON_THE_FLY);
vcw.close();
}
开发者ID:broadinstitute,项目名称:gatk,代码行数:13,代码来源:GATKVariantContextUtilsUnitTest.java
示例20: testOnTheFlyTabixCreation
import htsjdk.variant.variantcontext.writer.Options; //导入依赖的package包/类
@Test
public void testOnTheFlyTabixCreation() throws IOException {
final File inputGZIPFile = new File(publicTestDir + "org/broadinstitute/hellbender/engine/8_mutect2_sorted.vcf.gz");
final File outputGZIPFile = createTempFile("testOnTheFlyTabixCreation", ".vcf.gz");
long recordCount = 0;
try (final VariantContextWriter vcfWriter = GATKVariantContextUtils.createVCFWriter(
outputGZIPFile,
null,
false,
Options.INDEX_ON_THE_FLY);
final FeatureReader<VariantContext> inputFileReader =
AbstractFeatureReader.getFeatureReader(inputGZIPFile.getAbsolutePath(), new VCFCodec(), false))
{
vcfWriter.writeHeader((VCFHeader)inputFileReader.getHeader());
final Iterator<VariantContext> it = inputFileReader.iterator();
while (it.hasNext()) {
vcfWriter.add(it.next());
recordCount++;
}
}
// make sure we got a tabix index
final File tabixIndexFile = new File(outputGZIPFile.getAbsolutePath() + TabixUtils.STANDARD_INDEX_EXTENSION);
Assert.assertTrue(tabixIndexFile.exists());
Assert.assertTrue(tabixIndexFile.length() > 0);
// verify the index via query
final SimpleInterval queryInterval = new SimpleInterval("chr6:33414233-118314029");
try (final FeatureReader<VariantContext> outputFileReader = AbstractFeatureReader.getFeatureReader(
outputGZIPFile.getAbsolutePath(),
new VCFCodec(),
true)) // require index
{
final long actualCount = outputFileReader.query(
queryInterval.getContig(), queryInterval.getStart(), queryInterval.getEnd()).stream().count();
Assert.assertEquals(actualCount, recordCount);
}
}
开发者ID:broadinstitute,项目名称:gatk,代码行数:40,代码来源:GATKVariantContextUtilsUnitTest.java
注:本文中的htsjdk.variant.variantcontext.writer.Options类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论