nodes: 0, module; 1, function_definition; 2, function_name:index; 3, parameters; 4, block; 5, identifier:args; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, if_statement; 14, expression_statement; 15, comment:# Sequence, begin, end in 2, 3, 4-th column, respectively; 16, expression_statement; 17, if_statement; 18, comment:"""
      %prog index frgscf.sorted
  
      Compress frgscffile.sorted and index it using `tabix`.
      """; 19, assignment; 20, assignment; 21, comparison_operator:len(args) != 1; 22, block; 23, assignment; 24, assignment; 25, assignment; 26, not_operator; 27, block; 28, assignment; 29, assignment; 30, not_operator; 31, block; 32, identifier:p; 33, call; 34, pattern_list; 35, call; 36, call; 37, integer:1; 38, expression_statement; 39, pattern_list; 40, identifier:args; 41, identifier:gzfile; 42, binary_operator:frgscffile + ".gz"; 43, identifier:cmd; 44, call; 45, call; 46, expression_statement; 47, identifier:tbifile; 48, binary_operator:gzfile + ".tbi"; 49, identifier:cmd; 50, call; 51, call; 52, expression_statement; 53, identifier:OptionParser; 54, argument_list; 55, identifier:opts; 56, identifier:args; 57, attribute; 58, argument_list; 59, identifier:len; 60, argument_list; 61, call; 62, identifier:frgscffile; 63, identifier:frgscffile; 64, string:".gz"; 65, attribute; 66, argument_list; 67, attribute; 68, argument_list; 69, call; 70, identifier:gzfile; 71, string:".tbi"; 72, attribute; 73, argument_list; 74, attribute; 75, argument_list; 76, call; 77, attribute; 78, identifier:p; 79, identifier:parse_args; 80, identifier:args; 81, identifier:args; 82, attribute; 83, argument_list; 84, string:"bgzip -c {0}"; 85, identifier:format; 86, identifier:frgscffile; 87, identifier:op; 88, identifier:exists; 89, identifier:gzfile; 90, identifier:sh; 91, argument_list; 92, string:"tabix -s 2 -b 3 -e 4 {0}"; 93, identifier:format; 94, identifier:gzfile; 95, identifier:op; 96, identifier:exists; 97, identifier:tbifile; 98, identifier:sh; 99, argument_list; 100, identifier:index; 101, identifier:__doc__; 102, identifier:sys; 103, identifier:exit; 104, call; 105, identifier:cmd; 106, keyword_argument; 107, identifier:cmd; 108, attribute; 109, argument_list; 110, identifier:outfile; 111, identifier:gzfile; 112, identifier:p; 113, identifier:print_help
code: def index(args):
      """
      %prog index frgscf.sorted
  
      Compress frgscffile.sorted and index it using `tabix`.
      """
      p = OptionParser(index.__doc__)
  
      opts, args = p.parse_args(args)
  
      if len(args) != 1:
          sys.exit(p.print_help())
  
      frgscffile, = args
      gzfile = frgscffile + ".gz"
      cmd = "bgzip -c {0}".format(frgscffile)
  
      if not op.exists(gzfile):
          sh(cmd, outfile=gzfile)
  
      tbifile = gzfile + ".tbi"
      # Sequence, begin, end in 2, 3, 4-th column, respectively
      cmd = "tabix -s 2 -b 3 -e 4 {0}".format(gzfile)
  
      if not op.exists(tbifile):
          sh(cmd)