class_docstr: BaseClass for variant callers.
class_docstr_tok: ["BaseClass","for","variant","callers","."]
docstr: Performs the calculation described in reference_confidence().
docstr_tok: ["Performs","the","calculation","described","in","reference_confidence","(",")","."]
code: def _calc_reference_confidence(self, n_ref, n_total):
      """Performs the calculation described in reference_confidence()."""
      if n_ref < 0:
          raise ValueError("n_ref={} must be >= 0".format(n_ref))
      if n_total < n_ref:
          raise ValueError(
              "n_total={} must be >= n_ref={}".format(n_total, n_ref)
          )
      if self.options.ploidy != 2:
          raise ValueError(
              "ploidy={} but we only support ploidy=2".format(
                  self.options.ploidy
              )
          )
  
      if n_total == 0:
          # No coverage case - all likelihoods are log10 of 1/3, 1/3, 1/3.
          log10_probs = genomics_math.normalize_log10_probs(
              [-1.0, -1.0, -1.0]
          )
      else:
          n_alts = n_total - n_ref
          logp = math.log(self.options.p_error) / LOG_10
          log1p = math.log1p(-self.options.p_error) / LOG_10
          log10_p_ref = n_ref * log1p + n_alts * logp
          log10_p_het = (
              -n_total * math.log(self.options.ploidy) / LOG_10
          )
          log10_p_hom_alt = n_ref * logp + n_alts * log1p
          log10_probs = genomics_math.normalize_log10_probs(
              [log10_p_ref, log10_p_het, log10_p_hom_alt]
          )
  
      gq = genomics_math.log10_ptrue_to_phred(
          log10_probs[0], self.options.max_gq
      )
      gq = int(min(np.floor(gq), self.options.max_gq))
      return gq, log10_probs
  
imports: import abc
  import collections
  import itertools
  import math
  import operator
  import statistics
  from typing import Dict, Sequence, Tuple
  import numpy
  from deepvariant.protos import deepvariant_pb2
  from deepvariant.python import allelecounter
  from deepvariant.python import variant_calling
  from deepvariant.python import variant_calling_multisample
  from third_party.nucleus.protos import variants_pb2
  from third_party.nucleus.util import genomics_math
  from third_party.nucleus.util import variantcall_utils
  from third_party.nucleus.util import vcf_constants
label_desc: Use image node_id 3 for calling the VariantCaller obj's underlying member method code with example usage: obj._calc_reference_confidence(n_ref, n_total) and returns: gq,  log10_probs