code: def test_segment_intervals():
      vds = hl.vds.read_vds(
          os.path.join(resource("vds"), "1kg_chr22_5_samples.vds")
      )
  
      contig_len = (
          vds.reference_data.locus.dtype.reference_genome.lengths[
              "chr22"
          ]
      )
      breakpoints = hl.literal(
          [*range(1, contig_len, 5_000_000), contig_len]
      )
      intervals = hl.range(hl.len(breakpoints) - 1).map(
          lambda i: hl.struct(
              interval=hl.locus_interval(
                  "chr22",
                  breakpoints[i],
                  breakpoints[i + 1],
                  reference_genome="GRCh38",
              )
          )
      )
      intervals_ht = hl.Table.parallelize(intervals, key="interval")
  
      path = new_temp_file()
      r = hl.vds.segment_reference_blocks(
          vds.reference_data, intervals_ht
      )
      r.write(path)
      after = hl.read_matrix_table(path)
  
      es = after.entries()
      es = es.filter(
          (es.END < es.locus.position)
          | (es.END >= es.interval.end.position)
      )
      if es.count() > 0:
          es.show(width=1000)
          assert (
              False
          ), "found entries with END < position or END >= interval end"
  
      before = vds.reference_data
  
      sum_per_sample_before = before.select_cols(
          ref_block_bases=hl.agg.sum(
              before.END + 1 - before.locus.position
          )
      ).cols()
      sum_per_sample_after = after.select_cols(
          ref_block_bases=hl.agg.sum(
              after.END + 1 - after.locus.position
          )
      ).cols()
  
      before_coverage = sum_per_sample_before.collect()
      after_coverage = sum_per_sample_after.collect()
      assert before_coverage == after_coverage
  
imports: import os
  import pytest
  import hail
  from hail.utils import new_temp_file
  from hail.vds.combiner.combine import defined_entry_fields
  from ..helpers import resource, test_timeout, qobtest
label_desc: Use image node_id 9 for calling a global function with example usage: test_segment_intervals() without return types