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

Java ReferenceSource类代码示例

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

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



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

示例1: init

import htsjdk.samtools.cram.ref.ReferenceSource; //导入依赖的package包/类
private void init(
        final OutputStream output, final SAMFileHeader header, final boolean writeHeader,
        final TaskAttemptContext ctx)
        throws IOException
{
    origOutput = output;
    this.writeHeader = writeHeader;

    final String referenceURI =
            ctx.getConfiguration().get(CRAMInputFormat.REFERENCE_SOURCE_PATH_PROPERTY);
    refSource = new ReferenceSource(referenceURI == null ? null :
        NIOFileUtil.asPath(referenceURI));

    // A SAMFileHeader must be supplied at CRAMContainerStreamWriter creation time; if
    // we don't have one then delay creation until we do
    if (header != null) {
        cramContainerStream = new CRAMContainerStreamWriter(
                origOutput, null, refSource, header, HADOOP_BAM_PART_ID);
        if (writeHeader) {
            this.writeHeader(header);
        }
    }
}
 
开发者ID:HadoopGenomics,项目名称:Hadoop-BAM,代码行数:24,代码来源:CRAMRecordWriter.java


示例2: initialize

import htsjdk.samtools.cram.ref.ReferenceSource; //导入依赖的package包/类
@Override
public void initialize(InputSplit split, TaskAttemptContext context) throws IOException {
  if(isInitialized) {
    close();
  }
  isInitialized = true;

  final Configuration conf = context.getConfiguration();
  final FileSplit fileSplit = (FileSplit) split;
  final Path file  = fileSplit.getPath();

  String refSourcePath = conf.get(CRAMInputFormat.REFERENCE_SOURCE_PATH_PROPERTY);
  ReferenceSource refSource = new ReferenceSource(refSourcePath == null ? null :
      NIOFileUtil.asPath(refSourcePath));

  seekableStream = WrapSeekable.openPath(conf, file);
  start = fileSplit.getStart();
  length = fileSplit.getLength();
  long end = start + length;
  // CRAMIterator right shifts boundaries by 16 so we do the reverse here
  // also subtract one from end since CRAMIterator's boundaries are inclusive
  long[] boundaries = new long[] {start << 16, (end - 1) << 16};
  ValidationStringency stringency = SAMHeaderReader.getValidationStringency(conf);
  cramIterator = new CRAMIterator(seekableStream, refSource, boundaries, stringency);
}
 
开发者ID:HadoopGenomics,项目名称:Hadoop-BAM,代码行数:26,代码来源:CRAMRecordReader.java


示例3: readSAMHeaderFrom

import htsjdk.samtools.cram.ref.ReferenceSource; //导入依赖的package包/类
/** Does not close the stream. */
public static SAMFileHeader readSAMHeaderFrom(
	final InputStream in, final Configuration conf)
{
	final ValidationStringency
		stringency = getValidationStringency(conf);
	SamReaderFactory readerFactory = SamReaderFactory.makeDefault()
			.setOption(SamReaderFactory.Option.EAGERLY_DECODE, false)
			.setUseAsyncIo(false);
	if (stringency != null) {
		readerFactory.validationStringency(stringency);
	}

	final ReferenceSource refSource = getReferenceSource(conf);
	if (null != refSource) {
		readerFactory.referenceSource(refSource);
	}
	return readerFactory.open(SamInputResource.of(in)).getFileHeader();
}
 
开发者ID:HadoopGenomics,项目名称:Hadoop-BAM,代码行数:20,代码来源:SAMHeaderReader.java


示例4: setup

import htsjdk.samtools.cram.ref.ReferenceSource; //导入依赖的package包/类
@Before
public void setup() throws Exception {
    conf = new Configuration();

    testCRAMFileName = ClassLoader.getSystemClassLoader()
            .getResource("test.cram").getFile();
    testReferenceFileName = ClassLoader.getSystemClassLoader()
            .getResource("auxf.fa").getFile();
    testReferenceSource = new ReferenceSource(Paths.get(testReferenceFileName));

    conf.set("mapred.input.dir", "file://" + testCRAMFileName);
    conf.set(CRAMInputFormat.REFERENCE_SOURCE_PATH_PROPERTY,
            "file://" + testReferenceFileName);

    // fetch the SAMFile header from the original input to get the
    // expected count
    expectedRecordCount = getCRAMRecordCount(new File(testCRAMFileName));
    samFileHeader = SAMHeaderReader.readSAMHeaderFrom(
            new Path(testCRAMFileName), conf);

    taskAttemptContext = new TaskAttemptContextImpl(conf, mock(TaskAttemptID.class));
}
 
开发者ID:HadoopGenomics,项目名称:Hadoop-BAM,代码行数:23,代码来源:TestCRAMOutputFormat.java


示例5: openSamReaderResource

import htsjdk.samtools.cram.ref.ReferenceSource; //导入依赖的package包/类
private SamReader openSamReaderResource(final SamInputResource inputResource,
        List<Chromosome> chromosomes, Long referenceId) {
    Assert.notNull(inputResource, getMessage(RESOURCE_NOT_FOUND));
    return SamReaderFactory.makeDefault()
            .validationStringency(ValidationStringency.SILENT)
            .referenceSource(new ReferenceSource(new ChromosomeReferenceSequence(chromosomes,
                    referenceId, referenceManager)))
            .open(inputResource);
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:10,代码来源:BamHelper.java


示例6: init

import htsjdk.samtools.cram.ref.ReferenceSource; //导入依赖的package包/类
private void init(final OutputStream output, final boolean writeHeader,
		final TaskAttemptContext ctx) throws IOException {
	origOutput = output;
	this.writeHeader = writeHeader;

	final URI referenceURI = URI.create(ctx.getConfiguration().get(
			OUTPUTFORMAT_REFERENCE));

	rename = ctx.getConfiguration().getBoolean("rename.file", false);

	refSource = new ReferenceSource(Paths.get(referenceURI));
}
 
开发者ID:BGI-flexlab,项目名称:SOAPgaea,代码行数:13,代码来源:GaeaKeyIgnoringCramRecordWriter.java


示例7: initialize

import htsjdk.samtools.cram.ref.ReferenceSource; //导入依赖的package包/类
@Override
public void initialize(InputSplit split, TaskAttemptContext context)
		throws IOException {
	if (isInitialized) {
		close();
	}
	isInitialized = true;

	final Configuration conf = context.getConfiguration();
	final FileSplit fileSplit = (FileSplit) split;
	final Path file = fileSplit.getPath();

	String refSourcePath = conf.get(INPUTFORMAT_REFERENCE);

	ReferenceSource refSource = new ReferenceSource(new File(refSourcePath));
	
	seekableStream = WrapSeekable.openPath(conf, file);
	start = getStart(fileSplit, conf);
	if (start == 0) {
		samFileHeader = CramIO.readCramHeader(seekableStream).getSamFileHeader();
		start = seekableStream.position();
		seekableStream.seek(0);
	}

	length = getLength(fileSplit, conf, seekableStream.length());
	long end = start + length;
	if (end > seekableStream.length())
		end = seekableStream.length();

	long[] boundaries = new long[] { start << 16, (end - 1) << 16 };
	cramIterator = new CRAMIterator(seekableStream, refSource, boundaries,ValidationStringency.DEFAULT_STRINGENCY);
	ValidationStringency stringency = SAMHeaderReader
			.getValidationStringency(conf);
	if (stringency != null) {
		cramIterator.setValidationStringency(stringency);
	}
}
 
开发者ID:BGI-flexlab,项目名称:SOAPgaea,代码行数:38,代码来源:GaeaCramRecordReader.java


示例8: getReferenceSource

import htsjdk.samtools.cram.ref.ReferenceSource; //导入依赖的package包/类
public static ReferenceSource getReferenceSource(
		final Configuration conf)
{
	//TODO: There isn't anything particularly CRAM-specific about reference source or validation
	// stringency other than that a reference source is required for CRAM files. We should move
	// the reference source and validation stringency property names and utility methods out of
	// CRAMInputFormat and SAMHeaderReader and combine them together into a single class for extracting
	// configuration params, but it would break backward compatibility with existing code that
	// is dependent on the CRAMInputFormat.REFERENCE_SOURCE_PATH_PROPERTY.
	final String refSourcePath = conf.get(CRAMInputFormat.REFERENCE_SOURCE_PATH_PROPERTY);
	return refSourcePath == null ? null : new ReferenceSource(NIOFileUtil.asPath(refSourcePath));
}
 
开发者ID:HadoopGenomics,项目名称:Hadoop-BAM,代码行数:13,代码来源:SAMHeaderReader.java


示例9: getCRAMRecordCount

import htsjdk.samtools.cram.ref.ReferenceSource; //导入依赖的package包/类
private int getCRAMRecordCount(
    final File containerStreamFile,
    final SAMFileHeader header,
    final ReferenceSource refSource) throws IOException
{
    // assemble a proper CRAM file from the container stream shard(s) in
    // order to verify the contents
    final ByteArrayInputStream mergedStream = mergeCRAMContainerStream (
        containerStreamFile,
        header,
        refSource
    );

    // now we can verify that we can read everything back in
    final CRAMFileReader resultCRAMReader = new CRAMFileReader(
        mergedStream,
        (SeekableStream) null,
        refSource,
        ValidationStringency.DEFAULT_STRINGENCY);
    final Iterator<SAMRecord> it = resultCRAMReader.getIterator();
    int actualCount = 0;
    while (it.hasNext()) {
        it.next();
        actualCount++;
    }
    return actualCount;
}
 
开发者ID:HadoopGenomics,项目名称:Hadoop-BAM,代码行数:28,代码来源:TestCRAMOutputFormat.java


示例10: mergeCRAMContainerStream

import htsjdk.samtools.cram.ref.ReferenceSource; //导入依赖的package包/类
private ByteArrayInputStream mergeCRAMContainerStream(
    final File containerStreamFile,
    final SAMFileHeader header,
    final ReferenceSource refSource) throws IOException
{
    // assemble a proper CRAM file from the container stream shard(s) in
    // order to verify the contents
    final ByteArrayOutputStream cramOutputStream = new ByteArrayOutputStream();
    // write out the cram file header
    new SAMOutputPreparer().prepareForRecords(
        cramOutputStream,
        SAMFormat.CRAM,
        header);
    // now copy the contents of the container stream shard(s) written out by
    // the M/R job
    final ByteArrayOutputStream containerOutputStream = new ByteArrayOutputStream();
    Files.copy(containerStreamFile.toPath(), containerOutputStream);
    containerOutputStream.writeTo(cramOutputStream);

    // use containerStreamWriter directly to properly terminate the output
    // stream with an EOF container
    final CRAMContainerStreamWriter containerStreamWriter =
        new CRAMContainerStreamWriter(
            cramOutputStream,
            null,
            refSource,
            header,
            "CRAMTest");
    containerStreamWriter.finish(true); // close and write an EOF container
    cramOutputStream.close();

    return new ByteArrayInputStream(cramOutputStream.toByteArray());
}
 
开发者ID:HadoopGenomics,项目名称:Hadoop-BAM,代码行数:34,代码来源:TestCRAMOutputFormat.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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