code: def _build_vaf_histograms(histogram_json):
      """Create VAF histograms split by genotype."""
      guides = {REF: 0, HET: 0.5, HOM: 1}
      dfs = []
      for key in histogram_json:
          g = pd.DataFrame(histogram_json[key])
          pretty, group = _prettify_genotype(key)
          g["GT"] = pretty  # pretty genotype name
          g["g"] = group  # main/other genotypes
          g["l"] = guides.get(pretty, None)  # vertical line as guide
          dfs.append(g)
  
      hist_data = pd.concat(dfs)
      main_hist_data = hist_data[hist_data["g"] == "main"]
      other_hist_data = hist_data[hist_data["g"] == "others"]
  
      # Main genotypes (ref, het, hom-alt)
      # Histogram bars themselves
      # s = bin_start, e = bin_end, c = count
      bars = (
          alt.Chart(main_hist_data)
          .mark_bar()
          .encode(
              x=alt.X("s", title="VAF"),
              x2="e",
              y=alt.Y(
                  "c",
                  title="Count",
                  stack=True,
                  axis=alt.Axis(format="s"),
              ),
          )
      )
      # Vertical lines
      guides = alt.Chart(main_hist_data).mark_rule().encode(x="l")
      # Facet into 3 plots by genotype
      vaf_histograms = (
          (bars + guides)
          .properties(width=200, height=200)
          .facet(
              column=alt.Column(
                  "GT", title="Main genotypes", sort=[REF, HET, HOM]
              )
          )
          .resolve_scale(y="independent")
      )
  
      # Other genotypes (uncalled, het with two alt alleles)
      # s = bin_start, e = bin_end, c = count
      other_vaf_histograms = (
          alt.Chart(other_hist_data)
          .mark_bar()
          .encode(
              x=alt.X("s", title="VAF"),
              x2="e",
              y=alt.Y(
                  "c",
                  title="Count",
                  stack=True,
                  axis=alt.Axis(format="s"),
              ),
              column=alt.Column("GT", title="Other genotypes"),
          )
          .properties(width=150, height=150)
          .resolve_scale(y="independent")
      )
      return vaf_histograms, other_vaf_histograms
  
imports: import io
  import json
  import os
  import altair
  import numpy
  import pandas
  import tensorflow
label_desc: Use image node_id 6 for calling a global function with example usage: _build_vaf_histograms(histogram_json) and returns: vaf_histograms,  other_vaf_histograms