From 2b3779a6cae2ed4eaa280c2bb72b91c388152e36 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Tue, 2 Sep 2025 11:21:05 +0100 Subject: Add cat_genotype workhorse function. Move workhorse logic of the cat command to a separate function. This will make it easy to test the logic without having to invoke the command itself. --- pyhegp/pyhegp.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pyhegp/pyhegp.py b/pyhegp/pyhegp.py index e88ea8d..3ffa314 100644 --- a/pyhegp/pyhegp.py +++ b/pyhegp/pyhegp.py @@ -110,6 +110,9 @@ def encrypt_genotype(genotype, key, summary): columns=sample_names)), axis="columns") +def cat_genotype(genotypes): + return pd.concat(genotypes) + @click.group() def main(): pass @@ -176,7 +179,8 @@ def encrypt_command(genotype_file, summary_file, key_file): @click.argument("ciphertext-files", type=click.File("rb"), nargs=-1) def cat_command(output_file, ciphertext_files): write_genotype(output_file, - pd.concat([read_genotype(file) for file in ciphertext_files])) + cat_genotype([read_genotype(file) + for file in ciphertext_files])) if __name__ == "__main__": main() -- cgit 1.4.1