'Convert both options_string and options_dict to list form
while filtering out non-\'valid\' options.'

def to_options_list(self, options_string, options_dict):

    opt_list = []
    options_string = options_string.strip('-    ')
    validated_flag_list = set([flag for flag in options_string if (flag in self.FLAGS_WO_ARGS)])
    if ((self.dataset.ext == 'sam') and ('S' not in validated_flag_list)):
        validated_flag_list.append('S')
    if validated_flag_list:
        opt_list.append(('-' + ''.join(validated_flag_list)))
    for (flag, arg) in options_dict.items():
        if (flag in self.FLAGS_W_ARGS):
            opt_list.extend([('-' + flag), str(arg)])
    return opt_list
