about summary refs log tree commit diff
path: root/gn3/computations
diff options
context:
space:
mode:
authorAlexander_Kabui2025-01-23 13:57:28 +0300
committerBonfaceKilz2025-02-06 12:43:15 +0300
commit0169bd8b4ffe5cb5676e2fe2e4f0f82cdd104047 (patch)
tree4471c970c09bcc3719132807bcafa0a23672475c /gn3/computations
parentbdab517514d980ac4f1e5b350e5d9289f32cceb4 (diff)
downloadgenenetwork3-0169bd8b4ffe5cb5676e2fe2e4f0f82cdd104047.tar.gz
feat: Add utility function to create a file if it does not exist.
Diffstat (limited to 'gn3/computations')
-rw-r--r--gn3/computations/rqtl2.py10
1 files changed, 10 insertions, 0 deletions
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"
+