nodes: 0, module; 1, function_definition; 2, function_name:_enforce_max_region_size; 3, parameters; 4, block; 5, identifier:in_file; 6, identifier:data; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, function_definition; 11, expression_statement; 12, if_statement; 13, return_statement; 14, comment:"""Ensure we don't have any chunks in the region greater than 20kb.
  
      VarDict memory usage depends on size of individual windows in the input
      file. This breaks regions into 20kb chunks with 250bp overlaps. 20kb gives
      ~1Gb/core memory usage and the overlaps avoid missing indels spanning a
      gap. Downstream VarDict merging sorts out any variants across windows.
  
      https://github.com/AstraZeneca-NGS/VarDictJava/issues/64
      """; 15, assignment; 16, assignment; 17, function_name:_has_larger_regions; 18, parameters; 19, block; 20, assignment; 21, not_operator; 22, block; 23, identifier:out_file; 24, identifier:max_size; 25, integer:20000; 26, identifier:overlap_size; 27, integer:250; 28, identifier:f; 29, return_statement; 30, identifier:out_file; 31, binary_operator:"%s-regionlimit%s" % utils.splitext_plus(in_file); 32, call; 33, if_statement; 34, call; 35, string:"%s-regionlimit%s"; 36, call; 37, attribute; 38, argument_list; 39, call; 40, block; 41, else_clause; 42, identifier:any; 43, generator_expression; 44, attribute; 45, argument_list; 46, identifier:utils; 47, identifier:file_exists; 48, identifier:out_file; 49, identifier:_has_larger_regions; 50, argument_list; 51, with_statement; 52, block; 53, comparison_operator:r.stop - r.start > max_size; 54, for_in_clause; 55, identifier:utils; 56, identifier:splitext_plus; 57, identifier:in_file; 58, identifier:in_file; 59, with_clause; 60, block; 61, expression_statement; 62, binary_operator:r.stop - r.start; 63, identifier:max_size; 64, identifier:r; 65, call; 66, with_item; 67, expression_statement; 68, call; 69, attribute; 70, attribute; 71, attribute; 72, argument_list; 73, as_pattern; 74, call; 75, attribute; 76, argument_list; 77, identifier:r; 78, identifier:stop; 79, identifier:r; 80, identifier:start; 81, identifier:pybedtools; 82, identifier:BedTool; 83, identifier:f; 84, call; 85, as_pattern_target; 86, attribute; 87, argument_list; 88, identifier:utils; 89, identifier:symlink_plus; 90, identifier:in_file; 91, identifier:out_file; 92, identifier:file_transaction; 93, argument_list; 94, identifier:tx_out_file; 95, call; 96, identifier:saveas; 97, identifier:tx_out_file; 98, identifier:data; 99, identifier:out_file; 100, attribute; 101, argument_list; 102, call; 103, identifier:window_maker; 104, keyword_argument; 105, keyword_argument; 106, keyword_argument; 107, attribute; 108, argument_list; 109, identifier:w; 110, identifier:max_size; 111, identifier:s; 112, binary_operator:max_size - overlap_size; 113, identifier:b; 114, call; 115, identifier:pybedtools; 116, identifier:BedTool; 117, identifier:max_size; 118, identifier:overlap_size; 119, attribute; 120, argument_list; 121, identifier:pybedtools; 122, identifier:BedTool; 123, identifier:in_file
code: def _enforce_max_region_size(in_file, data):
      """Ensure we don't have any chunks in the region greater than 20kb.
  
      VarDict memory usage depends on size of individual windows in the input
      file. This breaks regions into 20kb chunks with 250bp overlaps. 20kb gives
      ~1Gb/core memory usage and the overlaps avoid missing indels spanning a
      gap. Downstream VarDict merging sorts out any variants across windows.
  
      https://github.com/AstraZeneca-NGS/VarDictJava/issues/64
      """
      max_size = 20000
      overlap_size = 250
      def _has_larger_regions(f):
          return any(r.stop - r.start > max_size for r in pybedtools.BedTool(f))
      out_file = "%s-regionlimit%s" % utils.splitext_plus(in_file)
      if not utils.file_exists(out_file):
          if _has_larger_regions(in_file):
              with file_transaction(data, out_file) as tx_out_file:
                  pybedtools.BedTool().window_maker(w=max_size,
                                                    s=max_size - overlap_size,
                                                    b=pybedtools.BedTool(in_file)).saveas(tx_out_file)
          else:
              utils.symlink_plus(in_file, out_file)
      return out_file