from pathlib import Path


def _parse_tensorqtl_config_file(config_file): 
	"""
	Returns paths and params used to initialize a tensorqtl run.
	"""
	assert Path(config_file).is_file()

	with open(config_file, "r") as f: 
		params = { line.split("\t")[0]:line.rstrip("\n").split("\t")[1] for line in f.readlines() }

	tensorqtl_paths = {
		"results_dir": params.pop("results_dir"),
		"plink_prefix": params.pop("plink_prefix"),
		"phenotype_path": params.pop("phenotype_path"),
		"covariates_path": params.pop("covariates_path"),
	}

	return tensorqtl_paths, params