当前位置: 首页>>代码示例>>Java>>正文


Java VariantContextWriterBuilder.setCreateMD5方法代码示例

本文整理汇总了Java中htsjdk.variant.variantcontext.writer.VariantContextWriterBuilder.setCreateMD5方法的典型用法代码示例。如果您正苦于以下问题:Java VariantContextWriterBuilder.setCreateMD5方法的具体用法?Java VariantContextWriterBuilder.setCreateMD5怎么用?Java VariantContextWriterBuilder.setCreateMD5使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在htsjdk.variant.variantcontext.writer.VariantContextWriterBuilder的用法示例。


在下文中一共展示了VariantContextWriterBuilder.setCreateMD5方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createVCFWriter

import htsjdk.variant.variantcontext.writer.VariantContextWriterBuilder; //导入方法依赖的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: createVariantContextWriter

import htsjdk.variant.variantcontext.writer.VariantContextWriterBuilder; //导入方法依赖的package包/类
/**
 * create a VariantContextWriter
 * @param OUT output file or null to stdout
 * @return
 * @throws IOException
 */
public static  VariantContextWriter createVariantContextWriter(final File OUT) throws IOException
	{
	if(OUT==null)
		{
		return createVariantContextWriterToStdout();
		}
	else
		{
		IOUtil.assertFileIsWritable(OUT);
		final VariantContextWriterBuilder vcwb=new VariantContextWriterBuilder();
		vcwb.setCreateMD5(false);
		vcwb.setReferenceDictionary(null);
		vcwb.clearOptions();
		vcwb.setOutputFile(OUT);
		return new VariantContextWriterDelayedFlush(vcwb.build());
		}
	}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:24,代码来源:VCFUtils.java

示例3: createVCFWriter

import htsjdk.variant.variantcontext.writer.VariantContextWriterBuilder; //导入方法依赖的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

示例4: open

import htsjdk.variant.variantcontext.writer.VariantContextWriterBuilder; //导入方法依赖的package包/类
@Override
public void open(final ExecutionContext executionContext) throws ItemStreamException {
	if(this.filenameFactory==null) throw new ItemStreamException("resource is not defined");
	try {
		final String filename = this.filenameFactory.apply(executionContext);
		if(StringUtil.isBlank(filename)) throw new ItemStreamException("No output file defined.");
		if(LOG.isInfoEnabled()) LOG.info("Opening "+filename+" for writing");
		
		if(!Arrays.stream(IOUtil.VCF_EXTENSIONS).anyMatch(SUFF->filename.endsWith(SUFF)))
			{
			throw new ItemStreamException("Bad extension for a VCF file:" + filename);
			}
		final File vcfFile = new File(filename);
		VCFHeader header= SpringBatchUtils.getVcfHeader(executionContext);
		final VariantContextWriterBuilder vcwb = new VariantContextWriterBuilder();
		vcwb.setOutputFile(vcfFile);
		if(this.reference!=null)
			{
			final SAMSequenceDictionary dic=SAMSequenceDictionaryExtractor.extractDictionary(this.reference);
			vcwb.setReferenceDictionary(dic);
			if(header.getSequenceDictionary()==null) {
				header = new VCFHeader(header);
				header.setSequenceDictionary(dic);
				}
			}
		else
			{
			vcwb.setReferenceDictionary(header.getSequenceDictionary());
			}
		vcwb.setCreateMD5(this.createMD5);
		this.vcw = vcwb.build();
		this.vcw.writeHeader(header);
		}
	catch(final Exception err)
		{
		priv_close();
		throw new ItemStreamException(err);
		}
	}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:40,代码来源:VariantContextBatchWriter.java

示例5: createVariantContextWriterToOutputStream

import htsjdk.variant.variantcontext.writer.VariantContextWriterBuilder; //导入方法依赖的package包/类
public static  VariantContextWriter createVariantContextWriterToOutputStream(final OutputStream ostream)
{
final VariantContextWriterBuilder vcwb=new VariantContextWriterBuilder();
vcwb.setCreateMD5(false);
vcwb.setOutputStream(ostream);
vcwb.setReferenceDictionary(null);
vcwb.clearOptions();
return new VariantContextWriterDelayedFlush(vcwb.build());
}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:10,代码来源:VCFUtils.java

示例6: writeHeader

import htsjdk.variant.variantcontext.writer.VariantContextWriterBuilder; //导入方法依赖的package包/类
@Override
public void writeHeader(final VCFHeader header) {
	if(this.delegate!=null) {
		throw new IllegalStateException("WriteHeader called twice");
		}
	
	SAMSequenceDictionary dict=config.dict;
	if(config.createIndex &&  dict==null) {
		dict= header.getSequenceDictionary();
		}
	
	final VariantContextWriterBuilder builder = this.config.createVariantContextWriterBuilder();
	builder.unsetOption(Options.INDEX_ON_THE_FLY);
	if(dict!=null) {
		builder.setReferenceDictionary(dict);
		}
	
	if(this.outputFileOrNull==null) {
		builder.setCreateMD5(false);
		if(this.config.outputbcf) {
			builder.setOutputBCFStream(this._stdout);
			}
		else
			{
			builder.setOutputVCFStream(this._stdout);
			}
		}
	else
		{
		builder.setCreateMD5(this.config.createMd5);
		if(this.config.createIndex)
			{
			if(dict==null|| dict.isEmpty()) {
				throw new JvarkitException.DictionaryMissing("Cannot index vcf when SamSequence dictionary missing");
				}
			builder.setOption(Options.INDEX_ON_THE_FLY);
			}
		builder.setOutputFile(this.outputFileOrNull);
		}
	this.delegate = builder.build();
	this.delegate.writeHeader(header);
	}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:43,代码来源:PostponedVariantContextWriter.java


注:本文中的htsjdk.variant.variantcontext.writer.VariantContextWriterBuilder.setCreateMD5方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。