aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2025-07-17 19:22:26 +0100
committerArun Isaac2025-07-17 20:46:36 +0100
commit5bca393ec2d43853de8f98d28a50c40a21eb994d (patch)
tree631f0a613130df9cf3ee4075e6d04c4287358805
parent050a88e80419acd747704c82d1a431601c1aaafe (diff)
downloadpyhegp-5bca393ec2d43853de8f98d28a50c40a21eb994d.tar.gz
pyhegp-5bca393ec2d43853de8f98d28a50c40a21eb994d.tar.lz
pyhegp-5bca393ec2d43853de8f98d28a50c40a21eb994d.zip
Use File instead of Path for encrypt subcommand options.
* pyhegp/pyhegp.py (encrypt): Use File instead of Path for options.
-rw-r--r--pyhegp/pyhegp.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/pyhegp/pyhegp.py b/pyhegp/pyhegp.py
index 2f0bdb4..2177881 100644
--- a/pyhegp/pyhegp.py
+++ b/pyhegp/pyhegp.py
@@ -93,21 +93,21 @@ def pool(pooled_summary_file, summary_files):
@click.option("--summary", "-s", "summary_file", type=click.File("rb"),
help="Summary statistics file",
required=True)
-@click.option("--key", "-k", "key_path", type=click.Path(),
+@click.option("--key", "-k", "key_file", type=click.File("w"),
help="Output key",
required=True)
-@click.option("--output", "-o", "ciphertext_path", type=click.Path(),
+@click.option("--output", "-o", "ciphertext_file", type=click.File("w"),
default="-",
help="Output ciphertext")
-def encrypt(genotype_file, summary_file, key_path, ciphertext_path):
+def encrypt(genotype_file, summary_file, key_file, ciphertext_file):
genotype = read_genotype(genotype_file)
summary = read_summary(summary_file)
rng = np.random.default_rng()
key = random_key(rng, len(genotype))
encrypted_genotype = hegp_encrypt(genotype, summary.mean,
summary.std, key)
- np.savetxt(key_path, key, delimiter=",", fmt="%f")
- np.savetxt(ciphertext_path, encrypted_genotype, delimiter=",", fmt="%f")
+ np.savetxt(key_file, key, delimiter=",", fmt="%f")
+ np.savetxt(ciphertext_file, encrypted_genotype, delimiter=",", fmt="%f")
if __name__ == "__main__":
main()