code: @Deprecated
      public Path index(Path bigwigPath) throws Exception {
  //        FileUtils.checkFile(indexPath);
          ChunkFrequencyManager chunkFrequencyManager = new ChunkFrequencyManager(indexPath);
  
          // get the chunk size
          int chunkSize = chunkFrequencyManager.getChunkSize();
  
          int prevChunk = 0, startChunk, endChunk, partial;
          String currChrom, prevChrom = null;
          List<Integer> values = new ArrayList<>();
  
          // and then iterate BigWig file
          BigWigIterator bwIterator = bbFileReader.getBigWigIterator();
          while (bwIterator.hasNext()) {
              WigItem wigItem = bwIterator.next();
  
              // get info from wig item
              currChrom = wigItem.getChromosome();
              startChunk = wigItem.getStartBase() / chunkSize;
              endChunk = wigItem.getEndBase() / chunkSize;
  
              // chromosome change, we must store previous chromosome values
              if (prevChrom != currChrom) {
                  if (values.size() > 0) {
                      WigUtils.computeAndSaveMeanValues(values, bigwigPath, prevChrom, chunkSize, chunkFrequencyManager);
                  }
                  currChrom = prevChrom;
              }
  
              if (prevChunk != startChunk) {
                  for (int chunk = prevChunk; chunk < startChunk; chunk++) {
                      values.add(0);
                  }
              }
  
              for (int chunk = startChunk, pos = startChunk * chunkSize;
                   chunk <= endChunk;
                   chunk++, pos += chunkSize) {
                  // compute how many values are within the current chunk
                  // and update the chunk
                  partial = Math.min(wigItem.getEndBase(), pos + chunkSize) - Math.max(wigItem.getStartBase(), pos);
                  values.add((int) (partial * wigItem.getWigValue()));
              }
              prevChunk = endChunk;
          }
  
          if (values.size() > 0) {
              WigUtils.computeAndSaveMeanValues(values, bigwigPath, prevChrom, chunkSize, chunkFrequencyManager);
          }
  
          return indexPath;
      }
docs: Index the entire Big Wig file content in a SQLite database.
  
  @param bigwigPath    Path to the Big Wig file to index
  @return              Path to the index (database file)
  @throws Exception