void processHeader() { contigsByReference = Maps.newHashMap(); for (Contig contig : requestedContigs) { contigsByReference.put(contig.referenceName != null ? contig.referenceName : "", contig); } if (contigsByReference.size() == 0 || contigsByReference.containsKey("*")) { LOG.info("Outputting unmapped reads shard "); output.output(new BAMShard(filePath, null, new Contig("*", 0, -1))); } allReferences = contigsByReference.size() == 0 || contigsByReference.containsKey(""); LOG.info("All references = " + allReferences); LOG.info("BAM has index = " + reader.hasIndex()); LOG.info("BAM has browseable index = " + reader.indexing().hasBrowseableIndex()); LOG.info("Class for index = " + reader.indexing().getIndex().getClass().getName()); }
void processHeader() { contigsByReference = Maps.newHashMap(); for (Contig contig : requestedContigs) { contigsByReference.put(contig.referenceName != null ? contig.referenceName : "", contig); } if (contigsByReference.size() == 0 || contigsByReference.containsKey("*")) { LOG.info("Outputting unmapped reads shard "); output.output(new BAMShard(filePath, null, new Contig("*", 0, -1))); } allReferences = contigsByReference.size() == 0 || contigsByReference.containsKey(""); LOG.info("All references = " + allReferences); LOG.info("BAM has index = " + reader.hasIndex()); LOG.info("BAM has browseable index = " + reader.indexing().hasBrowseableIndex()); LOG.info("Class for index = " + reader.indexing().getIndex().getClass().getName()); }
@Test(dataProvider = "composeAllPermutationsOfSamInputResource") public void exhaustInputResourcePermutation(final SamInputResource resource) throws IOException { try(final SamReader reader = SamReaderFactory.makeDefault().open(resource)) { LOG.info(String.format("Reading from %s ...", resource)); final List<SAMRecord> slurped = Iterables.slurp(reader); final SAMFileHeader fileHeader = reader.getFileHeader(); reader.hasIndex(); reader.indexing().hasBrowseableIndex(); /* Ensure all tests have read the same records in the same order or, if this is the first test, set it as the template. */ observedHeaders.add(fileHeader); observedRecordOrdering.add(slurped); } Assert.assertEquals(observedHeaders.size(), 1, "read different headers than other testcases"); Assert.assertEquals(observedRecordOrdering.size(), 1, "read different records than other testcases"); }
if (reader.indexing().hasBrowseableIndex()) { bamIndices.put(id, new GATKBAMIndexFromDataSource(id.getSamFile(), reader.getFileHeader(), reader.indexing().getBrowseableIndex()));
public static int exhaustivelyTestIndex(final SamReader reader) { // throws Exception { if (reader.indexing().hasBrowseableIndex()) { if (SamIndexes.BAI.fileNameSuffix.endsWith(reader.type().indexExtension())) {
if (reader.indexing().hasBrowseableIndex()) { if (SamIndexes.BAI.fileNameSuffix.endsWith(reader.type().indexExtension())) {
public static int exhaustivelyTestIndex(final SamReader reader) { // throws Exception { if (reader.indexing().hasBrowseableIndex()) {
if (reader.indexing().hasBrowseableIndex()) {
Assert.assertTrue(reader.indexing().hasBrowseableIndex());
void openFile() throws IOException { final BAMIO.ReaderAndIndex r = BAMIO.openBAMAndExposeIndex(storageClient, filePath, ValidationStringency.DEFAULT_STRINGENCY); reader = r.reader; indexStream = r.index; header = reader.getFileHeader(); hasIndex = reader.hasIndex() && reader.indexing().hasBrowseableIndex(); LOG.info("Has index = " + hasIndex); if (hasIndex) { index = new BAMFileIndexImpl( IOUtil.maybeBufferedSeekableStream(indexStream),header.getSequenceDictionary()); } else { index = null; } }
void openFile() throws IOException { final BAMIO.ReaderAndIndex r = BAMIO.openBAMAndExposeIndex(storageClient, filePath, ValidationStringency.DEFAULT_STRINGENCY); reader = r.reader; indexStream = r.index; header = reader.getFileHeader(); hasIndex = reader.hasIndex() && reader.indexing().hasBrowseableIndex(); LOG.info("Has index = " + hasIndex); if (hasIndex) { index = new BAMFileIndexImpl( IOUtil.maybeBufferedSeekableStream(indexStream),header.getSequenceDictionary()); } else { index = null; } }
@BeforeClass public void init() throws IOException { final SamReader reader = SamReaderFactory.makeDefault().enable(SamReaderFactory.Option.CACHE_FILE_BASED_INDEXES).open(bamFile); Assert.assertTrue(reader.hasIndex()); Assert.assertTrue(reader.indexing().hasBrowseableIndex()); bamIndex = new GATKBAMIndexFromDataSource(bamFile, reader.getFileHeader(), reader.indexing().getBrowseableIndex()); reader.close(); }