diff options
author | Frederick Muriuki Muriithi | 2024-02-02 15:09:34 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-02-02 15:09:34 +0300 |
commit | 6ff9544df0d49540b65f6f9ee4a138f7f4284683 (patch) | |
tree | 7b2684bfa3e11e81c8438848c857b85f380a8c03 /r_qtl/r_qtl2.py | |
parent | cb3851a91d63a29b808f44eb91c00df91641e380 (diff) | |
download | gn-uploader-6ff9544df0d49540b65f6f9ee4a138f7f4284683.tar.gz |
List file types in a single place for easier reuse
Diffstat (limited to 'r_qtl/r_qtl2.py')
-rw-r--r-- | r_qtl/r_qtl2.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/r_qtl/r_qtl2.py b/r_qtl/r_qtl2.py index 9127dce..c2828d2 100644 --- a/r_qtl/r_qtl2.py +++ b/r_qtl/r_qtl2.py @@ -12,6 +12,10 @@ from functional_tools import take, chain from r_qtl.errors import InvalidFormat +__FILE_TYPES__ = ( + "geno", "founder_geno", "pheno", "covar", "phenocovar", "gmap", "pmap", + "phenose") + def control_data(zfile: ZipFile) -> dict: """Retrieve the control file from the zip file info.""" files = tuple(filename @@ -29,9 +33,7 @@ def control_data(zfile: ZipFile) -> dict: "comment.char": "#", "sep": ",", **{ - f"{key}_transposed": False for key in ( - "geno", "founder_geno", "pheno", "covar", "phenocovar", "gmap", - "pmap", "phenose") + f"{key}_transposed": False for key in __FILE_TYPES__ }, **(json.loads(zfile.read(files[0])) if files[0].endswith(".json") @@ -297,9 +299,7 @@ def validate_bundle(zfile: ZipFile): zfile.getinfo(inner) try: - for member in (key for key in cdata.keys() if key in ( - "geno", "founder_geno", "pheno", "covar", "phenocovar", "gmap", - "pmap")): + for member in (key for key in cdata.keys() if key in __FILE_TYPES__): __member_exists_p__(zfile, cdata[member]) if "file" in cdata.get("sex", {}): |