htsjdk.samtools.util.Log.getInstance()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(10.1k)|赞(0)|评价(0)|浏览(200)

本文整理了Java中htsjdk.samtools.util.Log.getInstance()方法的一些代码示例,展示了Log.getInstance()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Log.getInstance()方法的具体详情如下:
包路径:htsjdk.samtools.util.Log
类名称:Log
方法名:getInstance

Log.getInstance介绍

[英]Get a Log instance to perform logging within the Class specified. Returns an instance of this class which wraps an instance of the commons logging Log class.
[中]获取日志实例以在指定的类内执行日志记录。返回此类的实例,该实例包装commons日志记录日志类的实例。

代码示例

代码示例来源:origin: com.github.samtools/htsjdk

ExperimentalCodec(final BitInputStream coreBlockInputStream,
           final BitOutputStream coreBlockOutputStream) {
    super(coreBlockInputStream, coreBlockOutputStream);

    final String subclass = this.getClass().getName();
    final String warning = String.format(
        "Using the experimental codec %s which is untested and scheduled for removal from the CRAM spec",
        subclass);

    final Log log = Log.getInstance(ExperimentalCodec.class);
    log.warn(warning);
  }
}

代码示例来源:origin: samtools/htsjdk

ExperimentalEncoding(final EncodingID encodingID) {
    super(encodingID);

    final String subclass = this.getClass().getName();
    final String warning = String.format(
        "Using the experimental encoding %s which is untested and scheduled for removal from the CRAM spec",
        subclass);

    final Log log = Log.getInstance(ExperimentalEncoding.class);
    log.warn(warning);
  }
}

代码示例来源:origin: com.github.samtools/htsjdk

ExperimentalEncoding(final EncodingID encodingID) {
    super(encodingID);

    final String subclass = this.getClass().getName();
    final String warning = String.format(
        "Using the experimental encoding %s which is untested and scheduled for removal from the CRAM spec",
        subclass);

    final Log log = Log.getInstance(ExperimentalEncoding.class);
    log.warn(warning);
  }
}

代码示例来源:origin: samtools/htsjdk

ExperimentalCodec(final BitInputStream coreBlockInputStream,
           final BitOutputStream coreBlockOutputStream) {
    super(coreBlockInputStream, coreBlockOutputStream);

    final String subclass = this.getClass().getName();
    final String warning = String.format(
        "Using the experimental codec %s which is untested and scheduled for removal from the CRAM spec",
        subclass);

    final Log log = Log.getInstance(ExperimentalCodec.class);
    log.warn(warning);
  }
}

代码示例来源:origin: broadinstitute/picard

/**
 * Describes the state of a tile being processed.  It is either not yet completely read, or read.
 */
private enum TileProcessingState {
  NOT_DONE_READING, DONE_READING
}

代码示例来源:origin: com.github.broadinstitute/picard

/**
 * Describes the state of a tile being processed.  It is either not yet completely read, or read.
 */
private enum TileProcessingState {
  NOT_DONE_READING, DONE_READING
}

代码示例来源:origin: org.opencb.biodata/biodata-tools

BAMIndexer.createIndex(reader, outputIndex.toFile(), Log.getInstance(BamManager.class));
} else {
  if (reader.type().equals(SamReader.Type.CRAM_TYPE)) {
    CRAMBAIIndexer.createIndex(streamFor, outputIndex.toFile(), Log.getInstance(BamManager.class),
        ValidationStringency.DEFAULT_STRINGENCY);
  } else {

代码示例来源:origin: broadinstitute/picard

@BeforeTest
public void setUp(){
  progress = new ProgressLogger(Log.getInstance(WgsMetricsProcessorImpl.class));
}

代码示例来源:origin: broadinstitute/picard

@Test
public void testKeeperAtEndWithinCliqueOfAllOpticalDuplicates() {
  final Log log = Log.getInstance(OpticalDuplicateFinderTest.class);
  final OpticalDuplicateFinder finder = new OpticalDuplicateFinder(OpticalDuplicateFinder.DEFAULT_READ_NAME_REGEX, 15, log);
  final List<PhysicalLocation> locs = Arrays.asList(
      loc(1, 10, 0),
      loc(1, 20, 0),
      loc(1, 30, 0)
  );
  assertEquals(finder.findOpticalDuplicates(locs, locs.get(2)), new boolean[] {true, true, false});
}

代码示例来源:origin: broadinstitute/picard

@Test
public void testKeeper() {
  final Log log = Log.getInstance(OpticalDuplicateFinderTest.class);
  final OpticalDuplicateFinder finder = new OpticalDuplicateFinder(OpticalDuplicateFinder.DEFAULT_READ_NAME_REGEX, 100, log);
  final List<PhysicalLocation> locs = Arrays.asList(
      loc(7, 1500, 1500),
      loc(7, 1501, 1501),
      loc(5, 1500, 1500),
      loc(7, 1490, 1502),
      loc(7, 2500, 2500),
      loc(7,   10,   10)
  );
  assertEquals(finder.findOpticalDuplicates(locs, null       ), new boolean[] {true, true,  false, false, false, false});
  assertEquals(finder.findOpticalDuplicates(locs, locs.get(0)), new boolean[] {false, true,  false, true, false, false});
  assertEquals(finder.findOpticalDuplicates(locs, locs.get(1)), new boolean[] {true,  false, false, true, false, false});
  assertEquals(finder.findOpticalDuplicates(locs, locs.get(3)), new boolean[] {true,  true,  false, false, false, false});
  for (int i=0; i<100; ++i) {
    final Random random = new Random(i);
    final List<PhysicalLocation> shuffled = new ArrayList<>(locs);
    final List<PhysicalLocation> keepers  = Arrays.asList(locs.get(0), locs.get(1), locs.get(3));
    final PhysicalLocation keeper = keepers.get(random.nextInt(keepers.size()));
    Collections.shuffle(shuffled);
    int opticalDupeCount = countTrue(finder.findOpticalDuplicates(shuffled, keeper));
    Assert.assertEquals(opticalDupeCount, 2);
  }
}

代码示例来源:origin: broadinstitute/picard

/**
 * Tests the case where the "keeper" record is not in the list that is passed to the OpticalDuplicateFinder. This can happen
 * when there are, e.g. FR and RF reads, which can all be molecular duplicates of one another, but cannot be duplicates of one
 * another and are thus partitioned into two sets for optical duplicate checking.
 */
@Test
public void testKeeperNotInList() {
  final Log log = Log.getInstance(OpticalDuplicateFinderTest.class);
  final OpticalDuplicateFinder finder = new OpticalDuplicateFinder(OpticalDuplicateFinder.DEFAULT_READ_NAME_REGEX, 100, log);
  final List<PhysicalLocation> locs = Arrays.asList(
      loc(1, 100, 100),
      loc(1, 101, 101),
      loc(1,  99, 99),
      loc(1,  99, 102)
  );
  Assert.assertEquals(countTrue(finder.findOpticalDuplicates(locs, loc(7, 5000, 5000))), 3);
}

代码示例来源:origin: broadinstitute/picard

@Test
public void testKeeperOrderDependence() {
  final Log log = Log.getInstance(OpticalDuplicateFinderTest.class);
  final OpticalDuplicateFinder finder = new OpticalDuplicateFinder(OpticalDuplicateFinder.DEFAULT_READ_NAME_REGEX, 100, log);
  final List<PhysicalLocation> locs = Arrays.asList(
      loc(1, 100, 190),
      loc(1, 100, 280),
      loc(1,  100, 370),
      loc(1,  100, 460)
  );
  final List<PhysicalLocation> locsReordered = Arrays.asList(
      loc(1, 100, 190),
      loc(1, 100, 460),
      loc(1,  100, 370),
      loc(1,  100, 280)
  );
  Assert.assertEquals(countTrue(finder.findOpticalDuplicates(locs, locs.get(0))), 3);
  Assert.assertEquals(countTrue(finder.findOpticalDuplicates(locsReordered, locsReordered.get(0))), 3);
}

代码示例来源:origin: broadinstitute/picard

protected int doWork() {
    IOUtil.assertFileIsReadable(INPUT);
    IOUtil.assertFileIsWritable(OUTPUT);
    final SamReader reader = SamReaderFactory.makeDefault().referenceSequence(REFERENCE_SEQUENCE).open(INPUT);
    final SAMFileWriter writer = new SAMFileWriterFactory().makeWriter(reader.getFileHeader(), true, OUTPUT, REFERENCE_SEQUENCE);

    if (CREATE_INDEX && writer.getFileHeader().getSortOrder() != SAMFileHeader.SortOrder.coordinate) {
      throw new PicardException("Can't CREATE_INDEX unless sort order is coordinate");
    }

    final ProgressLogger progress = new ProgressLogger(Log.getInstance(SamFormatConverter.class));
    for (final SAMRecord rec : reader) {
      writer.addAlignment(rec);
      progress.record(rec);
    }
    CloserUtil.close(reader);
    writer.close();
    return 0;
  }
}

代码示例来源:origin: com.github.broadinstitute/picard

protected int doWork() {
    IOUtil.assertFileIsReadable(INPUT);
    IOUtil.assertFileIsWritable(OUTPUT);
    final SamReader reader = SamReaderFactory.makeDefault().referenceSequence(REFERENCE_SEQUENCE).open(INPUT);
    final SAMFileWriter writer = new SAMFileWriterFactory().makeWriter(reader.getFileHeader(), true, OUTPUT, REFERENCE_SEQUENCE);

    if (CREATE_INDEX && writer.getFileHeader().getSortOrder() != SAMFileHeader.SortOrder.coordinate) {
      throw new PicardException("Can't CREATE_INDEX unless sort order is coordinate");
    }

    final ProgressLogger progress = new ProgressLogger(Log.getInstance(SamFormatConverter.class));
    for (final SAMRecord rec : reader) {
      writer.addAlignment(rec);
      progress.record(rec);
    }
    CloserUtil.close(reader);
    writer.close();
    return 0;
  }
}

代码示例来源:origin: broadinstitute/picard

private void standardReheader(final SAMFileHeader replacementHeader) {
  final SamReader recordReader = SamReaderFactory.makeDefault().referenceSequence(REFERENCE_SEQUENCE).validationStringency(ValidationStringency.SILENT).open(INPUT);
  if (replacementHeader.getSortOrder() != recordReader.getFileHeader().getSortOrder()) {
    throw new PicardException("Sort orders of INPUT (" + recordReader.getFileHeader().getSortOrder().name() +
        ") and HEADER (" + replacementHeader.getSortOrder().name() + ") do not agree.");
  }
  final SAMFileWriter writer = new SAMFileWriterFactory().makeSAMOrBAMWriter(replacementHeader, true, OUTPUT);
  final ProgressLogger progress = new ProgressLogger(Log.getInstance(ReplaceSamHeader.class));
  for (final SAMRecord rec : recordReader) {
    rec.setHeader(replacementHeader);
    writer.addAlignment(rec);
    progress.record(rec);
  }
  writer.close();
  CloserUtil.close(recordReader);
}

代码示例来源:origin: com.github.broadinstitute/picard

private void standardReheader(final SAMFileHeader replacementHeader) {
  final SamReader recordReader = SamReaderFactory.makeDefault().referenceSequence(REFERENCE_SEQUENCE).validationStringency(ValidationStringency.SILENT).open(INPUT);
  if (replacementHeader.getSortOrder() != recordReader.getFileHeader().getSortOrder()) {
    throw new PicardException("Sort orders of INPUT (" + recordReader.getFileHeader().getSortOrder().name() +
        ") and HEADER (" + replacementHeader.getSortOrder().name() + ") do not agree.");
  }
  final SAMFileWriter writer = new SAMFileWriterFactory().makeSAMOrBAMWriter(replacementHeader, true, OUTPUT);
  final ProgressLogger progress = new ProgressLogger(Log.getInstance(ReplaceSamHeader.class));
  for (final SAMRecord rec : recordReader) {
    rec.setHeader(replacementHeader);
    writer.addAlignment(rec);
    progress.record(rec);
  }
  writer.close();
  CloserUtil.close(recordReader);
}

代码示例来源:origin: broadinstitute/picard

final SAMFileWriter writer = new SAMFileWriterFactory().makeSAMOrBAMWriter(reader.getFileHeader(), true, OUTPUT);
final CloseableIterator<SAMRecord> it = reader.iterator();
final ProgressLogger progress = new ProgressLogger(Log.getInstance(CleanSam.class));

代码示例来源:origin: com.github.broadinstitute/picard

final SAMFileWriter writer = new SAMFileWriterFactory().makeSAMOrBAMWriter(reader.getFileHeader(), true, OUTPUT);
final CloseableIterator<SAMRecord> it = reader.iterator();
final ProgressLogger progress = new ProgressLogger(Log.getInstance(CleanSam.class));

代码示例来源:origin: broadinstitute/picard

final ProgressLogger progress = new ProgressLogger(Log.getInstance(MakeSitesOnlyVcf.class), 10000);

代码示例来源:origin: com.github.broadinstitute/picard

final ProgressLogger progress = new ProgressLogger(Log.getInstance(MakeSitesOnlyVcf.class), 10000);

相关文章