clean_path_to_sub_program would have an option to handle both component files (with underscore) and top level flow files (without underscore)
code below is an example of how origen tester plugin may use this method.
Try a regular component name first with leading _, then try for without
file = Origen.file_handler.clean_path_to_sub_program(file) ||
Origen.file_handler.clean_path_to_sub_program(file, with_underscore: false)