public MisencodedBAM(SAMRecord read, String message) { this(read.getFileSource() != null ? read.getFileSource().getReader().toString() : "(none)", message); }
public MalformedBAM(SAMRecord read, String message) { this(read.getFileSource() != null ? read.getFileSource().getReader().toString() : "(none)", message); }
/** * Retrieves the id of the reader which built the given read. * @param read The read to test. * @return ID of the reader. */ public SAMReaderID getReaderID(SAMRecord read) { return resourcePool.getReaderID(read.getFileSource().getReader()); }
@Override public Chunk getChunk() { final SAMFileSource source = rec.getFileSource(); if (source == null) { throw new SAMException("No source (virtual file offsets); needed for indexing on BAM Record " + rec); } return ((BAMFileSpan) source.getFilePointer()).getSingleChunk(); } });
@Override public Chunk getChunk() { final SAMFileSource source = rec.getFileSource(); if (source == null) { throw new SAMException("No source (virtual file offsets); needed for indexing on BAM Record " + rec); } return ((BAMFileSpan) source.getFilePointer()).getSingleChunk(); } });
@Override public Chunk getChunk() { final SAMFileSource source = rec.getFileSource(); if (source == null) { throw new SAMException("No source (virtual file offsets); needed for indexing on BAM Record " + rec); } return ((BAMFileSpan) source.getFilePointer()).getSingleChunk(); } });
@Override public Chunk getChunk() { final SAMFileSource source = rec.getFileSource(); if (source == null) { throw new SAMException("No source (virtual file offsets); needed for indexing on BAM Record " + rec); } return ((BAMFileSpan) source.getFilePointer()).getSingleChunk(); } });
/** * Process the given record for the index. * @param rec the record from the file being indexed * @throws IOException */ public void processAlignment(final SAMRecord rec) throws IOException { // write an offset for the first record and for the g-th record thereafter (where // g is the granularity), to be consistent with the index method if (count == 0 || (count + 1) % granularity == 0) { SAMFileSource fileSource = rec.getFileSource(); SAMFileSpan filePointer = fileSource.getFilePointer(); writeVirtualOffset(getPos(filePointer)); } count++; }
@Override public Chunk getChunk() { final SAMFileSource source = rec.getFileSource(); if (source == null) { throw new SAMException("No source (virtual file offsets); needed for indexing on BAM Record " + rec); } return ((BAMFileSpan) source.getFilePointer()).getSingleChunk(); } });
public MissortedBAM(SAMFileHeader.SortOrder order, SAMRecord read, String message) { super(String.format("Missorted input SAM/BAM/CRAM file %s: file sorted in %s order but %s is required. Please see " + HelpConstants.articlePost(1317) + "for more information. Error details: %s", read.getFileSource().getReader(), read.getHeader().getSortOrder(), order, message)); }
/** * Process the given record for the index. * @param rec the record from the file being indexed * @throws IOException */ public void processAlignment(final SAMRecord rec) throws IOException { // write an offset for the first record and for the g-th record thereafter (where // g is the granularity), to be consistent with the index method if (count == 0 || (count + 1) % granularity == 0) { SAMFileSource fileSource = rec.getFileSource(); SAMFileSpan filePointer = fileSource.getFilePointer(); writeVirtualOffset(getPos(filePointer)); } count++; }
/** * Process the given record for the index. * @param rec the record from the file being indexed * @throws IOException */ public void processAlignment(final SAMRecord rec) throws IOException { // write an offset for the first record and for the g-th record thereafter (where // g is the granularity), to be consistent with the index method if (count == 0 || (count + 1) % granularity == 0) { SAMFileSource fileSource = rec.getFileSource(); SAMFileSpan filePointer = fileSource.getFilePointer(); writeVirtualOffset(getPos(filePointer)); } count++; }
/** * Gets the reader associated with the given read. * @param readers Available readers. * @param read * @return */ private SAMReaderID getReaderID(SAMReaders readers, SAMRecord read) { for(SAMReaderID id: getReaderIDs()) { if(readers.getReader(id) == read.getFileSource().getReader()) return id; } throw new ReviewedGATKException("Unable to find id for reader associated with read " + read.getReadName()); }
/** * Extract relevant metaData from the record and its filePointer * Call only once per record in the file being indexed * * @param rec */ void recordMetaData(final SAMRecord rec) { final int alignmentStart = rec.getAlignmentStart(); if (alignmentStart == SAMRecord.NO_ALIGNMENT_START) { incrementNoCoordinateRecordCount(); return; } if (rec.getFileSource() == null) { throw new SAMException("BAM cannot be indexed without setting a fileSource for record " + rec); } final Chunk newChunk = ((BAMFileSpan) rec.getFileSource().getFilePointer()).getSingleChunk(); final long start = newChunk.getChunkStart(); final long end = newChunk.getChunkEnd(); if (rec.getReadUnmappedFlag()) { unAlignedRecords++; } else { alignedRecords++; } if (BlockCompressedFilePointerUtil.compare(start, firstOffset) < 1 || firstOffset == -1) { this.firstOffset = start; } if (BlockCompressedFilePointerUtil.compare(lastOffset, end) < 1) { this.lastOffset = end; } }
/** * Extract relevant metaData from the record and its filePointer * Call only once per record in the file being indexed * * @param rec */ void recordMetaData(final SAMRecord rec) { final int alignmentStart = rec.getAlignmentStart(); if (alignmentStart == SAMRecord.NO_ALIGNMENT_START) { incrementNoCoordinateRecordCount(); return; } if (rec.getFileSource() == null) { throw new SAMException("BAM cannot be indexed without setting a fileSource for record " + rec); } final Chunk newChunk = ((BAMFileSpan) rec.getFileSource().getFilePointer()).getSingleChunk(); final long start = newChunk.getChunkStart(); final long end = newChunk.getChunkEnd(); if (rec.getReadUnmappedFlag()) { unAlignedRecords++; } else { alignedRecords++; } if (BlockCompressedFilePointerUtil.compare(start, firstOffset) < 1 || firstOffset == -1) { this.firstOffset = start; } if (BlockCompressedFilePointerUtil.compare(lastOffset, end) < 1) { this.lastOffset = end; } }
/** * Extract relevant metaData from the record and its filePointer * Call only once per record in the file being indexed * * @param rec */ void recordMetaData(final SAMRecord rec) { final int alignmentStart = rec.getAlignmentStart(); if (alignmentStart == SAMRecord.NO_ALIGNMENT_START) { incrementNoCoordinateRecordCount(); return; } if (rec.getFileSource() == null){ throw new SAMException("BAM cannot be indexed without setting a fileSource for record " + rec); } final Chunk newChunk = ((BAMFileSpan) rec.getFileSource().getFilePointer()).getSingleChunk(); final long start = newChunk.getChunkStart(); final long end = newChunk.getChunkEnd(); if (rec.getReadUnmappedFlag()) { unAlignedRecords++; } else { alignedRecords++; } if (BlockCompressedFilePointerUtil.compare(start, firstOffset) < 1 || firstOffset == -1) { this.firstOffset = start; } if (BlockCompressedFilePointerUtil.compare(lastOffset, end) < 1) { this.lastOffset = end; } }
private void processAlignment(final SBIIndexWriter indexWriter, final SAMRecord rec) { final SAMFileSource source = rec.getFileSource(); if (source == null) { throw new SAMException("No source (virtual file offsets); needed for indexing on BAM Record " + rec); } final BAMFileSpan filePointer = (BAMFileSpan) source.getFilePointer(); indexWriter.processRecord(filePointer.getFirstOffset()); }
super.setFileSource(read.getFileSource()); super.setReadName(read.getReadName()); super.setCigarString(read.getCigarString());