def is_boxplot(name, f): """Return True if f is a qc_boxplot associated with sample 'name' can be a file name, or a file 'root' i.e. filename with all trailing extensions removed. """ name_underscore = os.path.basename(strip_ngs_extensions(name)) + "_" name_dot = os.path.basename(utils.rootname(name)) + "." if f.endswith("_boxplot.png"): if f.startswith(name_dot) or f.startswith(name_underscore): return True # Try progressive manipulations looking for a match # # Removing "_QV" from names f1 = f.replace("_QV", "") if f1.startswith(name_underscore) or f1.startswith(name_dot): return True # Removing "_F3_" from names f1 = f1.replace("_F3_", "_") if f1.startswith(name_underscore) or f1.startswith(name_dot): return True # Removing "_F5-BC_" from names f1 = f1.replace("_F5-BC_", "_") if f1.startswith(name_underscore) or f1.startswith(name_dot): return True # Failed all tests, not a boxplot return False
def is_program_info(name, f): """Return True if f is a 'program info' file associated with name 'name' can be a file name, or a file 'root' i.e. filename with all trailing extensions removed. """ name_underscore = os.path.basename(strip_ngs_extensions(name)) + "_" name_dot = os.path.basename(utils.rootname(name)) + "." if f.endswith(".programs") and (f.startswith(name_dot) or f.startswith(name_underscore)): return True else: return False