diff options
author | Arun Isaac | 2025-07-17 19:23:30 +0100 |
---|---|---|
committer | Arun Isaac | 2025-07-17 20:47:05 +0100 |
commit | 2dc78933903baa9acc200a40f1795be320d1c297 (patch) | |
tree | 9dec19a20f0be6a22ed553d0fdc37e4accb36495 | |
parent | 5bca393ec2d43853de8f98d28a50c40a21eb994d (diff) | |
download | pyhegp-2dc78933903baa9acc200a40f1795be320d1c297.tar.gz pyhegp-2dc78933903baa9acc200a40f1795be320d1c297.tar.lz pyhegp-2dc78933903baa9acc200a40f1795be320d1c297.zip |
Only output key optionally.
* pyhegp/pyhegp.py (encrypt): Only output key to file optionally.
-rw-r--r-- | pyhegp/pyhegp.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/pyhegp/pyhegp.py b/pyhegp/pyhegp.py index 2177881..aa4b3fe 100644 --- a/pyhegp/pyhegp.py +++ b/pyhegp/pyhegp.py @@ -94,8 +94,7 @@ def pool(pooled_summary_file, summary_files): help="Summary statistics file", required=True) @click.option("--key", "-k", "key_file", type=click.File("w"), - help="Output key", - required=True) + help="Output key") @click.option("--output", "-o", "ciphertext_file", type=click.File("w"), default="-", help="Output ciphertext") @@ -106,7 +105,8 @@ def encrypt(genotype_file, summary_file, key_file, ciphertext_file): key = random_key(rng, len(genotype)) encrypted_genotype = hegp_encrypt(genotype, summary.mean, summary.std, key) - np.savetxt(key_file, key, delimiter=",", fmt="%f") + if key_file: + np.savetxt(key_file, key, delimiter=",", fmt="%f") np.savetxt(ciphertext_file, encrypted_genotype, delimiter=",", fmt="%f") if __name__ == "__main__": |