nodes: 0, module; 1, function_definition; 2, function_name:picard_fix_rgs; 3, parameters; 4, block; 5, identifier:picard; 6, identifier:in_bam; 7, identifier:names; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, return_statement; 12, comment:"""Add read group information to BAM files and coordinate sort.
      """; 13, assignment; 14, not_operator; 15, block; 16, identifier:out_file; 17, identifier:out_file; 18, binary_operator:"%s-fixrgs.bam" % os.path.splitext(in_bam)[0]; 19, call; 20, with_statement; 21, string:"%s-fixrgs.bam"; 22, subscript; 23, identifier:file_exists; 24, argument_list; 25, with_clause; 26, block; 27, call; 28, integer:0; 29, identifier:out_file; 30, with_item; 31, with_statement; 32, attribute; 33, argument_list; 34, as_pattern; 35, with_clause; 36, block; 37, attribute; 38, identifier:splitext; 39, identifier:in_bam; 40, call; 41, as_pattern_target; 42, with_item; 43, expression_statement; 44, expression_statement; 45, identifier:os; 46, identifier:path; 47, identifier:tx_tmpdir; 48, argument_list; 49, identifier:tmp_dir; 50, as_pattern; 51, assignment; 52, call; 53, attribute; 54, call; 55, as_pattern_target; 56, identifier:opts; 57, list; 58, attribute; 59, argument_list; 60, identifier:picard; 61, identifier:_config; 62, identifier:file_transaction; 63, argument_list; 64, identifier:tx_out_file; 65, tuple; 66, tuple; 67, tuple; 68, tuple; 69, tuple; 70, tuple; 71, tuple; 72, tuple; 73, tuple; 74, identifier:picard; 75, identifier:run; 76, string:"AddOrReplaceReadGroups"; 77, identifier:opts; 78, attribute; 79, identifier:out_file; 80, string:"INPUT"; 81, identifier:in_bam; 82, string:"OUTPUT"; 83, identifier:tx_out_file; 84, string:"SORT_ORDER"; 85, string:"coordinate"; 86, string:"RGID"; 87, subscript; 88, string:"RGLB"; 89, call; 90, string:"RGPL"; 91, subscript; 92, string:"RGPU"; 93, subscript; 94, string:"RGSM"; 95, subscript; 96, string:"TMP_DIR"; 97, identifier:tmp_dir; 98, identifier:picard; 99, identifier:_config; 100, identifier:names; 101, string:"rg"; 102, attribute; 103, argument_list; 104, identifier:names; 105, string:"pl"; 106, identifier:names; 107, string:"pu"; 108, identifier:names; 109, string:"sample"; 110, identifier:names; 111, identifier:get; 112, string:"lb"; 113, string:"unknown"
code: def picard_fix_rgs(picard, in_bam, names):
      """Add read group information to BAM files and coordinate sort.
      """
      out_file = "%s-fixrgs.bam" % os.path.splitext(in_bam)[0]
      if not file_exists(out_file):
          with tx_tmpdir(picard._config) as tmp_dir:
              with file_transaction(picard._config, out_file) as tx_out_file:
                  opts = [("INPUT", in_bam),
                          ("OUTPUT", tx_out_file),
                          ("SORT_ORDER", "coordinate"),
                          ("RGID", names["rg"]),
                          ("RGLB", names.get("lb", "unknown")),
                          ("RGPL", names["pl"]),
                          ("RGPU", names["pu"]),
                          ("RGSM", names["sample"]),
                          ("TMP_DIR", tmp_dir)]
                  picard.run("AddOrReplaceReadGroups", opts)
      return out_file