@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); }
stats.push(longestFeatureLength);
public void addFeature(final Feature f, final long filePosition) { // protected static Map<Double,Index> createIndex(FileBasedFeatureIterator<Feature> iterator, Map<IndexType,IndexCreator> creators, IndexBalanceApproach iba) { // feed each feature to the indexes we've created // first take care of the stats featureCount++; // calculate the number of bases seen - we have to watch out for the situation where the last record was on the previous chromosome basesSeen = (lastFeature == null) ? basesSeen + f.getStart() : ((f.getStart() - lastFeature.getStart() >= 0) ? basesSeen + (f.getStart() - lastFeature.getStart()) : basesSeen + f.getStart()); longestFeatureLength = Math.max(longestFeatureLength,(f.getEnd()-f.getStart()) + 1); // push the longest feature to the running stats stats.push(longestFeatureLength); // now feed the feature to each of our creators for (final IndexCreator creator : creators.values()) { creator.addFeature(f,filePosition); } //Redundant check, done in IndexFactory // if the last feature is after the current feature, exception out // if (lastFeature != null && f.getStart() < lastFeature.getStart() && lastFeature.getChr().equals(f.getChr())) // throw new TribbleException.MalformedFeatureFile("We saw a record with a start of " + f.getChr() + ":" + f.getStart() + // " after a record with a start of " + lastFeature.getChr() + ":" + lastFeature.getStart(), inputFile.getAbsolutePath()); // save the last feature lastFeature = f; }
stats.push(longestFeatureLength);
@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); }
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 double standardDeviation() { return Math.sqrt(variance()); } }
public double standardDeviation() { return Math.sqrt(variance()); } }
public double standardDeviation() { return Math.sqrt(variance()); } }