From 5ccc75290f8498d9ae98d23e28a04144db6a7e24 Mon Sep 17 00:00:00 2001 From: Acribbs Date: Fri, 23 Aug 2024 11:14:31 +0200 Subject: [PATCH] Modified concatenate_tables to remove if args.cat --- cgat/tools/tables2table.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/cgat/tools/tables2table.py b/cgat/tools/tables2table.py index 53f48a69..d450caf1 100644 --- a/cgat/tools/tables2table.py +++ b/cgat/tools/tables2table.py @@ -280,16 +280,19 @@ def main(argv=sys.argv): E.info("combining %i tables" % len(args.filenames)) - if args.cat: - table = concatenate_tables(args.filenames, - regex_filename=args.regex_filename, - separator=args.separator, - headers=args.headers, - missing_value=args.missing_value, - cat=args.cat) - - table.to_csv(args.stdout, sep=args.separator, index=False) - E.stop() + # Remove the if statement and call concatenate_tables directly + table = concatenate_tables(args.filenames, + regex_filename=args.regex_filename, + separator=args.separator, + headers=args.headers, + missing_value=args.missing_value, + cat=args.cat) + + # Ensure the table object is not None before attempting to write it + if table is not None: + table.to_csv(args.stdout, sep=args.separator, index=False) + else: + E.warn("No tables were concatenated.") if __name__ == '__main__':