public DynamicIndexCreator(final Path inputPath, final IndexFactory.IndexBalanceApproach iba) { this.iba = iba; // get a list of index creators creators = getIndexCreators(inputPath, iba); }
/** * Create a VariantContextWriter with an associated index using the default index creator * * @param name the name of this writer (i.e. the file name or stream) * @param location the path to the output file * @param output the output stream to write to * @param refDict the reference dictionary * @param enableOnTheFlyIndexing is OTF indexing enabled? */ protected IndexingVariantContextWriter(final String name, final Path location, final OutputStream output, final SAMSequenceDictionary refDict, final boolean enableOnTheFlyIndexing) { this(name, location, output, refDict); if ( enableOnTheFlyIndexing ) { initIndexingWriter(new DynamicIndexCreator(location, IndexFactory.IndexBalanceApproach.FOR_SEEK_TIME)); } }
@Override public Index finalizeIndex(final long finalFilePosition) { // finalize all of the indexes // return the score of the indexes we've generated final Map<Double,TribbleIndexCreator> mapping = scoreIndexes((double)featureCount/(double)basesSeen, creators, longestFeatureLength, iba); final TribbleIndexCreator creator = getMinIndex(mapping, this.iba); for (final Map.Entry<String, String> entry : properties.entrySet()) { creator.addProperty(entry.getKey(), entry.getValue()); } // add our statistics to the file creator.addProperty("FEATURE_LENGTH_MEAN",String.valueOf(stats.mean())); creator.addProperty("FEATURE_LENGTH_STD_DEV",String.valueOf(stats.standardDeviation())); creator.addProperty("MEAN_FEATURE_VARIANCE",String.valueOf(stats.variance())); // add the feature count creator.addProperty("FEATURE_COUNT",String.valueOf(featureCount)); // Now let's finalize and create the index itself return creator.finalizeIndex(finalFilePosition); }
/** * Create a VariantContextWriter with an associated index using the default index creator * * @param name the name of this writer (i.e. the file name or stream) * @param location the path to the output file * @param output the output stream to write to * @param refDict the reference dictionary * @param enableOnTheFlyIndexing is OTF indexing enabled? */ protected IndexingVariantContextWriter(final String name, final Path location, final OutputStream output, final SAMSequenceDictionary refDict, final boolean enableOnTheFlyIndexing) { this(name, location, output, refDict); if ( enableOnTheFlyIndexing ) { initIndexingWriter(new DynamicIndexCreator(location, IndexFactory.IndexBalanceApproach.FOR_SEEK_TIME)); } }
@Override public Index finalizeIndex(final long finalFilePosition) { // finalize all of the indexes // return the score of the indexes we've generated final Map<Double,TribbleIndexCreator> mapping = scoreIndexes((double)featureCount/(double)basesSeen, creators, longestFeatureLength, iba); final TribbleIndexCreator creator = getMinIndex(mapping, this.iba); for (final Map.Entry<String, String> entry : properties.entrySet()) { creator.addProperty(entry.getKey(), entry.getValue()); } // add our statistics to the file creator.addProperty("FEATURE_LENGTH_MEAN",String.valueOf(stats.mean())); creator.addProperty("FEATURE_LENGTH_STD_DEV",String.valueOf(stats.standardDeviation())); creator.addProperty("MEAN_FEATURE_VARIANCE",String.valueOf(stats.variance())); // add the feature count creator.addProperty("FEATURE_COUNT",String.valueOf(featureCount)); // Now let's finalize and create the index itself return creator.finalizeIndex(finalFilePosition); }
/** * create a dynamic index, given an input file, codec, and balance approach * * @param inputFile the input file to load features from * @param codec the codec to use for decoding records * @param iba the index balancing approach */ public static <FEATURE_TYPE extends Feature, SOURCE_TYPE> Index createDynamicIndex(final File inputFile, final FeatureCodec<FEATURE_TYPE, SOURCE_TYPE> codec, final IndexBalanceApproach iba) { // get a list of index creators final DynamicIndexCreator indexCreator = new DynamicIndexCreator(inputFile, iba); return createIndex(inputFile, new FeatureIterator<FEATURE_TYPE, SOURCE_TYPE>(inputFile, codec), indexCreator); }
public Index finalizeIndex(final long finalFilePosition) { // finalize all of the indexes // return the score of the indexes we've generated final Map<Double,TribbleIndexCreator> mapping = scoreIndexes((double)featureCount/(double)basesSeen, creators, longestFeatureLength, iba); final TribbleIndexCreator creator = getMinIndex(mapping, this.iba); for (final Map.Entry<String, String> entry : properties.entrySet()) { creator.addProperty(entry.getKey(), entry.getValue()); } // add our statistics to the file creator.addProperty("FEATURE_LENGTH_MEAN",String.valueOf(stats.mean())); creator.addProperty("FEATURE_LENGTH_STD_DEV",String.valueOf(stats.standardDeviation())); creator.addProperty("MEAN_FEATURE_VARIANCE",String.valueOf(stats.variance())); // add the feature count creator.addProperty("FEATURE_COUNT",String.valueOf(featureCount)); // Now let's finalize and create the index itself return creator.finalizeIndex(finalFilePosition); }
public DynamicIndexCreator(final Path inputPath, final IndexFactory.IndexBalanceApproach iba) { this.iba = iba; // get a list of index creators creators = getIndexCreators(inputPath, iba); }
/** * create a dynamic index, given an input file, codec, and balance approach * * @param inputFile the input file to load features from * @param codec the codec to use for decoding records * @param iba the index balancing approach */ public static <FEATURE_TYPE extends Feature, SOURCE_TYPE> Index createDynamicIndex(final File inputFile, final FeatureCodec<FEATURE_TYPE, SOURCE_TYPE> codec, final IndexBalanceApproach iba) { // get a list of index creators final DynamicIndexCreator indexCreator = new DynamicIndexCreator(inputFile, iba); return createIndex(inputFile, new FeatureIterator<FEATURE_TYPE, SOURCE_TYPE>(inputFile, codec), indexCreator); }
public DynamicIndexCreator(final File inputFile, final IndexFactory.IndexBalanceApproach iba) { this.iba = iba; // get a list of index creators this.inputFile = inputFile; creators = getIndexCreators(inputFile,iba); }
/** * create a dynamic index, given an input file, codec, and balance approach * * @param inputFile the input file to load features from * @param codec the codec to use for decoding records * @param iba the index balancing approach */ public static <FEATURE_TYPE extends Feature, SOURCE_TYPE> Index createDynamicIndex(final File inputFile, final FeatureCodec<FEATURE_TYPE, SOURCE_TYPE> codec, final IndexBalanceApproach iba) { // get a list of index creators final DynamicIndexCreator indexCreator = new DynamicIndexCreator(inputFile, iba); return createIndex(inputFile, new FeatureIterator<FEATURE_TYPE, SOURCE_TYPE>(inputFile, codec), indexCreator); }
/** * Create a VariantContextWriter with an associated index using the default index creator * * @param name the name of this writer (i.e. the file name or stream) * @param location the path to the output file * @param output the output stream to write to * @param refDict the reference dictionary * @param enableOnTheFlyIndexing is OTF indexing enabled? */ @Requires({"name != null", "! ( location == null && output == null )", "! ( enableOnTheFlyIndexing && location == null )"}) protected IndexingVariantContextWriter(final String name, final File location, final OutputStream output, final SAMSequenceDictionary refDict, final boolean enableOnTheFlyIndexing) { this(name, location, output, refDict); if ( enableOnTheFlyIndexing ) { initIndexingWriter(new DynamicIndexCreator(location, IndexFactory.IndexBalanceApproach.FOR_SEEK_TIME)); } }
/** * Create and return an IndexCreator * @param type * @param parameter * @param outFile * @param sequenceDictionary * @return */ public static IndexCreator getIndexCreator(GATKVCFIndexType type, int parameter, File outFile, SAMSequenceDictionary sequenceDictionary) { if (ArgumentTypeDescriptor.isCompressed(outFile.toString())) { if (type != GATKVCFUtils.DEFAULT_INDEX_TYPE || parameter != GATKVCFUtils.DEFAULT_INDEX_PARAMETER) logger.warn("Creating Tabix index for " + outFile + ", ignoring user-specified index type and parameter"); if (sequenceDictionary == null) return new TabixIndexCreator(TabixFormat.VCF); else return new TabixIndexCreator(sequenceDictionary, TabixFormat.VCF); } IndexCreator idxCreator; switch (type) { case DYNAMIC_SEEK: idxCreator = new DynamicIndexCreator(outFile, IndexFactory.IndexBalanceApproach.FOR_SEEK_TIME); break; case DYNAMIC_SIZE: idxCreator = new DynamicIndexCreator(outFile, IndexFactory.IndexBalanceApproach.FOR_SIZE); break; case LINEAR: idxCreator = new LinearIndexCreator(outFile, parameter); break; case INTERVAL: idxCreator = new IntervalIndexCreator(outFile, parameter); break; default: throw new IllegalArgumentException("Unknown IndexCreator type: " + type); } return idxCreator; }