From 09cc9787fd18fc5ecb025c88d1c1ac1b1985af4e Mon Sep 17 00:00:00 2001 From: Harrison Deng Date: Fri, 7 Mar 2025 16:08:25 +0000 Subject: [PATCH] Fixed --csv output being blank when listing dbs --- src/autobigs/cli/info.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/autobigs/cli/info.py b/src/autobigs/cli/info.py index 31c1718..a7b284a 100644 --- a/src/autobigs/cli/info.py +++ b/src/autobigs/cli/info.py @@ -53,18 +53,19 @@ async def run(args: Namespace): writer.writerows(sorted_seqdef_dbs) print("\nDatabase output written to {0}".format(args.csv_output)) - csv_scheme_rows = [] - for bigsdb_scheme_name in args.list_bigsdb_schemes: - schemes = await bigsdb_index.get_schemes_for_seqdefdb(bigsdb_scheme_name) - csv_scheme_rows.extend([(name, id, bigsdb_scheme_name) for name, id in sorted(schemes.items())]) - print("The following are the known schemes for \"{0}\", and their associated IDs:".format(bigsdb_scheme_name)) - print("\n".join(["{0}: {1}".format(name, id) for name, id, database in csv_scheme_rows])) - if args.csv_output: - with open(args.csv_output, "w") as csv_out_handle: - writer = csv.writer(csv_out_handle) - writer.writerow(("Name", "ID", "Database Name")) - writer.writerows(csv_scheme_rows) - print("\nscheme list output written to {0}".format(args.csv_output)) + if args.list_bigsdb_schemes: + csv_scheme_rows = [] + for bigsdb_scheme_name in args.list_bigsdb_schemes: + schemes = await bigsdb_index.get_schemes_for_seqdefdb(bigsdb_scheme_name) + csv_scheme_rows.extend([(name, id, bigsdb_scheme_name) for name, id in sorted(schemes.items())]) + print("The following are the known schemes for \"{0}\", and their associated IDs:".format(bigsdb_scheme_name)) + print("\n".join(["{0}: {1}".format(name, id) for name, id, database in csv_scheme_rows])) + if args.csv_output: + with open(args.csv_output, "w") as csv_out_handle: + writer = csv.writer(csv_out_handle) + writer.writerow(("Name", "ID", "Database Name")) + writer.writerows(csv_scheme_rows) + print("\nscheme list output written to {0}".format(args.csv_output)) def run_asynchronously(args: Namespace): asyncio.run(run(args))