From 8b637a760362d08fb92152288d0b04f90299da5f Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 13 Feb 2024 04:03:02 +0300 Subject: Make "FILE_TYPES" part of public interface for module/package. --- r_qtl/r_qtl2.py | 4 ++-- r_qtl/r_qtl2_qc.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'r_qtl') diff --git a/r_qtl/r_qtl2.py b/r_qtl/r_qtl2.py index e74312f..0241458 100644 --- a/r_qtl/r_qtl2.py +++ b/r_qtl/r_qtl2.py @@ -12,7 +12,7 @@ from functional_tools import take, chain from r_qtl.errors import InvalidFormat, MissingFileError -__FILE_TYPES__ = ( +FILE_TYPES = ( "geno", "founder_geno", "pheno", "covar", "phenocovar", "gmap", "pmap", "phenose") @@ -33,7 +33,7 @@ def control_data(zfile: ZipFile) -> dict: "comment.char": "#", "sep": ",", **{ - f"{key}_transposed": False for key in __FILE_TYPES__ + f"{key}_transposed": False for key in FILE_TYPES }, **(json.loads(zfile.read(files[0])) if files[0].endswith(".json") diff --git a/r_qtl/r_qtl2_qc.py b/r_qtl/r_qtl2_qc.py index aa5c81e..43f7d94 100644 --- a/r_qtl/r_qtl2_qc.py +++ b/r_qtl/r_qtl2_qc.py @@ -5,7 +5,7 @@ from typing import Union, Iterator, Optional, Callable from r_qtl import errors as rqe from r_qtl import r_qtl2 as rqtl2 -from r_qtl.r_qtl2 import __FILE_TYPES__ +from r_qtl.r_qtl2 import FILE_TYPES from r_qtl.fileerrors import MissingFile from quality_control.errors import InvalidValue @@ -21,7 +21,7 @@ def bundle_files_list(cdata: dict) -> tuple[tuple[str, str], ...]: fileslist: tuple[tuple[str, str], ...] = reduce( __merge__, - (key for key in cdata.keys() if key in __FILE_TYPES__), + (key for key in cdata.keys() if key in FILE_TYPES), tuple()) if "file" in cdata.get("sex", {}): @@ -98,7 +98,7 @@ def phenose_errors(zfile: ZipFile) -> Iterator[Union[InvalidValue, MissingFile]] def retrieve_errors(zfile: ZipFile, filetype: str, checkers: tuple[Callable]) -> Iterator[ Union[InvalidValue, MissingFile]]: """Check for and retrieve errors from files of type `filetype`.""" - assert filetype in __FILE_TYPES__, f"Invalid file type {filetype}." + assert filetype in FILE_TYPES, f"Invalid file type {filetype}." cdata = rqtl2.control_data(zfile) try: for lineno, row in enumerate( -- cgit v1.2.3