static OverlapDetector<Interval> getOverlapDetectorFromIntervalListFile(File intervalList, int lhsBuffer, int rhsBuffer) { if (intervalList == null) { return null; } List<Interval> intervals = IntervalList.fromFile(intervalList).uniqued().getIntervals(); OverlapDetector<Interval> detector = new OverlapDetector<>(lhsBuffer, rhsBuffer); detector.addAll(intervals, intervals); return detector; }
@Override public boolean hasNext() { // fast succeed if (null != nextRecord) return true; // We would need to get another record, so check if we can either a record read from the input to the mark queue, or we have more that we should return. // There should be at no time records in the mark queue that are not tracked in the output buffer. return (backingIterator.hasNext() || !outputBuffer.isEmpty()); }
CompressedIndexFileBuffer(File file) { try { mCompressedStream = new BlockCompressedInputStream(file); binaryCodec = new BinaryCodec(mCompressedStream); } catch (IOException ioe) { throw(new RuntimeIOException("Construction error of CSI compressed stream: " + ioe)); } }
/** * Calculate the reverse complement of the specified sequence * (Stolen from Reseq) * * @param sequenceData * @return reverse complement */ public static String reverseComplement(final String sequenceData) { final byte[] bases = htsjdk.samtools.util.StringUtil.stringToBytes(sequenceData); reverseComplement(bases); return htsjdk.samtools.util.StringUtil.bytesToString(bases); }
CustomAdapterPair(final String fivePrime, final String threePrime) { this.threePrime = threePrime; this.threePrimeBytes = StringUtil.stringToBytes(threePrime); this.fivePrime = fivePrime; this.fivePrimeReadOrder = SequenceUtil.reverseComplement(fivePrime); this.fivePrimeBytes = StringUtil.stringToBytes(fivePrime); this.fivePrimeReadOrderBytes = StringUtil.stringToBytes(fivePrimeReadOrder); }
/** * Write a string to the buffer as ASCII bytes * * @param value string to write */ private void writeString(final String value) { writeBytes(StringUtil.stringToBytes(value)); }
/** Return true if the sequence/position lie in the provided interval list. */ public static boolean contains(final IntervalList intervalList, final String sequenceName, final long position) { for (final Interval interval : intervalList.uniqued().getIntervals()) { if (contains(interval, sequenceName, position)) return true; } return false; }
/** * Determines whether this interval contains the entire region represented by other * (in other words, whether it covers it). * * * @param other interval to check * @return true if this interval contains all of the base positions spanned by other, otherwise false */ default boolean contains(Locatable other) { return contigsMatch(other) && CoordMath.encloses(getStart(), getEnd(), other.getStart(), other.getEnd()); }
@Override protected IntervalList getProbeIntervals() { for (final File file : BAIT_INTERVALS) IOUtil.assertFileIsReadable(file); return IntervalList.fromFiles(BAIT_INTERVALS); }
/** * the function by which new loci are "shown" to the calculator **/ @Override public void addBase(final SamLocusIterator.RecordAndOffset recordAndOffset, final SamLocusAndReferenceIterator.SAMLocusAndReference locusAndRef) { if (!SequenceUtil.isNoCall(recordAndOffset.getReadBase())) { nBases++; } } }
@Override public boolean equals(final Object obj) { conditionallyUpdateTime(); return super.equals(obj); }
@Override protected void prepareForSeek() { flushReadAhead(); super.prepareForSeek(); }
private TruncatedAdapterPair(final String name, final String threePrimeReadOrder, final String fivePrimeReadOrder) { this.name = name; this.threePrime = threePrimeReadOrder; this.threePrimeBytes = StringUtil.stringToBytes(threePrimeReadOrder); this.fivePrimeReadOrder = fivePrimeReadOrder; this.fivePrimeReadOrderBytes = StringUtil.stringToBytes(fivePrimeReadOrder); this.fivePrime = SequenceUtil.reverseComplement(fivePrimeReadOrder); this.fivePrimeBytes = StringUtil.stringToBytes(this.fivePrime); }
private IlluminaAdapterPair(final String fivePrime, final String threePrime) { this.threePrime = threePrime; this.threePrimeBytes = StringUtil.stringToBytes(threePrime); this.fivePrime = fivePrime; this.fivePrimeReadOrder = SequenceUtil.reverseComplement(fivePrime); this.fivePrimeBytes = StringUtil.stringToBytes(fivePrime); this.fivePrimeReadOrderBytes = StringUtil.stringToBytes(fivePrimeReadOrder); }