예제 #1
0
  public void finalizeEvaluation() {
    nProcessedLoci = getWalker().getnProcessedLoci();
    nSNPs = allVariantCounts.all(Type.SNP);
    nIndels = allVariantCounts.all(Type.INDEL);
    nSVs = allVariantCounts.all(Type.CNV);

    TiTvRatio = transitionsPerSample.ratioValue(Type.SNP, transversionsPerSample, true);
    TiTvRatioPerSample = transitionsPerSample.ratioValue(Type.SNP, transversionsPerSample, false);

    nSNPsPerSample = countsPerSample.meanValue(Type.SNP);
    nIndelsPerSample = countsPerSample.meanValue(Type.INDEL);
    nSVsPerSample = countsPerSample.meanValue(Type.CNV);

    SNPNoveltyRate = noveltyRate(Type.SNP);
    IndelNoveltyRate = noveltyRate(Type.INDEL);
    SVNoveltyRate = noveltyRate(Type.CNV);

    SNPDPPerSample = depthPerSample.meanValue(Type.SNP);
    IndelDPPerSample = depthPerSample.meanValue(Type.INDEL);
  }
예제 #2
0
    public final double ratioValue(Type type, TypeSampleMap denoms, boolean allP) {
      double sum = 0;
      int n = 0;
      for (final String sample : get(type).keySet()) {
        if ((allP && sample == ALL) || (!allP && sample != ALL)) { // truly must be string ==
          final long num = get(type).get(sample);
          final long denom = denoms.get(type).get(sample);
          sum += ratio(num, denom);
          n++;
        }
      }

      return n > 0 ? sum / (1.0 * n) : 0.0;
    }
예제 #3
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());
      }
    }
  }
예제 #4
0
 private String noveltyRate(Type type) {
   final int all = allVariantCounts.all(type);
   final int known = knownVariantCounts.all(type);
   return Utils.formattedNoveltyRate(known, all);
 }