• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Defaults类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中htsjdk.samtools.Defaults的典型用法代码示例。如果您正苦于以下问题:Java Defaults类的具体用法?Java Defaults怎么用?Java Defaults使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: createStream

import htsjdk.samtools.Defaults; //导入依赖的package包/类
private InputStream createStream(final FileInputStream fileStream) throws IOException {
    // if this looks like a block compressed file and it in fact is, we will use it
    // otherwise we will use the file as is
    if (!AbstractFeatureReader.hasBlockCompressedExtension(inputFile)) {
        return fileStream;
    }

    // make a buffered stream to test that this is in fact a valid block compressed file
    final int bufferSize = Math.max(Defaults.BUFFER_SIZE,
            BlockCompressedStreamConstants.MAX_COMPRESSED_BLOCK_SIZE);
    final BufferedInputStream bufferedStream = new BufferedInputStream(fileStream, bufferSize);

    if (!BlockCompressedInputStream.isValidFile(bufferedStream)) {
        throw new TribbleException.MalformedFeatureFile(
                "Input file is not in valid block compressed format.", inputFile.getAbsolutePath());
    }

    final ISeekableStreamFactory ssf = SeekableStreamFactory.getInstance();
    // if we got here, the file is valid, make a SeekableStream for the BlockCompressedInputStream
    // to read from
    final SeekableStream seekableStream =
            ssf.getBufferedStream(ssf.getStreamFor(inputFile.getAbsolutePath()));
    return new BlockCompressedInputStream(seekableStream);
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:25,代码来源:FeatureIterator.java


示例2: printSettings

import htsjdk.samtools.Defaults; //导入依赖的package包/类
/**
 * Output a curated set of important settings to the logger.
 *
 * May be overridden by subclasses to specify a different set of settings to output.
 */
protected void printSettings() {
    if ( VERBOSITY != Log.LogLevel.DEBUG ) {
        logger.info("HTSJDK Defaults.COMPRESSION_LEVEL : " + Defaults.COMPRESSION_LEVEL);
        logger.info("HTSJDK Defaults.USE_ASYNC_IO_READ_FOR_SAMTOOLS : " + Defaults.USE_ASYNC_IO_READ_FOR_SAMTOOLS);
        logger.info("HTSJDK Defaults.USE_ASYNC_IO_WRITE_FOR_SAMTOOLS : " + Defaults.USE_ASYNC_IO_WRITE_FOR_SAMTOOLS);
        logger.info("HTSJDK Defaults.USE_ASYNC_IO_WRITE_FOR_TRIBBLE : " + Defaults.USE_ASYNC_IO_WRITE_FOR_TRIBBLE);
    }
    else {
        // At DEBUG verbosity, print all the HTSJDK defaults:
        Defaults.allDefaults().entrySet().stream().forEach(e->
                logger.info("HTSJDK " + Defaults.class.getSimpleName() + "." + e.getKey() + " : " + e.getValue())
        );
    }

    // Log the configuration options:
    ConfigFactory.logConfigFields(ConfigFactory.getInstance().getGATKConfig(), Log.LogLevel.DEBUG);

    final boolean usingIntelDeflater = (BlockCompressedOutputStream.getDefaultDeflaterFactory() instanceof IntelDeflaterFactory && ((IntelDeflaterFactory)BlockCompressedOutputStream.getDefaultDeflaterFactory()).usingIntelDeflater());
    logger.info("Deflater: " + (usingIntelDeflater ? "IntelDeflater": "JdkDeflater"));
    final boolean usingIntelInflater = (BlockGunzipper.getDefaultInflaterFactory() instanceof IntelInflaterFactory && ((IntelInflaterFactory)BlockGunzipper.getDefaultInflaterFactory()).usingIntelInflater());
    logger.info("Inflater: " + (usingIntelInflater ? "IntelInflater": "JdkInflater"));

    logger.info("GCS max retries/reopens: " + BucketUtils.getCloudStorageConfiguration(NIO_MAX_REOPENS).maxChannelReopens());
    logger.info("Using google-cloud-java patch 6d11bef1c81f885c26b2b56c8616b7a705171e4f from https://github.com/droazen/google-cloud-java/tree/dr_all_nio_fixes");
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:31,代码来源:CommandLineProgram.java


示例3: spillToDisk

import htsjdk.samtools.Defaults; //导入依赖的package包/类
/**
 * Sort the records in memory, write them to a file, and clear the buffer of records in memory.
 */
private void spillToDisk() {
    try {
    	Logger.info("Sort Spilling to disk...");
        Arrays.sort(this.ramRecords, 0, this.numRecordsInRam, this.comparator);
        final File f = newTempFile();
        OutputStream os = null;
        try {
            os = tempStreamFactory.wrapTempOutputStream(new FileOutputStream(f), Defaults.BUFFER_SIZE);
            this.codec.setOutputStream(os);
            for (int i = 0; i < this.numRecordsInRam; ++i) {
                this.codec.encode(ramRecords[i]);
                // Facilitate GC
                this.ramRecords[i] = null;
            }

            os.flush();
        } catch (RuntimeIOException ex) {
            throw new RuntimeIOException("Problem writing temporary file " + f.getAbsolutePath() +
                    ".  Try setting TMP_DIR to a file system with lots of space.", ex);
        } finally {
            if (os != null) {
                os.close();
            }
        }

        this.numRecordsInRam = 0;
        this.files.add(f);

    }
    catch (IOException e) {
        throw new RuntimeIOException(e);
    }
}
 
开发者ID:mozack,项目名称:abra2,代码行数:37,代码来源:SortingCollection2.java


示例4: FileRecordIterator

import htsjdk.samtools.Defaults; //导入依赖的package包/类
FileRecordIterator(final File file) {
    this.file = file;
    try {
        this.is = new FileInputStream(file);
        this.codec = SortingCollection2.this.codec.clone();
        this.codec.setInputStream(tempStreamFactory.wrapTempInputStream(this.is, Defaults.BUFFER_SIZE));
        advance();
    }
    catch (FileNotFoundException e) {
        throw new RuntimeIOException(e);
    }
}
 
开发者ID:mozack,项目名称:abra2,代码行数:13,代码来源:SortingCollection2.java


示例5: ReadWriterFactory

import htsjdk.samtools.Defaults; //导入依赖的package包/类
/** Creates a default factory. */
public ReadWriterFactory() {
    this.samFactory = new SAMFileWriterFactory();
    // setting the default create Md5 to the same as the samFactory default
    this.createMd5file = SAMFileWriterFactory.getDefaultCreateMd5File();
    this.useAsyncIo = Defaults.USE_ASYNC_IO_WRITE_FOR_SAMTOOLS;
}
 
开发者ID:magicDGS,项目名称:ReadTools,代码行数:8,代码来源:ReadWriterFactory.java


示例6: open

import htsjdk.samtools.Defaults; //导入依赖的package包/类
InputStream open(final File file, final boolean seekable, final boolean isGzip, final boolean isBgzf) {
    final String filePath = file.getAbsolutePath();

    try {
        // Open up a buffered stream to read from the file and optionally wrap it in a gzip stream if necessary
        if (isBgzf) {
            // Only BlockCompressedInputStreams can seek, and only if they are fed a SeekableStream.
            return new BlockCompressedInputStream(IOUtil.maybeBufferedSeekableStream(file));
        } else if (isGzip) {
            if (seekable) {
                throw new IllegalArgumentException(
                        String.format("Cannot create a seekable reader for gzip bcl: %s.", filePath)
                );
            }
            return (IOUtil.maybeBufferInputStream(new GZIPInputStream(new FileInputStream(file), Defaults.BUFFER_SIZE / 2),
                    Defaults.BUFFER_SIZE / 2));
        } else {
            if (seekable) {
                throw new IllegalArgumentException(
                        String.format("Cannot create a seekable reader for provided bcl: %s.", filePath)
                );
            }
            return IOUtil.maybeBufferInputStream(new FileInputStream(file));
        }
    } catch (final FileNotFoundException fnfe) {
        throw new PicardException("File not found: (" + filePath + ")", fnfe);
    } catch (final IOException ioe) {
        throw new PicardException("Error reading file: (" + filePath + ")", ioe);
    }
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:31,代码来源:BaseBclReader.java


示例7: makeReferenceArgumentCollection

import htsjdk.samtools.Defaults; //导入依赖的package包/类
@Override
protected ReferenceArgumentCollection makeReferenceArgumentCollection() {
    return new ReferenceArgumentCollection() {
        @Argument(shortName = StandardOptionDefinitions.REFERENCE_SHORT_NAME, common=false,
                doc = "The reference sequence (fasta) for the TARGET genome build (i.e., the new one.  The fasta file must have an " +
                            "accompanying sequence dictionary (.dict file).")
        public File REFERENCE_SEQUENCE = Defaults.REFERENCE_FASTA;

        @Override
        public File getReferenceFile() {
            return REFERENCE_SEQUENCE;
        }
    };
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:15,代码来源:LiftoverVcf.java


示例8: openFileForBufferedWriting

import htsjdk.samtools.Defaults; //导入依赖的package包/类
public static BufferedWriter openFileForBufferedWriting(final File file)  throws IOException
{
   return new BufferedWriter(new OutputStreamWriter(openFileForWriting(file)), Defaults.BUFFER_SIZE);
}
 
开发者ID:dariober,项目名称:ASCIIGenome,代码行数:5,代码来源:IOUtils.java


示例9: getSubsequenceAt

import htsjdk.samtools.Defaults; //导入依赖的package包/类
/**
 * Gets the subsequence of the contig in the range [start,stop]
 * @param contig Contig whose subsequence to retrieve.
 * @param start inclusive, 1-based start of region.
 * @param stop inclusive, 1-based stop of region.
 * @return The partial reference sequence associated with this range.
 */
public ReferenceSequence getSubsequenceAt( String contig, long start, long stop ) {
    if(start > stop + 1)
        throw new SAMException(String.format("Malformed query; start point %d lies after end point %d",start,stop));

    FastaSequenceIndexEntry indexEntry = index.getIndexEntry(contig);

    if(stop > indexEntry.getSize())
        throw new SAMException("Query asks for data past end of contig");

    int length = (int)(stop - start + 1);

    byte[] target = new byte[length];
    ByteBuffer targetBuffer = ByteBuffer.wrap(target);

    final int basesPerLine = indexEntry.getBasesPerLine();
    final int bytesPerLine = indexEntry.getBytesPerLine();
    final int terminatorLength = bytesPerLine - basesPerLine;

    long startOffset = ((start-1)/basesPerLine)*bytesPerLine + (start-1)%basesPerLine;
    // Cast to long so the second argument cannot overflow a signed integer.
    final long minBufferSize = Math.min((long) Defaults.NON_ZERO_BUFFER_SIZE, (long)(length / basesPerLine + 2) * (long)bytesPerLine);
    if (minBufferSize > Integer.MAX_VALUE) throw new SAMException("Buffer is too large: " +  minBufferSize);

    // Allocate a buffer for reading in sequence data.
    final ByteBuffer channelBuffer = ByteBuffer.allocate((int)minBufferSize);

    while(targetBuffer.position() < length) {
        // If the bufferOffset is currently within the eol characters in the string, push the bufferOffset forward to the next printable character.
        startOffset += Math.max((int)(startOffset%bytesPerLine - basesPerLine + 1),0);

        try {
            startOffset += readFromPosition(channel, channelBuffer, indexEntry.getLocation()+startOffset);
        }
        catch(IOException ex) {
            throw new SAMException("Unable to load " + contig + "(" + start + ", " + stop + ") from " + getAbsolutePath(), ex);
        }

        // Reset the buffer for outbound transfers.
        channelBuffer.flip();

        // Calculate the size of the next run of bases based on the contents we've already retrieved.
        final int positionInContig = (int)start-1+targetBuffer.position();
        final int nextBaseSpan = Math.min(basesPerLine-positionInContig%basesPerLine,length-targetBuffer.position());
        // Cap the bytes to transfer by limiting the nextBaseSpan to the size of the channel buffer.
        int bytesToTransfer = Math.min(nextBaseSpan,channelBuffer.capacity());

        channelBuffer.limit(channelBuffer.position()+bytesToTransfer);

        while(channelBuffer.hasRemaining()) {
            targetBuffer.put(channelBuffer);

            bytesToTransfer = Math.min(basesPerLine,length-targetBuffer.position());
            channelBuffer.limit(Math.min(channelBuffer.position()+bytesToTransfer+terminatorLength,channelBuffer.capacity()));
            channelBuffer.position(Math.min(channelBuffer.position()+terminatorLength,channelBuffer.capacity()));
        }

        // Reset the buffer for inbound transfers.
        channelBuffer.flip();
    }

    return new ReferenceSequence( contig, indexEntry.getSequenceIndex(), target );
}
 
开发者ID:chipster,项目名称:chipster,代码行数:70,代码来源:PicardIndexedFastaSequenceFile.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MavenImporter类代码示例发布时间:2022-05-22
下一篇:
Java PsiEquivalenceUtil类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap