about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2025-09-02 11:21:05 +0100
committerArun Isaac2025-09-02 11:28:27 +0100
commit2b3779a6cae2ed4eaa280c2bb72b91c388152e36 (patch)
tree6329569034c96f7bf2b0bafd18a9cfcdb7112e3f
parent5fb407f65c2714e589bb912c0f62cd79f7311a50 (diff)
downloadpyhegp-2b3779a6cae2ed4eaa280c2bb72b91c388152e36.tar.gz
pyhegp-2b3779a6cae2ed4eaa280c2bb72b91c388152e36.tar.lz
pyhegp-2b3779a6cae2ed4eaa280c2bb72b91c388152e36.zip
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.
-rw-r--r--pyhegp/pyhegp.py6
1 files changed, 5 insertions, 1 deletions
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()