public void initialize() {

    // Initialize VCF header
    if (vcfWriter != null) {
      Map<String, VCFHeader> header =
          GATKVCFUtils.getVCFHeadersFromRodPrefix(getToolkit(), alleles.getName());
      samples =
          SampleUtils.getSampleList(
              header, GATKVariantContextUtils.GenotypeMergeType.REQUIRE_UNIQUE);
      Set<VCFHeaderLine> headerLines = VCFUtils.smartMergeHeaders(header.values(), true);
      headerLines.add(new VCFHeaderLine("source", "GenotypeAndValidate"));
      headerLines.add(
          GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.GENOTYPE_AND_VALIDATE_STATUS_KEY));
      vcfWriter.writeHeader(new VCFHeader(headerLines, samples));
    }

    // Filling in SNP calling arguments for UG
    UnifiedArgumentCollection uac = new UnifiedArgumentCollection();
    uac.outputMode = OutputMode.EMIT_ALL_SITES;
    uac.alleles = alleles;

    // TODO -- if we change this tool to actually validate against the called allele, then this if
    // statement is needed;
    // TODO -- for now, though, we need to be able to validate the right allele (because we only
    // test isVariant below) [EB]
    // if (!bamIsTruth)
    uac.genotypingOutputMode = GenotypingOutputMode.GENOTYPE_GIVEN_ALLELES;

    if (mbq >= 0) uac.MIN_BASE_QUALTY_SCORE = mbq;
    if (deletions >= 0) uac.MAX_DELETION_FRACTION = deletions;
    else uac.MAX_DELETION_FRACTION = 1.0;
    if (emitConf >= 0) uac.genotypeArgs.STANDARD_CONFIDENCE_FOR_EMITTING = emitConf;
    if (callConf >= 0) uac.genotypeArgs.STANDARD_CONFIDENCE_FOR_CALLING = callConf;

    final GenomeAnalysisEngine toolkit = getToolkit();
    uac.GLmodel = GenotypeLikelihoodsCalculationModel.Model.SNP;
    snpEngine =
        new UnifiedGenotypingEngine(
            uac, FixedAFCalculatorProvider.createThreadSafeProvider(toolkit, uac, logger), toolkit);

    // Adding the INDEL calling arguments for UG
    UnifiedArgumentCollection uac_indel = uac.clone();
    uac_indel.GLmodel = GenotypeLikelihoodsCalculationModel.Model.INDEL;
    indelEngine =
        new UnifiedGenotypingEngine(
            uac_indel,
            FixedAFCalculatorProvider.createThreadSafeProvider(toolkit, uac, logger),
            toolkit);

    // make sure we have callConf set to the threshold set by the UAC so we can use it later.
    callConf = uac.genotypeArgs.STANDARD_CONFIDENCE_FOR_CALLING;
  }
Esempio n. 2
0
  /**
   * Gets the header lines for the VCF writer
   *
   * @return A set of VCF header lines
   */
  private static Set<VCFHeaderLine> getHeaderInfo() {
    Set<VCFHeaderLine> headerLines = new HashSet<>();

    // INFO fields for overall data
    headerLines.add(VCFStandardHeaderLines.getInfoLine(VCFConstants.END_KEY));
    headerLines.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.AVG_INTERVAL_DP_KEY));
    headerLines.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.INTERVAL_GC_CONTENT_KEY));
    headerLines.add(
        new VCFInfoHeaderLine(
            "Diagnose Targets", 0, VCFHeaderLineType.Flag, "DiagnoseTargets mode"));

    // FORMAT fields for each genotype
    headerLines.add(VCFStandardHeaderLines.getFormatLine(VCFConstants.GENOTYPE_FILTER_KEY));
    headerLines.add(
        GATKVCFHeaderLines.getFormatLine(GATKVCFConstants.AVG_INTERVAL_DP_BY_SAMPLE_KEY));
    headerLines.add(GATKVCFHeaderLines.getFormatLine(GATKVCFConstants.LOW_COVERAGE_LOCI));
    headerLines.add(GATKVCFHeaderLines.getFormatLine(GATKVCFConstants.ZERO_COVERAGE_LOCI));

    // FILTER fields
    for (CallableStatus stat : CallableStatus.values())
      headerLines.add(new VCFFilterHeaderLine(stat.name(), stat.description));

    return headerLines;
  }
Esempio n. 3
0
 @Override
 public List<VCFInfoHeaderLine> getDescriptions() {
   return Arrays.asList(GATKVCFHeaderLines.getInfoLine(getKeyNames().get(0)));
 }