class_docstr: Basic tests for the wrapped DeBruijnGraph class.
docstr: Test that we filter out edges containing low-quality basecalls.
docstr_tok: ["Test","that","we","filter","out","edges","containing","low-quality","basecalls","."]
code: def test_adding_edges_with_bad_positions(
      self, bad_position, dropped_edges
  ):
      """Test that we filter out edges containing low-quality basecalls."""
      ref_str = "GATTACA"
      read_str = "GATTACA"
  
      kmer_indices = {
          "GA": 0,
          "AT": 1,
          "TT": 2,
          "TA": 3,
          "AC": 4,
          "CA": 5,
      }
  
      def kmer_to_index_edge(kmer_edge):
          k1, k2 = kmer_edge.split("->")
          return "{}->{}".format(kmer_indices[k1], kmer_indices[k2])
  
      dropped_edges = {
          kmer_to_index_edge(edge) for edge in dropped_edges
      }
  
      for bad_type in ["qual", "base"]:
          bases = list(read_str)
          quals = [30] * len(bases)
          cigar = [(len(bases), "M")]
          if bad_position is not None:
              if bad_type == "qual":
                  quals[bad_position] = 1
              elif bad_type == "base":
                  bases[bad_position] = "N"
              else:
                  raise ValueError("Unexpected base type")
  
          read = test_utils.make_read(
              "".join(bases), start=0, cigar=cigar, quals=quals
          )
  
          # Use two reads so read path doesn't get pruned.
          dbg = debruijn_graph.build(
              ref_str, [read, read], self.single_k_dbg_options(2)
          )
  
          expected_edges = "\n".join(
              "{} [label={} color=red];".format(
                  edge, 1 if edge in dropped_edges else 3
              )
              for edge in ["0->1", "1->2", "2->3", "3->4", "4->5"]
          )
  
          self.assertGraphEqual(
              """\
              digraph G {
              0[label=GA];
              1[label=AT];
              2[label=TT];
              3[label=TA];
              4[label=AC];
              5[label=CA];
              %s
              }
              """
              % expected_edges,
              dbg,
          )
  
imports: from absl.testing import absltest
  from absl.testing import parameterized
  from third_party.nucleus.io import fasta
  from third_party.nucleus.io import sam
  from third_party.nucleus.testing import test_utils
  from third_party.nucleus.util import ranges
  from deepvariant import testdata
  from deepvariant.protos import realigner_pb2
  from deepvariant.realigner.python import debruijn_graph
label_desc: Use image node_id 7 for calling the DeBruijnGraphWrapTest obj's underlying member method code with example usage: obj.test_adding_edges_with_bad_positions(bad_position, dropped_edges) and returns: str