From 736541c4ec46361b40c8b0b107fe94cc8668e19e Mon Sep 17 00:00:00 2001 From: Alok Saldanha Date: Sat, 28 Dec 2019 22:11:15 -0500 Subject: [PATCH] #14 Added support for listing files with _ or - as separator --- cellxgene_gateway/filecrawl.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cellxgene_gateway/filecrawl.py b/cellxgene_gateway/filecrawl.py index 7097168..3b0234c 100644 --- a/cellxgene_gateway/filecrawl.py +++ b/cellxgene_gateway/filecrawl.py @@ -19,7 +19,8 @@ def recurse_dir(path): entries = [] else: entries = [{ - "name": x[:x.index('-')] if '-' in x else x, + "name": x[:-13] if (x[-13] in ['-','_']) else ( + x[:-4] if x.endwith('.csv') else x), "path": os.path.join(full_path, x).replace(env.cellxgene_data, ""), } for x in os.listdir(full_path) if x.endswith('.csv') and os.path.isfile(os.path.join(full_path, x))] return [{"name":'new', "path":full_path.replace(env.cellxgene_data, "")}] + entries