private void advanceToReference(final String sequenceName) { if (indexBuilder != null) { indexContents.add(indexBuilder.generateIndexContent()); } // If sequence dictionary is provided, BinningIndexBuilder can reduce size of array it allocates. final int sequenceLength; if (sequenceDictionary != null) { sequenceLength = sequenceDictionary.getSequence(sequenceName).getSequenceLength(); } else { sequenceLength = 0; } indexBuilder = new BinningIndexBuilder(sequenceNames.size(), sequenceLength); sequenceNames.add(sequenceName); currentSequenceName = sequenceName; sequenceNamesSeen.add(sequenceName); }
private void finalizeFeature(final long featureEndPosition) { previousFeature.featureEndFilePosition = featureEndPosition; if (previousFeature.featureStartFilePosition >= previousFeature.featureEndFilePosition) { throw new IllegalArgumentException(String.format("Feature start position %d >= feature end position %d", previousFeature.featureStartFilePosition, previousFeature.featureEndFilePosition)); } indexBuilder.processFeature(previousFeature); }
@Override public Index finalizeIndex(final long finalFilePosition) { if (previousFeature != null) { finalizeFeature(finalFilePosition); } if (indexBuilder != null) { indexContents.add(indexBuilder.generateIndexContent()); } // Make this as big as the sequence dictionary, even if there is not content for every sequence, // but truncate the sequence dictionary before its end if there are sequences in the sequence dictionary without // any features. final BinningIndexContent[] indices = indexContents.toArray(new BinningIndexContent[sequenceNames.size()]); return new TabixIndex(formatSpec, sequenceNames, indices); }
/** * reinitialize all data structures when the reference changes */ void startNewReference() { ++currentReference; // I'm not crazy about recycling this object, but that is the way it was originally written and // it helps keep track of no-coordinate read count (which shouldn't be stored in this class anyway). indexStats.newReference(); binningIndexBuilder = new BinningIndexBuilder(currentReference, sequenceDictionary.getSequence(currentReference).getSequenceLength()); } }
final int binNum = binNumber == null ? computeIndexingBin(feature) : binNumber;
@Override public Index finalizeIndex(final long finalFilePosition) { if (previousFeature != null) { finalizeFeature(finalFilePosition); } if (indexBuilder != null) { indexContents.add(indexBuilder.generateIndexContent()); } // Make this as big as the sequence dictionary, even if there is not content for every sequence, // but truncate the sequence dictionary before its end if there are sequences in the sequence dictionary without // any features. final BinningIndexContent[] indices = indexContents.toArray(new BinningIndexContent[sequenceNames.size()]); return new TabixIndex(formatSpec, sequenceNames, indices); }
/** * reinitialize all data structures when the reference changes */ void startNewReference(int reference) { currentReference = reference; // I'm not crazy about recycling this object, but that is the way it was originally written and // it helps keep track of no-coordinate read count (which shouldn't be stored in this class anyway). indexStats.newReference(); binningIndexBuilder = new BinningIndexBuilder(currentReference, sequenceDictionary.getSequence(currentReference).getSequenceLength()); } }
final int binNum = binNumber == null ? computeIndexingBin(feature) : binNumber;
private void advanceToReference(final String sequenceName) { if (indexBuilder != null) { indexContents.add(indexBuilder.generateIndexContent()); } // If sequence dictionary is provided, BinningIndexBuilder can reduce size of array it allocates. final int sequenceLength; if (sequenceDictionary != null) { sequenceLength = sequenceDictionary.getSequence(sequenceName).getSequenceLength(); } else { sequenceLength = 0; } indexBuilder = new BinningIndexBuilder(sequenceNames.size(), sequenceLength); sequenceNames.add(sequenceName); currentSequenceName = sequenceName; sequenceNamesSeen.add(sequenceName); }
@Override public Index finalizeIndex(final long finalFilePosition) { if (previousFeature != null) { finalizeFeature(finalFilePosition); } if (indexBuilder != null) { indexContents.add(indexBuilder.generateIndexContent()); } // Make this as big as the sequence dictionary, even if there is not content for every sequence, // but truncate the sequence dictionary before its end if there are sequences in the sequence dictionary without // any features. final BinningIndexContent[] indices = indexContents.toArray(new BinningIndexContent[sequenceNames.size()]); return new TabixIndex(formatSpec, sequenceNames, indices); }
private void finalizeFeature(final long featureEndPosition) { previousFeature.featureEndFilePosition = featureEndPosition; if (previousFeature.featureStartFilePosition >= previousFeature.featureEndFilePosition) { throw new IllegalArgumentException(String.format("Feature start position %d >= feature end position %d", previousFeature.featureStartFilePosition, previousFeature.featureEndFilePosition)); } indexBuilder.processFeature(previousFeature); }
/** * reinitialize all data structures when the reference changes */ void startNewReference() { ++currentReference; // I'm not crazy about recycling this object, but that is the way it was originally written and // it helps keep track of no-coordinate read count (which shouldn't be stored in this class anyway). indexStats.newReference(); binningIndexBuilder = new BinningIndexBuilder(currentReference, sequenceDictionary.getSequence(currentReference).getSequenceLength()); } }
final int binNum = binNumber == null ? computeIndexingBin(feature) : binNumber;
private void advanceToReference(final String sequenceName) { if (indexBuilder != null) { indexContents.add(indexBuilder.generateIndexContent()); } // If sequence dictionary is provided, BinningIndexBuilder can reduce size of array it allocates. final int sequenceLength; if (sequenceDictionary != null) { sequenceLength = sequenceDictionary.getSequence(sequenceName).getSequenceLength(); } else { sequenceLength = 0; } indexBuilder = new BinningIndexBuilder(sequenceNames.size(), sequenceLength); sequenceNames.add(sequenceName); currentSequenceName = sequenceName; sequenceNamesSeen.add(sequenceName); }
/** * Creates the BAMIndexContent for this reference. * Requires all alignments of the reference have already been processed. * @return Null if there are no features for this reference. */ public BAMIndexContent processReference(final int reference) { if (reference != currentReference) { throw new SAMException("Unexpected reference " + reference + " when constructing index for " + currentReference); } final BinningIndexContent indexContent = binningIndexBuilder.generateIndexContent(); if (indexContent == null) return null; return new BAMIndexContent(indexContent.getReferenceSequence(), indexContent.getBins(), indexStats, indexContent.getLinearIndex()); }
private void finalizeFeature(final long featureEndPosition) { previousFeature.featureEndFilePosition = featureEndPosition; if (previousFeature.featureStartFilePosition >= previousFeature.featureEndFilePosition) { throw new IllegalArgumentException(String.format("Feature start position %d >= feature end position %d", previousFeature.featureStartFilePosition, previousFeature.featureEndFilePosition)); } indexBuilder.processFeature(previousFeature); }
/** * reinitialize all data structures when the reference changes */ void startNewReference(int reference) { currentReference = reference; // I'm not crazy about recycling this object, but that is the way it was originally written and // it helps keep track of no-coordinate read count (which shouldn't be stored in this class anyway). indexStats.newReference(); binningIndexBuilder = new BinningIndexBuilder(currentReference, sequenceDictionary.getSequence(currentReference).getSequenceLength()); } }
@Test(dataProvider = "BinningFeatures") public void testFeatureAtOffsetZero( final List<MockIndexableFeature> mockFeatures, final List<Chunk> expectedChunks, final long[] expectedBins) { // use a sequence length that spans at least two (16k) binning blocks final BinningIndexBuilder bib = new BinningIndexBuilder(REFERNCE_SEQUENCE_INDEX, 40000); mockFeatures.forEach(bib::processFeature); final BinningIndexContent bic = bib.generateIndexContent(); Assert.assertEquals(expectedBins, bic.getLinearIndex().getIndexEntries()); Assert.assertEquals(expectedChunks, bic.getAllChunks()); }
/** * Creates the BAMIndexContent for this reference. * Requires all alignments of the reference have already been processed. * * @return Null if there are no features for this reference. */ public BAMIndexContent processReference(final int reference) { if (reference != currentReference) { throw new SAMException("Unexpected reference " + reference + " when constructing index for " + currentReference); } final BinningIndexContent indexContent = binningIndexBuilder.generateIndexContent(); if (indexContent == null) return null; return new BAMIndexContent(indexContent.getReferenceSequence(), indexContent.getBins(), indexStats, indexContent.getLinearIndex()); }
binningIndexBuilder.processFeature(new BinningIndexBuilder.FeatureToBeIndexed() { @Override public int getStart() {