def list_to_pathway_names(listname): if listname == 'all': pathway_names = [f[:-4] for f in listdir(pathways_dir()) if f.endswith('.txt')] else: listfile = join(pathway_lists_dir(),listname) with open(listfile) as f: lines = f.readlines() pathway_names = [x.strip() for x in lines] # remove newlines pathway_names = [x for x in pathway_names if x] # rmeove empty strings return pathway_names
def all_pathway_lists(): d = pathway_lists_dir() def is_ok(listname): return isfile(join(d,listname)) return [x for x in listdir(d) if is_ok(x)]