@Test(enabled = true) public void testSamTextFileError2() { File samFile = new File(publicTestDir + "testfile.sam"); try { final SamInputResource samInputResource = SamInputResource.of(samFile); final SamReader reader = SamReaderFactory.makeDefault().open(samInputResource); reader.indexing().getFilePointerSpanningReads(); // we shouldn't get here Assert.fail("We should have exceptioned out when trying to call getFilePointerSpanningReads() for a textual SAM file"); } catch (RuntimeException e) { Assert.assertTrue(e.getMessage().indexOf(CommandLineGATK.PICARD_TEXT_SAM_FILE_ERROR_2) != -1); } } }
/** * Get the initial reader positions across all BAM files * * @return the start positions of the first chunk of reads for all BAM files */ protected Map<SAMReaderID, GATKBAMFileSpan> getInitialReaderPositions() { Map<SAMReaderID, GATKBAMFileSpan> initialPositions = new HashMap<SAMReaderID, GATKBAMFileSpan>(); SAMReaders readers = resourcePool.getAvailableReaders(); for ( SAMReaderID id: getReaderIDs() ) { final GATKBAMFileSpan span = new GATKBAMFileSpan(readers.getReader(id).indexing().getFilePointerSpanningReads()); initialPositions.put(id, span); } resourcePool.releaseReaders(readers); return initialPositions; }
SamReader open = SamReaderFactory.makeDefault().setUseAsyncIo(false) .open(SamInputResource.of(inFile)); SAMFileSpan span = open.indexing().getFilePointerSpanningReads(); long bamStart = ((BAMFileSpan) span).getFirstOffset(); newSplit = new FileVirtualSplit(fSplit.getPath(),
SamReader open = SamReaderFactory.makeDefault().setUseAsyncIo(false) .open(SamInputResource.of(inFile)); SAMFileSpan span = open.indexing().getFilePointerSpanningReads(); long bamStart = ((BAMFileSpan) span).getFirstOffset(); newSplit = new FileVirtualSplit(fSplit.getPath(),
SamReader open = SamReaderFactory.makeDefault().setUseAsyncIo(false) .open(SamInputResource.of(inFile)); SAMFileSpan span = open.indexing().getFilePointerSpanningReads(); if (span instanceof BAMFileSpan) { return ((BAMFileSpan) span).getFirstOffset();
SamReader open = SamReaderFactory.makeDefault().setUseAsyncIo(false) .open(SamInputResource.of(inFile)); SAMFileSpan span = open.indexing().getFilePointerSpanningReads(); if (span instanceof BAMFileSpan) { return ((BAMFileSpan) span).getFirstOffset();
open .indexing() .getFilePointerSpanningReads();
} else { long totalRefLength = header.getSequenceDictionary().getReferenceLength(); long totalRecordRange = ((BAMFileSpan)reader.indexing().getFilePointerSpanningReads()).toCoordinateArray()[1]; chunk = new Chunk(totalRefLength, totalRecordRange);
} else { long chunkStart = index.getStartOfLastLinearBin(); long totalRecordRange = ((BAMFileSpan) reader.indexing().getFilePointerSpanningReads()).toCoordinateArray()[1]; span = new BAMFileSpan(new Chunk(chunkStart, totalRecordRange));
@Override public SAMFileSpan getFilePointerSpanningReads() { return this.reader.indexing().getFilePointerSpanningReads(); }