예제 #1
0
  public void update2(
      VariantContext eval,
      VariantContext comp,
      RefMetaDataTracker tracker,
      ReferenceContext ref,
      AlignmentContext context) {
    if (eval == null || (getWalker().ignoreAC0Sites() && eval.isMonomorphicInSamples())) return;

    final Type type = getType(eval);
    if (type == null) return;

    TypeSampleMap titvTable = null;

    // update DP, if possible
    if (eval.hasAttribute(VCFConstants.DEPTH_KEY)) depthPerSample.inc(type, ALL);

    // update counts
    allVariantCounts.inc(type, ALL);

    // type specific calculations
    if (type == Type.SNP && eval.isBiallelic()) {
      titvTable =
          VariantContextUtils.isTransition(eval) ? transitionsPerSample : transversionsPerSample;
      titvTable.inc(type, ALL);
    }

    // novelty calculation
    if (comp != null || (type == Type.CNV && overlapsKnownCNV(eval)))
      knownVariantCounts.inc(type, ALL);

    // per sample metrics
    for (final Genotype g : eval.getGenotypes()) {
      if (!g.isNoCall() && !g.isHomRef()) {
        countsPerSample.inc(type, g.getSampleName());

        // update transition / transversion ratio
        if (titvTable != null) titvTable.inc(type, g.getSampleName());

        if (g.hasDP()) depthPerSample.inc(type, g.getSampleName());
      }
    }
  }