SAMFileHeader header = SAMHeaderReader.readSAMHeaderFrom(in, conf); SAMSequenceDictionary dict = header.getSequenceDictionary(); BAMIndex idx = samReader.indexing().getIndex();
/** * 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; }
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()); }
if (reader.indexing().hasBrowseableIndex()) { bamIndices.put(id, new GATKBAMIndexFromDataSource(id.getSamFile(), reader.getFileHeader(), reader.indexing().getBrowseableIndex()));
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();
SAMFileHeader header = SAMHeaderReader.readSAMHeaderFrom(in, conf); SAMSequenceDictionary dict = header.getSequenceDictionary(); BAMIndex idx = samReader.indexing().getIndex();
if (reader.indexing().hasBrowseableIndex()) { if (SamIndexes.BAI.fileNameSuffix.endsWith(reader.type().indexExtension())) { final CachingBAMFileIndex existingIndex = (CachingBAMFileIndex) reader.indexing().getBrowseableIndex(); final int numRefs = existingIndex.getNumberOfReferences(); } else if (SamIndexes.CSI.fileNameSuffix.endsWith(reader.type().indexExtension())) { final CSIIndex existingIndex = (CSIIndex) reader.indexing().getBrowseableIndex(); // new CachingBAMFileIndex(inputBai, null); final int numRefs = existingIndex.getNumberOfReferences();
public static int exhaustivelyTestIndex(final SamReader reader) { // throws Exception { if (reader.indexing().hasBrowseableIndex()) { if (SamIndexes.BAI.fileNameSuffix.endsWith(reader.type().indexExtension())) { final CachingBAMFileIndex existingIndex = (CachingBAMFileIndex) reader.indexing().getBrowseableIndex(); // new CachingBAMFileIndex(inputBai, null); final int numRefs = existingIndex.getNumberOfReferences(); final CSIIndex existingIndex = (CSIIndex) reader.indexing().getBrowseableIndex(); // new CachingBAMFileIndex(inputBai, null); final int numRefs = existingIndex.getNumberOfReferences();
SAMFileHeader header = SAMHeaderReader.readSAMHeaderFromStream(in, conf); SAMSequenceDictionary dict = header.getSequenceDictionary(); BAMIndex idx = samReader.indexing().getIndex(); QueryInterval[] queryIntervals = prepareQueryIntervals(intervals, dict); fileToSpan.put(bamFile, BAMFileReader.getFileSpan(queryIntervals, idx));
open .indexing() .getFilePointerSpanningReads();
if (reader.indexing().hasBrowseableIndex()) { final CachingBAMFileIndex existingIndex = (CachingBAMFileIndex) reader.indexing().getBrowseableIndex(); final int numRefs = existingIndex.getNumberOfReferences();
iterator = ((SamReader.Indexing)reader).iterator(shard.getFileSpans().get(id));
public static int exhaustivelyTestIndex(final SamReader reader) { // throws Exception { if (reader.indexing().hasBrowseableIndex()) { final CachingBAMFileIndex existingIndex = (CachingBAMFileIndex) reader.indexing().getBrowseableIndex(); // new CachingBAMFileIndex(inputBai, null); final int numRefs = existingIndex.getNumberOfReferences();
Assert.assertTrue(reader.hasIndex()); final int sequenceIndex = reader.getFileHeader().getSequenceIndex("11"); BAMIndexMetaData metaData = reader.indexing().getIndex().getMetaData(sequenceIndex); Assert.assertEquals(EXPECTED_ALL_READS - EXPECTED_UNMAPPED_READS, metaData.getAlignedRecordCount());
int numRefs = samReader.getFileHeader().getSequenceDictionary().size(); Indexing index = samReader.indexing(); BAMIndex bai = index.getIndex(); for (int i = 0; i < numRefs; i++) {
} else { long totalRefLength = header.getSequenceDictionary().getReferenceLength(); long totalRecordRange = ((BAMFileSpan)reader.indexing().getFilePointerSpanningReads()).toCoordinateArray()[1]; chunk = new Chunk(totalRefLength, totalRecordRange); final SAMRecordIterator samRecordIterator = ((SamReader.Indexing) reader).iterator(new BAMFileSpan(chunk));
Assert.assertTrue(reader.indexing().hasBrowseableIndex()); BrowseableBAMIndex index = reader.indexing().getBrowseableIndex(); } else { long chunkStart = index.getStartOfLastLinearBin(); long totalRecordRange = ((BAMFileSpan) reader.indexing().getFilePointerSpanningReads()).toCoordinateArray()[1]; span = new BAMFileSpan(new Chunk(chunkStart, totalRecordRange)); final SAMRecordIterator samRecordIterator = ((SamReader.Indexing) reader).iterator(span);