code: public Path createIndex(Path indexPath) throws IOException {
          VCFFileReader reader = new VCFFileReader(input.toFile(), false);
  
          // compress vcf if necessary, .gz
          if (!dataPath.getFileName().endsWith(".gz")) {
              dataPath = Paths.get(input + ".gz");
              System.out.println("Creating compressed file: " + dataPath);
              VariantContextWriter writer = new VariantContextWriterBuilder()
                      .setOutputFile(dataPath.toFile())
                      .setOutputFileType(BLOCK_COMPRESSED_VCF)
                      .build();
  
              writer.writeHeader(reader.getFileHeader());
              for (VariantContext vc: reader) {
                  if (vc != null) {
                      writer.add(vc);
                  }
              }
              writer.close();
          }
  
  
          // and then create the tabix index, .tbi
          if (indexPath == null) {
              this.indexPath = Paths.get(dataPath + ".tbi");
          } else {
              this.indexPath = indexPath;
          }
  
  
          System.out.println("Creating index file: " + this.indexPath);
          IndexFactory.createTabixIndex(dataPath.toFile(), new VCFCodec(), TabixFormat.VCF, reader.getFileHeader().getSequenceDictionary())
                  .write(this.indexPath.toFile());
          reader.close();
          return this.indexPath;
      }
docs: Creates a VCF index file.
  @param indexPath The index created.
  @return
  @throws IOException