From 0169bd8b4ffe5cb5676e2fe2e4f0f82cdd104047 Mon Sep 17 00:00:00 2001 From: Alexander_Kabui Date: Thu, 23 Jan 2025 13:57:28 +0300 Subject: feat: Add utility function to create a file if it does not exist. --- gn3/computations/rqtl2.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'gn3') diff --git a/gn3/computations/rqtl2.py b/gn3/computations/rqtl2.py index bccedc0..95d8225 100644 --- a/gn3/computations/rqtl2.py +++ b/gn3/computations/rqtl2.py @@ -66,3 +66,13 @@ def compose_rqtl2_cmd(rqtl_path, input_file, rscript_path = config.get("RSCRIPT", "Rscript") return f"{rscript_path} { rqtl_path } " + " ".join( [f"--{key} {val}" for key, val in params.items()]) + + +def create_file(file_path): + """Utility function to create file given a file_path""" + try: + with open(file_path, "x",encoding="utf-8") as _file_handler: + return True, "File created at" + except FileExistsError: + return False, "File Already Exists" + -- cgit 1.4.1