code: def fraction_reads_with_low_mapq(
      channels: List[np.ndarray], threshold: int = 127
  ) -> float:
      """Gets fraction of reads that have low mapping quality scores in pileup.
  
      Args:
          channels: A list of channels of a DeepVariant pileup image. This only uses
            channels[2], the mapping quality channel.
          threshold: int. Default is 127 because this is half of the max (254).
  
      Returns:
          The fraction of bases with mapping quality below the threshold.
      """
      mapq_channel = remove_ref_band(channels[2])
      # Get max value of each row, aka each read.
      max_row_values = np.amax(mapq_channel, axis=1)
  
      non_zero_values = max_row_values[max_row_values > 0]
      num_non_zero = non_zero_values.shape[0]
      if num_non_zero == 0:
          return 0.0
      return sum((non_zero_values < threshold) * 1.0) / num_non_zero
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import enum
  import math
  from typing import List, NamedTuple, Tuple
  from etils import epath
  from IPython import display
  import numpy
  from PIL import Image
  from PIL import ImageDraw
  from third_party.nucleus.protos import variants_pb2
label_desc: Use image node_id 22 for calling a global function with example usage: fraction_reads_with_low_mapq(channels, threshold) and returns: unknown, int