@Override public void encode(final SAMRecordsForCluster val) { if (val.records.length != numRecords) { throw new IllegalStateException(String.format("Expected number of clusters %d != actual %d", numRecords, val.records.length)); } for (final SAMRecord rec : val.records) { bamCodec.encode(rec); } }
@Override public void encode(final SAMRecordsForCluster val) { if (val.records.length != numRecords) { throw new IllegalStateException(String.format("Expected number of clusters %d != actual %d", numRecords, val.records.length)); } for (final SAMRecord rec : val.records) { bamCodec.encode(rec); } }
protected void writeAlignment(final SAMRecord rec) throws IOException { if (splittingBAMIndexer != null) { splittingBAMIndexer.processAlignment(compressedOut.getFilePointer()); } recordCodec.encode(rec); }
protected void writeAlignment(final SAMRecord rec) throws IOException { if (splittingBAMIndexer != null) { splittingBAMIndexer.processAlignment(compressedOut.getFilePointer()); } recordCodec.encode(rec); }
protected void writeAlignment(final SAMRecord rec) throws IOException { if (splittingBAMIndexer != null) { splittingBAMIndexer.processAlignment(compressedOut.getFilePointer()); } recordCodec.encode(rec); }
@Override public void write(DataOutput out) throws IOException { // In theory, it shouldn't matter whether we give a header to // BAMRecordCodec or not, since the representation of an alignment in BAM // doesn't depend on the header data at all. Only its interpretation // does, and a simple read/write codec shouldn't really have anything to // say about that. (But in practice, it already does matter for decode(), // which is why LazyBAMRecordFactory exists.) final BAMRecordCodec codec = new BAMRecordCodec(record.getHeader()); codec.setOutputStream(new DataOutputWrapper(out)); codec.encode(record); } @Override public void readFields(DataInput in) throws IOException {
@Override public void write(DataOutput out) throws IOException { // In theory, it shouldn't matter whether we give a header to // BAMRecordCodec or not, since the representation of an alignment in BAM // doesn't depend on the header data at all. Only its interpretation // does, and a simple read/write codec shouldn't really have anything to // say about that. (But in practice, it already does matter for decode(), // which is why LazyBAMRecordFactory exists.) final BAMRecordCodec codec = new BAMRecordCodec(record.getHeader()); codec.setOutputStream(new DataOutputWrapper(out)); codec.encode(record); } @Override public void readFields(DataInput in) throws IOException {
@Override public void write(DataOutput out) throws IOException { // In theory, it shouldn't matter whether we give a header to // BAMRecordCodec or not, since the representation of an alignment in BAM // doesn't depend on the header data at all. Only its interpretation // does, and a simple read/write codec shouldn't really have anything to // say about that. (But in practice, it already does matter for decode(), // which is why LazyBAMRecordFactory exists.) final BAMRecordCodec codec = new BAMRecordCodec(record.getHeader()); codec.setOutputStream(new DataOutputWrapper(out)); codec.encode(record); } @Override public void readFields(DataInput in) throws IOException {
for (CramCompressionRecord record : records) { SAMRecord samRecord = f.create(record); codec.encode(samRecord);
@Override protected void writeAlignment(final SAMRecord alignment) { prepareToWriteAlignments(); if (bamIndexer != null) { try { final long startOffset = blockCompressedOutputStream.getFilePointer(); bamRecordCodec.encode(alignment); final long stopOffset = blockCompressedOutputStream.getFilePointer(); // set the alignment's SourceInfo and then prepare its index information alignment.setFileSource(new SAMFileSource(null, new BAMFileSpan(new Chunk(startOffset, stopOffset)))); bamIndexer.processAlignment(alignment); } catch (Exception e) { bamIndexer = null; throw new SAMException("Exception when processing alignment for BAM index " + alignment, e); } } else { bamRecordCodec.encode(alignment); } }
protected void writeAlignment(final SAMRecord alignment) { prepareToWriteAlignments(); if (bamIndexer != null) { try { final long startOffset = blockCompressedOutputStream.getFilePointer(); bamRecordCodec.encode(alignment); final long stopOffset = blockCompressedOutputStream.getFilePointer(); // set the alignment's SourceInfo and then prepare its index information alignment.setFileSource(new SAMFileSource(null, new BAMFileSpan(new Chunk(startOffset, stopOffset)))); bamIndexer.processAlignment(alignment); } catch (Exception e) { bamIndexer = null; throw new SAMException("Exception when processing alignment for BAM index " + alignment, e); } } else { bamRecordCodec.encode(alignment); } }
@Override protected void writeAlignment(final SAMRecord alignment) { prepareToWriteAlignments(); if (bamIndexer != null) { try { final long startOffset = blockCompressedOutputStream.getFilePointer(); bamRecordCodec.encode(alignment); final long stopOffset = blockCompressedOutputStream.getFilePointer(); // set the alignment's SourceInfo and then prepare its index information alignment.setFileSource(new SAMFileSource(null, new BAMFileSpan(new Chunk(startOffset, stopOffset)))); bamIndexer.processAlignment(alignment); } catch (Exception e) { bamIndexer = null; throw new SAMException("Exception when processing alignment for BAM index " + alignment, e); } } else { bamRecordCodec.encode(alignment); } }