/**
   * Perform filtering on all VCF files for a given workflow. Filtering involves removing lines that
   * are not "PASS" or "." Output files will have ".pass-filtered." in their name.
   *
   * @param workflowName The workflow to PASS filter
   * @param parents List of parent jobs.
   * @return
   */
  private Job passFilterWorkflow(Pipeline workflowName, Job... parents) {
    // Job passFilter = this.getWorkflow().createBashJob("pass filter "+workflowName);
    PreprocessJobGenerator generator =
        new PreprocessJobGenerator(
            this.JSONlocation, this.JSONrepoName, this.JSONfolderName, this.JSONfileName);

    Job passFilter = generator.passFilterWorkflow(this, workflowName, parents);

    return passFilter;
  }
  /**
   * Combine vcfs by from from ALL tumours. This is needed when generating the minibam for Normals
   * BAMs in a multi-tumour scenario.
   *
   * @param parents
   * @return
   */
  private Job combineVCFsByType(Job... parents) {
    PreprocessJobGenerator generator =
        new PreprocessJobGenerator(
            this.JSONlocation, this.JSONrepo, this.JSONfolderName, this.JSONfileName);
    List<VcfInfo> nonIndels =
        this.vcfs.stream().filter(p -> isIndel.negate().test(p)).collect(Collectors.toList());
    List<VcfInfo> indels = this.normalizedIndels.stream().collect(Collectors.toList());
    Consumer<VcfInfo> updateMergedVCFs = (v) -> this.mergedVcfs.add(v);
    Job vcfCombineJob =
        generator.combineVCFsByType(this, nonIndels, indels, updateMergedVCFs, parents);

    return vcfCombineJob;
  }
  /**
   * Pre-processes INDEL VCFs. Normalizes INDELs and extracts SNVs from normalized INDELs.
   *
   * @param parent
   * @param workflowName The name of the workflow whose files will be pre-processed.
   * @param vcfName The name of the INDEL VCF to normalize.
   * @return
   */
  private Job preProcessIndelVCF(
      Job parent, Pipeline workflowName, String vcfName, String tumourAliquotID) {
    PreprocessJobGenerator generator =
        new PreprocessJobGenerator(
            this.JSONlocation, this.JSONrepo, this.JSONfolderName, this.JSONfileName);
    generator.setTumourAliquotID(tumourAliquotID);
    Consumer<VcfInfo> updateExtractedSNVs = (v) -> this.extractedSnvsFromIndels.add(v);
    Consumer<VcfInfo> updateNormalizedINDELs = (v) -> this.normalizedIndels.add(v);
    Job preProcess =
        generator.preProcessIndelVCF(
            this,
            parent,
            workflowName,
            vcfName,
            this.refFile,
            this.updateFilesForUpload,
            updateExtractedSNVs,
            updateNormalizedINDELs);

    return preProcess;
  }