about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMunyoki Kilyungi2024-02-20 17:39:46 +0300
committerBonfaceKilz2024-02-25 17:57:17 +0300
commit1d811a1fa24ff105db458d56ea71a538737082d0 (patch)
tree0e34b355158317f8d636dec7c6e79cc2070f9713
parent039c1dee9add8f784911a84c7a5f16915166ba93 (diff)
downloadgenenetwork3-1d811a1fa24ff105db458d56ea71a538737082d0.tar.gz
Construct genofile_path using pathlib module.
* gn3/db/datasets.py: Remove os import.
(retrieve_sample_list): Replace os.path with Path.

Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
-rw-r--r--gn3/db/datasets.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/gn3/db/datasets.py b/gn3/db/datasets.py
index 043be4c..171a70e 100644
--- a/gn3/db/datasets.py
+++ b/gn3/db/datasets.py
@@ -1,7 +1,6 @@
 """
 This module contains functions relating to specific trait dataset manipulation
 """
-import os
 from typing import Any
 from pathlib import Path
 
@@ -16,11 +15,13 @@ def retrieve_sample_list(group: str):
     """
 
     samplelist = []
-    genofile_path = (
-        f'{app.config.get("GENENETWORK_FILES", "/home/gn2/production/genotype_files/")}'
-        f'/genotype/{group}.geno'
+    genofile_path = Path(
+        app.config.get(
+            "GENENETWORK_FILES",
+            "/home/gn2/production/genotype_files/"
+        ), f'genotype/{group}.geno'
     )
-    if os.path.isfile(genofile_path):
+    if genofile_path.is_file():
         with open(genofile_path, encoding="utf-8") as genofile:
             line = ""
             for line in genofile: