aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2025-07-17 19:36:04 +0100
committerArun Isaac2025-07-17 20:51:54 +0100
commit572dd0ffb8397b7338926b38c132522eb50830e3 (patch)
tree1ae6321f5b8d5ab8d46e8a82ad1ec138d75e0c35
parent2dc78933903baa9acc200a40f1795be320d1c297 (diff)
downloadpyhegp-572dd0ffb8397b7338926b38c132522eb50830e3.tar.gz
pyhegp-572dd0ffb8397b7338926b38c132522eb50830e3.tar.lz
pyhegp-572dd0ffb8397b7338926b38c132522eb50830e3.zip
Add cat subcommand.
* pyhegp/pyhegp.py (cat): New function.
-rw-r--r--pyhegp/pyhegp.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/pyhegp/pyhegp.py b/pyhegp/pyhegp.py
index aa4b3fe..a35cfcb 100644
--- a/pyhegp/pyhegp.py
+++ b/pyhegp/pyhegp.py
@@ -109,5 +109,17 @@ def encrypt(genotype_file, summary_file, key_file, ciphertext_file):
np.savetxt(key_file, key, delimiter=",", fmt="%f")
np.savetxt(ciphertext_file, encrypted_genotype, delimiter=",", fmt="%f")
+@main.command()
+@click.option("--output", "-o", "output_file",
+ type=click.File("wb"),
+ default="-",
+ help="output file")
+@click.argument("ciphertext-files", type=click.File("rb"), nargs=-1)
+def cat(output_file, ciphertext_files):
+ np.savetxt(output_file,
+ np.vstack([read_genotype(file) for file in ciphertext_files]),
+ delimiter=",",
+ fmt="%f")
+
if __name__ == "__main__":
main()