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

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

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

Log.error介绍

[英]Logs a Throwable and optional message parts at level error.
[中]在错误级别记录可丢弃和可选消息部分。

代码示例

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

@Override public void uncaughtException(final Thread t, final Throwable e) {
    this.throwable = e;
    log.error(e, "Exception caught on thread ", t.getName());
  }
}

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

@Override public void uncaughtException(final Thread t, final Throwable e) {
    this.throwable = e;
    log.error(e, "Exception caught on thread ", t.getName());
  }
}

代码示例来源:origin: PapenfussLab/gridss

private void checkSorted(int lastReferenceIndex, long lastPosition, int referenceIndex, long position, String evidenceID) {
  if (referenceIndex < lastReferenceIndex || (referenceIndex == lastReferenceIndex && position < lastPosition)) {
    String msg = String.format("Unable to find realignment record for %s. This is likely due to either " 
        + "a) alignment not completed successfully or "
        + "b) chosen aligner writing records out of order."
        + "The aligner is required to write records in same order as the input fastq. "
        + "Please raise a github enhancement request if use by an aligner with no capability to ensure this ordering is required. ", evidenceID);
    log.error(msg);
    throw new RuntimeException(msg);
  }
}
private String trackedBufferName = trackedName();

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

@Override
public long length() {
  try {
    return sbc.size();
  } catch (IOException e) {
    LOG.error("Cannot find length of path: " + path, e);
    return 0; // consistent with java.io.File
  }
}

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

@Override
public long length() {
  try {
    return sbc.size();
  } catch (IOException e) {
    LOG.error("Cannot find length of path: " + path, e);
    return 0; // consistent with java.io.File
  }
}

代码示例来源:origin: enasequence/cramtools

private static void eofNotFound(htsjdk.samtools.cram.common.Version version) {
  if (version.major >= 2 && version.minor >= 1) {
    log.error("Incomplete data: EOF marker not found.");
    if (quitOnMissingEOF)
      System.exit(1);
  } else {
    log.warn("EOF marker not found, possibly incomplete file/stream.");
  }
}

代码示例来源:origin: PapenfussLab/gridss

private boolean checkSortOrder(T current) {
  boolean success = true;
  if (last != null && current != null && comparator.compare(last, current) > 0) {
    success = false;
    if (!MessageThrottler.Current.shouldSupress(log, "iterator ordering")) {
      log.error("Sanity check failure: iterator not sorted. " + last.toString() + " encountered before " + current.toString());
    }
  }
  last = current;;
  return success;
}
@Override

代码示例来源:origin: enasequence/cramtools

private boolean confirmMD5(String md5, byte[] data) {
  String downloadedMD5 = null;
  downloadedMD5 = Utils.calculateMD5String(data);
  if (md5.equals(downloadedMD5)) {
    return true;
  } else {
    String message = String.format("Downloaded sequence is corrupt: requested md5=%s, received md5=%s", md5,
        downloadedMD5);
    log.error(message);
    return false;
  }
}

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

public static synchronized void closeAllInstances() {
    Collection<SeekablePathStream> clonedInstances = new HashSet<SeekablePathStream>();
    clonedInstances.addAll(ALL_INSTANCES);
    for (SeekablePathStream sfs : clonedInstances) {
      try {
        sfs.close();
      } catch (IOException e) {
        LOG.error("Error closing SeekablePathStream", e);
      }
    }
    ALL_INSTANCES.clear();
  }
}

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

public static synchronized void closeAllInstances() {
    Collection<SeekablePathStream> clonedInstances = new HashSet<SeekablePathStream>();
    clonedInstances.addAll(ALL_INSTANCES);
    for (SeekablePathStream sfs : clonedInstances) {
      try {
        sfs.close();
      } catch (IOException e) {
        LOG.error("Error closing SeekablePathStream", e);
      }
    }
    ALL_INSTANCES.clear();
  }
}

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

private void alignmentBordersSanityCheck(final byte[] ref) {
  if (sequenceId == SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX) return ;
  if (alignmentStart > 0 && sequenceId >= 0 && ref == null) throw new IllegalArgumentException ("Mapped slice reference is null.");
  if (alignmentStart > ref.length) {
    log.error(String.format("Slice mapped outside of reference: seqID=%d, start=%d, counter=%d.", sequenceId, alignmentStart,
        globalRecordCounter));
    throw new RuntimeException("Slice mapped outside of the reference.");
  }
  if (alignmentStart - 1 + alignmentSpan > ref.length) {
    log.warn(String.format("Slice partially mapped outside of reference: seqID=%d, start=%d, span=%d, counter=%d.",
        sequenceId, alignmentStart, alignmentSpan, globalRecordCounter));
  }
}

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

private void alignmentBordersSanityCheck(final byte[] ref) {
  if (sequenceId == SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX) return ;
  if (alignmentStart > 0 && sequenceId >= 0 && ref == null) throw new IllegalArgumentException ("Mapped slice reference is null.");
  if (alignmentStart > ref.length) {
    log.error(String.format("Slice mapped outside of reference: seqID=%d, start=%d, counter=%d.", sequenceId, alignmentStart,
        globalRecordCounter));
    throw new RuntimeException("Slice mapped outside of the reference.");
  }
  if (alignmentStart - 1 + alignmentSpan > ref.length) {
    log.warn(String.format("Slice partially mapped outside of reference: seqID=%d, start=%d, span=%d, counter=%d.",
        sequenceId, alignmentStart, alignmentSpan, globalRecordCounter));
  }
}

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

public static void awaitThreadPoolTermination(final String executorName, final ThreadPoolExecutor executorService,
                         final Duration timeBetweenChecks) {
    try {
      while (!executorService.awaitTermination(timeBetweenChecks.getSeconds(), TimeUnit.SECONDS)) {
        log.info(String.format("%s waiting for job completion. Finished jobs - %d : Running jobs - %d : Queued jobs  - %d",
            executorName, executorService.getCompletedTaskCount(), executorService.getActiveCount(),
            executorService.getQueue().size()));
      }
    } catch (final InterruptedException e) {
      log.error("Interrupted exception caught: ", e);
    }
  }
}

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

public static void awaitThreadPoolTermination(final String executorName, final ThreadPoolExecutor executorService,
                         final Duration timeBetweenChecks) {
    try {
      while (!executorService.awaitTermination(timeBetweenChecks.getSeconds(), TimeUnit.SECONDS)) {
        log.info(String.format("%s waiting for job completion. Finished jobs - %d : Running jobs - %d : Queued jobs  - %d",
            executorName, executorService.getCompletedTaskCount(), executorService.getActiveCount(),
            executorService.getQueue().size()));
      }
    } catch (final InterruptedException e) {
      log.error("Interrupted exception caught: ", e);
    }
  }
}

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

private List<IntervalList> openIntervalLists(final List<File> files) {
  final List<IntervalList> lists = new ArrayList<>();
  for (final File f : files) {
    try {
      lists.add(IntervalListInputType.getIntervalList(f, INCLUDE_FILTERED).padded(PADDING));
    } catch (final Exception e) {
      LOG.error("There was a problem opening IntervalList file " + f.getAbsolutePath());
      throw e;
    }
  }
  return lists;
}

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

private List<IntervalList> openIntervalLists(final List<File> files) {
  final List<IntervalList> lists = new ArrayList<>();
  for (final File f : files) {
    try {
      lists.add(IntervalListInputType.getIntervalList(f, INCLUDE_FILTERED).padded(PADDING));
    } catch (final Exception e) {
      LOG.error("There was a problem opening IntervalList file " + f.getAbsolutePath());
      throw e;
    }
  }
  return lists;
}

代码示例来源:origin: PapenfussLab/gridss

public static void sort(ProcessingContext processContext, File input, File output) {
  try {
    new SortCallable(processContext, input, output).call();
  } catch (IOException e) {
    log.error(log);
    throw new RuntimeException(e);
  }
}
/**

代码示例来源:origin: PapenfussLab/gridss

private static IdsvMetrics getIdsvMetrics(File idsvMetricsFiles) {
  IdsvMetrics metric = Iterators.getOnlyElement(Iterables.filter(MetricsFile.readBeans(idsvMetricsFiles), IdsvMetrics.class).iterator(), null);
  if (metric == null) {
    metric = new IdsvMetrics();
    log.error(String.format("No idsv metrics found in %s.", idsvMetricsFiles));
  }
  return metric;
}
public static InsertSizeMetrics getInsertSizeMetrics(File insertSizeMetricsFile, boolean singleEndExpected) {

代码示例来源:origin: PapenfussLab/gridss

public static void ensureIndexed(File fa) throws IOException {
  try (ReferenceSequenceFile reference = ReferenceSequenceFileFactory.getReferenceSequenceFile(fa)) {
    if (!reference.isIndexed()) {
      String msg = String.format("Unable to find index for %1$s. Please run 'samtools faidx %1$s' or picard tools BuildBamIndex to generate an index file.", fa);
      log.error(msg);
      throw new IOException(msg);
    } else {
      log.debug(fa, " is indexed.");
    }
  }
}
public void ensureDictionariesMatch() throws IOException {

代码示例来源:origin: PapenfussLab/gridss

public boolean sanityCheck() {
    assert(n != null);
    if (!n.isValid()) {
      log.error(String.format("[%d,%d] subnode over invalid node", firstStart(), firstEnd()));
    }
    assert(n.isValid());
    assert(start >= n.firstStart());
    assert(end <= n.firstEnd());
    return true;
  }
}

相关文章