nodes: 0, module; 1, function_definition; 2, function_name:_get_file_list; 3, parameters; 4, block; 5, identifier:orig_files; 6, identifier:out_file; 7, identifier:regions; 8, identifier:ref_file; 9, identifier:config; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, if_statement; 14, expression_statement; 15, expression_statement; 16, with_statement; 17, return_statement; 18, comment:"""Create file with region sorted list of non-empty VCFs for concatenating.
      """; 19, assignment; 20, assignment; 21, comparison_operator:len(exist_files) == 0; 22, comment:# no non-empty inputs, merge the empty ones; 23, block; 24, elif_clause; 25, else_clause; 26, assignment; 27, assignment; 28, with_clause; 29, block; 30, identifier:input_file_list; 31, identifier:sorted_files; 32, call; 33, identifier:exist_files; 34, list_comprehension; 35, call; 36, integer:0; 37, expression_statement; 38, comparison_operator:len(exist_files) > 1; 39, block; 40, block; 41, identifier:ready_files; 42, call; 43, identifier:input_file_list; 44, binary_operator:"%s-files.list" % utils.splitext_plus(out_file)[0]; 45, with_item; 46, for_statement; 47, identifier:_sort_by_region; 48, argument_list; 49, tuple; 50, for_in_clause; 51, if_clause; 52, identifier:len; 53, argument_list; 54, assignment; 55, call; 56, integer:1; 57, expression_statement; 58, expression_statement; 59, identifier:run_multicore; 60, argument_list; 61, string:"%s-files.list"; 62, subscript; 63, as_pattern; 64, identifier:fname; 65, identifier:ready_files; 66, block; 67, identifier:orig_files; 68, identifier:regions; 69, identifier:ref_file; 70, identifier:config; 71, identifier:c; 72, identifier:x; 73, pattern_list; 74, identifier:sorted_files; 75, boolean_operator; 76, identifier:exist_files; 77, identifier:exist_files; 78, list_comprehension; 79, identifier:len; 80, argument_list; 81, assignment; 82, assignment; 83, identifier:p_bgzip_and_index; 84, list_comprehension; 85, identifier:config; 86, call; 87, integer:0; 88, call; 89, as_pattern_target; 90, expression_statement; 91, identifier:c; 92, identifier:x; 93, call; 94, call; 95, identifier:x; 96, for_in_clause; 97, if_clause; 98, identifier:exist_files; 99, identifier:exist_files; 100, call; 101, identifier:exist_files; 102, list_comprehension; 103, list; 104, for_in_clause; 105, attribute; 106, argument_list; 107, identifier:open; 108, argument_list; 109, identifier:out_handle; 110, call; 111, attribute; 112, argument_list; 113, identifier:vcf_has_variants; 114, argument_list; 115, pattern_list; 116, identifier:sorted_files; 117, call; 118, identifier:_fix_gatk_header; 119, argument_list; 120, identifier:x; 121, for_in_clause; 122, identifier:x; 123, identifier:config; 124, identifier:x; 125, identifier:exist_files; 126, identifier:utils; 127, identifier:splitext_plus; 128, identifier:out_file; 129, identifier:input_file_list; 130, string:"w"; 131, attribute; 132, argument_list; 133, attribute; 134, identifier:exists; 135, identifier:x; 136, identifier:x; 137, identifier:c; 138, identifier:x; 139, attribute; 140, argument_list; 141, identifier:exist_files; 142, identifier:out_file; 143, identifier:config; 144, pattern_list; 145, identifier:exist_files; 146, identifier:out_handle; 147, identifier:write; 148, binary_operator:fname + "\n"; 149, identifier:os; 150, identifier:path; 151, attribute; 152, identifier:exists; 153, identifier:x; 154, identifier:c; 155, identifier:x; 156, identifier:fname; 157, string:"\n"; 158, identifier:os; 159, identifier:path
code: def _get_file_list(orig_files, out_file, regions, ref_file, config):
      """Create file with region sorted list of non-empty VCFs for concatenating.
      """
      sorted_files = _sort_by_region(orig_files, regions, ref_file, config)
      exist_files = [(c, x) for c, x in sorted_files if os.path.exists(x) and vcf_has_variants(x)]
      if len(exist_files) == 0:  # no non-empty inputs, merge the empty ones
          exist_files = [x for c, x in sorted_files if os.path.exists(x)]
      elif len(exist_files) > 1:
          exist_files = _fix_gatk_header(exist_files, out_file, config)
      else:
          exist_files = [x for c, x in exist_files]
      ready_files = run_multicore(p_bgzip_and_index, [[x, config] for x in exist_files], config)
      input_file_list = "%s-files.list" % utils.splitext_plus(out_file)[0]
      with open(input_file_list, "w") as out_handle:
          for fname in ready_files:
              out_handle.write(fname + "\n")
      return input_file_list