/** * create an interval-tree index with the default features per bin count * * @param inputFile the file containing the features * @param codec to decode the features */ public static <FEATURE_TYPE extends Feature, SOURCE_TYPE> IntervalTreeIndex createIntervalIndex(final File inputFile, final FeatureCodec<FEATURE_TYPE, SOURCE_TYPE> codec) { return createIntervalIndex(inputFile, codec, IntervalIndexCreator.DEFAULT_FEATURE_COUNT); }
/** * create an interval-tree index with the default features per bin count * * @param inputFile the file containing the features * @param codec to decode the features */ public static <FEATURE_TYPE extends Feature, SOURCE_TYPE> IntervalTreeIndex createIntervalIndex(final File inputFile, final FeatureCodec<FEATURE_TYPE, SOURCE_TYPE> codec) { return createIntervalIndex(inputFile, codec, IntervalIndexCreator.DEFAULT_FEATURE_COUNT); }
/** * create an interval-tree index with the default features per bin count * * @param inputFile the file containing the features * @param codec to decode the features */ public static <FEATURE_TYPE extends Feature, SOURCE_TYPE> IntervalTreeIndex createIntervalIndex(final File inputFile, final FeatureCodec<FEATURE_TYPE, SOURCE_TYPE> codec) { return createIntervalIndex(inputFile, codec, IntervalIndexCreator.DEFAULT_FEATURE_COUNT); }
/** * Create a index of the specified type with default binning parameters * * @param inputFile the input file to load features from * @param codec the codec to use for decoding records * @param type the type of index to create */ public static <FEATURE_TYPE extends Feature, SOURCE_TYPE> Index createIndex(final File inputFile, final FeatureCodec<FEATURE_TYPE, SOURCE_TYPE> codec, final IndexType type) { switch (type) { case INTERVAL_TREE: return createIntervalIndex(inputFile, codec); case LINEAR: return createLinearIndex(inputFile, codec); // Tabix index initialization requires additional information, so this construction method won't work. case TABIX: throw new UnsupportedOperationException("Tabix indices cannot be created through a generic interface"); } throw new IllegalArgumentException("Unrecognized IndexType " + type); }
/** * Create an index of the specified type with default binning parameters * * @param inputFile the input file to load features from * @param codec the codec to use for decoding records * @param type the type of index to create * @param sequenceDictionary May be null, but if present may reduce memory footprint for tabix index creation */ public static <FEATURE_TYPE extends Feature, SOURCE_TYPE> Index createIndex(final File inputFile, final FeatureCodec<FEATURE_TYPE, SOURCE_TYPE> codec, final IndexType type, final SAMSequenceDictionary sequenceDictionary) { switch (type) { case INTERVAL_TREE: return createIntervalIndex(inputFile, codec); case LINEAR: return createLinearIndex(inputFile, codec); case TABIX: return createTabixIndex(inputFile, codec, sequenceDictionary); } throw new IllegalArgumentException("Unrecognized IndexType " + type); }
/** * Create an index of the specified type with default binning parameters * * @param inputFile the input file to load features from * @param codec the codec to use for decoding records * @param type the type of index to create * @param sequenceDictionary May be null, but if present may reduce memory footprint for tabix index creation */ public static <FEATURE_TYPE extends Feature, SOURCE_TYPE> Index createIndex(final File inputFile, final FeatureCodec<FEATURE_TYPE, SOURCE_TYPE> codec, final IndexType type, final SAMSequenceDictionary sequenceDictionary) { switch (type) { case INTERVAL_TREE: return createIntervalIndex(inputFile, codec); case LINEAR: return createLinearIndex(inputFile, codec); case TABIX: return createTabixIndex(inputFile, codec, sequenceDictionary); } throw new IllegalArgumentException("Unrecognized IndexType " + type); }
idx = IndexFactory.createLinearIndex(inputFile, codec, binSize); } else { idx = IndexFactory.createIntervalIndex(inputFile, codec, binSize);
private static void createIndex(File idxFile, FeatureCodec codec) throws IOException { if (idxFile.exists()) { idxFile.delete(); } // Create the index Index idx = IndexFactory.createIntervalIndex(new File(testFile), codec, 10); LittleEndianOutputStream stream = null; try { stream = new LittleEndianOutputStream(new BufferedOutputStream(new FileOutputStream(idxFile))); idx.write(stream); } finally { if (stream != null) { stream.close(); } } idxFile.deleteOnExit(); }
Index idx = IndexFactory.createIntervalIndex(new File(bedFile), new BEDCodec(), batchSize);
public Index getIndex(final File vcfFile) { switch (type) { case DYNAMIC_SEEK : return IndexFactory.createDynamicIndex(vcfFile, new VCFCodec(), IndexFactory.IndexBalanceApproach.FOR_SEEK_TIME); case DYNAMIC_SIZE : return IndexFactory.createDynamicIndex(vcfFile, new VCFCodec(), IndexFactory.IndexBalanceApproach.FOR_SIZE); case LINEAR : return IndexFactory.createLinearIndex(vcfFile, new VCFCodec(), parameter); case INTERVAL : return IndexFactory.createIntervalIndex(vcfFile, new VCFCodec(), parameter); default : throw new TestException("Invalid index type"); } } }
public Index getIndex(final File vcfFile) { switch (type) { case DYNAMIC_SEEK : return IndexFactory.createDynamicIndex(vcfFile, new VCFCodec(), IndexFactory.IndexBalanceApproach.FOR_SEEK_TIME); case DYNAMIC_SIZE : return IndexFactory.createDynamicIndex(vcfFile, new VCFCodec(), IndexFactory.IndexBalanceApproach.FOR_SIZE); case LINEAR : return IndexFactory.createLinearIndex(vcfFile, new VCFCodec(), parameter); case INTERVAL : return IndexFactory.createIntervalIndex(vcfFile, new VCFCodec(), parameter); default : throw new TestException("Invalid index type"); } } }