@Override public void uncaughtException(final Thread t, final Throwable e) { this.throwable = e; log.error(e, "Exception caught on thread ", t.getName()); } }
@Override public void uncaughtException(final Thread t, final Throwable e) { this.throwable = e; log.error(e, "Exception caught on thread ", t.getName()); } }
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();
@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 } }
@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 } }
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."); } }
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
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; } }
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(); } }
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(); } }
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)); } }
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)); } }
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); } } }
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); } } }
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; }
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; }
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); } } /**
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) {
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 {
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; } }