# Selected columns
    if len(user_selected) == 0:
        print "No columns selected for output."
        sys.exit()
    print "Selected columns = %s" % ' '.join(user_selected)
    # Assume user counts columns starting from one and adjust to count from zero
    # Also check that the requested column exists and set up file names based on
    # user input
    selected = []
    col_lookup = {}
    file_names = {}
    for col in user_selected:
        try:
            col0 = int(col) - 1
            if col0 >= data.nColumns():
                logging.error("Unable to find column %s, not enough columns in input file" % col)
                sys.exit(1)
        except ValueError:
            # Not an integer
            if col not in data.header():
                logging.error("Unable to find column '%s' in input file" % col)
                sys.exit(1)
            col0 = data.header().index(col)
        # Column lookup
        col_lookup[col0] = col
        # Adjusted column names
        selected.append(col0)
        # File names
        if first_line_is_header:
            file_names[col0] = str(str(data.header()[col0])+".bedGraph").replace(' ','_')