DNA
A domain-specific language (transcription between UTF-8 text and DNA bases) based on YAML.
Transcoding
Please refer to coding.py:
DNA_TO_BIN = {
"A": "00",
"C": "01",
"G": "10",
"T": "11"
}
BIN_TO_DNA = {
v: k
for k, v in DNA_TO_BIN.items()
}
DNA_COMPLEMENT = {
"A": "T",
"T": "A",
"C": "G",
"G": "C"
}
Installation
DNA can be installed from PyPI:
pip install dnadsl
or download the repository and run:
pip install .
as of the repository root folder.
Usage
Run dna --help for help:
$ dna --help
usage: dna [-h] [-m {encode,decode}] [-i INPUT_FILE] [-o OUTPUT_FILE] [-v]
+--------------------------------------------------+
| DNA |
| A domain-specific language |
| (transcription between UTF-8 text and DNA bases) |
| based on YAML. |
+--------------------------------------------------+
options:
-h, --help show this help message and exit
-m {encode,decode}, --mode {encode,decode}
Choose the mode of transcoding.
encode: UTF-8 to bases; decode: bases to UTF-8.
The default is: encode
-i INPUT_FILE, --input-file INPUT_FILE
The path of the input YAML file.
-o OUTPUT_FILE, --output-file OUTPUT_FILE
The path of the output YAML file.
-v, --version Print the version number of dna and exit.
Examples
-
Convert UTF-8 text to DNA bases, e.g., run
dna -m encode -i input_text.yml -o output_bases.yml:-
text_utf8: 😄😊
-
text_utf8: 😄😊 dna: positive_strand: sequence: TTAAGCTTGCGAGACATTAAGCTTGCGAGAGG binary: 11110000 10011111 10011000 10000100 11110000 10011111 10011000 10001010 text: 😄😊 negative_strand: sequence: AATTCGAACGCTCTGTAATTCGAACGCTCTCC binary: 00001111 01100000 01100111 01111011 00001111 01100000 01100111 01110101 text: "\x0F`g{\x0F`gu"
-
-
Convert DNA bases to UTF-8 text, e.g., run
dna -m decode -i input_bases.yml -o output_text.yml:-
positive_strand: TGAGGCTCGGCATGTTGTGAGATTTTAAGCTTGCAAGTCG
-
text_utf8: ❤️🐶 dna: positive_strand: sequence: TGAGGCTCGGCATGTTGTGAGATTTTAAGCTTGCAAGTCG binary: 11100010 10011101 10100100 11101111 10111000 10001111 11110000 10011111 10010000 10110110 text: ❤️🐶 negative_strand: sequence: ACTCCGAGCCGTACAACACTCTAAAATTCGAACGTTCAGC binary: 00011101 01100010 01011011 00010000 01000111 01110000 00001111 01100000 01101111 01001001 text: "\x1Db[\x10Gp\x0F`oI"
-
Packaging
The binaries are created with PyInstaller:
# Package it on Linux
pyinstaller --name DNA --onefile -p dna dna/__main__.py
# Package it on Windows
pyinstaller --name DNA --onefile --icon python.ico -p dna dna/__main__.py
Web Applications
Copyrights
DNA is a free, open-source software package (distributed under the GPLv3 license). The logo used in README.md is downloaded from Wikimedia Commons. The Python icon is downloaded from python.ico.
Metadata
Release files for dnadsl 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| dnadsl-0.4.0.tar.gz | 17.9 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dnadsl-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 36.8 kB
Release files / dnadsl-0.4.0.tar.gz
| Download URL | dnadsl-0.4.0.tar.gz |
|---|---|
| Size | 17.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1cc5148c21230c427f79b17e69297425f524c56b68cba5c099031e800840dff7
|
|
BLAKE2b-256 checksum How to use checksums |
abdafb0d2c6a995b48de71d550ea83c50ba61f90bbd935bc832e0e21d0c3c87c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 19, 2025.
Transparency logRelease files / dnadsl-0.4.0-py3-none-any.whl
| Download URL | dnadsl-0.4.0-py3-none-any.whl |
|---|---|
| Size | 18.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
be4186200e70017c85c3a3efdb669de412cf92698a6b94199ca8474bf11c784e
|
|
BLAKE2b-256 checksum How to use checksums |
eb96c3f5c804c2dce04e8e8455f339750fac2d098d0d4e1e4166fb77be20b1a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 19, 2025.
Transparency logSecurity for dnadsl 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for dnadsl-0.4.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 19, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.