diff options
author | Arun Isaac | 2025-07-14 15:38:03 +0100 |
---|---|---|
committer | Arun Isaac | 2025-07-17 20:36:08 +0100 |
commit | 9e550de79dc7be747c3306f6b0f4619c23025f1b (patch) | |
tree | 98f894e5d8edc51fabdf76510ef16174afe44e76 | |
parent | 1ed0e16a4707222e07a68f57d231af1cd00fea73 (diff) | |
download | pyhegp-9e550de79dc7be747c3306f6b0f4619c23025f1b.tar.gz pyhegp-9e550de79dc7be747c3306f6b0f4619c23025f1b.tar.lz pyhegp-9e550de79dc7be747c3306f6b0f4619c23025f1b.zip |
Add summary subcommand.
* pyhegp/pyhegp.py: Import Summary and write_summary from
pyhegp.serialization.
(summary): New function.
-rw-r--r-- | pyhegp/pyhegp.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/pyhegp/pyhegp.py b/pyhegp/pyhegp.py index 54b6bb9..8075f07 100644 --- a/pyhegp/pyhegp.py +++ b/pyhegp/pyhegp.py @@ -20,6 +20,8 @@ import click import numpy as np from scipy.stats import special_ortho_group +from pyhegp.serialization import Summary, write_summary + def random_key(rng, n): return special_ortho_group.rvs(n, random_state=rng) @@ -45,6 +47,19 @@ def main(): @main.command() @click.argument("genotype-file", type=click.File("r")) +@click.option("--output", "-o", "summary_file", + type=click.File("wb"), + default="-", + help="output file") +def summary(genotype_file, summary_file): + genotype = read_genotype(genotype_file) + write_summary(summary_file, + Summary(genotype.shape[0], + np.mean(genotype, axis=0), + np.std(genotype, axis=0))) + +@main.command() +@click.argument("genotype-file", type=click.File("r")) @click.argument("maf-file", type=click.File("r")) @click.argument("key-path", type=click.Path()) @click.argument("ciphertext-path", type=click.Path()) |