From 64bce7438320f7705e000ab25981ffc150f3e7ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Kl=C3=B6tzl?= Date: Sun, 25 Feb 2024 12:13:31 +0000 Subject: [PATCH] python: add examples --- python/examples/libdna | 1 + python/examples/random.py | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 120000 python/examples/libdna create mode 100644 python/examples/random.py diff --git a/python/examples/libdna b/python/examples/libdna new file mode 120000 index 0000000..e849611 --- /dev/null +++ b/python/examples/libdna @@ -0,0 +1 @@ +../libdna \ No newline at end of file diff --git a/python/examples/random.py b/python/examples/random.py new file mode 100644 index 0000000..3b6899d --- /dev/null +++ b/python/examples/random.py @@ -0,0 +1,21 @@ +from libdna import dna4 +import argparse + + +def main(): + parser = argparse.ArgumentParser( + prog='random', + description='Create a random string of DNA') + parser.add_argument('-s', type=int, help='seed', default=1729) + parser.add_argument('-l', type=int, help='length', default=80) + + args = parser.parse_args() + seed = args.s + length = args.l + + print(f">rnd {seed=}") + print(dna4.random(length, seed)) + + +if __name__ == '__main__': + main()