nodes: 0, module; 1, function_definition; 2, function_name:fake_index; 3, parameters; 4, block; 5, identifier:in_bam; 6, identifier:data; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, return_statement; 11, comment:"""Create a fake index file for namesorted BAMs. bais require by CWL for consistency.
      """; 12, assignment; 13, not_operator; 14, block; 15, identifier:index_file; 16, identifier:index_file; 17, binary_operator:"%s.bai" % in_bam; 18, call; 19, with_statement; 20, string:"%s.bai"; 21, identifier:in_bam; 22, attribute; 23, argument_list; 24, with_clause; 25, block; 26, identifier:utils; 27, identifier:file_exists; 28, identifier:index_file; 29, with_item; 30, with_statement; 31, as_pattern; 32, with_clause; 33, block; 34, call; 35, as_pattern_target; 36, with_item; 37, expression_statement; 38, identifier:file_transaction; 39, argument_list; 40, identifier:tx_out_file; 41, as_pattern; 42, call; 43, identifier:data; 44, identifier:index_file; 45, call; 46, as_pattern_target; 47, attribute; 48, argument_list; 49, identifier:open; 50, argument_list; 51, identifier:out_handle; 52, identifier:out_handle; 53, identifier:write; 54, string:"name sorted -- no index"; 55, identifier:tx_out_file; 56, string:"w"
code: def fake_index(in_bam, data):
      """Create a fake index file for namesorted BAMs. bais require by CWL for consistency.
      """
      index_file = "%s.bai" % in_bam
      if not utils.file_exists(index_file):
          with file_transaction(data, index_file) as tx_out_file:
              with open(tx_out_file, "w") as out_handle:
                  out_handle.write("name sorted -- no index")
      return index_file