/** * Consume the entirety of the next container from the stream. * @param cramVersion * @param countingStream * @return The next Container from the stream. * @throws IOException */ protected Container containerFromStream(final Version cramVersion, final CountingInputStream countingStream) throws IOException { return ContainerIO.readContainer(cramHeader.getVersion(), countingStream); }
/** * Add a single read to the span * * @param start alignment start * @param span read span on the reference */ public void addSingle(final int start, final int span) { add(start, span, 1); }
private static void setNextMate(final CramCompressionRecord record, final CramCompressionRecord next) { record.mateAlignmentStart = next.alignmentStart; record.setMateUnmapped(next.isSegmentUnmapped()); record.setMateNegativeStrand(next.isNegativeStrand()); record.mateSequenceID = next.sequenceId; if (record.mateSequenceID == SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX) record.mateAlignmentStart = SAMRecord.NO_ALIGNMENT_START; }
/** * Reads next container from the stream. * * @param inputStream the stream to read from * @return CRAM container or null if no more data * @throws IOException */ private static Container readContainer(final int major, final InputStream inputStream) throws IOException { return readContainer(major, inputStream, 0, Integer.MAX_VALUE); }
/** * Writes a {@link Container} header information to a {@link OutputStream}. * * @param major the CRAM version to assume * @param container the container holding the header to write * @param outputStream the stream to write to * @return the number of bytes written * @throws IOException as per java IO contract */ public static int writeContainerHeader(final int major, final Container container, final OutputStream outputStream) throws IOException { return new ContainerHeaderIO().writeContainerHeader(major, container, outputStream); }
public static void read(final int major, final Slice slice, final InputStream inputStream) throws IOException { readSliceHeader(major, slice, inputStream); readSliceBlocks(major, slice, inputStream); } }
/** * Does this Slice contain reads placed on a single reference (whether their unmapped flags are set or not)? * @return true if all reads in the Slice are placed on a single reference */ public boolean isMappedSingleRef() { return ! isUnmapped() && ! isMultiref(); }
public int getAlignmentSpan() { if (alignmentSpan < 0) calculateAlignmentBoundaries(); return alignmentSpan; }
private static void setNextMate(final CramCompressionRecord record, final CramCompressionRecord next) { record.mateAlignmentStart = next.alignmentStart; record.setMateUnmapped(next.isSegmentUnmapped()); record.setMateNegativeStrand(next.isNegativeStrand()); record.mateSequenceID = next.sequenceId; if (record.mateSequenceID == SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX) record.mateAlignmentStart = SAMRecord.NO_ALIGNMENT_START; }
/** * Consume the entirety of the next container from the stream. * @param cramVersion * @param countingStream * @return The next Container from the stream. */ protected Container containerFromStream(final Version cramVersion, final CountingInputStream countingStream) { return ContainerIO.readContainer(cramHeader.getVersion(), countingStream); }
/** * Create a new span with a multiple reads in it. * * @param start alignment start of the span * @param span alignment span * @param count number of reads in the span */ public AlignmentSpan(final int start, final int span, final int count) { this.setStart(start); this.setSpan(span); this.count = count; }
/** * Reads next container from the stream. * * @param inputStream the stream to read from * @return CRAM container or null if no more data */ private static Container readContainer(final int major, final InputStream inputStream) { return readContainer(major, inputStream, 0, Integer.MAX_VALUE); }
/** * Writes a {@link Container} header information to a {@link OutputStream}. * * @param major the CRAM version to assume * @param container the container holding the header to write * @param outputStream the stream to write to * @return the number of bytes written */ public static int writeContainerHeader(final int major, final Container container, final OutputStream outputStream) { return new ContainerHeaderIO().writeContainerHeader(major, container, outputStream); }
public static void read(final int major, final Slice slice, final InputStream inputStream) { readSliceHeader(major, slice, inputStream); readSliceBlocks(major, slice, inputStream); } }
/** * Add a single read to the span * * @param start alignment start * @param span read span on the reference */ public void addSingle(final int start, final int span) { add(start, span, 1); }
private static void setNextMate(final CramCompressionRecord record, final CramCompressionRecord next) { record.mateAlignmentStart = next.alignmentStart; record.setMateUnmapped(next.isSegmentUnmapped()); record.setMateNegativeStrand(next.isNegativeStrand()); record.mateSequenceID = next.sequenceId; if (record.mateSequenceID == SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX) record.mateAlignmentStart = SAMRecord.NO_ALIGNMENT_START; }
private static void setNextMate(CramCompressionRecord r, CramCompressionRecord next) { r.mateAlignmentStart = next.alignmentStart; r.setMateUnmapped(next.isSegmentUnmapped()); r.setMateNegativeStrand(next.isNegativeStrand()); r.mateSequenceID = next.sequenceId; if (r.mateSequenceID == SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX) r.mateAlignmentStart = SAMRecord.NO_ALIGNMENT_START; }
/** * Create a new span with a multiple reads in it. * * @param start alignment start of the span * @param span alignment span * @param count number of reads in the span */ public AlignmentSpan(final int start, final int span, final int count) { this.setStart(start); this.setSpan(span); this.count = count; }