def parse_categories(dataframe, **parse_args):
    """
    A function to parse out categories from sequence IDs

    parse_arguments can be:
    - delimiter: character vector to split ID
    - field: field number in 0-index designating which field to keep
    OR
    - regex: a regex expression with a single capture group
    OR
    - callback: a function that takes the seqid and returns the 
        category
    """
    if 'delimiter' in parse_args.keys():
        delimiter = parse_args['delimiter']
        field = int(parse_args['field'])
        dataframe['category'] = dataframe.seqid.str.split(delimiter).str.get(
            field)
    elif 'regex' in parse_args.keys():
        regex = parse_args['regex']
        dataframe['category'] = dataframe.seqid.str.extract(regex, expand=False
            )
    elif 'callback' in parse_args.keys():
        callback = parse_args['callback']
        dataframe['category'] = dataframe.seqid.apply(lambda s: callback(s))
    else:
        raise Exception('Not sure how to parse categories.')
    return dataframe
